UNO Bootloader in Circuit Programmer $1
by msuzuki777 in Circuits > Arduino
4989 Views, 29 Favorites, 0 Comments
UNO Bootloader in Circuit Programmer $1
So this Lazy Old Geek (LOG) built an In Circuit Programmer to install the bootloader on to blank Atmega328 chips. So I did an Instructable:
https://www.instructables.com/id/My-Arduino-Bootloader/
Problem: Now this worked pretty good but it’s based on Lady Ada bootloader and Arduino has come out with a new UNO bootloader. It’s supposed to be smaller and faster. I’m not really sure how it compares to the Lady Ada. But I’m a Geek so I want the latest.
Solution1: Well, the first thing I tried was to get the UNO bootloader hex files into my script. Alas, no success. The problem is that most of my pde file was taken off the Internet and I don’t really understand a lot of it. I am OLD!!
Solution: Well, I did some Internet searching and found something called optiloader:
http://www.3guys1laser.com/blog-burn-bootloader-blank-atmega328atmega328p-arduino-uno
Now this looked pretty good and here’s the code:
https://github.com/WestfW/OptiLoader
My thanks to Bill Westfield for writing this.
Okay, so I breadboarded this up and it works great. But it’s pretty sparsely documented and as many Instructablers know, I like details. So I decided to convert my first ICP to this one and document it. I am not good at point-to-point designs so I created a schematic and added some features.
Features and Parts List
This In Circuit Programmer has the following features:
Programs the UNO Optiboot bootloader for the Atmega328 and Atmega168.
This is the version in Arduino IDE 1.0.1 environment.
Will program the Atmega328P-PU and the older Atmega328-PU.
I had trouble with this in previous attempts.
Once the script is loaded, it takes about 3 seconds to bootload each Atmega.
Removes power from IC once it’s complete so chip can be safely removed.
Shows status of Red for fail and Green for good.
Can be used standalone with an Arduino power supply.
The parts list is the similar to my first ICP with a couple of additions
Parts List:
PCB I used a hunk of the following:
5* Breadboard Bread Board Prototype 432 Points 5*7cm
$1.39 ebay
28 pin IC socket
$0.06 Taydaelectronics.com
2 1.2K resistors
2 22pF capacitors $0.01@ Taydaelectronics.com
1 16MHz crystal $0.07 Taydaelectronics.com
1 red LED
1 green LED
1 pushbutton
Male header pins
About $0.25 Taydaelectronics.com
I am assuming you already have an Arduino Duemilanove or clone. I haven’t updated prices but it’s probably still about $1.00
Assembly and Code
As many Arduino users know, the standard Arduino can take shields. As many Arduino users know, one connector is not on the same 0.1 inch spacing as the other three. As I only modified my old ICP, I’m not going to go into details as to how I got around this. See the first Instructable:
https://www.instructables.com/id/My-Arduino-Bootloader/
See schematic.
This could also be built on a standard Arduino proto shield. I am not going to do point-to-point and my pictures do not provide enough details to do that. I am assuming the reader/user knows how to transfer a schematic to a protoboard.
The main differences from the original are:
Power is obtained from Arduino Digital 9 instead of from 5V. On old ICP, Digital 9 supplied a 'heartbeat' to the IC being programmed. The crystal and capacitors take care of that.
One of the referenced websites has concerns about the IC being powered by digital output pin. The Atmega documentation I have says the digital pins can put out 20mA. I measured the current going to one Atmega, it was only 9mA. So I’m not concerned about this.
They also stated that the crystal and capacitors were not needed for new Atmega ICs. Well, I have none of those so, but I have a lot of used Atmegas that need the crystal and capacitors so I put them on my board. It will still work if they aren't needed.
FYI: you can change the bootload code on an Atmega over and over.
Here is another method to change Arduino bootloader to new UNO optiboot or non-optiboot. I haven’t tried this.
http://code.google.com/p/optiboot/
Code:
I’ve included the Arduino code. All I added was support for the error and OK LEDs and the start button. The red LED comes off if there is no Atmega, if it is installed backwards (I know) or if it fails to load the bootloader. The green LED turns on if bootload is successfully installed. The start button will start the process for the next Atmega.
Downloads
Procedure and Summary
Unzip MTS_Optiloader to computer
Install/connect adapter to Arduino(clone)
Plug in an AtMega328 (or AtMega168) into adapter
Connect USB cable from Arduino
Plug in USB computer to PC
Run Arduino IDE. (Version 1.0.1 works fine)
Open MTS_Optiloader.pde
Upload to Arduino. This takes a couple of minutes.
When 'Done Loading'
You will see the Green LED pulsing, the Red LED pulsing and the Arduino D13
LED pulsing if available.
Programming takes about 3 seconds.
Then if bootloader is installed, the green LED will stay on.
Power is disconnected from 28 pin socket so AtMega can be removed.
Insert another AtMega and push Start button.
If Red LED flashes and stays on, then there is no AtMega, it is installed backwards or it failed to program.
Option: Open serial monitor, set to 19200 baud
The monitor will display more information on process
Summary:
Using one of these AtMegas in an Arduino:
The UNO bootloader is supposed to be a lot smaller and load programs faster.
There had been some compatibility problems reported with UNO. I haven't confirmed any.
My limited experience says in Arduino environment, for board, you can select either UNO or Duemilanove.
Westfields original code:
https://github.com/WestfW/OptiLoader
will work with this adapter. The LEDs and Start button will not work but status will be displayed on the Serial monitor. The reason I mentioned this is that he may update the code to an newer version at this website.
PCB With ZIF
So I had a 28 pin ZIF (Zero Insertion Force) socket, lying around so I decided to use it and make a PCB for bootloading.
I’ve included the Eagle files I used to make this PCB.
Eagle comment: adafruit has an Eagle library that includes an Arduino UNO blank shield. I like it as it has all those connectors correctly spaced.
ZIF sockets: For those of you not familiar with these: Pull the lever up, insert IC, then push the lever down. It will sort of work the other way but will be intermittent.
This version is going to be more than $1 however.