This project is a sub-section of my larger project on focus stacking of fern gametophytes.
This section explains what hardware is required for a Raspberry Pi-driven system, and how it is all wired up. We are only covering the electronics here and the other hardware is discussed in the main page.
The full setupThis is the full setup from above. At the top, the microscope block is connected via cogs to the stepper motor. The stepper motor is then wired to a stepper motor shield, which is in turn wired to the Raspberry Pi at the bottom of the photo.
This second image shows the setup from the side. On the left is the Raspberry Pi, connected to the stepper motor shield in the centre, which is in turn connected to the stepper motor on the right. The stepper motor drives the microscope focus block via a couple of blue cogs.
The exact positions of the jumper wires on the GPIO pins of the Raspberry Pi is shown here.
The three jumper wires on the left side of the image lead to the stepper motor shield. The black and white wires on the right hand side of this image lead to the infra red camera remote control.
Stepper motor shield to Raspberry Pi:The stepper motor shield is shown in this image:
The jumper wires go to the GPIO pins as shown below.
The exact positions of the jumper wires on the GPIO pins of the Raspberry Pi is shown again here.
The stepper motor (https://uk.rs-online.com/web/p/dc-motors/5350401/) has four wires which are all unlabelled. It took us some work to figure out which was which, so that we could connect them to the right places. Our four wires are blue, green, red and black. They are connected to the pairs of holes labelled "A" and "B" at the bottom centre of the shield as seen in the photo above. The stepper motor is a RS PRO Hybrid Stepper Stepper Motor, 2.8 V, 5mm Shaft Diameter RS Stock No.:535-0401 Brand:RS PRO.
Power cable to stepper motorThe stepper motor needs power to operate, and this is provided via the stepper motor shield. We used a 12V transforner plug, the wires of which are soldered directly onto the stepper motor shield. Those wires are the black wires visible in the bottom left part of the image below. They are soldered to GND and M+.
The infra red remote control is also wired up to the Raspberry Pi, so that the camera shot can be triggered automatically, after each forward movement of the camera. Each time the camera has moved forward, the Raspberry Pi triggers the infra red remote control bulb to light, causing the camera to take a shot.
The photo below shows the position of the remote control in the setup.
The two images below show how the infra red camera trigger is wired up. Tim had to take the case right off and then he soldered on wires, and firmly connected them using a hot glue gun.
The wiring is shown below.
Below is the python program that I run on the Raspberry Pi to drive the rail. I do not have a screen attached to the Raspberry Pi, so I plug in a wireless dongle and then drive it from my laptop. I log into the raspberry pi using putty and then run the scripts from there. The scripts can be modified in between runs, so that if I feel that the movement of the microscope block needs to be a bigger step or a smaller step then I can quickly alter the distance in the programme. I can also alter the timing. For example I can have 1 micron steps with a 3 second gap in between to make sure that there is time for vibration to stop, or I can have a 5 micron step for a larger subject and 1 second gap if there is a risk that the subject will dry out and change shape during the series.
Comments