So you may have been playing with Arduino’s, or rather, Hackduino’s. If you made your own Hackduino or similar project, you may be wondering how to add the ICSP header. Basically, using the ICSP header will allow you to use an external programmer to ‘upload’ software to your MCU (microcontroller unit). This will work for non-Arduino’s nicely as well.
ICSP is basically “in circuit serial programming” which allows you to upload software to your MCU without having to pull it out every time.
So if you are pulling your MCU out each time you want to update the software on it and putting it into a programmer, or if you are just testing out your MCU and don’t know what you’re going to do with it yet, you can add the ICSP pins. If you have tried this before, but can’t programme it, I will also tell you how to fix that from my own experience. If that isn’t enough feel free to comment and I’ll help you as best as I can!
By writing this Instructable (my first, by the way), I assume you have completed an instructable such as the following: http://www.instructables.com/id/Perfboard-Hackduino-Arduino-compatible-circuit/ – thanks jmsaavedra! This should, however, be compatible with any kind of breadboard-connected MCU or any other set up you have, too.
This Instructable tells you how to add a 6-pin ICSP header. The 10-pin header doesn’t really add anything in ICSP mode. In step 3 you can also see the pinout for the 2×5 header, which works just the same. All you’d have to do is connect slightly differently – just follow the image and it’ll work fine.
Below you will see my slightly unorganised remotecontrol repeater, but hey, it works 🙂
I’m a bit new to the world of electronics, so if you find a mistake please feel free to comment!
Step 1 Gather components
First of all you need any kind of AVR controller and the datasheets that relate to it. You can download datasheets from www.atmel.com.
You can actually just stick the MCU in a board, connect the pins as mentioned, and you can upload software to the MCU, too. Same method goes to PIC’s, just check if it supports ICSP and where the pins are!
And of course some standard tools:
– Soldering equipment (or a breadboard will work too, but the pins may be too short to fit properly!)
– Some wire
* If you don’t have a 2×3 pin header, but instead a single row pin, you can just solder two lines next to eachother in your perfboard.
** Simply using 6 F/F cables works, too, in case you don’t have 2×3 connectors. 2×5 connectors will work too as long as you leave enough room. Be sure to position the cable correctly!
Step 2 Finding the pins to connect to
Got your datasheet ready? Great! We’ll need it now. Go to the “Pin configuration” page.
Write down where the following pins on your MCU are:
This is the same for all equally-pinned AVR MCU’s. That means if you have soldered an 28-pin IC socket you can safely replace the MCU with any other 28-pin variant (well, check the datasheet, I’m not a guru yet!). I tried this with a Atmega8 and Atmega328, which are both DIP-28. This should also be the same for Atmega168 and several others, so if you have any of those… simply use the image below.
We’re going to connect our ICSP header to these pins, see the next step!
Step 3 ICSP header pinout
You can place your ICSP header basically anywhere on your breadboard or perfboard (or PCB), simply connect the following lines to the pins you wrote down. Be sure to remember which side everything goes to.
This list is for 2×3 ICSP headers, if you want to use the 2×5 instead, see the image. It works just the same, but be sure to leave NC unconnected. Beware of the orientation!
Before proceeding please read the warning at the bottom of this page.
See the image below with the ICSP header pinout and do the following:
– Connect pin 1 of the ICSP header to the MISO pin of your MCU.
– Connect pin 2 of the ICSP header to your +5V supply on your board. So not necessarily to your Vcc pin on your MCU, simply put +5V on it.
– Connect pin 3 of the ICSP header to the SCK pin of your MCU.
– Connect pin 4 of the ICSP header to the MOSI pin of your MCU.
– Connect pin 5 of the ICSP header to the RESET pin of your MCU (usually pin 1)
– Connect pin 6 of the ICSP header to your ground (GND).
This takes some soldering and can be quite annoying, as the pins are quite near eachother. I’ll spare you the sight of my perfboard’s back view!
Now mark which is pin 1 near your ICSP header, and connect a cable to it.
Word of warning: if you connect your board to an external programmer through ICSP, 5V is put on pin 2! That means that this pin should directly connect to where-ever your 5V comes from (be it a 7805 or somewhere else). Your external programmer will automatically (usually) power your board through ICSP.
So here is the catch, if you have an external programmer connected and you don’t have a protection diode, the 5V from the programmer will flow into the battery or power supply. Be sure to connect either the ICSP – OR – a battery/power supply, and never both. You can prevent electricity flowing back by adding a diode just after your battery/power supply or you can add another 3-pin connector with a jumper so you can swap the power supply. However, that would be something nice for a next Instructable.
As electricity goes two ways, I recommend disconnecting the ICSP cable whenever you have your external programmer switched off. Power would flow into the programmer, and I don’t really think that this is healthy for your programmer.
This free embedded project also found using:
- icsp header
- pic16f887 icsp pinout