sensors & actuators

If you’re hoping to use your Arduino as a sensor or as a responsive mechanism, you’ll need to invest in some electronics.  Of course, these can be simple or complicated in terms of wiring and coding, and wildly inexpensive or more costly.  Here is a list of electronic sensors that we’ve tested and the tricks we’ve learned in the process of getting to know them.

First of all, when wiring sensors, pay attention to whether or not they are polarized (have a positive and negative wire) and whether their signals are analog (returning a wide range of outputs like a light sensor) or digital (returning information in the form of 1’s and 0’s like a pushbutton).

Most sensors are happier when wired up with a resistor. Sensors usually like to be wired in such a way that power is coming into them on one leg while their other leg lines up with one leg of a resistor and the signal output line.  The other leg of the resistor lines up with the ground line. You can find many tutorials on using these sensors with an arduino on LadyAda.net. You can also see more wiring diagrams by downloading Fritzing for free and looking at the Examples (File–>Open examples).

SENSORS

 

 

   

 Push buttons

These are the simplest of sensors.  They cost less than a nickel, and allow you to manually press signals into your microcontroller.   For an example of how these work: http://softsurfaces.wordpress.com/pushbutton-light/  DIGITAL. NO POLARITY.

Photosensors

There are several different sizes, but most work in a similar fashion.  On most, darkness is connoted by number readings in the low 400s and brightness brings the readings up toward 1000. When using Firefly, it will be useful to remap these numbers so that your responder (your motor, LEDS, etc.) can read them. These are also relatively cheap. (http://www.adafruit.com/products/193)   ANALOG. NO POLARITY

Accelerometer 

We’ve experimented with a LilyPad accelerometer, and it is very simple to wire.  It has five pin connections: one for ground and one for power, and then one for each axis of movement: x, y, and z. You can use it as a mobile sensor if you wire the accelerometer up to your arduino and the arduino up to an xbee radio and a battery pack.  Note, however, that the accelerometer is not a gps!  It is best for measuring tilts (shifts in orientation) or changes in speed.  You can get an idea of what you can do with it by looking into the way that I-phone applications have utilized the phone’s built-in accelerometer. (http://www.sparkfun.com/products/9267)  ANALOG. POLARIZED

Thermistors

These sensors register temperature, and you can find them for under a dollar.  There are different types: some look like transistors, others consist of a pair of rubber-coated wires joined at the end.  (http://www.ladyada.net/learn/sensors/thermistor.html).  ANALOG. NO POLARITY. 

Tilt Sensor

 These sensors allow you to register orientation and inclination. If you are interested in registering tilt in a general manner and aren’t interested in the precise x,y,z coordinate information of the data, you should use the tilt sensor and not an accelerometer.  They are much cheaper than accelerometers ($2 vs. $25), and output much less complex data strings. (http://www.adafruit.com/products/173).  DIGITAL. NO POLARITY.

  

Infrared Proximity Sensors

These sensors detect movement and proximity.  They send out an infrared beam (the range is usually between 4” and a few feet), and the data they output reflects the distance the beam can travel before it hits something.  They are a little more expensive than other sensors ($10-20) (http://www.adafruit.com/products/189  or http://www.sparkfun.com/products/242).  This is a helpful tutorial on how to use them.  DIGITAL or ANALOG. POLARIZED.

Bend/Flex Sensor

These sensors output data that reflects the amount of bend they are undergoing.  A force (touch or wind) can cause the sensor to flex, and the greater the flex, the higher the values.  (http://adafruit.com/products/182).  For an example of how these work: http://softsurfaces.wordpress.com/illuminating-wind-responsive-mechanism/.  ANALOG. NO POLARITY.

Force-Sensitive Resistor

These sensors detect squeeze or pressure. They are cheap and vary from sensor to sensor.  They will not provide extremely accurate data, but they can tell the difference between hard squeezes, little squeezes, and nonsqueezes (https://www.adafruit.com/products/166&zenid=acd2228c99861d8d6c3d4b67757887c8).  ANALOG. NO POLARITY.

Sensirion Humidity Sensor

These are fairly expensive ($40), but provide a lot of information: humidity, dewpoint, & temperature.  The catch is that if you want to read the values, you’ll have to find a way to include a special “sensirion” library in the arduino sketch.  This isn’t hard (and you can find an Arduino Sensirion sketch like this one on the internet fairly easily), but it means that you won’t be able to just load the Uno Firmata and work in Grasshopper…that is, unless you can adjust the Uno Firmata code to understand the library.   (http://www.robotshop.com/parallax-sensirion-temperature-humidity-sensor.html?utm_source=google&utm_medium=base&utm_campaign=jos).  ANALOG. POLARIZED.

DHTxx Temperature/Humidity Sensor

These are much cheaper than the Sensirion (only $5), but apparently are not as accurate and trustworthy.  There is a helpful tutorial about them on adafruit.com.  Like the Sensirion, they too require special Arduino libraries and coding.   (http://www.adafruit.com/category/35_66).  ANALOG & DIGITAL. POLARIZED.

LM358 for sensing sound

An LM358 microphone amplifier can be used with an electret microphone as a sound sensor.  The best information that we have found is from Dimitar Kovachev’s Lowvoltage site.  Kovachev discusses operational amplifier (op amp) performance as well as LM358 sound sensor performance.  He includes a photo of the circuit and a parts list.

ACTUATORS

  

LEDs

These come in a variety of colors (red, yellow, green, violet) and there are special ones called RGB LED that rotate between colors.  They are fairly cheap and very easy to wire: the longer leg hooks up to power (or the signal if you want it to respond to sensors), the shorter one to ground.  A resistor between the LED and the signal is usually helpful.   For a diagram of how to hook up the RGB LED, study this website: (http://fritzing.org/projects/color-fader/).  DIGITAL. POLARIZED.

Piezo Speakers

You can buy these for a nickel or you can even break open an old answering machine and find one lurking in there. You can use an Arduino Sketch to program notes into it: (http://www.arduino.cc/en/Tutorial/Melody).  This sketch can be altered; you can change the notes in the sketch and get it to sing a different melody. If you’re looking to use grasshopper/firefly, you can easily get them to make a sound (a little techy-sounding buzz) but if you’d like to make tunes in firefly, this is not as simple. This is because the signals that were sent through the Arduino with the Melody Sketch use a tone library and the Firmata Sketch does not accommodate this library. If you want to use firefly, you’ll need to hack into the firmata to reprogram the output pins into which the speaker is plugged so that they accommodate the tone library.  DIGITAL. POLARIZED.

MOTORS

DC Motors (or gear head) Motors

These motors can rotate continuously and can switch direction.  They are somewhat tricky to wire up, and you will need an H-bridge.  A good tutorial on how to set them up can be found here:    (http://itp.nyu.edu/physcomp/Labs/DCMotorControl).  If you look at the H-Bridge diagram in the tutorial and the accompanying chart, you can see that the speed and direction of the motor depends on the combination of high and low signals you are sending to the three motor inputs.  DIGITAL (but turn on the Servo control by right clicking on the input in the Firefly Component). POLARIZED.

Standard Servo Motors

These motors allow you to control the position or the amount of rotation.  However, the motor only turns 180 degrees in total (90 degrees in each direction).  If you’re looking to buy motors, be sure to visit Servo City.  They sell all types of motors and motor attachments.  DIGITAL (but turn on the Servo control by right clicking on the input in the Firefly Component). POLARIZED.

Continuous Rotation Servo Motors

These motors allow will rotate continuously, and they can rotate backwards and forwards.  However you cannot control the position of the motor precisely. (https://www.adafruit.com/products/154).  DIGITAL (but turn on the Servo control by right clicking on the input in the Firefly Component). POLARIZED.

Stepper Motors

This motor seems dreamy because you can both control its position, and it can rotate continuously.  The set up is not difficult in the arduino environment.  You will need external power as well as an HBridge or an EasyDriver (http://www.sparkfun.com/products/9402). There is a stepper motor firmata on the Firefly Forum (http://www.fireflyexperiments.com/discussions/post/1438445), but we’ve had little success with it.  You must download a special library and cpp file (available here: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1251509480.  Note: you must copy them into wordpad or some other text program and save the library code as easydriver.h and the cpp as easydriver.cpp.   Then copy these files into the Arduino Sketchbook library on your computer.  You can find the sketchbook library’s location by opening Arduino, clicking Fileàpreferences.  This directs you to where the folder is.  Find this folder on your computer.  Create a folder within that folder that is called “Libraries,”  and create within that folder a folder named “EasyDriver.”  Drop the .h and .cpp files into that folder and create another folder within the EasyDriver Folder named EasyDriver, drop the pde file from the box.net file into this folder.)  This should get you started, but we haven’t figured out how to get it to work right yet.  In fact, we found it easier to use the Original Firefly Firmata (as opposed to the Stepper Motor Firmata), but we couldn’t get the motor to behave correctly.  DIGITAL (but turn on the Servo control by right clicking on the input in the Firefly Component). POLARIZED.

meta

This is a gps module for the arduino with an antenna attached.  We purchased both components from cooking hacks, an electronics supplier located in Zaragosa, Spain. The module works well with the arduino, and one can receive gps information on the arduino serial monitor or from an SD data card (as part of the arduino assembly).  We set this up by following the tutorial on the cooking hacks site.  The video at the end of the tutorial is the most helpful part.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.