Instructables

Perfboard Hackduino (Arduino-compatible circuit)

Featured
Picture of Perfboard Hackduino (Arduino-compatible circuit)
Hackduino3_schem4.jpg
Never again will you have to dismantle a finished project just to reuse an Arduino board!

This tutorial will go through the steps involved in fabricating your own Arduino-compatible circuit using just ~$8 of parts (this includes the ATMega chip!).  This is perfect for installing and embedding in permanent pieces, as you don't need to waste a full $30 Arduino board in a project you will never need to reprogram or touch ever again.  It is also great because you can solder any custom circuits (LEDs, other ICs, any external analog circuit) on the same board, and customize in terms of shape and size. 

I assume you have a regular Arduino board already, so pulling out the chip to reprogram it shouldn't be a big deal, since we're going for minimal parts here. You could even go simpler by leaving out the reset button! To better illustrate the process, I did all the wiring on top of the board for tutorial purposes, but feel free to save yourself some space and make some of the connections on the copper-clad side of the board, as seen on hackduino.org or similar.
Hackduino3_schem.pdf(595x842) 219 KB
 
Remove these adsRemove these ads by Signing Up

Step 1: Gather Components and Tools

Picture of Gather Components and Tools
Parts list and buy links:

• 28-pin DIP IC Socket - $0.30 - buy mouser
• 16MHz crystal - $0.55 - buy mouser
• momentary push-button switch - $0.15 - buy mouser
• 1k ohm resistor - $0.05 - buy mouser
• LM7805 5v voltage regulator - $0.35 - buy mouser
• 2 x 22pF capacitors - $0.12 - buy mouser
• 10nF capacitor (ceramic disc code '103') - $0.10 - buy mouser
• 22uF capacitor - $0.02 - buy mouser
• ATMega168 or 328 microcontroller chip w/Arduino bootloader (you can use the one on your Arduino for now!) - $4.00-$5.50 - buy unbootloaded mouser(cheaper) / buy bootloaded sparkfun(expensive)
• breadboard style perf board - $1.45 from electronix express (elexp), or $1.99 - from radioshack

Total cost of components: $7.39 (!!!)  *22AWG wire is not included

I have created a Mouser project that includes everything you will need, except for the perfboard itself (Mouser doesn't carry a good one at a good price). Also, this is the blank ATMega328 - so you will need to bootload the chip yourself. Also keep in mind that ordering in multiples makes everything cheaper!  Here is the Mouser project.

Tools:
• IC Extraction Tool (you can use a min-flat head screwdriver to pop out chips as well) - buy
• Wire strippers
• Snips
• Multimeter
• Soldering Iron + solder

Step 2: IC Socket

First step is to figure out what exactly what you are putting into this circuit.  For this tutorial all we will build, other than the ATMega necessities, is a voltage regulator, so I am leaving space at the top of the board for this.  I also recommend leaving some space towards the bottom for a capacitor.  However, if you know this will include much more than just the ATMega circuit, you should plan this out on your board now, and install the IC socket appropriately.

Most IC's (Integrated Circuits), and consequently their corresponding sockets, have a notch on one end.  In this photo, you'll see the notch is towards the top of the board.  This is extremely important to pay attention to both while building the circuit and when inserting the chip during the last step. 

Go ahead and solder all 28 pins in, making sure the pins are sticking out of the copper side of the board.

Step 3: Voltage Regulator

LM7805 circuit goes next.  The 7805 allows you to power the circuit with a 9v battery or even 12v DC power supply, and ouputs 5v which is what our chip wants.  With the "chair" facing you, solder the 10nF capacitor connecting the right two legs of the 7805.  In this position, from left to right, the pins are input voltage - ground - output voltage (5v).

10nF cap (labeled 103) bridges the GND and OUTPUT voltage.

Step 4: Finishing the Power

I would never do this when actually building this circuit, but for tutorial purposes I felt it to be the clearest way to show you how I am taking power from the 7805 and sharing it with the board.  In fact i recommend that you do not put any wires on top of the 7805 as it can heat up quite a bit, particularly if you are inputting more than 9v. Go around the 7805 on either side. Down the center of the perfboard you can see two rails that go down the center of board, which I am using as power rails (similar to the outer rails of a breadboard). I have chosen one to be ground, the other to be power  (+5v).

From behind the 'chair' (7805) you can see I have taken the input voltage pin and ground to two terminals which is where our battery will plug in.

Lastly, install the 22uF capacitor across your power lines somewhere after the ATMega chip.  In this case I am putting it at the end of my power rails. Be aware of polarity when using electrolytic capacitors - match the ground of the cap to the ground rail.  This is important!

**if you haven't noticed by now, I ran out of red wire and am using blue for positive and the standard black for ground.

Step 5: Installing the 16MHz Crystal Oscillator

Now we begin building the ATMega circuit. I am attaching a diagram of every pin out of the ATMega8 series (also includes 168 and 328).  You can see how important that notch is in terms of knowing what is what in a situation like this.

Pins 9 and 10 are labeled "crystal" - referring to our 16MHz oscillator.  Polarity here doesn't matter go ahead and bridge the two pins with the crystal.  With the board I am using, you can see each pin of the IC socket has 2 terminals bridged already.  This is perfect here because we then need to add the 22pF capacitors and take those to what will be GND.  For now just take them to the empty terminal slot, we will add GND here later.

Step 6: AREF, +5Vs, and GNDs

Picture of AREF, +5Vs, and GNDs
4592303992_30647ea871.jpg
4581968393_8a97f69ed9.jpg
We will continue to build out our ATMega circuit by adding power and ground connections.  As you can see in the Pin Mapping:

- GND needs to go to pins 8 and 22.
- VCC (+5v) needs to go to 7, 20, and 21 (the analog reference voltage).

Go ahead and connect these pins to the outer terminal pairs directly across from them, using the appropriately colored wire.

Step 7: Resistor to Reset pin

This 1k ohm resistor connecting pin 1 to +5v will guarantee that the ATMega chip will never get accidentally reset. 

By using a resistor and not wire, we have the option to add a button for resetting to this pin later.

Step 8: Connect GNDs and PWRs to the rails

Now it's time to start actually connecting our leads to PWR and GND.  I will use the power rails going down the board to my advantage and take leads from there. 

**The way I am connecting these pins in this example is for tutorial purposes only. I want you to see exactly what I am connecting to where.  If I were making a board for my own use, I would make these connections underneath the board directly to the power rails in the center.  This can save lots and lots of space, but would be very hard to understand and follow in this tutorial.  That being said, you can copy this exactly, and your circuit will work great!  Just not the most space efficient method - get creative!

Step 9: Reset Button

**this step is optional -- you can leave the reset pin connected to +5v with the resistor, and your board will work perfecty**

For the reset button I am using a momentary push-button switch connected to GND. The kind I recommend has 4 legs, however there are only two you need to be concerned with.  Using your multimeter check to see which pairs are redundant (meaning always connected, share the same line).  When you press the button, both pairs get bridged, and GND is shared with pin 1, the reset pin, thus resetting the board.

Look at the rollovers to understand what i mean.

Step 10: Power Terminal : Battery/supply connection

We are very close to finishing the circuit!

I have chosen to install female header pins to the input power supply terminals.  This so that I can easily pop in and out any supply I want.  However, for a board that will be going in to a specific project, it is a good idea to just permanently solder in your power supply.  Perhaps it is a 9v battery clip. Or a DC wall adapter.

Now that we have finished soldering everything, use your multimeter to check continuity between the power railsThere should be no connection between the two.  If the multimeter says there is go through and check for where there is a short.  This could be harmful to the chip if we power it up and there is a short.

This is also a great time to check that your voltage regulator circuit is functional. Plug in your power supply and turn it on without the chip inserted into the socket. Use your multimeter to check that exactly 5v are running between the power rails.  Because all of our power pins are connected to the rails, we know the chip will only receive 5v - just like we want.

Step 11: Program ATMega chip w/Arduino and Extract

1. Program an Arduino, as you normally would.  I am uploading code that flashes S-O-S in morse code on every digital pin.  It is attached to this step. My version of hello world.

2. Using the IC extractor tool, slip both ends of the tool under either end of the chip.  This can take a bit of fidgeting to wedge them under, but once they are, yank on it!  The chip is often very secure in the IC socket, but you can't hurt it by pulling straight out after you have a secure hold on the chip.

3. I usually now replace the missing ATMega chip with the new chip ordered. Make sure it has the Arduino bootloader on it, though!


Here is the code in case you don't want to waste time downloading:

/*

S.O.S. morse code all LEDs!

Hello World for the Distressed Chip.

joe saavedra 2010
http://jos.ph

*/

int S = 1;
int O = 2;

void setup(){
  for(int i=0; i<14; i++){
    pinMode(i, OUTPUT);
  }
}

void loop(){
 
  flash(S);
  flash(O); 
  flash(S);
 
  delay(750);
 
}
 
void flash(int letter){
  switch(letter){
    case 1:  //the letter 'S' !
      dot();
      dot();
      dot();   
    break;
   
    case 2:  //the letter 'O' !
      dash();
      dash();
      dash();
    break;
  }
  delay(250); //break between each letter
}
  
void dot(){
  for(int j=0; j<14; j++){
    digitalWrite(j, HIGH);
  }
  delay(130); //length of dot

  for(int j=0; j<14; j++){
    digitalWrite(j, LOW);
  } 
  delay(130); //space between dot
  return;
}
 
   
void dash(){
  for(int k=0; k<14; k++){
    digitalWrite(k, HIGH);
  }
  delay(250); //length of dash

  for(int k=0; k<14; k++){
    digitalWrite(k, LOW);
  }
  delay(130); //space between dash
  return;
}
 
   

Step 12: LED on Pin 13 and... DONE!

In classic Arduino style, I have soldered in an LED to digital pin 13 (which is pin 19 of the IC). You could of course solder the LED to any part of the board and run wire to GND and pin 13, I am just lazy in this case and put it right on the pin itself.

Making sure that there is no short between PWR and GND rails, and that you have exactly 5v running through the board, insert the chip into the socket.  Be aware of the notch! Power up the board, and if all is well you should see S.O.S. start to flash on any LEDs connected to digital pins! Success!  All ready to embed into projects! 

Another great thing worth noting about this board is the 4 holes in each corner.  Standoffs are a very professional way to mount your board to a project and can prevent any potential shorting of your circuit.

Good luck and post up a comment with any projects you embed with your own perfboard hackduino!

1-40 of 155Next »
kamhagh7 months ago

whats the point of using a board while you can just put it on breadboard? not a complain or anything just asking to see if it worths the time and stuff!!! if i made i will put 2 sockets for both atmega328P and atmega 32!!! (i programm in avr! but sometimes arduino too:D i do taht whit my arduino uno i use it as isp now)

Ok maybe someone can help me understand my problem here.
I have built this Hackduino using the exact materials and wiring as described but on a protoboard. I burned my ATMEGA328, uploaded the SOS code and verified it worked with my original UNO. All fine. However when I plug the chip into the protoboard and power it up... nothing. So I checked and rechecked my wiring; all fine. It wasn't until I pulled both GNDs from the 22uF caps and crystal that the damn thing started blinking!
So without any GND to the caps and crystal it works absolutely fine. Weird?
So I have two questions: Do you think the crystal might have gone bad?
And
Do i even need the damned thing?
jmsaavedra (author)  joshua.zajac2 years ago
i know that ATMegas have an internal crystal. i believe that when no external crystal is used, the chip defaults to using that. the arduino and most compatible circuits use an external crystal with caps because it's far more reliable and accurate. this might become apparent if you use the millis() function and compare it to actual time passed... i'd predict the internal clock to be inaccurate over time.

also, i believe you're using the wrong capacitors. it's 22pF (picofarad), not 22uF (microfarad).

hope it helps
zgr95 jmsaavedra10 months ago
I know this is a late reply but i just wanted to make sure there was no confusion in the future. To use the atmega 328's internal clock the chips fuses must be written to do so. Another method would be to flash the chip with a pre-made bootloader for it
tonesofheresy11 months ago
Hello, I'm hoping someone can help me with this. I followed the instructions perfectly and I'm pretty sure the board is wired correctly, however, when I check the voltage between the power rails, I only get 3.2-3.3 V. I'm using a power supply from Adafruit for the Raspberry Pi, rated at 5.25 V (supposed to account for loss through the USB cable). I'm very new to electronics and am having a hard time tracing the path of the current so if there are other places I can check the potential difference to try and narrow down any faulty connections, I'd greatly appreciate some input. Thanks!
it sounds like you may have tried to run the 5.25 V supply through the 7805 this would cause the low voltage your getting. The reason for this is that the 7805 has drop out voltage (voltage lost when run through the regulator) it is typically a good idea to run atleast 2 V above your desired V out into the regulator. I would try replacing the Raspberry Pi supply with a 9 volt battery this should be high enough of a voltage to get you the 5 V out that your expecting
LeumasYrrep2 years ago
I love your Instructable and have found it to be very useful when finishing up my electronics projects. I just wanted to point out an improvement that save a lot of unnecessary wire and time.

I moved the voltage regulator to connect directly to the center voltage rails. This way I hook the power input to the left side of the regulator and place the negative power connection directly on the negative voltage rail. Saves me from placing those two extra wires looping around the regulator and frees up a large bit of real estate to add more components. I also connected pin 7 to the positive voltage rail on the underside to clean up the top a little bit. Power is distributed to the reset resistor from this connection.
DSC05972.JPGDSC05973.JPG
fls_27 LeumasYrrep11 months ago
Could you please post a full pic of the top side of the board?
riju161 year ago
Hi everyone...ive joined in as a member...iam a beginner to arduino..anywayz just saw steps of Perfboard Hackduino (Arduino-compatible circuit)..can anyone pls tell me by how much has the size reduced as compared to da original arduino board..in my project i need to reduce the size of arduino uno..as small as possible..Thanks..
riju161 year ago
Hi everyone...ive joined in as a member...iam a beginner to arduino..anywayz just saw steps of Perfboard Hackduino (Arduino-compatible circuit)..can anyone pls tell me by how much has the reduced as compared to da original arduino board..in my project i need to reduce the arduino uno..as small as possible..Thanks..
wrecks1351 year ago
Okay I asked this question below, but could somebody who knows more than me (most - if not all of you) please look at his 7805 power supply hook up and let me know if he actually shows it correctly. My understanding is that the electrolytic cap should go input to ground and the ceramic cap should go output to ground. I don't think he did that. In fact when I look at this instructable - I don't think there is ANY capacitor between input and ground but there are two capacitors between output and ground.

The 7805 datasheet shows that there should be a cap going between input and ground - he doesn't have one as best I can tell. Also, why is the electrolytic capacitor after the power comes off the rails - wouldn't it be best before?
His power supply looks fine its all about what is powering the 7805 if it is a battery or other pre-made power supply's his design is perfectly fine. The only time it would be crucial to have capacitors before the input of the 7805 would be in an environment where the supply feeding the 7805 is constantly fluctuating and affecting the micro-controller itself. In any case this design is perfectly fine for most uses. Hopefully this has cleared up any confusion. If you have any other questions don't hesitate to ask.
Thanks!
dianeshpj1 year ago
Can i program this to control RGB LEDs ?? Sorry if the question is so idiotic i'm new to this.......
you definately can
Thank you for the reply
ncc 17011 year ago
how important are exact values on the capacitors, and is the crystal at all heat sensitive(e.g. should extra care be taken to solder it in quickly)?
zgr95 ncc 17011 year ago
the exact capacitor values are really dependent on on your power supply the cleaner the supply the less filtering you need (less filtering smaller value) going up in capacitor value shouldn't be an issue, although the two 22pF capacitors you should not change. As far as heat sensitivity as long as you solder quickly it should be fine if your worried clip an alligator clip to the top of the crystal it will act like a small heatsink which should allow you more time
JesusGeek1 year ago
For those who don't know this, Vcc on the Atmega168/328 is the GND for the I/O pins. This can also be the +5V from anywhere else, since this is connected to Vcc.
JesusGeek1 year ago
@jasshopper, look up "hackduino" in the search box, look at fruitkid101's LED cube.
jameskirk1 year ago
I'm a really really big newbie here...
How can I hookup female header pins on the board to hook my projects too???
Thank You
search for the pin outs of atmega168 and connect the female headers to the digital and analog pins.
There are 14 digital pins and 6 analog pins does that mean i should connect one to all of those???
here is a pic of one does that mean i should connect a header pin to all of them???
Thank You,
Mike
atmega168_pinout.png
well, i'm not a pro in arduino, so i guess you should connect to all pins. but its best of you to search more.
tomtiki1 year ago
For a few more dollars ($12 instead of $7.39), check out the shield compatible Diavolino : http://evilmadscience.com/productsmenu/tinykitlist/180

If you don't need shield compatibility, use a ATMegaXX8 target board for $3. They also sell the Atmega chips with the bootloader installed for $5.

Just a happy customer.
jasshopper1 year ago
can you use this to make a led cube? if yes where are the point to connect it to this?
2cool4me41 year ago
Oh, no! It appears that I just deleted the 22pF capacitors (you had to order them in quantities of 2000 or more), and Mouser won't let me add them back! Is this a problem that just pertains to me, or did I just screw everybody up?
i have the same ic puller :)
i made mine with help of http://www.jo3ri.be/tutorials and it is working greate. It just starts when i press tectile switch and stops after 1 min with blinking led example.... what could be one for continuous loop ?
100213-1630.jpg
How would i add an FTDI chip to this so I could connect it via usb?
Too much hassle. The FTDI IC is a surface-mount chip
with *very* small leads. It's much easier to install a 6-pin
programming header, connected to Rx, Tx, +5v, Gnd,
and reset. That way you could use an FTDI breakout
board or cable.
Hey there!

I'm wondering if you happen to have a way to upload sketches to these chips without having a duemilanove to pull and place chips in.
If you look at the pinout diagram, notice that pins 2 and 3 are RX and TX , respectively. You can program the atmega while it is installed by hooking up a FTDI cable (ie. USB to serial) to those pins in this order:

FTDI TX to Atmega RX
FTDI RX to Atmega TX

The power and other lines can remain disconnected.
Gofilord2 years ago
Hey ummm... I have an arduino nano so I can't really preform this step.. is there any OTHER WAY for uploading a sketch do my hackduino? Like, maybe, using jumpers from an existing arduino or buying a cheap FTDI chip that I can use for all of my hackduinos?
Thanks!!
Sparkfun makes a really great, easy to use ISP programmer: http://www.sparkfun.com/products/9825. 14.95 is about as cheap as an FTDI combo gets these days. Of course, you will have to add a pinout on your hackduino board to get to the 6 pins necessary for ISP. You can find ISP standard pinouts, and which pins on the AVR correspond to those ISP pins, in your datasheet and/or Atmel's online resources for its programmers, like the AVR ISP mkII or the AVR Dragon.
Anianna2 years ago
I am a complete newb with Arduino and I would like to thank you for showing me how to reduce the cost point so that I can reasonably get myself and four kids actually working on projects. The Uno boards cost way too much to get a family all learning and building. That said, I have a question regarding the microcontroller chip:

The Sparkfun link you provided leads to an earlier model they are no longer producing and there is a link to a more recent product. I tried to find the more recent product on Mouser, but their ATMega chip listings do not mention the Arduino bootloader. How do I know which chips on Mouser will work to build an Arduino compatible board?

Forgive me if this has been asked or answered already. I glanced through the comments and did not see it.
eboily2 years ago
If I properly read your pictures, both capacitors are between GND and OUTPUT. I thought that 7805 also needed a capacitor between INPUT and GND...

Am I reading correctly?

Thanks
The pictures look that way to me to...I'm also not sure why the 22uf cap is all the way on the far side of the board instead of right up next to the power supply section of the board. Does that make a difference?

From my research it looks like the electrolytic cap should go input to ground and the ceramic cap should go output to ground
Thats what he did
wrecks1352 years ago
Can you explain how your power supply setup is different than the one shown on this project:

http://www.instructables.com/id/DIY-Arduino-or-The-DIY-Duino/step18/Putting-it-Together/

The linked project seems to have a cap bridging the input and ground in front of the 7805 and then the ground and output after the 7805. Your schematic doesn't seem to follow the same pattern. Your cap (the 103) comes after the regulator and then there is another cap after the ATmega. I'm confused.

I'm a total noob at this so I'm just trying to learn the different options and understand how it works. Can you explain the difference and maybe the pros and cons of one way vs. the other?
1-40 of 155Next »