You can find microcontrollers everywhere, from wrist watches to washing machines. They are small computers squeezed into a small chip and you can get them in any sizes and flavours depending on your need for memory and I/O-pins. Nowadays the most commonly used microcontrollers in do-it-yourself projects are Atmel's AVR- and Microchip's PIC-families. In this article we will introduce you to Atmel's AVR and how to get started with them. More in depth information about microcontrollers can be found from Wikipedia for example and here are a couple of links:» Wikipedia - Microcontroller
» Wikipedia - Atmel AVR
» Wikipedia - Microchip PIC
Atmel currently provides AVR microcontrollers in many shapes and sizes, ranging from small 8-pin tinys to 100-pin xmegas. Flash memory sizes for program code range from 1 kilobyte to 256 kilobytes. You can find more information and a list of devices from here.
For this basic tutorial on how to get started with AVR-microcontrollers we are using a 8-pin ATtiny45 (full datasheet can be found here), which has 4 kilobytes of flash and 5 general input/output-pins (maximum is 6 but one is used for reset). Every pin can be programmed individually as an input (digital or analog) or output (digital only) pin. We will go step by step on what hardware and software do you need and after that some example programs. The hardware part will include the making of an easy testing board and the programming cable, which is needed to get the compiled program from the computer to the chip. The software part then guides you what you need in order to make your program code and to transfer the ready compiled binary code to your board.
You will need some basic knowledge about electronics (how to connect leds etc) and it is good to read our Basic electricity for modders if all of this is new to you. There are example programs written in C later in the article so some knowledge in programming isn't bad either.
What you need (hardware)
First of all, you'll need a testing board for the controller and a programming cable. Below is a list of components needed for the following example board. The circuit will be built on a testing platform for easy testing and adding of additional parts. The first board will only have one led but don't worry, we will be adding some more later.Board
- 1x Atmel ATtiny25 or ATtiny45 (DIP-version)
- 1x red led
- 1x 270 ohm resistor, current limiting resistor for the led (use LedCalc to calculate the right resistor for different leds)
- Connector for the programming header
- Testing board and wire
- 1x 7805 or 78L05 (5V regulator)
- 2x 10 uF 16 V electrolytic capacitor
- 2x 100 nF 16 V capacitor
- 9 volt battery clip and 9 volt battery or 7-12VDC wall transformer and a connector for it
Or you can do a simple cable to get +5V out from USB as shown later. Always remember to check the polarities and pinout for the connector so you wont fry anything.
Circuit built on prototyping board
USB power cable
|Pages: 1 2 3 4 5 6|