Search This Blog

Monday, 27 May 2024

 Making and Populating a Raspberry Pi CM4IO PCB

RP CM4


The RP CM4 (https://datasheets.raspberrypi.com/cm4/cm4-datasheet.pdf) is a small processing unit capable of running Linux. It's cheap-ish and powerful-ish and useful for all sorts of things. It has many interfaces and RP designed a PCB to showcase these, it's called the CM4IO


 (https://datasheets.raspberrypi.com/cm4io/cm4io-datasheet.pdf).

How easy is it to make your own PCB with a CM4 on it?

The first challenge is to check that your PCB manufacturer can make a PCB with the correct impedances for some of the signal tracks, in my case, HDMI was what I was interested in. So, JLCPCB was used to make a standard CM4IO PCB, using 1.6mm thickness (the artwork seemed to be designed for this thickness of PCB).

The second challenge is the 'comedy' footprint that the CM4 has. It uses some high density connectors that have to be aligned perfectly (datasheet gives a tolerance of +/- 0mm for the distance between them) on the PCB. I managed to solder a pair of connectors by tinning the footprint pads and aligning a connector on top of that footprint, pinning it in place by reheating (with flux) the diagonally opposite  pads) and then re-heating the pads to fix the connector to the PCB. 

As an aside, drag soldering worked for one connector, but the other is attached to ground planes and that conducts the heat away too quickly for my tip/iron combinations.

With an HDMI connector and some other components, this is the result:


This shows that the soldering of the CM4 footprint is at least partially successful, and the PCB impedance is good enough for a decent HDMI image. 

Monday, 20 May 2024

 Stainless Steel Sewing Kit

Quite a while ago I bought a stainless steel cigar tube with no real idea what I'd use it for. I knew I'd do something with it, and finally I have. 


Now and again I do some sewing repairs and for that you need a few needles and some thread. On Kickstarter, also a long time ago now, there was a project for a container that held some needles and thread. I was looking forward to getting it and being able to have a safe sewing pack in the house. Unfortunately it never arrived due to various things, not least of which, COVID. I did get a couple of Crane knives instead though, as the same people made those, as compensation. Time passed, and I came to the conclusion that the cigar tube would do as a container for a sewing pack. I put some thread on a reel in there and stuck some needles in some plastic foam and there you go, a sewing kit. It was not pretty, though, and getting the needles out of the foam that they were poked into was painful now and again. So, I made an insert that holds the needles that fits in the cigar tube. Hopefully no more pain when finding a needle.



The needle holder fits in the tube with a reel of thread and another tube which doesn't really have a purpose at the moment, it may later on.



The insert fits nicely into the tube:

There's o rings on the lids which hold them firmly in the tube, so they won't just fall out, you can see the o ring in one of the photos above. We'll see how I get on with it...

The Kickstarter (Darter) is here:

https://www.kickstarter.com/projects/662950207/darter-a-micro-pen-with-a-hidden-secret

It's smaller than the cigar tube and (I forgot this) it's a pen.

Monday, 23 January 2023

Getting ROM Dumps by Post

 What do you do if you want to dump the ROM in some equipment that is owned by someone else, who is happy to have their ROMs dumped, but who live in another country? they are probably not too happy sending things through the postal system as loss and damage is common these days. 

To solve this problem (and also allow me to dump some of my own ROMs) i made a little gadget that can dump a ROM that is plugged into it. Plug in the ROM, power up the gadget and wait for an LED to flash and you are done. The gadget can be posted to whoever has the ROM, they plug the ROM in and turn the unit on. After the light flashes, the unit is sent back to the person who needs the ROM dump.

Here it is:


From the title of this post and the photo, it's obvious that this is based on the RP Pico. In fact, 'based on' is a bit of a loose term to describe this gadget, it is, in fact, almost only a Pico. there's a few resistors, and a socket for the ROM but that's it. The Pico does everything else.

This is designed to dump 24 pin ROMs. I did this as the Pico doesn't have many GPIOs and the ROMs I wanted to dump right now are all 24 pin. They are also a weird pinout (2332 and 2364 devices) and my device readers don't support them. Hence the gadget. There are also ROMs I'd like dumped elsewhere in the world so I added the remote dumping features to the code.

What is also obvious is that there are no level shifters on this circuit. The ROM is indeed a 5V device and is wired to the USB 5V supply. A while ago I read, somewhere on the internet, that the Pico GPIOs are actually, probably, 5V tolerant. This seemed like a good project to test that out on. If you have a gadget that is designed to run, well if not once, then a few times, and you are posting it around the world and maybe not even getting it back (deliberately or due to postal service), then why not see if the Pico is 5V tolerant? If it instantly isn't then I'll see that and design a new gadget with level shifters.

So, the address and control lines of the ROM are connected to the Pico, which drives them at 3V3 through small (15R) resistor. the data lines, however, are connected through 28K resistors to the Pico directly. The resistors are a trifle cowardly, but I did want a working ROM reader at least for a few minutes. The protection diodes in the Pico may clamp the signal as well, so this isn't a strong test of 5V tolerance, but it's a start. So far, the Pico I am using is fine.

The dumped ROM data is sent to the USB serial port and can be captured by a terminal emulator. For less technically minded ROM dumping, and to avoid terminal emulator setup woes, the gadget can be configured (using non-volatile storage) to dump and store the data in the flash of the Pico. The Pico can write to its own flash chip and use it as storage for things other than firmware. You have to run the code from RAM when doing this to avoid various problems.

the code sets up several slots, each 16K in flash that the ROM dumps are sent to. You plug the ROM in, turn the gadget on and the LED illuminates when the dump is running, then flashes when it is done. unplug USB and plug a second ROM in, attach USB again and a second dump will be performed and the data stored in the next flash slot. And so on. Then the gadget can be returned.

the device does not overwrite slots, but does dump ROM data to USB when in slot dumping mode. The USB data can be captured if needed, once the slots are full.

I've used this to dump some ROMs I wanted images for and it has worked well. There's more information in this video:


The code and PCB files are here:

https://github.com/blackjetrock/postal-pico-rom-reader


Wednesday, 21 December 2022

 This One Got Away From Me a Bit...

I make pen sets occasionally, and to go with the set I make boxes. These are to hold the pen set and all the bits and bobs that go with them, and also provide a secure way to ship the pen set to it's final owner.

Over time these boxes have become projects in their own right and have become themed, rather than being boxes. The latest box has sort of got away from me a bit. It started as a vague idea of doing something 'Dr Who' themed. After some research on the internet I found a prop called 'The Moment'. This is a cube with intricate decoration on it. There are detailed pictures here, and you can see a replica in the video below.



I've been looking for decent box catches and locks for a while, a lot of the cheaper ones are just barely acceptable. So I was very pleased when I realised that the intricate mechanism on the top of 'The Moment' is actually a latch. That's when the box build started to get away from me. I decided to build one. After some investigation I found that the original was a 30cm cube, which was too big for the pen box I needed. I started to make a scaled version of the box, to fit the pens better. I also thought that a cube shaped box was a bit awkward, so decided to make a 'Half Moment'. In my case it's a half cube with the top mechanism scaled to four fifths of the original, nothing on the bottom and the side faces cut in half.

Here's a trial fit of some of the parts, only three panels have anything on them and everything is just pushed together or resting on other parts.


The lock panel is the most complicated, it has several different shaped parts, repeated four times. I made them out of metal, I think the original was made from plastic, maybe. It's difficult to see what the materials were in the original. I wanted a durable, working latch system, so I made the lock parts out of brass, aluminium and copper. Here's some of them:


These were all cut out on my 3020 CNC using a 1mm cutter. It took quite a while. If you use a slow feed and some sort of cutting fluid then you can cut metal on the 3020. I did break quite a few cutters, though. The plastic parts are acrylic of various thicknesses, also cut on the 3020. The panels themselves are plywood and the frame is pine, cut down on a band-saw to the correct size. The caps on the ends of the frame are 3D printed and held on with a single screw.

The pivots for the lock mechanism are all dome head rivets of different sizes, in copper, brass and aluminium. I tapped the end of each of them to accept either an M3 or an M4 allen head screw which is used to hold them to a panel.

Actually, there is no glue in the entire box, apart from the adhesive on the crushed velvet lining. the whole box can be taken apart down to every single part totally non destructively, apart from the crushed velvet which would have to be replaced. his came in very handy while I was fitting and re-fitting parts. Even with the velvet attached the box is largely dismantle-able as the fixing screws for covered panels are generally driven through the velvet. This makes the box repairable and even upgrade-able if problems arise later on.

Latch Mechanism

Here's the latch mechanism:

The large centre wheel is attached directly to four aluminium 'lock rods' and indirectly via the four smaller aluminium wheels to four copper 'lock rods'. When the large wheel is turned the lock rods slide in and out along brass blocks either into or out of slots in the frame. This provides a nice positive solid latching mechanism.

The wheels are held on to the top board with copper dome head rivets which have tapped holes and machine screws fixing them to the board. the rods attached to the smaller wheels have rivets holding them on. Those rivets are actually riveted. 

The brass blocks the rods slide in are made from two or three blocks, machined on my mini-mill and arranged so that the height of the slot matches either the copper or the aluminium rod height.

All of the parts of the latch are held at heights that allow the mechanism to operate without different parts fouling on each other.

there are four copper rivets that do no attach to the board, these hold parts at certain heights and push one of the lock rods. These have a drilled and tapped hole like the ones that attach to the board but they have a stainless steel washer 0.3mm thick and a hex head bolt. the head of the bolt has been machined down to a thickness of 1mm as there's no height for a thicker head.

All of these parts were cut on a 3020 CNC machine. The main wheel:


took about five hours to cut using a 1mm cutter.

Engraved Grid Panel

This panel is made of stainless steel and is engraved with Gallifreyan symbols. I did this on the 3020. 

The black frame that goes over the plate is cut from black acrylic, also on the 3020.

The frame is held on by screws that come in from the back of the panel through holes in the plate.


Gear panel

The original gear panel had four gears, that had to change when I cut the cube in half. The three gears on this panel do rotate as a set. The finish isn't the matte sort of sparkly finish of the original either. 


The gear panel is a sandwich of three plywood panels, the top two create a stepped recess that the gears sit in. The panels are all fixed with M1.4 x 10mm screws from the back.


Lattice Panel

This intricate panel is composed of a black acrylic panel on top of a white acrylic sheet. The black panel detail was cut out using the 3020.


The black panel is held on with screws from the back through holes in the white panel.

Circular Pattern Panel

The circular parts are cut from gold acrylic and mounted on copper dome head rivets of differing heights.


The copper rivets are drilled and tapped in the same way as the mechanism on top. There are aluminium spacers that hold the circular parts against the rivet heads at the various heights. The panel underneath is engraved and sprayed with copper paint.

Frame

The frame is made from pine. I cut down scaffolding boards to the required size and shape using a  bandsaw. Due to the shape of the box, there are four shorter pieces and eight longer pieces. The lomger pieces are joined using 10mm M1.4 screws and corner lap joints.



The longer frame pieces form two squares, these are attached to the shorter vertical pieces with wood screws. The corners are covered with 3D printed silver PLA parts that are filled and sanded and then sprayed with silver paint. The top four corner pieces are attached to the frame with a single M1.4 10mm screw at the corner. The lower four corners are attached with the wood screws that hold the vertical pieces to the lower four longer pieces. There's a countersunk hole that the wood screw if fixed through that holds the corner piece. This leaves the screw visible, it is covered by a self adhesive foot on each corner, one of the rare places where some glue is present in the box (the other is the self adhesive crushed velvet).



Interior

The panels on the sides of the box are held in place using 3D printed brackets that are also the surface that the mechanism panel sits on. The brackets are fixed at exactly the correct height for this top panel.

The interior of the box is lined with two layers of plywood, covered with crushed velvet. These panels are designed to create a simple plain space with none of the panel fixing showing. 


There are two smaller panels on either side of the interior that the panel with the pen holders on it rests on. The pen holder and panel is covered in crushed velvet.

Transport Box

The original Moment was seen being transported in a sack. There's no way I was going to do that when delivering this version, so I built a box, or a crate, really, to transport the pen box. This crate is a simple plywood affair with a simple (and cheap) latch. It has some Gallifreyan engraved on the lid. I used a translator on the web to put the owners name and the name of the moment itself on the plywood lid.


There are some foam pieces on the inside of the lid that hold the moment down so it doesn't move when being transported. Inside the box, at the bottom, the base has a foam insert that is covered in crushed velvet. The box sits on this.

There's more of the box in these videos:















Saturday, 26 March 2022

 Pens, Scutoids and a Box

A combination of biology and mathematics was the theme for a recent pen box. It turns out that scutoids are a newly discovered shape that arrived with a fair amount of mathematics and biology. I decided to add them to a pen box that I was making. The result is here:



These are 3D printed and covered in crushed velvet. Each one has a space inside that is big enough for a small bottle of ink or some cartridges. 



They sit on a pair of 3D printed recesses which are arranged to hold the four scutoids in their signature interlocking positions.


This base is, in turn placed on a base board that holds the scutoids and the pen box itself.


The pen box is simple, it has a top section that holds the pens (securely when the lid is closed, there's a soft layer that holds the pens in their recesses during transport.


The pen stands can be removed and underneath is a space for the various paraphernalia that goes along with the pens and pencil that lives above.


These are all versions of Beaufort Ink Mistral range. there's a fountain pen, a ballpoint and a pencil. The blanks used were a blue acrylic.


There's a converter in the fountain pen, this can be removed and cartridges used if required. these are very nice kits, I've built quite a few of them now.





Wednesday, 23 February 2022

Coding With Rules of Thumb

I create code quite a bit and have fallen into a process of using 'Rules of Thumb'  or 'Meta Patterns ' when doing this. These rules aren't hard and fast and cover all aspects of working with code. I thought I'd document them, so other people can have a look and maybe use them. I also get a list of my rules, and a list of things can help spot missing and duplicated items.

These rules are similar to software patterns but are usually at a much higher level than the code (The Software Hammer) or at a very low level (Chinese Questions).

This page is the index of rules and will be updated as I get round to documenting the rules, and in some case recognising that I use a rule.


The Software Hammer

Chinese Questions

Code the Specification




Chinese Questions

It's always a good idea to have descriptive labels when coding, it is extra information that is useful for code comprehension. So:

turn_the_light_on

is a nicely description label, and 

light_on

is a shorter way to name a procedure that turns a light on. If you have code that does something then you quite often have code that checks that the something has been done. This is code that asks a question and the obvious way to name such a function is as:

light_on?

this isn't valid in at least C. The simple way to solve this problem is to drop the question mark:

light_on

and infer the question from the context. That's the same name as the function's partner procedure, though, and that doesn't work. You end up with something like:

is_light_on

Which is fine but a bit cumbersome (well I think so). It turns out that the Chinese language comes to the rescue here, as Chinese indicates a question using the suffix 'ma'. I'm not an expert in Chinese and don't have to be as the key point is that I can write that suffix in plain text. So, we can create a label that asks a question:

light_on_ma

The pair of labels for code that does something and the code that checks that same something is now very consistently named and this rule is easy to apply. It's also probably confusing to anyone who reads the code, unfortunately, so should be explained somewhere obvious.