Many people using Arduino or some other development board in their projects, instead of making their own board with microcontroller because they simply don’t know how to design PCB with microcontrollers. What microcontrollers need in order to operate?
This time I will be focusing on two most popular 8 bit micro architectures: Atmel AVR and Microchip PIC.
In reality what many people are afraid of is really simple to do. You just need a couple of passive components and you’re good to go.
There’s two scenarios you might want to stick with:
- Do not put ISP (In System Programming interface) on the board. Just upload firmware to the micro before inserting it (or soldering it) to the board.
- Put ISP to the board and upload firmware to the chip while device is all assembled and working.
For example you would want to stick with first first scenario when you’ve got fairly simple device and you sure that you wont need to change it’s firmware in future. In that case you can save money on connector and a few resistors. In some cases even on controller with higher pin count, because when you’ve got ISP functionality, you can’t use “reset” pin as a general I/O pin. And sometimes one pin makes all the difference.
Second scenario will allow you to make changes in firmware when everything is soldered and device is working. In most cases you would want to put ISP to the board.
So, what you need to make your own board with microcontroller?
- Microcontroller (I guess.. )
- Decoupling capacitor (usually ceramic 0.1uF)
- Crystal + two capacitors (optional)
That’s it! Usually microcontrollers have everything they need on board. Like internal flash memory, RC oscillator and so on. And from you they need only power.
If you need to be able to upload firmware to microcontroller (for example, like Arduino sketch) using ISP (In System Programming interface), you would also need a couple of resistors and connector (and in case of PIC microcontrollers – a diode).
In this self-explanatory schematic you can see decoupling capacitor on the right, which must be as close to microcontroller’s power pins as possible; crystal oscillator, which is optional, because you can use internal RC oscillator or external clock signal, depends on your needs; 10k pull-up resistor for RESET pin, to allow external programmer to drive this pin low when uploading firmware; ISP connector. And if you want to use MISO, MOSI and SCK pins for purposes other than firmware upoload, you can connect 4.7k resistors between those pins and peripherals that you want to connect there.
And this is pinout of programming connectors for AVR micros:
Two connectors on the left are from the most popular AVR programmer made by Atmel – AVRISP mkII. And on the right is the pinout that I’m using in my projects, because it is much easier to work with single row connector than with double row ones. But be aware – it’s not a standard connector pinout.
For PIC microcontrollers it’s almost the same:
ICSP states for In-Circuit Serial Programming. It takes only 3 microcontroller pins instead of 4 in AVR series for firmware upload.
Since in PIC microcontrollers 12-13V applied to MCLR pin for programming you need to put schottky diode or 470 ohms resistor between RC circuit and MCLR pin.
In some cases you can omit capacitor and diode and connect 10k resistor straight to MCLR pin. You can read more about this here: System Supervisors in ICSP Architecture and PICKIT 2 programmer manual.
And here is ICSP connector pinout for PICKIT III programmer:
PICKIT III and PICKIT II programmers are made by Microchip, they’re very cheap and have some additional functionality, like UART tool, which allows you to talk to the microcontroller or any other device using UART serial protocol.
Some useful documents: