Sensor graphing with 3 lines of code!

I’ve been looking for simple ways to graph the data from a sensor attached to a microcontroller lately, because it’s such a necessary activity if you want to look at sensor data over time. Using Apples Grapher program, which comes with OSX, I found a simple way that involves only four lines of code on an Arduino or Wiring microcontroller, and produces graphs like this:

graph.png

Continue reading “Sensor graphing with 3 lines of code!”

iPod control from Arduino or Wiring

Rosie Daniel wrote a nice piece of Arduino code to control an iPod. Rosie used a hacked iPod remote to connect her Arduino to the iPod. The remote’s AUD connection is its data in connection, which is connected to the Arduino/Wiring board’s data out. The iPod’s power (VCC) and Ground are connected to the power and ground of the microcontroller. Then this code works.

Thanks to Rosie for writing this:

Technorati Tags: , ,


Continue reading “iPod control from Arduino or Wiring”

Startup Checks

When you’re making a microcontroller circuit that drives a high current load like a motor or an incandescent light, it’s not uncommon to make a mistake and create a circuit that draws too much electrical energy on startup and causes the microcontroller to reset itself constantly. To debug this, it helps to put a routine in your startup() function so you can see when the microcontroller has started up. For example, I often blink an LED three times in the startup. If the LED blinks three times then stops, I know the microcontroller has successfully run the startup and gone into its main loop. If it blinks constantly, I know the microcontroller is continually resetting, so there’s a problem.

Hans Steiner recently showed me his trick for checking for the startup routine on the Arduino: he writes to the microcontroller’s EEPROM, or permanent memory, and reads back the result. Every time the Arduino resets, it’ll increment the EEPROM value. Since this value is stored even when the Arduino is not powered, you’re going to get a new number each time it’s run.

Thanks to Hans for the code.

Technorati Tags: ,


Continue reading “Startup Checks”

USBTinyISP

Recently, I’d been trying to re-program some Atmega168’s for use in Arduino modules, and was having no luck using my AVRISP MkII programmer. All appeared to be working, but it kept failing. I even dug into the details of avrdude, and the programmer responded as if it was working but delivered no love.

Fortunately I had on hand a USBTinyISP from Adafruit. Even more fortunately, Limor Fried has written some nice instructions on the programmer and on installing and running avrdude to program with it. What’s nice is that she’s packaged the software well, so you can run it without too much hassle. The only thing I had to learn was how to point avrdude at her custom config file, by using the -C flag, like so:

./avrdude -C avrdude.conf -v -p m168 -e

(etc)

Even nicer, David Mellis is including support for this programmer in Arduino 0010, so that I can burn new bootloader firmware onto the chips using it without needing to touch the command line app.

Even nicer still: her programmer’s cheaper than the AVRISP mkII (of which I have blown up a few). I may blow this one up in time too, but I’ll be able to afford to replace it much easier.

Technorati Tags: ,

Virtual Color Fader for Max/MSP

This Max/MSP patch reads in a serial string like this:

Rnnn
Gnnn
Bnnn

Where nnn is an ASCII-formatted decimal number from 0 to 255. It then converts the values into the RGB colod for the patch’s background.

An Arduino program to send the appropriate data follows.

To use the patch, copy the text and paste it into a new max patch window.

Thanks to David Mellis and Jamie Allen for the collaboration. These patches were written for a one-day Arduino workshop at NIME 07 hosted by the three of us. The Arduino program comes from the Arduino example files, by David Mellis.

Technorati Tags: , ,


Continue reading “Virtual Color Fader for Max/MSP”

Analog to Frequency for Max/MSP

This Max/MSP patch takes a serial string in and converts it to a numeric value, then plays a frequency using the value.

To use the patch, copy the text and paste it into a new max patch window.

Thanks to David Mellis and Jamie Allen for the collaboration. These patches were written for a one-day Arduino workshop at NIME 07 hosted by the three of us. The Arduino program comes from the Arduino example files, by David Mellis.

Technorati Tags: ,


Continue reading “Analog to Frequency for Max/MSP”

Physical Pixel Controller

This Max/MSP patch turns on or off an LED attached to an Arduino. Max and the Arduino communicate serially.

To use the patch, copy the text and paste it into a new max patch window.

Thanks to David Mellis and Jamie Allen for the collaboration. These patches were written for a one-day Arduino workshop at NIME 07 hosted by the three of us. The Arduino program comes from the Arduino example files, by David Mellis.

Technorati Tags: , ,


Continue reading “Physical Pixel Controller”

LED Fader in Max/MSP

This Max/MSP patch sends data out the serial port. The corresponding Arduino program reads the data from Max serially and uses it to set the brightness of an LED on digital pin 9.

To use the patch, copy the text and paste it into a new max patch window.

Thanks to David Mellis and Jamie Allen for the collaboration. These patches were written for a one-day Arduino workshop at NIME 07 hosted by the three of us. The Arduino program comes from the Arduino example files, by David Mellis.

Technorati Tags: , ,


Continue reading “LED Fader in Max/MSP”

Ascii to Number in Max/MSP

This patch receives an ASCII-encoded decimal string that ends with a linefeed and carriage return in the serial port, and converts it to a number. A Wiring/Arduino program to send data to it follows. It’s based on an example by Jamie Allen.

To use the patch, copy the text and paste it into a new max patch window.

Thanks to David Mellis and Jamie Allen for the collaboration. These patches were written for a one-day Arduino workshop at NIME 07 hosted by the three of us. The Arduino program comes from the Arduino example files, by David Mellis.

Continue reading “Ascii to Number in Max/MSP”