Introduction: Switchable Dual-Voltage (3.3v/5v) Hacduino
a Radio Shack PC board (solderable breadboard) with a triple-pad IC
layout. It turned out to be, essentially, an Arduino Duemilanove clone,
complete with headers for plugging in shields. The result was more than
satisfactory, but I needed a denser parts layout this time.
I wanted a Hackduino that would run at 3.3 volts (but retaining 5 volt compatibility),
which would permit direct interfacing with 3.3v sensors and peripherals
(and with a Raspberry Pi!) without having to use level shifters.
It would be also be nice to have an on-board plug-in socket for a Nokia 5110 display,
since that (allegedly) runs on 3.3v. Headers for shields were superfluous because I
already had laying around quite a number of factory-built Arduinos that
would serve that purpose. Result: a tailor-made special purpose Hackduino.
Let's call it a Hacduino.
I build this one on a stripboard and that proved to be more suitable
than a solderable breadboard for a dense and efficient parts layout.
It's especially useful when there are terminal points with multiple
Features of the Mark II Hacduino:
- On/off power switch
- Switchable between 3.3v and 5v to the Vcc buss (& voltage indicator?)
- D13 LED can be enabled/disabled by a jumper
- Wired on-board socket for a Nokia 5110 monochrome display
- Uses standard (cheap) hole-through ATMega328 chip
- Highly customizable -- can optionally add extra header strips for power and I/O.
An ATMega 328 powered at 3.3 volts with a 16 MHz clock is running out
of spec. Effectively, it is overclocked. I have not had any problems with
this, but I certainly would not run an overclocked CPU on mission critical
projects, such as controlling industrial machinery or even home automation.
For hobby purposes, it should be just fine, though.
Step 1: What You Will Need
- 1 or 2 2-position pc board screw terminals
- ATMega328 (28-pin hole-through version)
- 7805 voltage regulator (5v)
- LM1117T-3.3 voltage regulator (3.3v)
- 1N4001 diode
- resettable polyfuse
- 100 uF capacitor (25v)
- 100 uF capacitor (10v)
- 3 - 5 .1uF capacitors
- 2 - 22 pF capacitors
- 2 - 1K resistors [R1, R2]
- 10K resistor [R3]
- 1 - 16 Mhz crystal
- 2 - LEDs (each a different color)
- mini-pushbutton switch (normally open)
- 2-gang 3-position paddle switch
- 2 strips 40-pin female header
- strip of 6-pin male header, straight
- strip of 6-pin male header, bent (optional)
- strip of 3-pin male header
- 1 - 28-pin (narrow) IC socket
- 2.1 mm coaxial (power) jack, panel mount
- 2.54 mm pc board jumper
- 1 - two-position screw-terminal block (second one optional)
- 2 - female-to-male Dupont-type jumper cables
- Nokia 5110 display, or equivalent **
- Panel meter, miniature, 0 - 30 volts (optional)
- Spacer (2" approx.), and 1/8" bolt with two nuts (optional)
- Small case (I used a "cream cheese storage container," $1 at Big Lots)
- hookup wire
- removable adhesive putty, picture/poster mounting type *
** Note that some of the cheaper 5110 displays sold on eBay are a bit odd.
Some require 3.3v on the display's Vcc pin, but others may need 2.9v,
or even something between 4v and 5v, even with the logic pins at 3.3v.
Best to find a trusted source for these, even if you have to pay a
bit extra. And even a good 5110 display has relatively low contrast,
as compared to a standard backlit 16x2 LCD. That is an inherent
shortcoming of these displays.
- Soldering iron, fine tipped
- Needlenosed pliers
- Wire stripper
- Wire cutting shears (Plato or equivalent)
- Rotary tool, Dremel or equivalent [and goggles or other type of eye protection]
- Clamp or vise suitable for holding a small PC board while soldering (optional)
Step 2: Planning and Layout
We will be constructing our Hacduino in sections, for ease of assembly.
Choose one end of the stripboard for the power supply module. This
will take up approximately 1/4 of the board real estate. The positive
and ground wires from the case-mounted power jack will attach to a
two-position screw terminal block, and from here the positive input
voltage will go to a polyfuse, then to a 1N4001 diode, then to filter
capacitors, and finally to a paddle switch selecting the appropriate
regulator.* We will reserve one connector strip for each of the Vcc and
Ground rails, both at the top and the bottom of the board -- a total of
four strips. The power rails will get one 100 uF electrolytic capacitor
and several .1 uF ceramic caps for filtering.
* The paddle switch also has a center power-off position.
The remainder of the board is for the ATMega328 and associated components.
Of course, the '328 will be socketed, and we will use a crystal, rather
than a resonator. There will be a programming header -- either a 6-pin
straight header, or the bent variety -- or both, for redundancy.
A sketch on quadrille or engineering notepad paper might be helpful at
Step 3: Using Stripboard
Unlike solderable breadboard, stripboard has on its copper side a
series of parallel conducting strips, separated by non-conducting
channels. Building a project on stripboard requires a bit more planning
than conventional boards, but it permits a denser and more efficient parts
layout. The general practice is to position and solder the components
in each functional section, then to partition off the conducting paths
by cutting the strips. The cutting may be done with a sharp blade,
an appropriately sized drill bit, or with the cutting disk of a rotary
tool. I prefer the last method.
Always wear eyeprotection when using a cutting disk with a rotary tool.
The disks have a tendency to shatter, and the fragments fly in all
directions. If your naked eyeball is in the path of a flying fragment, then
you will learn the true meaning of "blind fool."
Step 4: Building It: the Power Supply Section
Refer to the schematic and pictorials for building this section. Of
course, you will need to use your own judgment as to how closely to
follow these instructions (there's more than one path to the destination!).
A 9 - 12 volt (DC) wall wart with a 2.1 mm male coaxial plug will connect
to the 2.1 mm female coaxial power jack mounted on our project box.
We will wire the positive and ground terminals of the jack to a 2-position
screw terminal block on the hacduino board. It follows that the screw
terminal block is the first to be positioned and soldered on the edge of
the power supply section of the board. Solder the positive and ground pins
of the screw terminal block to the board and connect the ground pin,
via a neighboring hole on its strip, to the ground buss strip. With a
fine-tip black marker, mark the positive and ground input terminals of
the screw block. This will avoid confusion (and mistakes) later.
On the same edge of the board, but on the other corner, position the
paddle switch. This switch has three positions, and we will use Left
for +5v, Center for Off, and Right for +3.3v. Press the pins of the
switch down into the corresponding holes in the board, but solder only
one pin to hold it in place. When we have made the other connections to
the switch, we will solder the remainder of the pins.
Now, back to the screw terminal block. The positive pin connects to
one pin of a polyfuse. This is a component that looks like a small
capacitor, but its function is to protect everything the circuit
by ceasing to conduct current when it overheats, as in the case of a
short or too high a current draw. When it cools down after power off,
it automatically resets. Think of it as a resettable fuse.
The polyfuse connects to the positive (non-banded) terminal of a 1N4001
diode. The diode protects the circuit from input power with reversed
The diode connects to the two input capacitors, 100 uF and .1 uF.
These filter out ripple in the input power, and they must be rated
for 16 volts or better. If using a 12 volt wall wart, then the rating
should be 25 volts. Be mindful of the polarity of the 100 uF electrolytic
capactor. The .1 uF cap is likely non-polarized.
The banded end of the diode and positive pins of the capacitors go to the
center pole of the switch. You can figure out the function of each of the
switch terminals with the help of the ohms function of your multitester.
The switch has two more poles. One connects to the In terminal of
the 7805 (5-volt) voltage regulator and the other to the In terminal
of the 1117-3.3 (3.3-volt) voltage regulator. The Ground terminal of
each regulator connects to the ground bus. The Out terminals of both
regulators connect together and are wired to the Vcc buss (see schematic).
This seems like an odd state of affairs, with the Out terminal of
the switched-off regulator still connected to Vcc, but this will not
damage it because its internal pass transistor and associated resistors
prevent it from conducting more than a trickle of current when its Input
On the output side of the power supply, we have a second set of 100 uF
and .1 uF capacitors for filtering. These need to be rated for only 10
v. Finally, there is a colored LED -- red is nice -- to indicate that
power is on. The LED needs a 1K ohm current-limiting resistor to
keep it from drawing too much current and burning out.
After soldering, cut through the conducting strips on the solder side
of the board to isolate groups of components, as necessary. Refer to
Now, we'll do a preliminary test of just the power supply section.
First, do a visual check? Do you see any shorts or anything wrong?
If not, then proceed.
Connect a 9 - 12 volt wall wart with a 2.1 mm coax output plug to
the input power jack of our board. Flip the paddle switch to the 5V
position. Does the indicator LED on the board light? If not, remove power
immediately and recheck the board for solder bridges and incomplete cuts
on the conducting strips. If the LED does light, then leave the power
on long enough to measure the voltage with a multitester from the Vcc
to the Ground buss. All okay? If so, then repeat the test for the 3.3V
position of the switch. Flip the switch back and forth a few times just
to make sure. Test that the center position of the switch does turn
the power off, as intended. If the power section works as specified,
we can go on to the next step.
Step 5: Building It: the CPU and Associated Components
For the following step, we will refer to the main circuit schematic
and to the appropriate pictures.
We have reserved the remaining section of the board for the ATMega328.
Position the 28-pin socket* for the '328 about 3/4" away from the two
regulators and the switch, centered across the width of the board.
Solder the pins of the socket. Now, cut off two 14-pin sections of
the the female header strip. Emplace one each of these on either side
of the 28-pin IC socket, lined up evenly with both ends of the socket
(see pictures). Solder the pins of these strips.
* There are two varieties of 28-pin IC sockets.
For this project we use the narrow kind,
to accommodate an ATMega328 chip.
It's almost time to place and connect the essential '328 support
components. But first let's hook up Vcc and Ground, to pins 7 and 8,
respectively, of the 28-pin IC socket. A .1 uF capacitor goes between
these two pins, to handle power spikes. Pin 20 connects to Vcc and pin
22 to Ground -- these are for the analog portion of the '328.
Pin 1 (Reset) of the '328 needs to be pulled up to Vcc for reliable
operation, so we connect pin 1 of the IC socket to the Vcc rail through
a 10K resistor.
A 16 MHz crystal goes from pin 9 to pin 10 of the IC socket. These two
pins also have a 22 pF capacitor going to Ground. This will provide the 16
MHz clock for the '328. As an alternative, you could mount a 16 MHz resonator,
rather than a crystal. A resonator does not need the capacitors, but is not
as accurate for micro-timing.
Finally, we will connect an LED from pin 19 of the socket through a 1K
current-limiting resistor to Ground. This will be the notorious D13 (SCK)
blinking LED. We will include a 3-pin male header as a switch to
enable/disable this LED.
After soldering, cut through the conducting strips on the solder side
of the board to isolate groups of components, as necessary. Refer to
Whew! We're almost done.
Step 6: The Smoke Test
Now we'll see if our Hacduino actually works.
First, check all soldered connections and make sure the cuts on the copper
strips are clean and have no hairline bridges. Use the ohms setting on
your multitester or a continuity tester, as required.
Program an ATMega 328 chip with the Blink program on a working Arduino.
This sketch will blink the LED at D13 if the hardware is functional.
Now, carefully remove the '328 from the Arduino with a chip puller,
if available, or with a small straight-bladed screwdriver. Insert the
'328 into the socket on our board. (Power must be off!) Make certain
that pin 1 of the chip lines up with pin 1 of the socket and that no
pins of the chip have bent when you pressed it down. Take a deep breath.
Connect the plug of the wall wart to the power jack of the board. Flip the
switch to the 5V position. Does the power LED light? Does the D13 LED
blink? If so, congratulate yourself, then flip the switch to the 3.3V
position and repeat the test. If any problems, check the solder side of
the board for shorts and mistakes. Don't sweat it if things don't work
the first time. Troubleshoot, fix, and try again. The '328 chip can stand
being plugged in backwards (I've done this at least once!) and probably
survive a short or two, though that may shorten its life. In any case,
hole-through '328 chips are cheap enough to replace -- only three or
four bucks apiece.
Credit: The illustration for this section is used here with permission
of its photographer/artist, Stefan Krause, who released it under a
FAL Free Art License.
Step 7: Building It: Finishing the Board
Refer once more to the schematic and the pictures for this step.
We need to add a reset switch and a programming header. A few assorted
female header strips for Vcc, Ground, and possibly for a digital IO pin
or two might be nice, as well. An enable/disable jumper for the D13 LED
would certainly be useful.
First, let's build a socket for the 5110 display. This display has a total
of 8 pins, so we'll need two 8-pin sections of female header. These
will mount right next to each other, as one 8-pin section will be
the actual socket for plugging the display into, and the adjoining one will
be for connecting wires from the '328 chip -- the power and signal
lines. Position the two rows of headers about 1/4" down from the CPU
socket (see the pictures). Use a couple of dabs of adhesive putty to
hold the headers in place, then turn over the board and solder them in.
Mount the mini-pushbutton (reset) switch in a convenient location near
the edge of the board farthest from the power supply section. Make
certain that the pushbutton will be easily accessible even after the
5110 display is plugged into its socket. Before mounting the pushbutton,
use the resistance setting of a multitester to determine how the pins
are internally connected (two sets of two). One terminal of the switch
connects to pin 1 of the '328 socket (RESET) and the other to the
Mount a (bent) 6-pin programming header on the far edge of the board,
according to its schematic. The pins are Ground, N.C.*, Vcc, Tx, Rx,
and DTR, respectively. DTR connects to pin 1 of the IC socket through
a .1 uF capacitor. You may optionally add, in parallel, a 6-pin female
header and/or a (straight) 6-pin male header, for easy access vertically
if mounting the project in a small case.
* N.C. = Not Connected
We now add female header strips for extra access point to Vcc, Ground,
and perhaps one or two of the '328 digital pins. Mount these so they do
not interfere with the other components on the board.
Step 8: More Tests
Power up the board. Is the power LED lit up? Is the D13 LED blinking?
Well, It's good to know that we haven't made any major blunders
or blown anything up in the last step.
Hook up a programming cable or FTDI breakout board to the programming
header we just installed. Connect it to your laptop computer's USB
port and fire up the Arduino IDE. Pull up the BlinkWithoutDelay sketch
from the Examples/2.Digital menu and change the _interval_ (blink rate)
parameter to 200. This should cause the D13 LED to blink five times per
second. Now, try uploading the sketch. Does the upload work? Does the
LED start blinking rapidly?
If all is okay so far, we can proceed to the last test. Unhook the board's
cable from the laptop and locate the Nokia 5110 display. This is small
monochrome screen used in a previous generation of cell phones. It can
do crude graphic and display six lines of text. Best of all, there is
a nice Arduino library (Adafruit's PCD8544 library)for both text and
graphics for the 5110. There is a test sketch included with the library
Wire up one row of the prepared socket with appropriate wires:
pin 7 - Serial clock out (SCLK)
pin 6 - Serial data out (DIN)
pin 5 - Data/Command select (D/C)
pin 4 - LCD chip select (CS)
pin 3 - LCD reset (RST)
The other three pins are for Vcc*, Ground, and Backlight. Note that
there is no standard pinout for the 5110 displays, so you need to pay
attention the labeling of the pins on your particular unit. The sketch
may be changed to permit alternate wiring on the socket.
PCD8544 nokia = PCD8544(7, 6, 5, 4, 3);
---> X X X X X
* Note that some 5110 displays work best at about 2.9 volts. A 100-ohm
resistor from the display power pin to the Vcc buss takes care of this
nicely. Other 5110 displays work at odd voltages between 3.8 an 4.5
bolts. I find these pretty much useless unless in conjunction with
a level-shifter. On still others, the metal tabs on the reverse side need tightening.
With the wiring row of the socket complete, plug in the display. Reconnect
the board to the laptop computer with the programming cable. Upload to
the board an example from the Arduino 5110 (PCD8544) library package.
Does it work?
Step 9: Notes
As an afterthought, I added a a miniature panel voltage meter to the
hacduino. It's mounted on a standoff, secured with a machine screw
through one of its mounting holes. These meters are cheap and this
added touch provides a bold visual double-check of what voltage
the Hacduino is running at.
It would be nice if Atmel tested their hole-through 328 chips at 3.3v
before releasing them to the market. They could even charge a slight
premium for 328s certified at 3.3v and many would gladly pay it. I
believe Intel did something like this at one time with their CPU chips,
but that's a story for another day.
I've incorporated a number of Nokia 5110 displays in projects. When
they work, they're a great alternative to 2x16 LCD displays, and it's
nice that they run at 3.3v with a low current draw. But, as previously
noted, the 5110s have a couple of problems.
1) There is no standard pinout.
2) Some 5110s need odd voltages at their Vcc pin, either slightly
lower or higher than the 3.3v that their logic takes. Lower than
3.3v can be obtained from a 3.3v system buss with a voltage-dropping
resistor. Higher than 3.3v can be a bit problematic.
What I'd do differently next time:
1) Use a ZIF socket for the '328, rather than a standard IC socket.
2) Add a socket for a 16x2 LCD display, in addition to the one
for the 5110. It's so nice to have options.
3) Have 5 and 3.3 volt busses available, regardless of the power switch
So, of what use is a Hacduino running at 3.3 volts? Well, fellas and gals,
for a start you can directly interface it, via the serial lines for
example, to a Raspberry Pi or a Beaglebone Black. Or, you can hook it up
to a Mighty Ohm geiger counter, as I did. And best of all, many sensors,
peripherals, and displays require 3.3 volts, so the Hacduino can directly
interface to them without need for level-shifter hardware.
Step 10: Hacduino, Version 2.5
I did build a second Hacduino, incorporating most of the wish list of features discussed
in the previous step. Note the ZIF socket for the ATMega328 and all the general
purpose plug-in sockets for breakout boards, modules, sensors, and the like.
Another change I made was having the D13 LED unwired from D13,
and thus able to be hooked up to any digital port.
I built it on an Archer 276-153 bare PC board that Radio Shack used to sell a few decades back.
As for the rest, well, it was mostly spare parts I had laying around. So, let's call this an
The second pic shows a Nokia 5110 display inserted and wired up, and also an
Adafruit GPS breakout board. It works great!
The third and fourth pics show my Mark III Hacduino, this one with headers that accept standard Arduino shields. The voltage is continually adjustable by a pot from 2v to 5.5v. It also features pins on the bottom of the board suitable for plugging into a solderless breadboard for prototyping and experimenting. Of course, it also has such "standard" add-ons, such as on-board piezo buzzer and 8x2 general-purpose header for plugging in a Nokia
5110 display or SD card breakout board.
The final pic is yet another variation of a Hacduino, one built on an old blank circuit board I had laying around in my junk box. This one has a cruder look than my other Hacs, since I had to do more improvisation, and hand-wire the power busses.
Participated in the