Focus Stacking with a Raspberry Pi – Assembling and Connecting the Peripherals
There have been some advances and some setbacks – typical of an involved project.
The LED USB stalk light arrived before Christmas and it was relatively straightforward to disassemble it and modify it to act as the housing for the camera shutter IR Trigger. I removed the USB plug which revealed the wiring; I then had to remove some of the steel flexicoil to expose sufficient wire to enable the wiring to be extended. This was not as easy as I thought it would be as the steel coil is very tough and quite thick. At the other end, the LED shroud came off easily enough, and the LED and its resistor were removed, being replaced with the IR transmitter, and the whole thing being put back together without difficulty. The stalk is attached to the ally chassis with a couple of p-clips I had lying around. It all tested out OK and makes a nice neat job.
It was also time to figure out how to connect the stepper motor controller and the relay module. In both cases it was necessary to examine the PCB and to draw out the circuit tracks with the chip schematics and work out the overall unit schematic so that the connections could be made with confidence. I also researched the wiring on the internet but was there is very little reliable information, but lots of people making contradictory suggestions. In particular, it was not at all clear whether or not the jumpers on each module needed to be removed or left in place, nor how to use a separate 5v supply from the Pi. Drawing it all out helped to unravel the mystery.
Having decided how to connect the stepper motor controller, the next step was to try out the connection scheme without using the Pi, to avoid any Pi related disasters which would probably be expensive. I had various power supplies at my disposal, and once I had hooked up the motor control unit to the 5v supply it was possible to increment the stepper motor by poking 3.3v onto the input pins in sequence. You couldn’t see the motor stepping but you could feel it increment round, and after a number of pulses some rotation was visible. So there was a tick in the box for that!
Next up was the 2-channel relay module to drive the IR transmitter to trigger the camera shutter – only one channel being used. In this case the wiring was simpler and clearer and there was a bit more information available. It should have been very simple, but absolutely nothing would make the relays operate. There are some LEDs that should light up and they remained dead to the world. I am thinking that the input opto-isolators on both channels are caput; these should be good for 3v to 15v so my attempts with 3v and 5v should have achieved something and done no damage. Anyway, the relay unit cost just £2.35 on e-bay and looks like a Chinese copy of a SainSmart 2-channel 5V relay module, so I have decided to buy the real thing which is quite a lot more expensive – probably also made in China but hopefully with better QA! The replacement unit should arrive in a few days time.
Next up, was to make the control panel that sits on the sledge chassis and contains some LED indicators, an emergency stop button that stops the current Pi routine, and a switch for the subject lights. Inside this box are the LED resistors and a few other bits and pieces. The finished article can be seen in the pictures. At one stage of the testing, right at the end when I was relying on the final ribbon cable for connection to the power supplies, nothing would work at all – this after everything had been OK using individual jury rig connections for the power supplies. After some considerable time I found that there was a fault in one of the ribbon cable female connectors that slips onto a PCB pin – in this case the Ground connection which of course affected everything! On disassembling the faulty female connector it was possible to see that the insulation was crimped on as it should be, but there was no nice copper conductor emerging from the end – QED, no electrical connection. Soldering iron to the rescue and everything worked perfectly. I now check the continuity on each ribbon wire before using.
I have also added a centimeter scale alongside the rack, with a pointer on the stage, so that the approximate position of the stage can be visually and consistently referenced. This may also be useful when calibrating the stepper motor to determine the number of steps per mm.
So I am just waiting for the new 2-channel relay module and then I can finish testing. After that it will be time to connect everything up to the Pi.
Once everything is tested and working correctly I will draw up a detailed circuit diagram and will post it on this site.