Building my own ATmega328P

Hi everybody.

So I have been wanting to do this for a while and I recently acquired a lot of electronic stuff from a friend who is moving. Among all of these parts I found ten ATmega328P-PUs on a piece of antistatic foam. I ordered some 16 megahertz resonators from Digikey and built my first "Board" on a breadboard. I was planning on burning a bootloader to the chip but decided to power it on once first. Just my luck, they all seem to have a bootloader on them and the blink sketch uploaded. I've also found that I can plug any of them right into my UNO and upload sketches.

So from there, I took a Radio shack proto-board and soldered everything up with the 328 in a socket so I can remove it if I want to. I also added headers so I can actually use it and I added a 5v regulator, caps and a power and reset LED. You will notice in the picture, I have two jumpers on the board, those are so I can disable the 5v regulator if I'm using an external regulated power supply.

I'm planning to build a small DC-DC Step-up circuit to use up some of the available space on this proto-board and might throw a dual H-bridge on there as well if I have space.

Ultimately I'm going to design a PCB for this to go on, print, etch, drill and assemble that. Then, hopefully turn the whole thing into a kit. From there I would like to try and use that kit as something to help fund a makerspace that myself and some friends have been working toward getting started locally.

Anyway, my question is this. There are a few different ways one might load a sketch onto this chip through the existing GPIO. Should I also include an ICSP header on my final board to give the end user another way to upload sketches? I personally may never use this option but I feel some may prefer it for whatever reason.

I know it's a bit ugly currently but please keep in mind this is just my prototype. I am considering arranging the GPIO headers so standard shields can be used but I'm not yet totally sold on this because I'm pretty confident I can make the board smaller by omitting some of the less necessary parts.

You may also note that this board doesn't have the 16mhz crystal you might be used to seeing on an arduino board. I've used a resonator instead for simplicity. When using a crystal you also have to include two capacitors and since my current design and board availability has me using through-hole components rather than surface-mount, it would have taken up more space than I wanted to make available. These resonators have the two capacitors you need inside, making it a 3-pin package rather than a 2-pin for almost the same cost. Link to the resonator I used at Digikey

What is the kit? - Scotty

Yes to the ICSP header, makes it easier to put a bootloader on to new parts, or to upload a sketch if no bootloader is installed. Otherwise, an adapter cable is needed to access the needed pins assuming you make them accessible somehow.
I prefer a crystal for the better frequency accuracy (30-50ppm vs +/-0.2%) and stability.
(I think 50ppm = 800 Hz variation, 0.2% = 32000 Hz variation)
36 cents vs 40 cents for the resonator at low quantities.

And like everything, parts can be found for less if you look around:
http://www.dipmicro.com/store/XC7-16000

To Scottyjr: The kit I am planning is simply going to be a printed circuit board and all of the components you would need in order to build a working ATmega controller, similar to the one I have pictured above, plus the missing components but will be arranged a little better once I have designed the final circuit board. Obviously it's not something anybody will really "need" compared to the products that Arduino makes, but it will hopefully appeal to people who like building their own stuff to get to know the parts a little better.

To CrossRoads: Asside from simply being easier to solder up, not having to also deal with ceramic caps. I will refer you to this Resonators vs Oscillators Additionally, I don't do anything extremely precision with the ATmega328 (yet) and have not noticed any inaccuracies yet. I did, however, also pick up some crystal oscillators and do plan to compare both side by side to see if I do actually notice any difference.

And thank you for your input on the ICSP. I will add that to my design.

You can solder surface mount capacitors between those tracks on a through hole board. I do it all the time. They take up very little space.

Grumpy_Mike:
You can solder surface mount capacitors between those tracks on a through hole board. I do it all the time. They take up very little space.

That is true, but for the sake of the kit I want to design, I'm planning to stick with through-hole components as they're easier to work with, and will be easier for a novice to identify.

..Plus I don't have surface mount components.

I'm working on the next part of the prototype now that more of the parts I've ordered have arrived. The DC-DC step-up converter. I wanted to include this mostly because of personal preference. I would rather power micro controllers with smaller rechargeable batteries like LiPo cells, or at least fewer rechargeable AA cells. This will allow the whole controller to fit into a smaller footprint and have the same functionality. Also, you don't have to build or purchase additional circuitry in order to run your board off of a LiPo.

Long story short. I wired up a circuit in a hurry before work hoping to be able to test something before I left, but when I checked my output voltage I was getting 36.2v rather than 5.2v. Kind of impressive for two AA batteries but not really what I'm going for. I'll tear that down in the morning and try rebuilding it.

This circuit is built around the LT1302 if anybody is familiar with it. I'm using a 10uH inductor rather than the 100uH inductor found on the MintyBoost version 3.

More on the DC-DC step-up circuit..

I rebuilt the circuit going from a slightly different schematic and now I'm getting a very usable 5.02 volts. This seems to be enough to power my Arduino UNO and the controller I'm building on a proto-board but, does anybody know what components I might be able to swap out for slightly higher output voltage? Or maybe an adjustable voltage?

I have tried using different ceramic capacitors and I have also tried various different resistors but none of them seem to change the voltage at all. This being said I'm not entirely sure how this circuit works and honestly couldn't explain it to somebody. Can anybody explain it to me? :smiley:

This is the schematic I've built my circuit after, excluding the resistors on the output, since I'm not powering a USB device with this.

One note: I've got a 27k resistor off of pin 2 of the IC because that's what I have available, more digging could have found a 20k but as I previously mentioned, the ceramics and the resistor seem negligible to the performance from my observation.

Where is the part of the project where you /build/ your own Atmega328P? I was expecting to see that.

// Per.

Zapro:
Where is the part of the project where you /build/ your own Atmega328P? I was expecting to see that.

// Per.

I used that wording because I don't want to use the term "Arduino compatible" I am considering everything that is open source to not belong to anybody so calling it "Arduino compatible" could be misconstrued as me saying it's a knock-off or a copy when in reality I just don't have anything else to compare it to. I would welcome any other name I could give to the device I'm working on though.

does anybody know what components I might be able to swap out for slightly higher output voltage?

I would strongly recommend you do not power 5V devices with any bigger voltage.

However, it you want to get more out of that circuit remove pin 4 and connect it to the center point of a potential divider between the 5V and ground.

Grumpy_Mike:
I would strongly recommend you do not power 5V devices with any bigger voltage.

My thought there was sag compensation. Since it's only doing 5.02 volts wouldn't I essentially start having under-voltage issues using this to power an ATmega328P and a few additional things? Perhaps a rangefinder and a servo? Or a handfull of various sensors like gyro/compass, thermometer, altimeter? ...Without eluding too much into what I'm intending to build :slight_smile:

Since it's only doing 5.02 volts wouldn't I essentially start having under-voltage issues using this to power an ATmega328P and a few additional things?

No, the switching supply should not "sag". This is because there is a feedback loop that prevents any sag in output.

600mA rated DC-DC converter. Should 5V unless you are drawing too much current with the various sensors that you "elude" to.
You may need a 2nd converter to supply 3.3V also.

So when I initially incorporated the LT1302 "DC-DC step-up circuit" into my prototype and moved the jumpers over so the controller was using that output power the controller behaved as if it was restarting rapidly, as if the power source was unstable or outputting alternating current. I was able to resolve this with the addition of a capacitor between the positive and negative rails. To that end, the 5.02 volts doesn't seem to be harming anything.

This week/weekend, I'm going to set the board up on one of my robot chassis and play around with driving some DC motors, a single rangefinder and a servo. I've already used this robot with an UNO, a Dumilanove and a Nano clone so I know what kind of behavior to expect and will use the same sketch I've used with the others. If all goes well with that testing I'll move on to the next phases. That's going to split off into making the kit, as I previously mentioned, a printed circuit board, a bag of parts and some instructions. The profits from which will be going toward a non-profit for the local maker-space in the works. The other half of that split will be research for my other project that I'm trying not to talk too much about yet. If you've seen some of my other threads you probably already know what it is.

Oh yeah, I'll also be putting in the ICSP header so I don't have to pull out the ATmega every time I want to put a new sketch on it.

Here's an image of the board with both inputs powered, In this picture I have the jumpers off so there's no power going to the controller. Still plenty of space for the ICSP and whatever else I might decide to add on, if anything. As far as 3.3v goes, I haven't had a need for it since I stopped building things with the raspberry Pi. So I might not be including that.

sigh..... this thread was about USING a 328

I was kinda looking forward to see how one would build their own 328

to build ur own arduino board below these need

  1. avr pocket programmer to upload code(https://www.sparkfun.com/products/9825)

  2. atmega328 IC

you need to build circuit in atmega

build ICSP circuit,
power circuit supplying 5v
blink circuit to check code.
reset circuit

make ensure you use proper crystal & capacior being used

I'm sorry that the title of this thread is somewhat misleading, I did not realize at first that people were going to think I was actually building a 328P itself. Considering it doesn't look like Atmel has published the internal schematic of the controller, I don't see how anybody would think that, but I suppose maybe the schematic is out there somewhere.

I'll be waiting until later this weekend to add the rest of the components to my prototype board as I've been asked by my maker group to bring it to our Friday meeting and demonstrate it's use. Because of that, I've attached the board to one of my robot chassis with a motor driver on a small breadboard for a nice live and somewhat interactive demonstration.

It's a little hard to see from this image but I've added some headers on the power rails for 5v and ground and have the servo connected to those. Input voltage is going first to the breadboard and the dual H-bridge along with a nice big capacitor and then to the voltage regulator. Pins 2,4,7 and 8 control the two geared motors and pin 9 controls the servo. Not visible is an HC-SR04 connected to pins 12 and 13 and in the bottom layer of the chassis are five rechargable AA batteries. Yes, I am feeding a little too much enable voltage to my H-bridge but only running for a few minutes at a time, it doesn't damage the bridge (L293D). Once that is integrated into the board a lot of this mess of wires will be eliminated and I'll be feeding a regulated 5v to the bridge. Input voltage for the motors will be switchable between the 5v onboard power and an external power source since the L293D can handle up to 36v.

The final kit is going to be all through-hole components and the three ICs will be in sockets so they can be removed. The top surface of the board will be screened to better indicate what goes where and also to identify the headers. I'm also going to include some assembly instructions. I've not built a complete parts list yet so I cannot speak of the cost but I'm hoping it will be inexpensive enough that folks interested in the project will want to pick one up.

Later I'll be planning an all surface mount variant of the board, excluding the things that I don't want on that version as it will be purpose built. It will have solder pads instead of header pins and most likely will not have a motor driver and will be powered by a constant current bus driven by a single LiPo cell and a PV.

http://forum.allaboutcircuits.com/proxy.php?image=http%3A%2F%2Fwww.dansdata.com%2Fimages%2Fcaselight%2Fvero500.jpg&hash=d7b17bd9b2b104047f4e3fb79c3e791a

  1. you should try to send us schematic of build circuit. its difficult to trace image where it gone wrong

  2. i have attached PCB board used. you must always use board @ bottom in image attached. you used PCB board which is on top.top prototype PCB board have seprate GND & VCC path, If they get shorted or connected via pad might cause problem

3)while uploading code r u getting any error , if yes post the error messge

AMPS-N:
http://forum.allaboutcircuits.com/proxy.php?image=http%3A%2F%2Fwww.dansdata.com%2Fimages%2Fcaselight%2Fvero500.jpg&hash=d7b17bd9b2b104047f4e3fb79c3e791a

  1. you should try to send us schematic of build circuit. its difficult to trace image where it gone wrong

  2. i have attached PCB board used. you must always use board @ bottom in image attached. you used PCB board which is on top.top prototype PCB board have seprate GND & VCC path, If they get shorted or connected via pad might cause problem

3)while uploading code r u getting any error , if yes post the error messge

While I appreciate your readiness to provide support, I don't know where you got the idea that I was having a problem with my prototype. It's working perfectly. Did you read any of my posts?