Make Your Own 1x1 22 IO Pin Ardunio Compatible
by dustinandrews in Circuits > Arduino
65133 Views, 220 Favorites, 0 Comments
Make Your Own 1x1 22 IO Pin Ardunio Compatible
What is it?
This Instructable will give you all the files and information you need to make your own Arduino Compatible in small surface mount package.
It requires a board manufactured to about 9mil precision. I recommend having the board manufactured at BatchPCB.com, Sunstone.com or your favorite board house.
We will be using a hot plate reflow method. It's pretty easy and the components in this project tolerate the heat pretty well. I have not used a solder mask. Surface tension is your friend, but I did get some speckles on the boards and had to fix up one bridge. So feel free to make one if you know how. Solder masks won't be covered here. Note: The fine commentators over at Hack A Day noted that you can actually do this project with a regular soldering iron using a method called "Tack and Drag." So, if you don't want to get a hot plate and solder paste, you have choices. That's the magic of DIY.
Is this Instructable for you?
If you like Arduino and think you might like to learn how to do surface mount soldering, this is a great project to start with. If you don't know about Arduino, you should get a development board and try it out. This isn't a great beginner's Arduino Compatible. It needs an external voltage regulator and it's small form factor isn't as friendly as the full sized boards. If you ever built a breadboard Arduino you will feel right at home here.
Can I modify this Instructable to do something custom?
You could make an Arduino with an on board compass, or on board robot controls. If you know how to make something work with Atmega328 you can move it on board with these files as a jumping off place.
What good is an Arduino anyway?
Just search Instructables for "Arduino". This clone is really good for adding cores to existing projects or embedding in projects where space is at a premium.
What should I already know?
You should know your way around the Arduino IDE well enough to "burn the blink program" and have some practice wiring up an Arduino with simple circuits. It helps if you can already solder some. If you know how to make PCB's or have ever build a "boarduino" you will be fine.
You will need the ability to open a command prompt in windows (or Linux), change directories and run programs as directed. The directions assume you are running Windows. If you run Linux I have faith you will figure it out.
Is this physically demanding at all?
You will need decent eye sight, a fair amount of hand eye co-ordination and good fine motor control. The griddle is also hot, so parts of this are sweaty work despite being physically easy
Open source goodies
The board is open source with a Creative Commons non-commercial license. You can get the eagle files from GitHub if you want to modify the board or use it as a jumping off point for your own clone.
https://github.com/dustinandrews/ExtraCore
This looks hard but I want one, can I just buy one?
Yep, for sale from Rugged Circuits. Follow @dustin1970
Tools You Will Need
- Electric skillet or griddle
- Good ventilation
- Fine tweezers that are not even a little magnetized. Plastic is OK.
- Fine tweezers that can take 250 degrees F. Magetized is OK, clearly plastic is not.
- Magnifying glass. Depending on your eyes, higher magnification might be helpful.
- Solder paste
- Syringe or heavy duty zip top bag with a needle hole in the corner for applying paste
- Sewing needle
- Soldering Iron (Adjustable if at all possible)
- Fine solder wick
- Solderless breadboard and jumpers.
- 1-3 spare LEDs and 220-1k ohm resistors. (Tools since you can re-use them after this project)
- Any arduino compatible or ISP known to work with Atmega chips. These instructions assume an Arduino loaded with ArduinoISP
- A PC, these instructions assume windows. Linux will also work for sure.
- 5v FTDI breakout or cable or know how to do without.
- WinAvr
- Arduino IDE
- Optiboot boot loader.
Note: You can use another bootloader if you wish, but you are on your own for burning the fuzes correctly. Messing up the fuzes can brick a chip, and the on board resonator will make it impossible to recover with even a high voltage programmer.
Get the Circuit Boards
You can now get a board with all the electronics from Rugged Circuits for $10.
If you want to have a circuit board made you have to DIY or send it to a "fab house." These services require design files in a compatible format. "Gerber" is a common format that the Eagle software I used outputs and just about every board manufacturing service accepts.
The Gerber files I used are attached to this step. You can also get the Eagle Files from GitHub and make your own Gerber (or whatever) files if you need to modify the design. You can send the Gerbers to a fab house like BatchPCB or www.sunstone.com. I have used both. BatchPCB will cost about $13 not including shipping for one board and it will arrive in about a month. So far they have always sent me 2 boards when I ordered one, but I have had one board (of the two) have problems. Sunstone's prototype service costs about twice as much and you will have boards in half the time. I quality of the Sunstone boards is good, but the silk screen isn't as clear as BatchPCB with the same Gerber files. The price at Sunstone is the same for one or two boards so go ahead and get two.
If you want, you can order boards from BatchPCB via files I have already uploaded here.
(For the adventuresome an
If you want to modify the design and make your own Gerber files, Spark Fun has a good tutorial and job file.
You can upload Gerbers to BatchPCB and have their DRC bot check them for free, Sometimes the design rules in Eagle show problems that you can ignore, but the "DRC bot" there rarely has false alarms.
There is also great, free online Gerber viewer here: http://circuitpeople.com/
Downloads
Gather Components
Here are the parts you need and the digeykey part numbers. For items that don't have a minimum of 10, I recomend you get at least 2 and possibly more. If you have 2 good boards, you can make two Ardunio Compatibles. The small parts are really, really easy to lose so having extras is great. Be careful with them when you open the packages.
2x 445-6389-1-ND INDUCTOR MULTILAYER 10UH 0603
2x 490-1198-1-ND CER RESONATOR 16.0MHZ SMD
2x 754-1547-1-ND LED GREEN ROUND CLEAR SMD
2x ATMEGA328-AU-ND IC MCU AVR 32K FLASH 32TQFP
10x 541-10.0KSCT-ND RES 10.0K OHM .25W 1% 0603 SMD
10x 445-1316-1-ND CAP CER .10UF 25V X7R 10% 0603
This bill of materials costs about $15 + shipping at the time of this writing. If you know what you are doing you can make substitutions. All these parts are really standard. Don't substitute the Atemga328 chip unless you are super sure you know what you are doing. This one works, I promise. If you get another I can just about promise the fuze settings I recommend turn it into a tiny coaster.
Recommended Headers
You will also need some standard headers and some right angle headers. I like long headers so you can push them into a breadboard and still put female jumpers on the top.
18 x Standard long Headers
12 x Right Angle Headers
Optional External Voltage Regulation
2 x P5149-ND 22uf capacitors
1 x IFX25001TS V50-ND 5.0V 400MA Voltage Regulator
I have tested this regulator in a bread board with 12v "wall warts". It works great and it has a lot of built in protection. It also has plenty of power to run your Atmega chip and lots of other stuff besides. Remember not to source more than 150 MA directly from your Arduino pins. (That's about 7 LEDs at full brightness.)
Put the Solder Paste on the Chip
Eat a snack, scratch your nose, rub your eyes, go potty and get any other eating, drinking and face touching out of the way for a while. Once you start with the solder paste, you won't want to do any of that till you get a chance to wash up.
Clean the board(s). I like to use isopropyl alcohol. Use the flux on every pad.
This solder paste is lead based. It's great because it melts at a low temperature and is pretty easy to work with. It's bad because it's lead and because it will get on things. Have some paper towels handy. Wash your hands well when you are done. Gloves might be a good idea, but I find they make me slightly clumsier and this is fine work.
If you aren't near sighted (like me) get your magnifier(s) set up so you can use both hands under magnification.
Look at the diagram. It highlights all the pads.
If you have a syringe that is big enough to pass the solder paste but small enough to be accurate, you can put some paste on each pad using that. I have one that sort-of works, but if you find a good size please share.
This method worked better than the syringe for me. Put some solder paste in the corner of a heavy duty zip top bag and put a needle hole in the very corner. Then just use the bag like you are frosting a (very small) cake. Concentrate on getting some paste on each pad. Don't worry if you are a little sloppy on the Atmega footprint. Surface tension will suck the solder into the center of the pads pretty well. You can fix it up with some wick and soldering iron if there are bridges. The size of the hole was key. A needle hole is too small, but you only need to widen it bit for it to work pretty good.
Use the sewing needle to touch up or clean up any spots where the paste didn't go quite right. Be gentle with it, but you can clean up the paste with it pretty well. You have a really wide tolerance for the amount of paste that will work. Go a little sparse on the Atmega footprint and more generous for the other components.
Use a magnifier and inspect your work carefully. Gently use the needle to clean up any messes or bridges.
Place Components
Make sure the cat's or kids can't knock your work on the floor while you do the next two steps. Even someone walking by can cause enough vibrations on some floors to be a problem.
For best results, print out the picture for this step scaled up to the size of your paper on a color printer. There is also a black and white version.
The trick for every component is to gently place it down with the tweezers then push very lightly down to seat it into the paste. Use the tweezers or the needle to nudge crooked parts.
The really small parts come in a strip. Using tweezers or a sharp knife carefully cut them free. These are really easy to lose in the carpet. If you grab too hard with the tweezers they can shoot out and you will never find them (ask me how I know...) . Lucky you listened to me and got spares, right?
- The only component on the board with a polarity besides the Atmega is the LED. Look on the bottom and you will see a little green arrow (unless you got some other LED). Match that with the diagram. Put it down in the paste and push it slightly down to seat it.
- Next add C3. Make sure it's not touching LED1 and clean any paste trails between them. This is the tightest fit on the board. It works fine with 0402 and 0602, but you need to pay extra attention to this spot.
- Next add L1 (the inductor)
- Add R1 and R2
- Add C1 and C2
- Add the Atmega chip. Try to line it up as strait as you can. It will "snap" a little into place, but not as much as the other components. The chip has a circle and a cut off corner indicating the corner near pin 1. The board silkscreen has the same markings. Make sure you get the chip the right way round!
- Finally add Resonator Y1. make sure it's not touching the nearest pin on the Atmega chip and any paste between them isn't a bridge.
Don't forget to refrigerate your remaining solder paste. You can seal the zip top bag and fold it over to save what is in there.
Reflow the Solder
This step is pretty easy and fast. Pay attention so you don't get burned (literally). Read through once or twice so you know the rhythm before we start the dance.
- Find a pair of tweezers that you can grab the board by a corner hole with easily. Alternately a thin bit of metal to use like a pizza peal works.
- Look under the hot plate and get an idea where the element is. You will have a hot spot here. For this small chip it doesn't matter a lot, but it's good to know.
- Heat your hot plate to 375 and wait till it's hot.
- Drop the board gently on the hot plate. In 10-30 seconds you will see the solder start to melt.
- Turn the chip or move it to the other side of the heating element to get it to heat evenly.
- Once the solder is all melted, try to get the chip off in the next 10-20 seconds.
- Using the tweezers or your bit of metal gently get the chip off the heat.
- Gently set the chip down on the piece of wood. It's still molten and you can knock stuff right off if you aren't reasonably careful.
If things don't quite look right you can add more paste and heat it again. You can also touch up individual components with a regular soldering iron if you have a gentle touch. I was able to rescue a resistor that put on upside down that way. You might be able to fix a misaligned Atmega chip with tweezers while it's hot.
I don't know how many times you can re-work these components. They datasheets say two or three is the magic number. I have reworked one board four times and it still works as far as I can tell. The LED is probably the most delicate component. You can smush the plastic housing when it's hot. The resistors and caps are really tough. You would have to work hard to ruin them. I have never ruined an Atmega chip with anything but programming the wrong fuzes. Those things are tougher than they have any right to be.
Turn off your hot plate or repeat the steps for chip #2-#n. Put your new board in a safe place and go wash your hands and take a break. You earned it! Congratulations on becoming a surface mount pro.
Fix Up Any Problems
Just get some small solder wick, put some flux on the end and put it on the problem area. A quick heat with the soldering iron and it's fixed. Turn it down a little from where you would solder through hole stuff.
Add the Header Pins
Once you solder the headers, re-work on the skillet becomes impossible. So make sure you are happy with that first. I know it's a chicken and egg problem since you need to test it before you can be sure you are happy. Use spring headers or tiny alligator clips to test if you are concerned.
- Take 6 right angle header pins and put them in the FTDI programming port. That starts in the top left at GND and ends at DTR. Solder just one pin. Check the alignment, then solder the rest.
- Take another 6 right angle pins and put them in A6-D5. Solder one pin, check alignment, solder the rest.
- Solder 8 standard pins down the left side from GND to A5. Solder one, check, continue.
- Solder 9 pins down the right side from D6-RST. Solder one, check fit in a breadboard preferably, continue.
- Optionally solder a pin in AREF. If you don't know why you would use AREF, don't bother. :)
Flash the Bootloader
Wiring from the existing Arduino
The picture shows a Pro-Mini, but any Arduino compatible should work.
- Load ArduinoISP to your existing (or borrowed) Arduino.
- Connect D9 to a resistor (220ohm-1k works with most leds) and a LED so you can see the "heartbeat".
- Optionally connect D7 and D8 so you can see what's going on. I don't normally use them when things are working.
- Connect VCC and GND between the boards.
- Connect D10 on the programmer to RST on your new board.
- Connect D11 to D11
- Connect D12 to D12
- Connect D13 to D13
On the computer
Prepare your software
- Open the Arduino IDE
- Load the ArduinoISP sketch
- Double check the Serial.begin command is set to 19200.
- Load it onto your Arduino and make a note of the serial port you used. You will need to use it below with AVRDude.
- Check the heartbeat is working. If it ever stops when AVRDude isn't running, hit the reset button.
- Install or locate WinAVR.
- Download Optiboot.hex and put it in the WinAVR bin directory
- Open a command prompt. (Start->cmd.exe)
- Use the CD command to change to the WinAVR bin directory. (remove quotes) "CD C:\winavr\bin" for example.
- Run the following command (remove quotes and use your own com port)
"avrdude -p m328p -P com16 -c avrisp -b 19200"
If all is well, you will see a chip signature of "0x1e9514" even though AVRDude says "Yikes I was expecting 0x1e951...". Skip down past troubleshooting and burn the bootloader. If you see 0x000000 or another error, do the troubleshooting.
Troubleshooting
- Hit the reset button on the Arduino, briefly ground RST on your new board and try again.
- Triple check your wiring. Did you get GND and VCC right?
- Double check your com port.
- Check the board again for defects. Use a meter to check RST, and D11-13.
- Remove all the wiring and do it over.
- Take a break, think for a while, look at the setup with fresh eyes.
- Show it to a helper and explain things. Even (especially?) if they don't care you will notice errors this way often.
- Look for help with AVRDude online, and post here with photos of your setup.
Make a file called ard328burn.cmd in the WinAVR bin directory and copy this text into the file. Change com16 if you use another port.
Code (Don't include this line)
@echo off
avrdude -p m328p -P com16 -c avrisp -b 19200
echo enter to continue, CTRL-C to exit. Hit enter if you see 0x1e9514
pause
avrdude -p m328p -P com16 -c avrisp -b 19200 -F –e
echo hit enter if there were no errors. CTRL-C to exit.
pause
avrdude -p m328p -P com16 -c avrisp -b 19200 -F -U lock:w:0x3F:m
echo hit enter if there were no errors. CTRL-C to exit.
pause
avrdude -p m328p -P com16 -c avrisp -b 19200 -F -U lfuse:w:0xFF:m -U hfuse:w:0xDE:m efuse:w:0x05:m -U flash:w:optiboot_atmega328.hex -U lock:w:0x0f:m
Type "ard328burn.cmd" and the burning should start. The first message will complain about the Signature, but that's expected. Hit enter if the signature is 0x1e9514. If it's 0x000000 something is wrong. Often this means you mixed up 11,12 and/or 13s wires. Watch each step and hit Enter if there are no errors.
Check the bootloader.
If all is well, the on board LED is blinking on and off. If not, try resetting the board. Connect RST to GND for a moment and see if the on board LED flashes and starts blinking. If the LED on the existing Arduino is flashing and yours isn't it means the only thing wrong is your LED. Maybe you got it backwards or it (or it's resistor) isn't connected. I had to touch one up with a solder iron when I got the resistor upside down on accident.
If this doesn't work, reset the Arduino and your board. Then run the batch file again. Examine the output carefully to be sure everything went well. AVRDude will read the data back and double check that it is correct.
Now you can plug in your new Arduino Compatible with the FTDI breakout. Set the Arduino IDE to "Uno" and flash a program onto the chip.
Using Your New Micro Controller
Additional Features
- 2 more analog input pins than the Pro Mini (A6 and A7 are brought out). Unlike A0-A5 these are not general purpose pins. This is how the Atmega chip works.
- Low Pass filter on AVCC
- AREF test point
- Optiboot boot loader allowing slightly larger sketches.
- No on board power regulator. (I.E. no RAW power pin.)
- No reset button.
- The board doesn't always reset when the IDE has programmed a new sketch. There is some evidence this is due to the optiboot loader on Atmega328. It could be a bad design of the DTR on the board, but DTR works for programming every time so I suspect not.
- Like the LilyPad there is no overvoltage or backwards voltage protection. I have hooked up Atmega328 DIP chips backwards and had them heat up, but live. This form factor might not fair so well. Please think twice before you connect to voltage.
Other notes
If you want to reset the board, ground RST for a moment. If you want to use power sources that vary much from +5v you will need to add a power regulator and a couple of capacitors. If you just want to run off USB power, then you are good to go. A diode "backwards" across VCC/GND might be a good idea if you worry about backwards voltage accidents.
Other than the above changes, it should work just like any other Arduino.
Programming Using an Existing Development Board.
Programming the ExtraCore (or a Pro-mini) With AVRDude and Another Arduino
Here is an alternative method if you have another Ardunio, but don't have an FTDI interface.
WARNING: This will blow away your boot loader. You can always use this method to get it back or just keep loading sketches with this method. This method is for the adventuresome or impatient. AVRdude will happily turn your board into a useless coaster if you experiment with any fuse settings. Tread with caution.
Wiring from the existing Arduino
The picture shows a Pro-Mini, but any Arduino compatible should work.
- Load ArduinoISP to your existing (or borrowed) Arduino. (see below "on the computer" for details).
- Connect D9 to a resistor (220ohm-1k works with most leds) and a LED so you can see the "heartbeat".
- Optionally connect D7 and D8 so you can see what's going on. I don't normally use them when things are working.
- Connect VCC and GND between the boards.
- Connect D10 on the programmer to RST on your new board.
- Connect D11 to D11
- Connect D12 to D12
- Connect D13 to D13
Connect the computer to the Arduino via the USB cable and determine the USB port. Mine was com16 so all my examples use that. Change to fit your situation.
On the computer
Prepare your software
- Open the Arduino IDE
- Load the ArduinoISP sketch
- Double check the Serial.begin command is set to 19200.
- Load it onto your Arduino and make a note of the serial port you used. You will need to use it below with AVRDude.
- Check the heartbeat is working. If it ever stops when AVRDude isn't running, hit the reset button.
- Install or locate WinAVR.
- Load the sketch you want to put on the ExtraCore
- Hit the "verify" button. This will compile the sketch to a .hex file.
- Locate the .hex file. (the .hex file is written to /tmp (on Mac and Linux) or \Documents and Settings\<USER>\Local Settings\Temp (on Windows)).
- Open a command prompt. (Start->cmd.exe)
- Use the CD command to change to the WinAVR bin directory. (remove quotes) "CD C:\winavr\bin" for example.
- Run the following command (remove angle brackets and use your own com port)
C:\winavr\bin\>avrdude -p m328p -P <com16> -c avrisp -b 19200
If all is well, you will see a chip signature of "0x1e9514" or "0x1e951"even if AVRDude says "Yikes I was expecting 0x1e951...".
Burn the sketch to the board
Replace the stuff in <angle brackets> with your path and sketch name.
C:\winavr\bin\>avrdude -p m328p -P com16 -c avrisp -b 19200 -F -U flash:w:<Path to your sketch>\<MySketchName>.hex
If all goes well AVRDUDE will put the sketch on the board and then verify that it worked. Your sketch is now ready to go.