Archive

Posts Tagged ‘usb’

Mood Rock

September 19th, 2009

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

P1030107.jpg

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.

P1030059.jpg

P1030060.jpg

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.

P1030062.jpg

And the effects were pretty cool..

P1030066.jpg

P1030065.jpg

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.

Resources

Electronics , , , , , ,

Stepper Motor Controller – USB interface

September 1st, 2009

stepper.jpg

I just finished designing a Stepper Motor Controller (SMC) for a PCB Mill that I ordered. One requirement most SMCs have is the need for a real-time operating system running only the milling software. This is because each motor movement must be timed precisely to ensure an accurate rate of movement from the milling head. If other software is running, then the timing of the interrupts can be off resulting in errors on the mill.

Not wanting to use a dedicated computer, I decided to design a bipolar chopper controller for myself. The big difference with this device and other controllers is that you will be able to feed it g-code directly, and not worry about controlling the timing. The processor onboard will be able to deal with the timing requirements and it should work. Some features include :

  • Send g-code directly via USB interface (linux/mac/winblowz drivers), does not require dedicated PC
  • Software controllable current (chopper mode) (1.5A/motor max)
  • 3-Axis on small PCB (2.9″x2.2″)
  • USB interface, powered off USB except for motor.
  • Over-temperature monitoring

If there is any interest, I’m happy to release the designs to the public domain.

Electronics , , ,