Introduction: Vernier Sensors and Arduino (or Teensy) for Data Logging

About: Husband, Father, Educator, Facilitator, Nerd.

Let's look at how to collect data from Vernier educational sensors using an Arduino-compatible microcontroller development board.

If you just need to interface one probe with a computer and want everything to work, you should probably buy a Vernier Go!Link, but I was looking for something a little less expensive and more DIY.


Step 1: Required Materials

I played around with the TI MSP430 LaunchPad for a while, since it is only $4.30, but it's not quite as beginner-friendly as the Arduino . I eventually settled on the Arduino-compatible Teensy for its low price ($16) and small size.

For testing I used the TI Light Probe , since it was handy and I could test the sensor output by pointing it at the window or covering it with my hand, but this should work with any analog Vernier sensors .

You'll also need some short wires and perhaps a breadboard. A BT631A jack also makes things easier.

Step 2: Hardware Setup

At minimum you need to connect sensor output, power, and ground from your probe to the Teensy (or other development board). According to the sensor pinouts page :

pin 6 (closest to the clip) is sensor output (0 to 5 V)
pin 5 is power (5 V)
pin 2 is ground

Using some short wire, you'll connect those pins to A0 (labelled F0 on the board), VCC, and GND on the Teensy. Feel free to use a breadboard or solder them in place. I just bent the wires around for testing purposes.

To connect at the sensor end, I ordered a BT to RJ11 adaptor from DealExtreme , but unfortunately it's only 6P4C and we need 6P6C (6 conductors) to connect to pin 6. I'll try ordering something from UXCell or Vernier , but for now I've just used some breadboarding wires stuck into the back of the female connector.

Before you connect the USB cable from your Teensy to the computer, make sure the software is set up.

Step 3: Software Setup

The tutorial on the Teensy site is great, so I won't attempt to duplicate it here.

Step 4: Arduino Code

/*
 Analog input, serial output
 Reads an analog input pin and prints the results to the serial monitor.
 The circuit:
 Vernier probe pin 2: Ground (GND)
 Vernier probe pin 5: +5 V (VCC)
 Vernier probe pin 6: Sensor output (A0)

 created 2011-09-08 by David Hay (misterhay)
 Some code borrowed from example by Tom Igoe
  http://arduino.cc/en/Tutorial/AnalogInOutSerial

 This code is Creative Commons Attribution (http://creativecommons.org/licenses/by/3.0/)
*/

// Constants, used to give names to the pins used
const int analogInPin = A0; // Analog input pin that the probe is attached to
const int ledPin = 11; // The Teensy on-board LED is on pin 11

// Variables
int sensorValue = 0; // value read from the probe

// The setup, which runs once when the sketch starts
void setup()
{
  Serial.begin(38400); // initialize serial communications at 38400 bps,
                           // not that this matters since it runs at USB speed
  pinMode(ledPin, OUTPUT); // set the digital pin as an output
}

// The actual loop that does the sampling and output to the serial monitor
// This will continue to run as long as the Teensy is plugged in
// Use the Arduino Serial Monitor or some fancy GUI to see the output
void loop()
{
  // read the analog in value:
  sensorValue = analogRead(analogInPin);
// print the results to the serial monitor:
Serial.println(sensorValue);

// wait 10 milliseconds for the analog-to-digital converter to settle
delay(10);
}          

Step 5: Finished (or at Least Working) Product

Watch the output in a serial monitor program on your computer (the one in the Arduino software or something like PuTTY ), and paste it into a spreadsheet program if you want to graph it.

Eventually I'll build a GUI for adjusting sample rates and number of sensors and maybe some live graphing , add some calibration , and put it in a better enclosure .