Atmega-USB-thingy

Once again a tiny but shiny article about the Atmega8. Yap, we love this thing!
This time we soldered a USB-Port on it, to — erm — yes, control things via USB. This time we didn't have this much to do by ourself, since someone already did some of the work.(You don't have to download all the stuff in the following article, since it all comes packed in our release). Together with the usb-drivers comes a commandline-tool to send/receive to/from an atmega.

Driver and commandline-tool

With version 0.1 you can enter binary values (8bit) on the commandline, these get send to the atmega where the matching pins are being set.
The first (highest) bit decides, wether PORTC or PORTB get set.
1xxxxxxx = PORTB
0xxxxxxx = PORTC
The remaining seven bits control the sole pins of the ports.

./commandline/usb-dingens set 10000101

Would set PB0 and PB2 to high!

Hardware
In addition to the preparations done by Ronald Schaten we made two connections for servos (+,-,pwm) at OCR1A and OCR1B, and made two pinsockets (PC0-PC5 and PB3-PB5) for easy access.
I had no time to test the pwm, since the servos i got laying around here draw to much current for usb-port, so be warned, you could damage the usb-port of your computer! If you (like me) _have_ to try it, use a usb-hub! Next version will get a connection for an external battery.
As you can see, we had a nice evening of etching and drilling at about 11:30pm, my neighbours gotta love me!
What you gotta do to get it work
1. Flash the firmware (Example uses Usbprog)
>> avrdude -p m8 -c avrisp2 -P usb -U flash:w:main.hex (Example uses Usbprog)
2. Set fuses for external quarz, Atemga8:
>> avrdude -p m8 -c avrisp2 -P usb -U lfuse:w:0xEF:m
3. With Linux: Check, if device registered at usb-bus
>> lsusb Bus 002 Device 003: ID 15d9:0a33 The ID is the same at yours if you havent changed the firmware.
4. CD into your usb-dingens directory, and type
>> ./usb-dingens test This sends a bunch of values to the atmega and checks, wether he answers correct.
5. Nerd!
Code your own stuff and do funny things!
USB-LCD-Thingy
Today i had time again, so i modded the usb-thingy into an usb-lcd-thingy. Code, as always, looks pretty adventurous but does the job, works clean and solid!
USB-LCD-Thingy

Schematics -->DB4-DB7 of the LCD to PC0-PC3,
RS to PC4,
EN to PC5,
I hooked it into the circuit of the usb-hub, works perfect!
Short description:
Like above, unzip, flash firmware, then, try typing

./commandline/usb-dingens-lcd set 1YO_WHAT_UP?

Like above, set-command, and as second argument line-number (1 or 2) followed by 0-16 letters. Weazy!
Works like this: the commandline-tool converts the string in integer-values, sends one byte to the usb-lcd-atmega which tells him that there are 16 more bytes coming. After this one init-byte 16 integer-values get sent to the usb-board, decoded by the atmega and thrown on the LCD.

0 comments