This instructable will show you how to build an Arduino shield that adds another Atmega168/328 on top of your Arduino, giving you an extra complete set of I/O pins to use. That's 12 PWM pins, 12 Analog pins, 4 external interrupts,  or 40 Digital pins total.


*UPDATE* 3-11-10
I re-did the Eagle file and scrapped the R/C header and both of the 7805 voltage regulators. The new design will ONLY draw power from the base Arduino. There was a bit of confusion about the selectable power source of the old design, so I just made it simple. Also, it is now short enough to add an Arduino shield on top. The 2 VIN pins are to supply power to the base Arduino via it's VIN pin (thereby powering the core2duino through the base arduino's 5v regulator). If powered through these pins, voltage should not exceed 12v.

This design is also stackable.. meaning you can add the Core3duino on top of it!


Using I2C, you can connect 1 Arduino (master) to a host of slave Arduino's through Analog ports 4 and 5.

Also, you can add the security of having a completely separate CPU to your project that is unaffected by any code running on the base Arduino.  I use this shield as a failsafe on my R/C lawnmower. The base processor uses the 2 external interrupts to sample and decode 2 servo signals from an R/C transmitter/receiver, while a 3rd servo signal is sent to the Core2duino that controls a relay for the motor-controller power supply. This way, even if there is a problem with the main code and it stops responding, the Core2duino will still be able to carry out it's main function unaffected (which is to kill the power to the bot if anything unusual happens).

I have included the Eagle files needed to build the board. It is basically just a breakout board for the Atmega168, that has it's own power regulation and crystal oscillator. It provides access to the base Arduino's pins by using stackable headers that plug directly into the base Arduino.

It is a fun board to play with and I thought I would share, just in case anyone else has a use for it.

You can check out my other projects at my website: www.rediculouslygoodlooking.com

This board also works with the Core3duino... more pins!

Step 1: What You Need to Get Started

Things you probably need to buy:

1. (1)pc copper clad (3"x4") or assortment
2. (1) 28-pin dip socket
3. 16 mHz crystal resonator w/ built-in capacitor
4. A 2nd Atmega168 with Arduino bootloader
5. stackable header set
6. (2) 6-pos female headers (2) 8-pos female headers .1"
7. (4) male pin headers (optional) .1"

Other things needed:

power LED, any size/color
330 ohm-1k ohm resistor for power led
10k resistor for reset button
reset button
.1uf capacitor optional

etchant solution (muriatic acid + hydrogen peroxide)
paper towels
scotch brite pads
Laser Printer
magazine paper
rubber gloves

 Now I would assume that since I have a 328, that I should have another 328 to match right?
not necessary, they are independent of each other, so if the code on 1 of the chips needs to be much larger, you can use the 328 for that one. I have mixed them with no problems.<br />
So I could use an Atmega8 as the 2nd core, with it's own 8mHz crystal, and do the timming adjustments through software on any of the cores... correct?
Really interesting... the Atmega8 is SO cheap that makes a great candidate for an auxiliar I/O board (with fancier possibilities)!<br>Maybe a couple of them on the same shield..<br><br>Thanks a lot for the instructables!!
Wait, I'm a little confused.... How do you program the second atmega? Does it just get its own binary? How do you hook it up to program it? Looks cool, I'm just not sure how it works.
you can upload the same test code to both Arduino's to see that they work properly, then make up your own code to go on the 2nd Arduino. If you don't yet need a 2nd Arduino (or more commonly, an Arduino Mega) then this instructable is not yet for you. Once you get to the point that you need either more than 6 analog inputs, or more than 20 digital I/O pins, or more than 2 external interrupts, or more than 6 PWM outputs pins..... you will quickly see why this board can be very useful for how cheap it is to make. I used this board to decode a failsafe signal from my R/C receiver to keep it separate from the main processing code, for added safety. If the main processor fails, I can still disable the 200lb bot. You can use it to power 40 LED's, or if you need 12 PWM outputs, or 12 analog inputs, etc....
Ah. So, two programs for the two arduinos. Don't worry, I see the merits of the project, especially for big bots like yours. I would hate to have that running around my neighborhood.
Great idea, johndavid400. I'm just curious why you didn't piggyback off of the Arduino's 5v supply and oscillator. I can understand not sharing the oscillator if that would require soldering directly to the Arduino, but I can't see what the issue would be with sharing the power supply.
It does share the power supply.&nbsp; You can use the jumpers to select 1 of 3 power sources. You can tie the core2duino directly to the base Arduino +5v (regulated), or you can connect the VIN (voltage&nbsp;In) pins together and let them both use their onboard 5v regulators to supply power, or if you have neither a&nbsp; USB cable or a DC&nbsp;jack, you can use the screw-terminal on the core2duino to supply power to both itself and the base Arduino. So either one can power the other or just itself. The jumpers allow you to choose which source you want very easily.<br />
Cool I guess I should look more closely next time :)<br /> I haven't done any Arduino stuff (yet), but do you know if it would be possible to share oscillators if you were building your own Arduino clone unit?
not sure if you can share the oscillator, seems like it would be possible if you made the base Arduino as well, and 2 header pins that are connected to the Xtal1 and Xtal2 pins of the Atmega168... but they are not accessible on the standard Arduino as far as I know. The oscillator only cost $0.54 each and you only need 1 per Atmega that you use. You can use the Atmega with it's internal oscillator, but it will only run at 8mHz (instead of 16mHz), so every function based on timing will be off, like delay() and millis(). <br />
Also, interference along the oscillator lines can cause crazy bugs.&nbsp; That's why most designs have the oscillator as close as physically possible to the chip<br />
Nice project!<br /> <br /> 1) Is a *kit* coming soon?? &nbsp;;)<br /> <br /> 2) Does this extend the current set of pins within my *main* program or are we really programming 2 different chips at this point?<br /> <br /> I am trying to get more external interrupts (without having to buy a Mega)<br /> <br /> Maybe some examples on using the different pins (which are for chip1 and chip2)???<br /> <br /> Thanks and again, nice job!<br /> <br />
In revision 4, the one without the extras, what is the value for the capacitor? And I assume that the resistor is for the LED and not a diode or something.
the capacitor is probably not even needed, unless you are going to be flashing a bunch of LED's or something that might draw excess current from the base Arduino. I&nbsp;put it there to give the core2duino some extra juice if needed... so I&nbsp;would use a short (in height) electrolytic capacitor, whatever value you have between 50uf and 250uf (10v or higher). You want the capacitor to be about the height of the female headers, so you can add a shield on top later if you like. Also, I would use either a 1/8w or 1/4w, 330ohm resistor and a 3.5mm LED for the power light. <br /> <br /> hope this helps,<br /> ~jd<br />
also, not sure if said much about the Eagle file, but:<br /> <br /> The red lines are jumper wires. There should be a 10k resistor underneath the 28pin dip-socket for the Atmega168 (it is the pull-up resistor for the reset button).<br /> The reset button goes above the atmega&nbsp;(I put 2 sets of holes for different size buttons). The 16mhz crystal oscillator goes to the left of the atmega, orientation does not matter. The 2 holes to the right of the LED&nbsp;resistor should be populated with (2) .1&quot; male shrouded breakaway headers (these are the VIN selector jumper pins and are only needed if planning on using the power input from the Core2duino). The outer-most set of Arduino pins on each side should have the stackable headers. The inner-most set of pins use the regular female headers.<br /> <br /> Again, you will want to solder the stackable headers first! you will be able to more easily access them with the soldering iron.<br />
&nbsp;cool, what's it do
&nbsp;How would you do this on a protoboard/perfboard? I have absolutely no experience with etching and thus would like to use a protoboard/perfboard instead.
&nbsp;I've always etched my own boards, but since I don't have access to a laserjet printer to make my own resists I have to use a paintpen or a sharpie. One thing I also use is a perfboard. I use it to layout my grid and do proper spacing. So I'd say you're better off with a perfboard if you don't already have a etching setup. And no offense to johndavid400, but I'd say the perf will look a lot cleaner and more organized.
you can do it, but you will have to use bent <a href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1206626508/30" rel="nofollow">stackable-headers</a> like these (because the Arduino header spacing is .15&quot; instead of .1&quot;) and the <a href="http://www.radioshack.com/product/index.jsp?productId=2103800" rel="nofollow">perf-board</a> will require a lot of wire. Other than the <a href="http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;name=X908-ND" rel="nofollow">16mHz resonator</a> (center pin grounded, left and right pins to&nbsp; Xtal1 and Xtal2 on atmega), the <a href="http://dailyduino.com/wp-content/uploads/2008/11/arduino_pinout.png" rel="nofollow">Atmega168 pinout</a>, and any <a href="http://www.radioshack.com/product/index.jsp?productId=2062599" rel="nofollow">5v regulator</a>, you just need a bit of patience and some good wire strippers. You should also take some pics and post an instructable showing how you made yours. I have made several Arduino dummy breakout boards on perf-board, but they all had screw-terminals instead of headers (they are not stackable).<br />

About This Instructable




Bio: I have always been one to take things apart to figure out how they work, so most of what I own has been dismantled. If ... More »
More by johndavid400:Arduino controlled Bluetooth-bot Core3duino Arduino R/C Lawnmower (painted) 
Add instructable to: