Friday, April 2, 2010

Ardweeny

The Solarbotics Ardweeny

I've been wanting to play around with Arduino to see what all the fuss is about. Solarbotics sells an inexpensive Arduino-compatible backpack style kit called Ardweeny. It consists of a small PCB with headers that allow it to sit on top of the included ATmega328, giving it the smallest through-hole footprint possible.

Building it was simple thanks to very easy to follow, full-color, illustrated instructions. I also bought the Sparkfun 5V USB-to-TTL FTDI breakout board through Solarbotics which allows for programming and powering the Ardweeny.  Right after plugging in the USB-connected serial board, powering up the Ardweeny, the LED started blinking. Apparently this Arduino started out life with an LED blinking sketch?

The Ardweeny lives!

Now... what to do with it?  Naturally I started by writing a custom LED blinking sketch and downloading it to the chip.

But first, I had to download the Virtual COM Port (VCP) drivers from FTDI, then unplug/replug the USB cable, and tell the Arduino IDE (that I'd downloaded previously) to use the correct COM port after checking in Device Manager to find the virtual port for USB.

Similar procedure for Mac OS X.  Arduino IDE is cross platform. Download FTDI's OS X VCP driver disk image, install the appropriate package, and when you plug in the programmer, look for a file to appear named /dev/tty.Sparkfun*  -- For example, on my computer I saw: /dev/tty.SparkFun-BT-SerialPort-1 

Here's the blinking LED code:

int ledPin = 13; // LED on digital pin 13

void setup()
{
  pinMode(ledPin, OUTPUT); // set pin as output
}

void loop()
{
  digitalWrite(ledPin, HIGH); // led on
  delay(1000);
  digitalWrite(ledPin, LOW); // led off
  delay(1000);
}

Next test was reading the analog value from a Sharp GP2D12 IR ranger sensor and blinking the LED at a rate proportional to the value. I modified the blink code above by adding reference to analog pin for IR and a variable to store the analog value.

int irPin = 5;
int val = 0;

Then I incorporated the sensor value into the blinking loop. Pretty simple.

void loop()
{
  val = analogRead(irPin); // get sensor value
  digitalWrite(ledPin, HIGH);
  delay(val); // use value for delay
  digitalWrite(ledPin, LOW);
  delay(val); // use value for delay
}

The final test was sending the value from the sensor directly to the computer via the FTDI serial port.

void loop() {
  val = analogRead(irPin);
  Serial.println(val, DEC); // print value with newline
  delay(1000);
}

Hmm. That was all really easy--not entirely unlike using a Basic Stamp (but cheaper).  Of course, there's much more to explore.

Speaking of cheap, the Ardweeny was inspired by Kimio Kosaka's "One-Chip-Arduino" project. That's about as low budget as it gets...

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.