Skip to content

Toying with AVR Microcontrollers

October 4, 2011

A while ago I ordered some AVR microcontrollers on ebay (ATmega8s, ATtiny85s) for some overly ambitious robot project of mine that involved power wheelchair parts. Unfortunately, I never had the time and patience to get them working. I didn’t get myself a development board like the Arduino, but just the microcontroller chips, voltage regulators, and other electronic parts. I thought I would be saving money by making my own custom circuits for projects.

Turns out, especially if you’re an electronics newbie like me, it’s just not that easy to get them working (and perhaps Arduino just is the better beginner choice!). The programmer device bought on ebay never seemed to work right with Linux. I had trouble getting my voltage regulator to supply 5V to the chips. I ended up buying two more programmers on ebay, still didn’t work, I got some cryptic error message about the programmer failing to program my chips. I had no idea what was wrong with my electronic circuit, and ended up basically giving up… Until now!

I was bored this weekend, and spent some time investigating my issues. Turns out that only one of my USB programmers seems to work properly (the one branded USBasp). Also turns out that the breadboards I was using are wired strangely. The power lines don’t run all the way along the sides as you would expect, but in broken segments that don’t match the visible layout of the dots on the surface of the boards. In the end, I was able to finally program a microcontroller using avr-gcc and avrdude.

I’ve made great progress. I got both an ATtiny85 and an ATmega8 working. I was able to hook them up to a 74HC595 shift register to control multiple LEDs. I hooked up an USB-to-TTL interface to the UART and got a serial terminal (GtkTerm) communicating with them, and finally, I interfaced with a DS1307 real-time-clock chip through the I2C bus. I decided it would be cool to perhaps make an advanced alarm clock project out of this. Most alarm clocks are pretty lacking in functionality. Small displays you can’t read with your glasses off, no option to preprogram days off so it won’t wake you up at the usual work time. No option to auto turn off (or ring later) on the weekend, etc. Perhaps, with some patience, I could make an alarm clock full of feature overkill.

Some ideas (and I most probably won’t implement all of them) for the XTREME alarm clock:

– Big display
– Button to not-ring-tomorrow (TM)
– Different weekend alarm time
– Auto-snooze after 1 min
– Preprogrammed holidays
– Hook a motion detector to it to detect when I go to bed
– Display auto dimming when the light is off
– Ethernet connection for memo system, alarm time programming
– Protection switch so you can’t mess up the if by pressing buttons by accident
– Temperature and humidity sensing & display
– Battery backup, keeps the time without wall power

To make things cooler, I’ve found out it’s possible to use AVR chips to produce VGA/composite signals. I just happen to own a small 7″ composite input LCD I could possibly use for my big alarm clock display!

I also thought it might be cool to build myself a persistance of vision gizmo at some point, for the next time I go out dancing :)

Leave a comment