top bar


Revision as of 15:04, 25 December 2012 by P.nanda (Talk | contribs)

Arduino adapter

Summary: Adapter for the Arduino electronics prototyping platform
Author: Nico Stuurman
License: LGPL
Platforms: Linux, Mac, and Windows
Since version: 1.3.18
Automated Serial Port Setup: Yes
Peripheral device discovery: No

The Arduino is a low cost programmable digital IO board. It has some digital inputs and digital outputs and can communicate with the computer through a serial interface (that is hidden in a USB connection). A very nice and simple programming language makes the Arduino very simple to program. The Micro-Manager interface to the Arduino consists of an Arduino program (the 'firmware') that you need to upload to the Arduino first. The current version of the Micro-Manager has facilities to use the Arduino as a shutter, and as a shutter that only opens when a TTL is set high (for instance, when the camera is exposing). Also, timed sequences of TTL output can be setup. There are also facilities for programmable analogue out, however, those need connection of a DA chip and requires constructions of a 'daughterboard'/'shield'.

To install the Arduino Micro-Manager 'firmware', download and install the Arduino Software for your platform. Establish a connection with your Arduino using the instructions that come with the Arduino software (this includes installing a driver for the USB to serial adapter build into the Arduino.. Then download the firmware source code and copy into the Arduino editor. Send to the Arduino, and your Arduino is programmed to work with Micro-Manager.

In Micro-Manager, use the hardware configuration wizard to add the Arduino. Set the serial port to 57600 baud.

The Arduino 'Switch' sets the digital output pattern using a single byte. Bit 1 corresponds to Arduino ouput pin 8, bit 2 corresponds to output pin 9, etc... Bits 7 and 8 are not used. So, setting the switch to value '5', will set output pins 8 and 10 high and the others low.

You'll need to think in binary to get this right, meaning that to get pin 13 to open, you need to flip bit 5 which means you want to send 2^5 = 32. Similarly pin 10 will be bit 2 which is 2^2=4. Here is a simple table Nico send to the mailing list in an email to help (me :) with powers of 2:

bitpinnr when high

When used directly (not via trigger mode) the Arduino Shutter is the device that will change the voltage on the pins specified by the State of the Arduino-Switch (as described above). You'll need to add three devices to your configuration, the hub the switch and the shutter. The Hub takes care of all communication and you don't need to worry about it. The Switch is where you set the pattern you want and opening/closing the shutter will actually change the voltage on the pins as determined by the Switch pattern.

Troubleshooting tip: In Arduino boards from Duemilanove and on pin 13 also controls the built in LED. Therefore you can test the configuration by changing the Arduino-Switch state to 32 in the device/property browser and than chose Arduino as your shuter and just open/close it in the main MM window. and opening and closing the Arduino-shutter. You should see the built-in LED light changes when you close / open the arduino shutter.

As of version 1.3.47, the Arduino adapter can also report the digital (0 or 1) and analog (0-1023) state of the analog input pins 0-5 on the Arduino. To do so, add the "Arduino-Input" device in the Hardware Configuration Wizard. You can either have it report all analog pins or only a specific one (you set this with the "Pin" pre-initialization property). You can also define whether or not the Arduino should use its internal 20 kohm internal pull-up resistor using a pre-initialization property. If you want to report multiple individual pins, you can add this device multiple times.

David Knecht put up a nice tutorial on how to build a box around the Arduino and use it to control LED illumination on your microscope [1].

--Nico 02:20, 27 February 2009 (UTC)

additions by: --Roy 12:43, April 12 2010 (UTC)

© Micro-Manager : Vale Lab, UCSF 2006-2011 | All Rights Reserved | Contact