Building your own Setup - dogerber/temperature_gradient_microscopy_stage Wiki

The present setup is tailored to the kind of experiment I needed it for and the microscopy stage we have available. Any other user will probably need a different geometry, so I'll only summarise the design ideas behind rather than being specific about the design.

Controller box

Parts used

A short description of the parts used with some notes why they were chosen

  • Arduino Mega ($50)
  • Arduino Mega Proto Shield Rev3 ($6) - Makes it easy to replace the Arduino Mega if it gets burned.
  • Adafruit 1.44" Color TFT LCD Display with MicroSD ($15)
  • Adafruit OLED 128x64 ($20)
  • Motor driver Pololu DRV8834 ($9)
  • LM4040 ($8)- For a constant and known voltage supply for the voltage divider.
  • Analog-to-digital converter ADS1115 ($15)
  • 3x Thermistors Amphenol MC65F103AN (3x $10)
  • 3x Reference Resistors 30 kOhm (high accuracy and low temperature dependance
  • 8x 10 kOhm Resistors
  • Dual Motor Pololu Driver VNH5019 ($100)
  • 2x Peltier devices (2x $50) ( CUI Devices, CP604060395 )
  • Linear actuator (Nanotec LGA201S06-A-TDBA-038 ) ($ 130) - desired small stepsize, small size and large travel
  • 1 Power switch, 2 buttons, 1 5-way joystick
  • Cable connectors, wires
  • 4x 1uF Capacitor, 1x 100 uF Capacitor
  • Piezo Buzzer
  • Custom made stage head (see below)
  • EPDM O-rings
  • Plastic screws
  • Custom made water cooling loop (see e.g. Heating cooling circulator or commercial GPU water coolers)
  • Custom made enclosure

Approximate total cost of (non-custom) parts: $481


The wiring diagram can be found here: Schematic, Breadboard view, Fritzing file.

Breadboard drawing
PIN connections as list
  • 4 VNH5019 - M1A
  • 5 VNH5019 - M1B
  • 6 VNH5019 - M1ENABLE
  • 7 VNH5019 - M1PWM
  • 8 VNH5019 - M2A
  • 9 VNH5019 - M2B
  • 10 VNH5019 - M2ENABLE
  • 11 VNH5019 - M2PWM
  • 22 DRV8834 - DIR
  • 23 DRV8834 - STEP
  • 24 DRV8834 - M0
  • 25 DRV8834 - M1
  • 26 DRV8834 - Sleep
  • 30 Button - OK
  • 31 Button - cancel
  • 32 Joystick - Left
  • 35 Joystick - Push ? (not used)
  • 34 Joystick - Up
  • 35 Joystick - Down
  • 37 Joystick - Right
  • 38 TFT_DC
  • 40 SD_CS CCS on display
  • 41 TFT_CS
  • 42 OLED_DC
  • 43 OLED_CS
  • 50 MISO
  • 51 MOSI
  • 52 SCK, Clock
  • SCL, SDA (I2C): for ADS1115 (temperature measurement)

I set the current limiting of the DRV8834 to 0.6 A which was enough for the actuator used here. A tutorial on how to do this can be found here.

The small OLED display needs to be modified to work in SPI mode. For this, the traces J1 and J2 need to be cut at the back. Note that there is a printing error on the board saying that open is for I2C mode, which is wrong. More details about this can be found here.

Power considerations

The setup needs power for the Peltiers, the linear actuator and the controller box. The Peltiers can operate the fastet with a high voltage, however the Arduino and actuator can only handle limited Voltages. Therefore I split the power into two with

  • High Power for Peltiers
    • VNH5019: max. 12 A, max. 24 V
    • Peltiers: max 6A, max. 23 V
  • Low Power for Linear actuator and Arduino
    • Arduino Mega: 7-12 V
    • DRV8834: 1.5 A / 2.5-10.8 V

Never connect the USB cable and power the Arduino through the low power line (Power Button ON), as this can damage the Arduino Mega

Stage head

CAD files are available on the public Onshape Document. CAD .step files can be downloaded from here directly. Technical drawing can be downloaded here.

An important parameter is the overall weight of the stage, as it must be below the maximum allowed weight of the Microscope stage.

  • Humidity protection: This is crucial to limit condensation on the copper blocks when operating at temperatures below room temperature. Condensation can decrease image quality or prevent sample movement. The humidity protection here is optimized for a copper block spacing of 2.2 mm, at which it fits tightly. Any opening should be further closed with sticky tape or foam. Especially at the opening towards the translation frame it makes sense to have some kind of lip to close the slit down while still allowing the translation frame to be moved.
  • Copper block (top): This makes sure the sample is surrounded by the same temperature on both sides to make the temperature gradient as 1D as possible. This should be made from copper in to have good thermal conductivity from the lower base to the top, as it can only be thermally connected far from the window of observation in between the copper blocks.
  • Sample: The current design is optimized for standard microscopy glass slides 50x24 mm and maximum height of 1 mm (depending on the spacer)
  • Translation frame: Should fit tightly with the sample geometry.
  • Linear actuator: Moves the sample relative to the applied temperature gradient. The coupling to the frame is made with a weak clamp, so if there's any resistance (i.e. when the frame freezes to the copper block) the motor can slide past the frame and will not be damaged. The maximum travel range of the motor should be marked on the cooling backplate as well as the middle in order to calibrate the movement and preventing a movement out of range (which can damage the actuator)
  • Spacer: Thermal connection between the top and bottom copper part. Shoudl be as small as the sample geometry allows. This can easily be exchanged
  • Copper block (bottom): This has space for two samples next to each other (one position below the top copper blocks and one next to it). This allows for ice nucleation on the uncovered position (usually done with a "cold finger", e.g. liquid nitrogen cooled cotton swab), after which the sample can be pushed to the covered position. The thermistors are located in the covered position as close as possible to the typical observation window. The copper blocks should be as thin as they can be machined (while still allowing for a channel inside them to hold the thermistors), as this limits how close the microscope objective can approach the sample. Only microscope objectives with a working distance larger than the thickness (+ the distance one wants to move into the sample + sample wall thickness) of the lower copper block can be used. Low thermal conductiviy screws must be used to connect the copper block to the cooling backplate (to not cause a thermal short).
  • Peltier device: Optimized for large possibly temperature difference (as in steady opertion little heat flow is expected) and geometry as close as possible to the copper block (bottom).
  • Cooling connection: The cooling must be sufficient to keep the backplate at a constant temperature and this must be tested extensively at realistic conditions.
  • Cooling backplate: This design depends on the microscope stage opening. The current design was made for a 160x110 mm opening "Universal insert" I-3091. A copperplate can be added between Peltier device and cooling circuit to ensure tightness (even if the peltier device shoud crack).

Assembly Notes:

  • Thermal paste should be applied with a Razor blade.
  • Screws need to be tightened very slowly and carfully to not break the Peltier device.
  • After assembly the setup must be tested for stability and tightness for several hours under realistic conditions.


Temperature measurement calibration

Temperatue is determined by measuring the resistance of the thermistors and converting this into a temperature. In order to check the measurement the resistance of resistors should be checked. Measurement noise can be reduced by either adding appropriate capacitors, averaging measurements and shielding the wires. If the correct resistance is measured, the temperature measured should also be checked. Best practise is to use an ice bath or a calibrated reference thermometer.

PID loop tuning

The PID loop can be checked by connecting a USB cable, running the Arduino Serial Plotter (ctrl+L) and enabling the option Settings/Output T on the controller (make sure any other Serial communication is disabled). The plotter will then show the set and actual temperature values. The PID variables can be changed in Settings/Pgain, Igain and Dgain (they will reset to the hard coded values when the controller is restarted). There are many ways to tune a PID loop, this is the way I did it:

  • turn Igain and Dgain to 0
  • Turn Pgain up until the temperature oscillates continuously around the target value
  • Turn Pgain down until this is not the case anymore
  • Turn Igain up until the signal reaches the target within reasonable time
  • Turn Dgain up to reduce any oscillation.

The performance is always a tradeoff between speed, precision and acceptable overshoot. It is worth noting, that the peltier heats much faster than it cools. I personally optimized for cooling performance and little overshoot.

Motor movement calibration

The motor stepsize should be measured on a microscope and updated in the code for the Arduino. The variable "mot_maxPos" must then be adjusted to prevent movement out of the range of the linear actuator.

⚠️ ** Fallback** ⚠️