Building the Breadboard “Mega1284-P”
Building your own breadboard microcontroller is both an educational exercise and satisfying. It gives one basic layout for future projects as well as a working development platform. Note, there are a many ways to achieve the the same circuit, so you may find another layout that you like better.
The basic start-up circuit looks like this:
When 5 volts are applied to the power rails of the Optibooted ATmega1284P-PU, the green LED should blink.
To get to this point, we need to start with a breadboard, various pieces of bent wire and an ATmega1284P-PU with the Optiboot bootloader. If you wish to have an FTDI header you will want to have male headers as well.
Special note for counting pins on the DIP package. The relative ‘UP’ orientation for the DIP is marked with a half circle “notch” in the package. Pin 1 is marked with either a circle depression or a triangle. Counting pins continues down the length of the pins on that side 2,3,4 … and then counting will be will resume on the right side bottom up.
There are two power inputs to the ATmega chip, the Vcc (Pin 10) for power to the digital side of the microcontroller and AVcc (Pin 30) for the analog to digital controller (ADC). The Vcc and the AVcc need to be connected to the 5V power rail as well as both GNDs (Pins 11 and 31)into the 0V or ground rail. A 0.1uF ceramic capacitor straddling the Vcc – GND and AVcc – GND is very helpful for dampening high frequency noise that can be introduced into the power rails from various devices/chips. The closer to the device (in this case, the microcontroller) the better. Ceramic capacitors do not have polarity, so you can place the legs into either 5V or 0V (GND) rails.
For low frequency noise, a 10uF (or greater) electrolytic straddling the 5V and 0V rails will decouple the power from the power draw of the microcontroller. Electrolytic capacitors have polarity and must be inserted into the 5V and 0V rails according to the capacitor markings. This is typically indicated on the electrolytic capacitor with a stripe down the height of the capacitor with the “-” symbol in the stripe.
Next, you need to pull up the RESET (Pin 9) with a 10,000 ohm resistor. Connect one end of the 10K resistor to Pin 9 and the other end to the 5V power rail.
Now, we need the external crystal to bring the microcontroller up to 16 MHz. Plug the crystal into a place on the breadboard that is out of the way of the microcontroller then plug (2) 22pF ceramic capacitors with a leg that is common to each capacitor and the other leg on each of the leads of the 16MHz crystal. The common of the capacitors will connect to the breadboard GND or 0V, while the leads of the crystal will need a bent wire connection to connect to XTAL1 (Pin13) and XTAL2 (Pin12).
Finally, we hook up an LED to the “D13” or the microcontroller pin 19. Since we will be putting a 330 ohm resistor to limit the current from the microcontroller to the LED, we will place the LED out of the way of the microcontroller. Connect one end of the resistor into the pin 19 rail and connect with the non-flatted side of the LED. Connect the flatted side lead to GND or the 0V rail.
Now for the test. With the USB2TTL (FTDI, etc.) board not connected to the USB, connect the GND from the USB2TTL header to the GND/0V rail on the breadboard. Connect the Vcc / 5V from the USB2TTL to the 5V or the breadboard. When the USB is connected to the USB2TTL board, the LED should go into a blinking mode.
Next, we will hook up the USART/Communications…