Sample barebones ATMega328P SMD layout board available

I have written up a recently completed project that I thought might be helpful to others. It may be old hat to many of you, but something like it would have been of great use to me when I started on it, so I present it here in the hopes that it may be of interest to someone else. It is basically a barebones Arduino PCB layout using SMD parts, efficiently powered off AA batteries for wallwart-free installation. It is in the same vein as a "breadboarduino", except you do it in Eagle instead of with wires.

Once you have a prototype Arduino-based project working, what do you do next? A lot of projects that I see just stop there, and that is fine. But the downside is that you have to dedicate your Arduino to that one function, and provide it with a steady diet of DC power. I wanted to do a simple project that would end with a nice enclosed board, self powered with AA batteries, that would run for months at a time.

Most of the available mini Arduino boards (say, the Arduino Pro Mini) use an LDO and most have a power LED. Both of those draw continuous power, and would need to go. I found jeelabs.org had done a lot of work on mobile low-power Arduino systems, so I used the boost converter that he uses for an AA power board, the LTC3525. It comes in 3.3V and 5V versions; I opted for the 5V because the sensor I am using requires it, but for the lowest power draw the 3.3V would be preferable.

I was unable to find any sample layouts for a barebones Arduino SMD setup, although there are plenty of bread board examples. I cribbed the essential circuit schematics from the Arduino Pro Mini board, removing all the extraneous pin routing to headers, and from the LTC3525 datasheet. A friend of mine helped me with the layout (staring at a mass of tangled air wires is the hardest part to work through, even for such a simple board), and threw in an ICSP 3x2 header and a serial header with DTR brought out for auto-reset using SparkFun's FTDI breakout board. All parts are 0805 or larger, except for the TQFP ATMega328P, and the whatever-it-is (but very tiny) LTC3525.

Some helpful notes to anyone who wishes to go down this path:

  • Hand soldering fine pitch SMD parts isn't that hard, and you don't need an expensive Hakko. I used my trusty 30W Radio Shack iron. Get some flux, some copper braid, and google "drag soldering".
  • What is hard is soldering the SMD ceramic resonator. I used the SparkFun footprint, which places the pads completely underneath the package. I was able to solder it by offsetting it slightly on the pads to be able to reach them. This was only after ruining my first board when I didn't have it soldered correctly, then tried to burn a bootloader. If you set the fuses to require an external oscillator, and the oscillator is not installed properly, you will not be able to recover. In the future, I will redraw the pads, or use a through hole resonator.
  • Another error I made was not checking the microcontroller data sheet before routing my project pins. I mistakenly used pin 19, ADC6, expecting to address it as an output. Turns out, it is a read only pin.
  • For a truly barebones setup, you can delete the external resonator and the serial pins/header/pullup, leaving just the ICSP for programming. The USBTinyISP programmer is cheap, and I can recommend it. You can also set up an Arduino as an ICSP programmer. Having a serial port really makes for easier debugging, which is not necessary if you already have a working sketch. If you remove the resonator, you must be familiar with (or learn about) setting fuses to use the internal clock. Or you can use it as-is, but it will run 8 times slower than you expect.
  • I used an 8 MHz oscillator because I didn't need the faster speed, and wanted the least amount of power use. 16 MHz is as simple as using a different oscillator and a slightly different boards.txt entry. I cribbed mine off the 8 MHz Arduino Pro Mini board spec (pro328), use pro5v328 for 16 MHz.

To reuse the files for your own project, simply delete the three LEDs and their resistors. Plop down your own components/headers in the schematic, and route them. Some basic familiarity with Eagle is required, but having something minimal to start with is (would have been) a great help. Minimum incremental cost for a new project is ~$25: $4 for microcontroller, $4 for boost chip, $17 for 5 PCBs (including shipping) from seeedstudio.org or similar hobbyist fab, a bit more for resistors/capacitors/etc., then whatever else your project needs.

Some project-specific points of interest: the project is a parking aid, to tell you when to stop when parking, using the cheap HC-SR04 module ($2/each on ebay). It uses the jeelib library from jeelabs to enter deep sleep between ping attempts. It uses the NewPing library to interface to the sensor module. There are three LEDs, green, yellow and red; the green and red LEDs are either on or off, but the yellow one blinks at a rate proportional to the sensed distance. The blinking is handled through an interrupt handler using TIMER1 in CTC mode, so that the main loop does not have to account for it. There is a simple state machine to determine the ping cycle: 100 ms for active sensing during parking, 1 minute for a parked car, and 2 s for an empty bay.

The project writeup is here: Ultrasonic Parking Aid without Arduino | Hackaday.io
Eagle source files, project specific firmware, and STL files for the 3D printed project enclosure are here: GitHub - jinschoi/parking
Project test video: - YouTube

I have not tested the actual power drawn, but given the low duty cycle, I expect "months" is not an unreasonable estimate.