DIY Sanguino

Not long after I got my Arduino I was already craving more I/O pins, more interrupts, more serial ports, more capabilities. That's when most people would look to the arduino mega, but I  was looking for something more touchable and more importantly, cheap. That's when I ran into the ATMega 644P while browsing parts online. A few days later it was in my hands. Of course I wasn't the first person to think of this. This kind of board goes by the name Sanguino and more info about them can be found here:

That website has all the info you need to build your own, but I'll show you how I did it with basic, cheap components.

Here are the parts I used:
 And here they are in list form: (*=bought, otherwise scavenged from junk)
1. *ATMega 644P
2. *pcb - breadboard style layout
3. *40 pin DIP socket
4. *20 pin wire sockets (x2)
5. *2-wire screw terminals (x2)
6. *22pF ceramic capacitors (x2)
7. 100uF 16V electrolytic capacitors (x2)
8. 100nF ceramic capacitor
9. 16MHz oscillator
10. 10k ohm resistor
11. 470 ohm resistor
12. LED
13. 7805 5V voltage regulator
14. button switch
15. 22awg solid wire

I had previously laid everything out and made all the wire pieces. I also painted the terminals for color coding, but that was a mistake as you will see.

I had to slightly modify the board to mount the wire terminals. I cut and scraped the trace off in two places and soldered some jumpers in.

The next step was soldering in the terminals and wires. The long one on the right is actually two wires. One is on top of the other. You can see that the paint is halfway rubbed off already. Also, note that the two rows on top are ground and input voltage rails. The two rows on bottom are ground and+5V rails. The terminals take +inputV, ground, ground, +5V from top to bottom. I can either supply 7-12 volts(inputV) to a 5V regulator or 5 volts directly via the +5Vterminal.

 Then come the sockets and button. Notice that I am utilizing the space beneath the chip. Those wires are for the Vcc and ground pins on either side.

Then I soldered in the rest of the components. The 22pF capacitors connect both sides of the oscillator to ground. I know it is good practice to put the oscillator as close as possible to the chip, but this is really the only place I could possibly put it. One of the 100uF capacitors is on the input side of the 7805 regulator. The output side has another 100uF cap as well as a 100nF ceramic capacitor. The reset pin is pulled up by a 10k resistor and also goes through the switch to ground. The power LED makes use of the 470 ohm resistor. Finally, I colored the ground terminals black, with a marker this time, and popped in the ATMega644P.
This was about as compact as I could possibly make it. Actually, is just about the same size as an arduino uno. The space restrictions necessitated some interesting wiring techniques such as these wires running between the legs of the regulator.
And of course, here is a look at the underside. Can you spot the unsoldered pin? I noticed it after taking the picture and soldered it up. 

Now for the hard part. 
Actually, before I did any of this I wired up everything on a breadboard and burned a bootloader onto the chip. This was done using an arduino as an ISP. The bootloader and matching header file came from . If you try this, you will most likely run into an error when you try to burn the bootloader. It will look like: 
avrdude: stk500_getsync(): not in sync: resp=0x00 
There may be some variation on this.
This comes from the fact that your ATMega644P is still using the internal oscillator at 8MHz. There are lots of solutions posted around the web, but the one I found least scary was this:  
1. Go into this file in your arduino directory hardware/arduino/cores/arduino/HardwareSerial.cpp  
2. Look for the line that says  #define SERIAL_BUFFER_SIZE 64 . 
3. Change the 64 to 128 and save. 
4. Reload the ISP program onto your arduino and try again. 
If you are as lucky as I, it will work now. After you have the bootloader burned, you can go change the 128 back to 64 and things will still work. If this doesn't work, search around on google for another answer.

Now finally I can start using it. I can conveniently use the arduino IDE and the arduino as an ISP to program it. Another hint: to upload, don't use the upload button in the IDE. Go to the tools menu and select: programmer - arduino as ISP. then go to the file menu and select "upload using programmer". 

Here is the celebratory first blink test. Oh and also note that little red jumper in the middle of the top row. That connects +5V to the analog reference. It will probably stay there permanently, but it gives me the option of using a different analog reference, I think.

Good luck, and enjoy!


SDragon said...

Where did you buy the parts?

ME said...

@SDragon -
I bought them from Akizukidenshi. Unfortunately they only ship inside Japan, so unless you live here that doesn't really help.

Anonymous said...

Could you please give me a detailed description about how you built the line following robot?

Edwin said...

Well done. I have never seen such a breadboard like PCB. Good to know they exist.
Sadly, at AliExpress I can only find the TQFP chip and that is no option for DIY

Kotori said...

You can usually pick up a couple of 644/1284 DIPs as free samples from atmel.

Anonymous said...

I bought a similar kit from Germany:
Search with Sanguino on the page