Mini prototyping circuit for Arduino

Rapid prototyping circuits like Arduino are a great resource when it comes to testing a design without having to worry about the setup of the base to test the design on. The same applies to the devices to be attached to Arduino itself : most of the times the I/Os are potentiometers, pushbuttons, LEDs, displays, IR emitters and receivers and sensors in general. And I don’t want to bother with soldering when the the source code (the ’sketch’) is there ready to run.

That’s why I developped and setup a few circuits ready to go with Arduino or general microcontroller based circuits : they come complete with wires, plugs to connect the Arduino and a few safety devices useful to protect the circuit and Arduino from possible wiring and programming errors. Connecting a switch in parallel to an output instead to an input might break the microcontroller or switching the three leads of a potentiometer might break it.

Many of my circuits are based on the original mini PCBs coming from consumer electronics, that’s why I never dispose or completely dismantle scrap TVs or printers on VCRs and all of the electronic devices I scavenge or get from friends (real friends ! ). I always save small PCBs with switches, motors and else together with the wiring and connectors.

The IR receiver in the picture above is on the original PCB froma Sony TV. The LED could be connected through an SMD transitor on the back of the pcb to the IR receiver to monitor the IR receiver output for received IR pulses.

The same for the IR emitter : a small LED on the collector of the transistor provides for a monitor of output IR pulses.

A better view of the schematic is here.

Mini prototyping circuits for Arduino

This is an example of protection device where the wiper of the potentiometer has a resistor in series : in case the wiring is switched and the wiper is incorrectly connected to a supply rail, the power supply is not shorted through the potentiometer burning the pot and possibly the power supply. Voltage drop across the resistor is not much of an issue as Arduino’s inputs leak very little current.

A capacitor at the wiper helps filter out wiper’s electric noise.

A better schematic is here.

The same for the pushbutton : however connected, no more than 5/220A (i.e. 20mA) are allowed to flow across the pushbutton (or an Arduino’s output pin). The board with the switches comes from an HP printer: as a bonus three LEDs are sitting there on the board along with the connector and wiring leads. The golden pins are from some PC board : heat shrink tubing helps keep the solder firm and lasting. This for male plugs.

Female sockets can be made easily with dismantled wire-to-PCB connector contacts and, again, heat shrink tubing.

Mini prototyping circuits for Arduino On the left an RGB led with resistors (inside the heat shrink tubing. The piezo sensor on the right is a vibration/hit sensor. It doubles also as a piezo emitter. The schematic is here.

Updated 25 April 2009

With this notes I’ll show how I configured an Atmel STK500 as an Arduino-based development system.
I used the STK500 instead of a real Arduino PCB because I already had it and the board carries 8 switches, 8 LEDs and a variable, software programmable AREF voltage as well as a variable power supply. Great things to experiment with on a single board.

What follows applies to the STK500 evb equipped with an ATMega168. Please note I made my best to be as accurate as possible, some errors may be present though. Should you find some, please let me know.
AVR Studio 4.14 build 589 is used in the following; newer versions should be hopefully upward compatible.

Things needed :

One Atmel STK500 Evaluation Board with power supply
One Atmel ATMega168
One 16MHz crystal
One serial cable
One PC with AVR Studio 4 and one serial port
The Arduino software development system and the bootloader file for the ATMega168.

In case the PC doesn’t have a serial port but just USBs, a USB to serial adapter is necessary to interface the STK500 to the PC. I haven’t tried but it should work.

RS232 is needed in first instance to interface the STK500 evaluation board with the PC.

First the STK500 was wired and the jumper set as shown in the picture below.Click the picture for a larger version.

The ATMega168 must be on board, any other CPU must be removed.

The ATMega168 must be placed in the green 28pin socket and the 16MHz crystal into the socket as shown. The PC must be connected to the STK500 serial programmin port, the one labelled “RS232 CTRL” on the PCB. Take note what port of the PC you are using (say COM1 or COM2).

Launch AVR Studio and turn on the STK500.

From AVR Studio select “connect” (the “IC” icon below the menus) and select “STK500″ as platform and “COM1″ or “COM2″ ( the one connected before ) as port.

Press “connect” and the following should come up, the “main” tab :

m

Select ATmega168 for “device and signature bytes” then press the “Read Signature” button and check that the platform recognizes the device (the “Signature matches selected device” label is what you want to see ).

Press the “Erase device” button.

Next, press the “program” tab to display the following:

Check the “Erase device before FLASH programming” and “Verify device after programming”.

Now select the “…” button to the right of the “input HEX file” field and browse to the directory “\arduino-0012\hardware\bootloaders\atmega168″ starting from the place where you exploded the Arduino zip file you downloaded and select the ATmegaBOOT_168_ng.HEX file. Otherwise browse to where you saved the bootloader downloaded from arduino.cc

Press the “Program” button : after a few seconds the bootloader will be FLASHed into the micro and verified automatically. The bottom part of the window shall give some promising “OK !”s

Now click on the “Fuses” tab. Make it look like the following picture: make sure to un-check CKDIV8 and to select the “Ext Crystal Osc. 8.0 – MHz…”.

Changes are reflected in the “EXTENDED”, “HIGH” and “LOW” registers at the bottom: make sure they are the same as below.

Press “Program”.

m

Now, with the “lock bits” tab, the bootloader must be protected from overwriting :

m

The “BLB1″ must be changed to what is above and the “LOCKBIT” register should finally be 0xCF as above, press “Program”.

Now you’re done: you can remove the 6-pin ribbon cable necessary to program the micro and move the serial cable to the other serial port connector of the STK500 (the one marked “RS232 SPARE” on the PCB), make sure you leave connected the PD0 and PD1 to RXD and TXD because these pins make the serial port of Arduino !

Now you have and STK500 running Arduino with the added advantage of pushbuttons and LEDs on board plus variable power supply (useful when working with 3.3V external sensors) and variable Analog Reference (AREF).
The AREF short pin must be inserted when the on-board voltage reference is to be used. Remove the short otherwise. The Analog Reference Voltage can be controlled with the “Connect” dialog box. Target Supply voltage can be controlled there also.
The connections of teh ATMega168 are available at connectors J700 & J701 of the STK500.

The pinout is shown below along with the equivalent name to Arduino’s.

Again, the “spare serial port” of the STK500 is the one used to download sketches on the STK500-Arduino: remember to move the serial cable to this port to connect your PC to your Arduino !

The Reset button on the STK500 is now the reset button of the STK500-Arduino: it must be pressed to download sketches on the board as you would with a regular Arduino.

Connecting PB5 to an LED of the ones on the board gives a visual monitor where the LED blinks right after reset to show it is waiting for the code on the serial port.

Update : there’s a bug in AVR studio 4.16 which prevents bootloader from being written correctly into the micro, see comment below from avirdi.

Have fun and write for questions and comments.

Alessandro

STK500 as Arduino : J700 and J701 pinout Vs Arduino pinout