Category Archives: Project
Sooner or later, one finds the need to move the project from the breadboard to a more permanent setting. There are development platforms like the Arduino Uno, Mega2560 with stackable shields, or you may want to just wire one up on a through-hole perf-board. The layout of most development boards are certainly enticing, some projects require a little more flexiblity that stripboards and perf-boards can provide. For low power applications strip-boards and perf-boards really handy for leaving the regulator off for low power battery performance and then later, adding a regulator. The lack of inexpensive Mega1284P development boards make the perf-board an easy choice.
The kit you will need for the Basic Perf-board Mega1284 is as follows:
- (1) – ATMEGA1284P
- (1) – 40 Pin IC Socket (wide)
- (1) – 54 x 28 0.1″ spacing perf-board
- (1) – 16MHz Crystal
- (2) – 22pF ceramic capacitors
- (3) – 100nF ceramic capacitors
- (1) – 100uF 16-25 volt electrolytic capacitor
- (1) – 10K ohm resistor
- (1) – 1 x 6 pin header
- (10) – Feet of 30 gauge stainless steel wire
- (1) – DPST momentary switch
- (1) – USB2TTL FTDI convertor
The first thing to note about perf-boards is that the solder pads can pull up if the solder iron is applied too long (around 10 seconds). If you are not melting solder by 5 seconds, you will need to stop or you may damage the pad.
Step 1 – Placing and Soldering the IC Socket
Cut out 1 inch of the 30 gauge wire and connect pin 10 (VCC) to pin 30 (AVCC)
Place the IC Socket over the connection wire
Solder up the 40 pin IC Socket
On the backside of the perf-board, solder a piece of 30 gauge wire connecting pin 11 (GND) to pin 31 (GND)
Cut out 4 inches of 30 AWG wire and solder one end to pin 10 (VCC) and thread out to make connection with FTDI Vcc
Cut out 4 inches of 30 AWG wire and solder one end to pin 11 (GND) and thread out to make connection with FTDI GND
Place and solder a 0.1uF ceramic capacitor across pins 10 (VCC) & 11 (GND)
Place and solder a 0.1uF ceramic capacitor across pins 30 (AVCC) & 31 (GND)
Place and solder a 0.1uF ceramic capacitor across pins 32 (AREF) & 31 (GND)
Step 2 – Connecting the Crystal
Place the 16 MHz Crystal where one leg will make a straight connection to pin 12 (XTAL2)
Cut a piece of 30 AWG wire to connect the other leg to pin 12 (XTAL2)
Cut a piece of 30 AWG wire to connect the other leg to pin 13 (XTAL1)
With one of the 22pF ceramic capacitors, connect the lead between the Crystal and XTAL2 to GND
With another 22pF ceramic capacitor, connect the other lead between the Crystal and XTAL1 to GND
Step 3 – Connecting Reset and UART Communications
Cut out 4 inches of 30 AWG wire and solder one end to pin 9 (RST) and thread out to make connection with FTDI Reset three holes short of connecting to the reset pin on the header
Thread a 0.1uF ceramic capacitor lead into the same hole the 30 AWG (RST) line and solder
Thread the other lead and continue to connect to the FTDI Reset pin
With a 10k ohm resistor connect the 30 AWG (RST) line and 30 AWG (VCC) where close by
Place the DPST momentary switch to connect the 30 AWG (RST) line and the Ground (GND)
Cut out 4 inches of 30 AWG wire and solder one end to pin 14 (RXD0) and thread out to make connection with FTDI Tx
Cut out 4 inches of 30 AWG wire and solder one end to pin 15 (TXD0) and thread out to make connection with FTDI Rx
Step 4 – Finishing Up
Connect a 100uF/16-25V electrolytic capacitor on the 30 AWG (VCC) and (GND) lines (Negative on Ground).
Place an LED by pin 19 (Arduino D13) with the flatted side (Cathode) towards Ground and solder a lead from the Anode to pin 19
Place a 460 ohm resistor between the LED Cathode and Ground then solder the LED to the Resistor and the Resistor to Ground
Place the ATMEGA1284 microcontroller into the socket
Connect the FTDI
If the ATMEGA1284 is freshly bootloaded and everything is connected correctly, the LED should flash.
Now that you have a MEGA-1284 Logic Analyzer, it is time to view some data signals. We will start with a UART off of another Arduino, since it is a fairly explicit communications protocol. I loaded the ASCIITable sketch from the Arduino IDE to generate the communications on the Arduino. Disconnect the USB and jumper from the power rails 5v0 and GND to the header pins 5v0 and GND on the Signal Arduino. Then simply connect Channel 0 (D16 or chip pin 22) on the MEGA-1284 Logic Analyzer to D1 (TX) of the Signal Arduino. You should be ready on the hardware side, so go ahead and plug the MEGA-1284 Logic Analyzer into the PC. Then, startup the Open Logic Sniffer client application.
Click on <Capture> and <Begin Capture> to open the “Connection” tab and verify connection to the MEGA-1284 by clicking the “Show device metadata” button. Information show populate the fields below the button. If not, you will have to verify the connection settings are correct.
Click on the “Acquisition” tab and change the “Sampling rate” to 20 kHz. At 9600 bps, 10 kHz should suffice, but I was getting noise in the data and the Noise filter is not developed yet for the MEGA-1284. Click on the “Triggers” tab and click a check in Mask 0 (Channel 0) and nothing in the value for Mask 0 (trigger will occur from a HIGH to a LOW).
Eventually, the electronic hobbyist find themselves needing more complicated tools. One need that arises is to view into the world of the electronic pulses and gaze upon the communications.
One simple example of such a digital communication is an IR receiver. A more complicated example would be a I2C bus or UART communication. All of these can be addressed fairly simply with a logic analyzer.
The first thing that is needed is a sketch to load onto the ATMEGA1284:
Now, with a Breadboard Mega built out, we need a way to get programs or sketches onto the microcontroller. One of many tools is a USB to Serial or TTL (Transitor-Transitor Logic) breakout board. The most common is FTDI232RL, but there are others. This board will allow one to UPLOAD a sketch onto the ATmega1284 without disturbing the bootloader in Flash or the EEPROM. Other ways use a programmer that erase and overwrite the microcontroller and the bootloader will be no more. Of course, you can use the programmer to put the bootloader back, but not both at the same time.
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:
Behind every great project, stands a micro-controller. Whether it be a lowly ATTINY13A with 1-kilobyte of Flash to a beefy STM32F407VGT6 with 1-gigabyte of Flash Memory, working with the external world is a lot easier with a microcontroller. We just need to know where to start. By far the largest body of open source libraries would be the Arduino compatible microcontrollers. The popular ATmega328-P is quite comfortable with 32k of Flash Memory, but the 2k of RAM is a little tight. It also has 6 Analog Input/Outputs (IOs) and 14 Digital IOs with 1 USART (aka UART or TTL) for serial communications.
The ATmega1284-P (I hyphenate the “P” to denote the PDIP as opposed to the “Pico-Power” that is nomenclature) on the other hand, has 128k of Flash Memory and 16k of RAM, 8 analog pins, 24 digital pins with 2 USARTs. While the ATmega1284-P takes up much more realestate, it is only a nuisance on a half sized solderless breadboard (you will have to build your 5V regulated circuit elsewhere). It is a small price considering the extra Flash, RAM, IOs and USARTs. Those that have connected a Graphical Liquid Crystal Display (GLCD) to an ATmega328 without SPI/I2C have gasped the lack of IOs left over. A good demonstration of the ATmega1284-P can be found here: http://www.theresistornetwork.com/2013/04/designing-window-manager-for-avr.html
Anyhow, the Bill of Materials (BOM) are here:
- (1) Full Sized Breadboard
- (1) ATMEGA1284P-PU w/ Optiboot Bootloader
- (6) 0.1uF Ceramic Capacitors
- (2) 22pF Ceramic Capacitors
- (2) 100uF Electrolytic Capacitors
- (2) 330 ohm Resistors
- (1) 10k ohm Resistor
- (1) Red 5mm LED
- (1) Green 5mm LED
- (22) Bent Hookup Wire
- (5) Breadboard Jumpers
- (1) 7805 5VDC Regulator
- (1) 1N4001 Diode
- (1) 16MHz Crystal
- (1) USB2TTL FTDI Serial Communications with 8″ Jumpers
- (1) 9VDC Battery Clip
This bootloader setup operates either on a 16MHz resonator or a 16MHz crystal and two 22pF capacitors. Uploading the IDE sketches are through USART0. The bootloader is the same Optiboot that is used in the Arduino compatible Unos. For the technical types, the High Fuse needs to be set to Full Swing on these PDIP chips for communication issues (USART0) and the XTAL1 signal next to RXD0.
Next, the buildout…