top bar

Difference between revisions of "Arduino"

(Fill in Peripheral Devices Setup property tables.)
(Clean up communication test explanation.)
Line 90: Line 90:
=== Test Communication ===
=== Test Communication ===
In Arduino boards from Duemilanove and on pin 13 also controls the built in LED. Therefore you can test the configuration by changing the <code>Arduino-Switch</code> state to 32 in the <code>Device/Property Browser</code> and than chose Arduino as your shutter and just open/close it in the main MM window. You should see the built-in LED light changes when you close / open the Arduino shutter.
Arduino boards Duemilanove and newer feature an LED attached to pin 13. We can verify communication by changing the state of pin 13 and confirming the LED changes.  Setting pin 13 HIGH requires setting the <code>Arduino-Switch-State</code> to 32 (i.e. 2^5) in the <code>Device/Property Browser</code>.  If you added the <code>Arduino-Shutter</code> peripheral to the <code>Arduino-Hub</code> toggle the <code>Arduino-Shutter</code> in the main MM window, or if you don't have it change the <code>Arduino-Switch-State</code> back to 0 to see the LED go off.
== Usage Notes ==
== Usage Notes ==

Revision as of 18:11, 13 July 2014

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
Wiki page: Nico Stuurman
Pariksheet Nanda
Roy Wollman

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'.

Figure: Functional pinout set by firmware version 2
(Image source .svg file)


Arduino Software

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 built 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.

Hardware Configuration Wizard


Add the Arduino-Hub. You may want to set the "Verbose" property of the port to 0 to avoid extensive logging of the communcation with the device, especially if you are using the input functionality (which queries the Arduino every second).

Pre-Initialization Properties Description
Logic Inverted causes digital inputs and outputs to be considered HIGH when 0 Volts and LOW when +5 Volts.
Serial Setting Value
AnswerTimeout 500
BaudRate 57600
DelayBetweenCharsMs 0
Handshaking Off
Parity None
StopBits 1
Verbose 0

Peripheral Devices Setup

Name Description
Arduino-Switch Digital output pattern set across pins 8 to 13. See usage in #Digital IO
Arduino-Shutter Toggles the digital outputs pattern across pins 8 to 13. Set all pins off when the shutter is closed, and restores the value set in Switch-State when the shutter is opened.
Arduino-Input Reports, both, the digital and analog (0-1023) state of the analog input pins 0 to 5.
Arduino-DAC{1,2} (Not usually used) Reserved for TLV5618 AOTF Peripheral. There does not appear to be any documentation of this peripheral and seems to be a bespoke AOTF control board built for UCSF.
Initialization Properties Description
Pin Reads all 6 input pins when set to All, otherwise reads the individual 0-5 Pin number.
Pull-Up-Resistor Choose whether the Arduino should use its internal 20 kOhm internal pull-up resistor. If not sure, choose On.

Test Communication

Arduino boards Duemilanove and newer feature an LED attached to pin 13. We can verify communication by changing the state of pin 13 and confirming the LED changes. Setting pin 13 HIGH requires setting the Arduino-Switch-State to 32 (i.e. 2^5) in the Device/Property Browser. If you added the Arduino-Shutter peripheral to the Arduino-Hub toggle the Arduino-Shutter in the main MM window, or if you don't have it change the Arduino-Switch-State back to 0 to see the LED go off.

Usage Notes

Switch Mode

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.

Digital IO

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.

Bit 1 corresponds to Arduino output pin 8, bit 2 corresponds to output pin 9, etc... Bits 7 and 8 are not used. e.g. setting the switch to value '5', will set output pins 8 and 10 high and the others low.

Here is a simple table Nico send to the mailing list in an email to help (me :) with powers of 2:

bitpinnr when high

Device Properties

Properties Description
Switch-Blank On Allows Low or High.
Switch-Blanking Mode Allows On or Off.
Switch-Label Allows 0-63.
Switch-Sequence Allows On or Off.
Switch-State Allows 0-63.
Input-AnalogInput{0:5} 10-bit value of ADC input.
Input-DigitalInput Value depends on how the Pin initialization property was set. Shows binary state of the input pin, if a single in was selected. Shows the 5-bit value of all input pins if "All" was selected.

Project Tutorials

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