Friday, August 07, 2009


Arduino Board!
I have finally taken the dive and gotten into microcontrollers (lil' computers for the non-nerd-alerts). In embedded systems (systems that use said lil' computers) you can add a small and less-smart-than-your-laptop computer to nearly ANYTHING... but for what? You can have inputs and outputs, post them to the web, make 'em wireless, robotics, twittering toilets, automate your house so that when you come home the temperature in the hot tub is JUST the way you like it... all kinds of possibilities.
Warning: This is not super complicated, complex, or something you could not do by simply reading this post. No need to feel overwhelmed with big words or wierd terms. Post questions and I will answer.
Here I will outline how I intend to use the first effort of mine: a magnetic levitation system. The hope is to one day use a magnetic hall effect sensor to sense how close a train is to the railing and feed an electromagnet using Pulse Width Modulation (commonly called PWM) to tell it how hard to pull up to the railing. Find the concept here.

So here's the first step! I got the arduino yesterday, woke up this morning and had breakfast with my folks from Oregon, and have been trying to remember everything in my ECE3090 class since then so I could have it working before going into Grand Targhee Ski Resort at 2p to bartend and serve food. I have a working system that lights up when a certain threshold is hit by the magnetic sensor.
video
Thanks for checkin' it out!


For those interested I also have some pictures and details here:
The arduino is the duevemilanove (italian for 2009), the LED is a standard green LED that came with a motor kit I need to solder together, and the sensor is a Honeywell ss495a. The code was stolen from a sensor sketch (an example arduino environment code) and edited to output the voltage in the console (it shows 0-5V mapped between values of 0-1023... that means 512 is approx. 2.5 volts which is what the sensor outputs with neutral magnetic fields).

The Sensor:

The Honeywell ss495a is a linear hall effect sensor. It is meant to tell you the magentic field around the sensor. There are three pins to the sensors: V+, V-, and outp
ut. If the magnetic field is very positive then it will output V+, if it is very negative it will output V-, and with no magnetic field present it will output right in the middle ( (V+ - V-)/2 OR 2.5 volts if V+ is 5V and V- is 0V). This makes it a great sensor for electrodynamic suspension (making things float magnetically).

The Code:
/Screenshot.bmp Note the raw output voltages at the bottom of the console.
It is self explanatory for most programmers but to explain it to non-nerds-for-life it sets up by setting up a serial connection with the computer, assigns variables like which pin the LED is or which analog input the hall effect sensor is connected to, and then goes into a loop which repeats every 10 ms or so. The loop reads the voltage that the Hall Effect Sensor is outputting, checks it to see if its higher than a prescribed threshold, and decides whether or not to light up the LED. Lastly it sends the raw sensor output through serial to the Arduino console. Delay 10 ms, rinse, and repeat...