For sensor workshop, we had an assignment to display the activity of a sensor in time.  My first idea was to use a Hall effect sensor to measure how much my pet mice run in their wheel in a given day.  However, I think this would be better suited to our next assignment (data logging), so I decided to hold off.

I was all ready to dive into sensors until I realized…I have no Arduino.  Oops!  So it turns out I’ve never actually purchased an Arduino, except for my sewable Lilypad.  I did, however, have some ATMega chips with an Arduino bootloader (only $4!).  I first breadboarded the ATMega 328s, added an external oscillator (16 mHz), and some capacitors.  I also put a small capacitor between the chip’s reset line and the FTDI’s DTR that would allow my FTDI to reset the Arduino if needed (otherwise it is super annoying to program and you have to manually reset the board at the right time).  Then I hooked up my FTDI’s RX, TX, and GND lines and did a test to ensure I could program the chip.   SUCCESS!

My next step was to hook up a sensor.  I really didn’t have anything too fancy lying around, until I randomly found an LV-MaxSonar-EZ ultrasonic sensor (I don’t think this sensor is actually mine -where did it come from?!).   MaxSonar makes several types of ultrasonic sensor – each with a different range, sensitivity, and angle of measurement. My sensor didn’t seem to have the exact part number on it (aside from being from the EZ line), so I wasn’t exactly sure of its specs.

Experiment 1

For my sensor in time test, I decided that I wanted to use the ultrasonic sensor to roughly map the topography of objects on a table.  I set up some random boxes, cans, etc. and, using the handy ruler on the table, took a sensor measurement every 2 centimeters.  I then graphed my findings in Excel.

Experiment 2

This time, I connected my Arduino program to Processing and mapped the ultrasonic sensor’s readings in real time.  Unfortunately, the readings were really jumpy!  I found some nice low-pass filter code and added it to the Arduino program.  You can adjust how much emphasis to place on a new reading vs. the past couple of readings.

What I DON”T like about graphing the ultrasonic readings in time is that this doesn’t show how the current ultrasonic reading compares to ultrasonic readings done in the surrounding area.  It would be really great to have both an acceleration and and an ultrasonic sensor reading shown on a graph.  As you move the ultrasonic sensor faster, the graph would also move faster and take more readings.