3D room mapping with sonar

My final project for the Arduno microcontroller class is this 3D room mapping thing. It still needs some work but here’s basically what it looks like. An ultrasonic distance sensor is mounted on a servo (which is mounted on another servo), and records the distance of objects located at various angles. Two angles and a distance from the center make up a spherical coordinate system, and those coordinates can be plotted.

Continue reading “3D room mapping with sonar”

IRC on an Arduino-powered GLCD

IRC on a GLCD
IRC on a GLCD!

I found this thing about making an IRC bot in Python, and thought: since I know how to send serial information from Python using pySerial and how to receive serial information on the Arduino as well as knowing how to output text on a GLCD, why not make an Arduino program that shows IRC text on a GLCD?

Basically, the IRC bot connects to a server and channel you choose, and it just stays in there, sending serial information to the Arduino. Using the GLCD library 3 beta, the Arduino simply prints each character received to a text area and checks for newlines.

The IRC bot isn’t that great (probably still needs a lot of work) but it gets the job done.

Source code available here and in the full post. Note that the Python script requires pySerial and Python 3.1.

Continue reading “IRC on an Arduino-powered GLCD”

Tri-color LED

Bought one of these RGB LEDs from Adafruit; here’s a video of it in action. I didn’t save the Arduino sketch, but I simply declared the PWM out value for each pin as a random byte between 0 and 255 in the setup() function and just added 1 to each value every iteration of the loop() function (since they were declared as bytes, it wraps around after exceeding a value of 255).

Animations on KS0108 GLCD


The source code for Running Marisa can be found here.

Included with the Arduino GLCD library is a Processing program by Michael Margolis that converts an image into a header file that you can include in your Arduino sketch to display bitmaps using GLCD.DrawBitmap(). It’s pretty convenient, but what if I wanted to include lots of bitmaps, to be used as frames of an animation? I’d have to generate the header files one by one and include all of them, then define some arrays to point to the different frames.

I decided to modify the program to accept a folder as an input, and the output would be a single file containing the headers for all of the files in the array. In addition, at the very end of the file, a pointer array is declared, with each entry in the array pointing to the address of each image. The length of the array is also stored as a variable.

Bitmap header file
The lines appended to the end of the file.

You can download the Processing file and java applet here.

Continue reading “Animations on KS0108 GLCD”

Audio playback assignment

One of our microcontrollers assignments was to use a digital potentiometer as a digital to analog converter. We were given a file with thousands of numerical values, and had to use a digital potentiometer to convert the values to an analog voltage, and using an audio connector and headphones/speakers, had to identify the song. In addition, a potentiometer is used to change the playback speed.

Sorry about the fact that the audio is kinda low.