Arduino-Processing Serial Communication
April 6th, 2011
Over the last few weeks I’ve been messing around quite a bit with the Processing programming language. I was drawn to it initially because it is a close cousin to the Arduino language and programming environment (which is based on Processing), so naturally I wanted to find a way to combine the two in a project.
Background
What I had in mind, of course, was an outlandishly-complicated, full-screen Processing user interface, with dials and button and knobs and sliders and big maps and graphs of data readouts and a little videoport showing the view from the Kinect-based eyes of some hardy Arduino-powered robot as it trundled bravely into the caldera of a smoking volcano.
- Download and install controlP5 GUI Library for Processing.
- Download SliderSerial_Arduino.
- Download SliderSerial_Processing.
But alas, I thought it would be better to start small — with one little graphical slider control, one Arduino, and one LED. The slider would command a brightness level for the LED, serial communication would do the talking, and pulse-width modulation (PWM) would do the legwork. In my quest for the ultimate ready-made user interface, however, I did stumble across the awesome-looking and fully-featured controlP5 GUI library for Processing.
Building Boarduino
April 26th, 2008
I recently soldered up a Boarduino from Adafruit Industries. Boarduino is simply an Arduino clone with a smaller form factor, designed to plug directly into a breadboard rather than giving you the female headers of the original. I thought I’d post a few photos of the process.
I really like the idea of the Boarduino, because I found I was doing almost all of my prototyping on a breadboard, and it seemed like I was always trying to figure out new and different ways to anchor the big Arduino down.
Arduino-Python 4-Axis Servo Control
April 8th, 2008
Although the Arduino platform is ideal for standalone applications, it really comes to life when interfaced with a PC. Connect Arduino to a personal computer and you instantly add a ton of versatility and processing power to your project.
This tutorial will describe how to use Arduino to control a bank of four independent RC servos with your PC (or Mac, or *nix Box), using a USB cable and a modular Arduino-Python software stack.
The following discussion builds upon concepts presented in two previous articles, “Arduino Serial Servo Control” and “Joystick Control of a Servo.” As always, comments, critiques, or suggestions for improving or adapting this code are welcome and appreciated.
Project Outline
The primary goal for this project was to create a software stack that allows simple and flexible control of multiple servos from any type of Python script.
The solution has two basic components: (1) an Arduino sketch that waits for serial input from a connected PC, then moves each servo to its commanded position, and; (2) a Python module on the PC that opens the serial connection and formats the data packets expected by the Arduino.
Any other Python program written to sit on top of these two layers need not worry about the messy details of serial communication, but rather can just say something like, “Move servo #2 to 90 degrees.” Or, more precisely:
servo.move(2,90)
Easy, right? Let’s get started.
Joystick Control of a Servo
December 27th, 2007
detailed information on using a USB joystick to control one or more RC servos.
Inspired by Armadillo Aerospace and their laptop-controlled Pixel rocket, I decided to figure out how to use an Arduino module to achieve wireless remote control of a flight vehicle.
Along the path to development, an achievable intermediate goal would be something like a wireless RC rover with a video camera, monitored and controlled with a laptop and joystick on a WiFi network.
Step one in the process is simple joystick control of a servo over a USB connection. This project builds upon the process documented in “Arduino Serial Servo Control.” I welcome any comments or suggestions for improving or adapting this code.
Arduino Serial Servo Control
December 9th, 2007
One of the cool features of the Arduino platform is its ability to talk to other electronic devices using standard protocols. The big draw of physical computing, in my opinion, is the power it gives you to affect a limitless range of real-world objects with your PC, rather than just boring old monitors and printers.
This short tutorial will demonstrate one way to use Arduino to control a servo motor with a PC, using a USB cable and the Arduino’s serial library. It will in no way attempt to be an introduction to asynchronous serial communication, since such topics are better addressed elsewhere.
RC servos are comprised of a DC motor mechanically linked to a potentiometer. Pulse-width modulation (PWM) signals sent to the servo are translated into position commands by electronics inside the servo. When the servo is commanded to rotate, the DC motor is powered until the potentiometer reaches the value corresponding to the commanded position.
Arduino Pulse Width Modulation
December 8th, 2007
The digital pins on the Arduino board can be set (with code) to output either HIGH (5V) or LOW (0V) — essentially ON or OFF. This is great for applications like blinking LEDs or activating relays.
But what if we wanted an output voltage somewhere in between 0V and 5V? This might be useful in applications like controlling the speed of a DC motor, or “dimming” an LED.
Well, the digital pins cannot directly produce an analog voltage; as we’ve said, they’re either HIGH or LOW. But it turns out we can simulate these “in-between” voltages using a technique called Pulse Width Modulation, or PWM.
Open Source Hardware
December 6th, 2007
Check out this cool video from the O’Reilly Open Source Convention (OSCON) July 23-27, 2007 in Portland, Oregon, featuring (two of my heroes) Phillip Torrone, Senior Editor of MAKE Magazine and Limor Fried, founder of Adafruit Industries, discussing the relatively new idea of open-source hardware.
It’s worth a look, if only to see Limor jam all the WiFi in the room with her hand-held Wave Bubble!
Joining the Real and the Virtual
November 26th, 2007
I really enjoyed watching this hour-long talk by Jonathan Oxer, entitled “Hardware/Software Hacking: Joining the Real and the Virtual,” which addresses the growing trends in physical computing, and the process of connecting the physical world with the virtual.
~ from Google Tech Talks, July 31, 2007
ABSTRACT
Software developers usually confine themselves to working entirely within the runtime environment of a computer just pushing around bits and pixels. Even virtual worlds such as Second Life exist only in the confines of our CPUs.
On the other hand, hardware hacking has really taken off in recent years and there are now magazines such as MAKE devoted to modifying everyday objects. It’s a lot easier than software jockeys may expect, and this talk will begin with an entertaining exploration of simple ways to get started with linking a computer to real-world objects.
Running Arduino on Ubuntu
November 24th, 2007
Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use microcontroller hardware and software. It’s intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments.
This short tutorial will guide you through the installation of the Arduino development environment on Ubuntu. These instructions reference arduino-0010 and have been tested on Feisty and Gutsy, both 32-bit and 64-bit installations. Thanks to this post on the Ubuntu Forums for the basic setup.
arduino-0011Arduino Project #1: Morse Code
October 12th, 2007
It’s hard to believe how rewarding it can be making something this pointless! This is my version of “Hello World” on the Arduino. Instead of just flashing an LED on and off, this variation flashes a three-letter Morse code navaid identifier (something familiar to aviators).
The Arduino is a wonderful new open-source physical computing platform and programming environment. It is based on the Atmel ATmega8 microcontroller, and is cheap and easy to learn. Microcontrollers can be used in everything from automation and robotics to interactive art projects. Get the skinny at http://arduino.cc/.

