Arduino Painting
Thursday, August 27th, 2009One of the students in my arduino class this summer painted an awesome painting of the Duemilanove. It is going to be used as an aid for pointing out parts in the next class I teach.
One of the students in my arduino class this summer painted an awesome painting of the Duemilanove. It is going to be used as an aid for pointing out parts in the next class I teach.
Another post on Pachube and how easy it is to get setup and going. This post will cover the basic steps on how to get some sensors online! I will be using my project of two light sensors as an example. The status of my light sensors are viewable at http://www.pachube.com/feeds/2145
Pachube + Arduino from Morgellon on Vimeo.
STEP ONE: GET A PACHUBE ACCOUNT!
Head over to the Pachube website and see various sensors from all over the world and view their status. Be sure to view the ABOUT page, this describes INPUTs and OUTPUTs, along with ways to interface with Pachube and your sensors. The QUICKSTART page has the details to get started and how to use your API. Pachube is still in beta, so you’ll need to get an invite code… but no worries, Pachube has an email address on the QUICKSTART page. Just send them and email asking for an invite and what you would like to do. If they let me in… they will let anyone in!
STEP TWO: PREPARE ARDUINO!
The Arduino can be interfaced with Pachube two ways: 1. With an Ethernet shield OR 2. Via USB connected to a PC running Processing… which is the way used in this tutorial… as I feel it is an easy and inexpensive way. You can learn more about each way at the Pachube Arduino page.
To prep the Arduino, you need to connect the sensors you will be using and verify that they are working correctly! Once the sensors are good, then upload the “Standard Firmata” to the Arduino. Now the Arduino is prepped for Pachube! Leave the Arduino connected to the PC.
STEP THREE: PREPARE PROCESSING!
To have Processing communicate easily with Pachube, you will need to add a few libraries. They are the Pachuino, Arduino and EEML libraries, they are available and there is more info at the PACHUINO page. Download, unzip and move them to the libraries folder, in your sketchbook folder. Now Processing is ready!
STEP FOUR: PREPARE INPUT FEED!
Once you have a Pachube account and your API key, go ahead and set up a new feed for your sensors. Since I have light sensors, I started a new INPUT FEED. I chose to make my feed “manual” (as this is easier for me) which means Pachube gets updates only when I send them. Instead of Pachube connecting directly to my PC to pull the info.
STEP FIVE: PREPARE CODE FOR PROCESSING!
Once you have the libraries in the folder, you are ready to start Processing and start coding. Below is the code I used for my light sensor. This was taken from the sample code and stripped to make it more simple. I added a LED on pin 11 to light up (to let me know when my Arduino was running) and a delay(1500).
Be sure to add you API Key, and the URL of your INPUT FEED!
import processing.serial.*;
import cc.arduino.*;
import eeml.*;
import pachuino.*;
Pachuino p;
Arduino arduino;
int ledPin = 11;
void setup(){
p = new Pachuino(this, Arduino.list()[0], 115200);
p.manualUpdate(”http://www.pachube.com/api/2145.xml”); // change URL — this is the feed you want to update
p.setKey(”—YOUR API KEY HERE—”);
// local sensors
p.addLocalSensor(”analog”, 0,”Light Sensor Inside”);
p.addLocalSensor(”analog”, 1,”Light Sensor Outside”);
}
void draw(){
//p.debug();
p.digitalWrite(ledPin, Arduino.HIGH);
delay(1500);
}
// you don’t need to change any of these
void onReceiveEEML(DataIn d){
p.updateRemoteSensors(d);
}
STEP SIX: LAUNCH CODE AND COLLECT DATA!
Make sure that:
Now run your program and begin collecting data and sharing it on the web!! Check your feed to make sure you data is being transmitted. Have fun and happy tinkering!
–Morgellon OUT!
Quick update before I zonk out… Yesterday I setup an account for Pachube and spent all night getting familiar with how it works. Pachube describes itself as a service that enables you to connect, tag and share real time sensor data from objects, devices, buildings and environments around the world. The key aim is to facilitate interaction between remote environments, both physical and virtual.
It also works with Arduino and Processing… hrmmmmm…..


The graphs will continue to update as they receive more data from the sensors. It will be interesting to watch and compare the differences in the two graphs. More to come soon!
–Morgellon OUT!!
Finally gotten around to posting some pictures and video from the Flourish Conference, in Chicago IL. Flourish was a blast, Droops and I had a wonderful time with all the great people that we met.
Massimo Banzi at Flourish ‘09 from Morgellon on Vimeo.
Processing Workshop at Flourish ‘09 (pt1) from Morgellon on Vimeo.
Processing Workshop at Flourish ‘09 (pt2) from Morgellon on Vimeo.
There has been quite a flurry of development revolving around the official ethernet shield recently. Here are what I consider a few of the more important changes.
Ethernet fixes – There are some connection issues with the ethernet library with regard to incomplete disconnects. Since the wiznet chip only supports 4 simultaneous connections, this manifests itself pretty quickly if you are trying to poll a server for changes. Etracer, from the arduino forums, found and fixed this problem and has released a new client.cpp as well as detailed the issues in a post to the arduino developers mailing list.
Another recent addition is Ben Combee’s Webduino library, which greatly simplifies processing html forms when using the arduino and ethernet shield as a web server. The library and basic examples are available at: http://code.google.com/p/webduino/
Bjoern Hartmann’s UDP library has also been used for a couple of recent projects including work on DNS/DHCP and fellow Infonomicon member Cynshard’s work on a NTP library. The NTP library is particularly useful since it can be combined with the software Date/Time library to have fairly accurate time without adding a hardware realtime clock to your project.
As you can see, there seems to be a lot of development activity ongoing for the official ethernet shield and since the addition of networking to the arduino greatly expands its possible uses, I think we’ll see even more. Please remember to thank these folks for their code and bugfix contributions…
Saw this pop up on Evil Mad Scientist Laboratory’s Twitter feed (http://twitter.com/EMSL) and thought it was worth sharing.
Looks like there is a new Arduino in the works… the Arduino Mega?!
Here are the “reported” specs… but please keep in mind, this is not official and I could be totally wrong!
The Mega is an Arduino processor ATMEGA1280
According to the original post, the release date of the Adruino Mega could be March 26th… so keep your eyes open if you’re interested!
It looks like all this buzz and excitement was generated from a post in a Portuguese language forum. Here’s a link to the original Portuguese post: http://lusorobotica.com/index.php/topic,675.msg5625.html and here’s a link to the page translated! http://translate.google.com/translate?prev=_t&hl=en&ie=UTF-8&u=http%3A%2F%2Flusorobotica.com%2Findex.php%2Ftopic%2C675.msg5625.html&sl=pt&tl=en&history_state0=
Its just like my Diecimilia’s except that when I have a shield on it, its so much easier to change the power supply. (from usb to 9v external)
Here is a pic of my new baby along with some other boards.
BEHOLD!… the Arduino USB board has evolved from the old “Decemilia” to the new “Deumilanove”! Just like a fine wine, the Arduino keeps getting better over the course of time.
The new Deumilanove offers a few improvements over previous Arduinos including:
http://www.arduino.cc/en/Main/ArduinoBoardDuemilanove
(Be sure to scroll down to the bottom of the page to download an audio file of how to pronounce “Duemilanove“!)
The color selector is 3 linear pots that control the rgb values of a square in a window. The window also displays the rgb values. Kinda simple to make, I reused a lot of code from the etch-a-sketch sketch. I am working on my processing book, so my projects should get better.
The dot in the red pick, is me not being able to use a mouse properly, the lines on the text seem to be a problem with the font I picked.
/*
Color Selector
Takes 3 pots hooked up to analog 0,1,2 and uses them for the red green blue
values of a square.
Also displays the number for each color
*/
import processing.serial.*;
Serial myPort;
String inString; // Input string from serial port:
String letter;
int number;
String numberS;
int redNum, greenNum, blueNum;
int x = 300; //somewhere around 200 or 300
int y = 300;
int lf = 10;
PFont font;
void setup() {
size(x, y);
//you may have to change the serial port
myPort = new Serial(this, Serial.list()[0], 9600);
myPort.bufferUntil(lf);
background(0);
font = loadFont("aakar-medium-20.vlw"); //make your own font
}
void draw() {
background(0);
textFont(font);
fill(255, 0, 0);
text(redNum, 10,30);
fill(0, 255, 0);
text(greenNum, 70,30);
fill(0, 0, 255);
text(blueNum, 130,30);
fill(redNum, greenNum, blueNum);
rect(0,50,x,y);
}
void serialEvent(Serial p) {
inString = (myPort.readString());
letter = inString.substring(0, 1);
numberS = inString.substring(2);
numberS = trim(numberS);
number = Integer.parseInt(numberS); //I could have combined a bit of this, but this code is for learning
if(letter.equals("R") == true) {
redNum = number;
}
if(letter.equals("G") == true) {
greenNum = number;
}
if(letter.equals("B") == true) {
blueNum = number;
}
}
/*Arduino Code
int bluePin = 2; //analog pin for right hand knob
int greenPin = 1; //analog pin for left hand knob
int redPin = 0; //analog pin for center knob (width)
//Info for Serial Data
int id_1 = 'R';
int id_2 = 'G';
int id_3 = 'B';
int space = ' ';
void setup()
{
pinMode(redPin, INPUT);
pinMode(greenPin, INPUT);
pinMode(bluePin, INPUT);
Serial.begin(9600);
}
void loop()
{
int redNum = analogRead(redPin);
int greenNum = analogRead(greenPin);
int blueNum = analogRead(bluePin);
//the arduino will read from 0 to 1024 on teh analog pins, so we divide that by 4
redNum = redNum / 4;
greenNum = greenNum / 4;
blueNum = blueNum / 4;
printByte(id_1);
printByte(space);
printInteger(redNum); printByte(10);
printByte(id_2);
printByte(space);
printInteger(greenNum); printByte(10);
printByte(id_3);
printByte(space);
printInteger(blueNum); printByte(10);
delay(10);
}
*/