In response to the continued demand for a PCB version of my Arduino-based AVR High Voltage Programmer, I just released a first cut to BatchPCB and should have a prototype within 3-4 weeks.
This design is an improvement upon the original HV programmer shield in the following areas:
Onboard 12V boost converter eliminates the need for an external 12V power supply
Support for two of the most common families of AVR microcontrollers, the ATmega48/88/168 and ATtiny2313
Separate Ready and Burn indicators
Protection resistors on every single data, control, and supply line to the target AVR, meaning that your Arduino and AVR should survive any mishaps during programming, including inserting the AVR backwards or off by 1 pin.
I hope to have kits for sale in early February. Sorry for the delay in getting these made, but I wanted to make the best possible shield I could!
This is the seventh part of an ongoing series about building a low cost, open source streaming internet radio. If you haven’t already, check out the previous parts (see the links at the end of this article) for some background about the project.
In part six, we used OpenWrt’s UNIX-style shell commands to interface with mpd, the music player daemon, and redirect song and stream information to our ASUS WL-520gU wireless router’s serial port. In this part, we’ll use a Sparkfun 16×2 LCD display and a handful of other components to build an LCD status display for the radio.
The Atmel AVR Microcontroller:
After much thought, I decided to use an Atmel ATmega168 AVR microcontroller to drive the display. I realize that this raises the technical level of this project significantly, but I have been wanting to feature an AVR project on the site and this is a great opportunity. The truth is that an Arduino would work just as well and it shouldn’t be too difficult to port this program to an Arduino sketch. (The Arduino is built with the same ATmega168 microcontroller, after all.) If anyone does this, let me know and I’ll post a link to your version of the display.
If you’re an AVR veteran, you can skip over this part and straight to the bill of materials below.
If you are new to the AVR, don’t be intimidated. There are a number of tutorials online to help you learn how to use this inexpensive and powerful microcontroller. I recommend starting with this one or maybe this one, but see my note about AVR MacPack below if you’re using a Mac. If you’ve never programmed in C before, you’ll have an additional hurdle to get over, although for this project you won’t need any actual knowledge of programming or C to burn the code to the AVR and get things working.
You will need to install some software to work with the AVR, I recommend:
AVR MacPack for OS X (the Adafruit tutorial recommends OSX-AVR, use this instead)
I recommend following a tutorial or two and getting a simple blinking LED example working on your AVR before building the LCD display. That way you can be sure your programmer, development environment, breadboard, etc are working first.
Building the display:
Bill of Materials:
You will need:
one A-B USB cable (the kind with one flat and one square end)
Assembling the circuit on the breadboard is pretty straightforward. Here’s a photo showing all components of the setup. The router is shown above with the serial port wired to the breadboard (the RX line is floating as we’re not using it yet). The USB AVR programmer is on the right, where it is also functioning as a 5V power supply for the circuit. Make sure the 2-pin jumper on the USBTinyISP is installed, this enables the +5V supply. The LCD is shown displaying the current stream name (DI.fm).
Here is a closeup of the components installed on the breadboard to show how I did things, feel free to experiment with the placement of components. As long as you follow the schematic the circuit should still work.
Here is a closeup of the serial port connection to the router, including the 4-pin female 0.1″ header. I soldered wires to the pins of the female header (not the pins on the board).
Once the circuit is assembled on the breadboard, we need to flash the AVR microcontroller with the main.hex file included with the firmware above.
If you’re using AVR MacPack and OS X, this should be easy (since that’s what I’m using). PC guys will need to figure this out for themselves but hopefully the process is similar (please let me know if the Makefile works).
Connect the USBTinyISP to your computer with the USB cable and to the breadboard with the ISP cable. The green light on the programmer should be on, indicating it is ready, and the backlight of the LCD should be lit, indicating that the breadboard is getting power.
Open a terminal window and create a new directory, I used ~/temp. Unzip the firmware into a directory somewhere, and execute ‘make flash’, as shown:
avrdude: Device signature = 0x1e9406
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "main.hex"
avrdude: writing flash (1326 bytes):
avrdude: verifying ...
avrdude: 1326 bytes of flash verified
avrdude: safemode: Fuses OK
avrdude done. Thank you.
If everything went well, the LCD display firmware is now loaded into the ATmega168 and the circuit is ready to go. If not, double check your connections and take a look at the help! page for the USBTinyISP.
Testing the display:
Telnet or ssh into the router. Start mpd and connect to a stream using mpc (we covered this in part five).
Once the stream starts playing, execute the display.sh script we created in part six. Within a few seconds, if everything is working, you should see the stream name on the display, followed by the artist and name of the current song. Congratulations!
Here is a video of the LCD display in action, including the horizontal scrolling feature to show information that is too wide to fit within the visible area of the display:
That’s it for part seven! In part eight, we’ll start working on the input side of the user interface.
Like what you’re seeing? Have suggestions about what could be improved? Leave a comment or contact me directly.
Update:Part eight, in which I add a tuning control to the radio, is now available.
Update 2: There is a new Wifi Radio Discussion Forum, hop over there to ask questions about the project or see what other people are working on! (4/12/09)
Evil Mad Scientist Laboratories just released Meggy Jr., an open source handheld gaming platform that includes cool chunky buttons, support for the Arduino IDE, and an 8×8 RGB LED matrix capable of displaying beautifully pixelated color images.
Definitely the coolest EMSL release of 2008 – and just in time for the holidays.
The Arduino team has released a new version of the awesome Arduino platform called Arduino Duemilanove. Improvements include automatic selection of USB vs. external power, header pins for RESET and 3.3V supply, and an easy to cut automatic-RESET-disable trace.
The wiki page includes a very helpful audio sample to demonstrate proper pronunciation of the new name.
Update 03/11/09: Kits based on this design are now for sale!
Update 12/14/10: The original AVR HV Rescue Shield kit has been replaced by the new and improved HV Rescue Shield 2. Visit the HV Rescue Shield 2 product page for information about the new kit!
As I mentioned earlier this week, I recently “lost” an ATmega168 due to flashing the configuration fuses to disable the RESET pin, without realizing that this makes the device impossible to reflash with SPI. This is particularly frustrating because the device is still 100% functional, just completely deaf to ordinary serial programmers. The only way to recover the device is using what Atmel calls “High Voltage Parallel Programming Mode” which very few programmers support, most importantly, not the USBtinyISP I otherwise love.
Fortunately, my trusty Arduino came to the rescue – I created an Arduino-based AVR programmer that uses the high voltage programming mode and can fix pesky fuses like RSTDISBL.
The Arduino has just enough IO to implement the entire HV protocol plus a “go” button. So far I have only implemented setting LFUSE and HFUSE in software, but there is no reason why the code couldn’t be extended to support chip erase and programming the entire flash as well.
The fuse programming process is simple:
Upload the HVFuse sketch to the Arduino, available for download here: HVFuse.pde
Install the shield and apply +12VDC to the terminals on the left
Wait for the red LED to turn on (if it isn’t already)
Install the ATmega to be repaired
Push the button
As soon as the LED turns back on, the AVR is fixed and ready to be put back into service!
Here is an Eagle schematic of the HV Programming shield (click to enlarge):
Update 12/17/08: An observant reader pointed out that there were three errors in the way GND/AGND, AREF and VCC/AVCC were connected on the target AVR in the original schematic. The errors have been fixed and the updated schematic is below. Apologies for any confusion this caused.