Posts Tagged ‘avr’

Mood Rock

September 19th, 2009

I was in an art store and came across a neat looking alabaster rock.


And for some reason, I thought it would be cool to stick some lights in it, which started yet another project. I started out by building a circuit on the cheap using some components I had lying around.



I thought it would be cool to control the color from the PC, so I decided to check out the AVR-USB project. The cool thing about AVR-USB is that it handles the USB protocol in firmware alone and doesn’t require any additional ICs. I had a number of hickups – the biggest one being that as soon as a USB packet was received, the SPI on the AVR would stop working. After many hours of not being able to figure out the culprit, I resorted to bit-bang SPI and everything started working. The lights are shiftbrites from macetech. The cable is an ISP programming interface for the AVR. Component count is fairly low – a crystal, a bypass cap, a supply cap, two USB termination resistors and a pullup resistor.

I used a masonry bit to drill a lot of holes in the bottom of the rock, then used a hammer and chisel to finish enlarging the space. The board just barley fits in there.


And the effects were pretty cool..



The communication is via a modified hidtool.c application (an example shipped with AVR-USB) which transmits a 4 byte payload which is then shifted onto the LEDs. For completeness, I wrote a small application in perl to act as a webserver and handle requests – forwarding valid requests to the hidtool application. And I also put together a nice color picker front end which uses AJAX to update the color on the fly. So as you move the color picker, the rock changes color accordingly. I put together a video of everything working together here :

There is a small amount of lag, which is to be expected — the chain of operations is…

  1. open web app, and pick a color
  2. color picker uses AJAX to send requests to a server running on my desktop
  3. server forks hidtool.exe with the color arguments
  4. hidtool then connects to the USB device (rock) and transmits the new color strings.

This chain of events is repeated every time the color changes – this happens as the cursor is being moved around thus it can generate quite a few requests. To improve throughput, I would need to merge the C app into the perl app, or visa-vera.

I’ve gone ahead and put the application online here so go ahead and set your mood color which will be displayed on my rock.

Live Feed

This image is updated every 5 seconds.  Or go here.


Electronics , , , , , ,

CO2 Sensor Distraction

August 21st, 2009

Many hours ago I got sidetracked and decided to build a “quick” Carbon Monoxide (CO) sensor interface. The CO sensor is a Figaro TGS 2442 Carbon Monoxide sensor. It ended up taking much loner than expected to build – though most all projects take longer than expected. I am using the module in the bottom of the picture to power the device via a USB connector. The number of LEDs illuminated increase as the CO2 conentration increases. The measured values from the sensor are pretty meaningless as the device must first be calibrated using controlled CO concentrations which I can’t produce at home. As a result, I defined the CO level in my room as 1 LED. The goal is to migrate this circuit into my car and use it to gather geotagged CO data on the road using the car gadget that I recently mentioned.


Electronics, Personal , ,