Filed under: ATTiny45, AVR, Electronics, Prototyping | Tags: attiny, ATTiny45, AVR, led, pcb, rgb, usb, usbtiny
I’ve finally set about building the USB mail alert.
In my previous post, I showed the bread board prototype of my cube hack. Here is the adapted circuit diagram.

schematic
NB: 2 is D+ 3 is D-
When laying out circuits, it is a good idea to, start with the largest component first, in this case, the ATTiny45. I want to program the chip first so I am using a DIL socket. This also has the advantage of protecting the chip from excessive heat when soldering. I’d also like to use as small a board as possible so I am limiting the width to six tracks. Place all the components on the board before soldering so you can get an idea of how large the board needs to be. I followed the layout of the breadboard, however I want to make the circuit small so I have mounted the resistors and diodes vertically, with one leg bent back.
I also tried to avoid cutting tracks with the spot cutter and instead used a knife to allow components to be closer to each other. This requires a sharp knife and care must be taken to cut only one track. Soldering is also more challenging, solder sparingly, to avoid bridging across your cuts.
I cut the tracks under the chip; note that the reset pin is left disconnected. If you needed extra IO you can flash the chip to use it as such but after that you can no longer reprogram it so I avoid that as I may use the chips from previous devices in future things.
I soldered the LEDs at the end of their leads, towards the end of the PCB. This means they will be in the center of the difuser. They also have a series resistor to reduce the AVR output voltage from 3.6V to the approriate level. This resistor may not be required with some ultrabright LEDs.
To fit in the cube, I have removed the circuit, the coin cells and cover. The cube is going to be used as a cover for the new circuit so I have just cut a space using a sharp knife allowing space for the LEDs to fit into the diffuser. The circuit is slotted into the empty cube to complete the device. Plug it in and test it using the libusb command line tool, mentioned in a previous post.

The finished cube
19 Comments so far
Leave a comment
Great looking cube!
Would be nice if you can add more details and pictures. For example which toolchain do you use, how do you flash the ATTiny, how fast can you change the colors… is it fast enough for color fading? How much will it cost to build your own (from scratch). Never used an Atmel controller, sorry if I ask beginner questions. Thanks
Comment by MMM April 23, 2009 @ 3:04 pmI’ve posted a follow up for you
Comment by davehillier April 23, 2009 @ 10:29 pm[...] Schematic and final build [...]
Pingback by Cube follow up « Dave’s Blog April 23, 2009 @ 10:37 pmHi Dave
As you know we are playing with this project over at http://www.eeeuser.com‘s forums, but I am having some issues compiling the code and getting the project up and running.
Been able to get set-led running for a short while, but can’t keep it reliable…
Blair
Comment by Blair June 15, 2009 @ 9:06 pmWhat problems are you having specifically?
Comment by davehillier June 15, 2009 @ 9:19 pm‘m having some reliability issues with the reliability of the circuit. Last night I attempted to move the set-led program to the usr/bin folder
I am not sure if I broke something there or elsewhere, but I can’t get it to light up again. Been playing with it tonight and no joy. It sees a device is attached
blair@blair-laptop:~/Documents/avrusb/firmware$ lsusb
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 011: ID 16c0:05df VOTI
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
However when I run Set-Led I get this error message.
blair@blair-laptop:~/Documents/avrusb/commandline$ ./set-led 255 0 0
Could not find USB device “LEDCtlHID” with vid=0x16c0 pid=0x5df
I also tried this…
blair@blair-laptop:~/Documents/avrusb/commandline$ lsusb -d 16c0:05df -v
Bus 001 Device 011: ID 16c0:05df VOTI
Comment by Blair June 15, 2009 @ 9:33 pmDevice Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x16c0 VOTI
idProduct 0x05df
bcdDevice 2.00
iManufacturer 1
iProduct 2
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 34
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0×80
(Bus Powered)
MaxPower 40mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0 No Subclass
bInterfaceProtocol 0 None
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.01
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 22
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0×81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0×0008 1x 8 bytes
bInterval 100
cannot read device status, Operation not permitted (1)
Have you changed the name of the device? What is VOTI?
Comment by davehillier June 15, 2009 @ 9:56 pmDouble check the length of the Report Descriptors. That section being unavailable looks suspicious.
I haven’t changed the code at all. I do get a warning when I compile the firmware hex.
blair@blair-laptop:~/Documents/avrusb/firmware$ make hex
avr-gcc -Wall -Os -DF_CPU=16500000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -mmcu=attiny45 -c usbdrv/usbdrv.c -o usbdrv/usbdrv.o
avr-gcc -Wall -Os -DF_CPU=16500000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -mmcu=attiny45 -x assembler-with-cpp -c usbdrv/usbdrvasm.S -o usbdrv/usbdrvasm.o
avr-gcc -Wall -Os -DF_CPU=16500000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -mmcu=attiny45 -c usbdrv/oddebug.c -o usbdrv/oddebug.o
avr-g++ -Wall -Os -DF_CPU=16500000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -mmcu=attiny45 -c main.cpp -o main.o
main.cpp:44: warning: only initialized variables can be placed into program memory area
avr-gcc -Wall -Os -DF_CPU=16500000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -mmcu=attiny45 -o main.elf usbdrv/usbdrv.o usbdrv/usbdrvasm.o usbdrv/oddebug.o main.o
rm -f main.hex main.eep.hex
avr-objcopy -j .text -j .data -O ihex main.elf main.hex
avr-size main.hex
text data bss dec hex filename
0 2016 0 2016 7e0 main.hex
I don’t know if this is where the problem lies
Comment by Blair June 15, 2009 @ 10:11 pmIs it possible you have another device with the same vid/pid named ‘VOTI’?
Comment by davehillier June 16, 2009 @ 10:49 amI dont think so, the VOTI is a vendor ID issued from
http://www.voti.nl/shop/catalog.html?usb
I am not sure, but I think it may mean that the source is not compiling properly and perhaps the device ID and Vendor ID are being compiled?
I have hunted through the code with my novice like eyes and I can’t work out why not. But I wonder if its to do with that warning.
Not out of laziness, but more from frustration, but any chance of publishing the compiled hex?
Comment by Blair June 16, 2009 @ 2:43 pmI mean Device Descriptor and Vendor descriptor
main.cpp:44: warning: only initialized variables can be placed into program memory area
I wonder if this is where it goes wrong
Comment by Blair June 16, 2009 @ 2:45 pmHi Dave,
We got it running now without errors. The device name “VOTI” is normal (I built a circuit for testing and can see a device “VOTI” too when I use lsusb, albeit with proper Vid/Pid). My guess is that “lsusb” only does show the nedor name not the device name. Voti is probably the vendor name of the guy from the netherlands who bought Vid/Pid pair(s?) from usb.org and sells them to the company that makes V-USB. Or something like that.
What would you suggest as a compiler for WinXP – MinGW perhaps? I’m a total noob with C, and just need that “set-led.exe”..
Thanks
Dennis
Comment by Dennis June 24, 2009 @ 6:20 amI’d use visual studio. There is an express edition available for free.
Comment by davehillier June 27, 2009 @ 1:54 pm[...] of the forum members on eeeuser.com have been attempting to build a mail notifier inspired the LED cube that I’ve built. They’ve put their progress in this thread. Forum member posted some [...]
Pingback by Mail notifier clones « Dave’s Blog June 29, 2009 @ 10:41 pmI built one last night and use it in my office to let me know if my server is running or not. Thanks for sharing your excellent project!
Jim
Comment by Jim January 15, 2010 @ 7:23 pmHi Dave,
I built a PCB, but not too small since it’s not using surface mount components… I’d be happy to send you one if you want to email me your address. Thanks again for sharing your great project.
Jim
Comment by Jim February 11, 2010 @ 12:49 amI have worked up a schematic from the “the cube” hardware from Dave Hiller. The difference is that it uses an external 12v power source (does not draw power from usb) and drives three NPN power transistors to power 5m of RGB LED Strip (1A). Or, to generate a signal for an external signal amplifiers.
I am posting this to get feed back (I don’t have a test suite to test it out) to see if it should work.
sfranzyshen
schematic
Comment by sfranzyshen November 30, 2010 @ 10:15 pmWhere programm for microcontroller?
Comment by Ivan August 19, 2011 @ 11:38 amYour shematic is wrong! Also the NB note under it.
The data lines have to be interchanged.
Pin2 = D-
Pin3 = D+
src: http://upload.wikimedia.org/wikipedia/commons/6/67/USB.svg
Anyway great hack!
Cheers from Austria,
Comment by John October 15, 2011 @ 3:27 amJohn