Introduction: Binguino: an Arduino-based Bingo Number Generator
My granddaughter enjoys playing Bingo, so I went out and bought her a
cheap set at a local discount store. The cards and the markers are fine,
but the spinner disk for selecting the numbers is a piece of garbage.
It flew apart about ten minutes into the first game.
True, I could have gotten a more expensive Bingo game, say for $10 or
so, one that uses a clever little hand-cranked cage and teensy wooden
decaled balls to select the numbers. But, hey, all of us Instructables
people are DIY-ers, so I decided to build a number generator using an
ATMega 328 CPU and a garden-variety 16x2 LCD display. I would test and
debug the code on my Arduino Duemillanove with LCD shield, and then build
the handy-dandy Bingo Number Generator as a stand-alone project on a
prototyping board. This means that you need not build the hardware for
this project -- you can run the code on an Arduino with LCD shield and
get the same functionality. But, why tie up your development board every
time you want to play Bingo? And why cheat yourself of the fun of
Essentially, we'll be constructing a stand-alone Arduino, with a built-in
LCD socket and hard-wired momentary-contact switch. It will lack only
the female header strips for plugging in shields, though you could
optionally add those, too. Consider this project as a sort of prototype
all-purpose microcontroller board with display. So, even if you're not
a Bingo enthusiast, this should still be of interest.
Step 1: What You'll Need
This project does require a fair amount of hardware,
but none of the components listed below are difficult
to find or particularly expensive.
ATMega 328 CPU 6.00
16x2 LCD display 4.00
[Radio Shack 276-168, or similar]
LM7805 5v regulator .50
1N4001 diode .25
resettable polyfuse .35 [optional, but recommended]
[All Electronics, catalog # RXE-065, or equivalent]
40-pin male header strip .75
40-pin female header strip .75
28-pin IC socket, narrow .75
mini pushbutton switch .50
momentary contact switch .50 [generic]
16-MHz crystal 1.00
mini 10K trimpot .25
330-ohm resistor, 1/4 watt (2x) .50 [anything from 220 to 1k is okay]
LEDs (2x) .35 [generic, one red, one green]
power jack, coaxial [2.1 mm] .75 *
power plug, coaxial, [2.1 mm] .75 *
[Radio Shack 274-1569, Size M, or similar]
100 uF capacitors, 25-35v (2x) 1.00 [Don't get the 16v kind.] **
10 uF capacitor [optional] .50 [for extra filtering]
22 pF capacitors (2x) .50
.1 uF capacitors (2x) .50
* Make sure you get a matching set of plug and jack.
There are several similar-looking ones in approximately
the same size, and they are NOT necessarily cross-compatible.
[I could go on a rant about lack of standardization in plugs and jacks,
but this is not the appropriate time or place.]
** If you use a filter cap with at least a 25-volt rating, then you can
plug in a 12-volt power supply with no worries. A 16-volt filter cap
may not give you enough tolerance.
Hopefully, you have at least a few of these components in your spare
parts box. If you had to buy each and every one of them, the total could
easily run over $20.
Step 2: The Power Supply
Refer to the power supply schematic (first figure) for this step.
Let us build the board power supply as a separate module on one corner
of the protoboard.
To begin with, we mount the 2.1 mm coaxial jack on a far corner of
the blank protoboard. The bottom two prongs on the jack pass through holes
in the protoboard (we will connect the ground prong later). To affix the
jack to the board, I used hot-melt glue, applied with a glue gun. This
is quick and convenient, and it creates a bond more than strong enough
to withstand repeated insertion and removal of the power plug.
Now solder a polyfuse to the rear terminal (positive) of the coaxial jack.
The function of the polyfuse is to protect the circuit against overloads,
such as those caused by shorts or plugging in a wrong-polarity power plug.
If there is an overload, the polyfuse functions as a circuit breaker.
The polyfuse connects, in linear fashion (see illustration) to the diode.
The function of the diode is to block current from a reversed-polarity plug.
Finally, the wire leading from the banded end of the diode (negative)
goes to the input of the LM7805 regulator IC.
Let's position and connect up the remaining components of the power
supply section. There are three capacitors, an indicator LED, and a
current-limiting resistor for the LED. Refer to the schematic and the
Note that we're using a 4-pin male header strip, with jumper, as an on-off
power switch. This is cheaper and simpler than mounting a toggle switch.
The +5 volt input connects to the left pin of the on-off header,
and the second pin of the header has a wire connected as the output.
Therefore, when these two pins are bridged with a jumper, then the
main circuit gets power. Removing the jumper
(or moving it to pins 3 and 4 of the header) cuts the power.
Be careful to observe polarity. The center pin of the power jack is positive.
Choose an external plug-in power supply with an output plug
that likewise has a positive center. But, you need not worry too much
about this. If the polarity is wrong, the 1N4001 diode will block current
flow. And if there is a short, then the polyfuse will open. In either case,
no damage should result. But, our neither will our project work.
Time to test the power supply. Plug in a 9-12 volt DC source.
Does the power LED light up? Yes, it does. If you have a multitester,
check whether we're getting a 5-volt output at the positive pin of the
100 uF capacitor. Okay so far?
Step 3: Building the Main Circuit, Part 1
We will refer to the main circuit schematic diagram for this and the
subsequent steps. [Note that this and a few of the other schematics and
pictorials were pieced together and modified by the author of this
Instructable from Creative Commons artwork from Adafruit, Sparkfun,
and other sources.] This main circuit schematic will be repeated in
some of the subsequent steps to make it easier to follow along.
Position and solder the 28-pin IC socket and a 16-pin female header
strip for the LCD display. Place the IC socket near the center of the board,
but off to one side near the power supply, as in the pictorial.
Note that the IC socket is the narrow variety, the type that fits an
ATMega 328 chip. A wide 28-pin IC socket will not work here!
The IC socket will straddle rows of solder strips in a manner that puts
each pin on a strip of three connecting holes. This will make connections
on the solder side convenient (see illustration).
Now we can position and mount the trimpot that will adjust the LCD contrast.
Make sure each leg of the trimpot is on a different 3-hole strip. Solder
each leg and make sure the trimpot stands up from the board in a vertical
Step 4: Building the Main Circuit, Part 2
At this point, we'll add the CPU-support components, the ones that connect
to/from pins on the IC socket. Refer to the main circuit schematic and add
the 16 Mhz crystal, between pins 9 and 10, and the two 22 pF capacitors,
going to ground from each of those two pins. We'll also connect pin 7
to +5v, and pins 8 and 22 to ground. Note that the notched end of the IC
socket marks pin 1.
Near the IC socket:
Connect a couple of .1 uF ceramic or mylar capacitors from
+5v to ground for decoupling. Optionally, also add a 10 uF capacitor
between +5v and ground for extra filtering.
Now would be a good time to mount the 6-pin right-angle programming
header. While we're at it, we'll solder in a LED, preferably of the
ultra-bright variety, to connect to pin 19 (SCK) of the IC socket.
This LED will provide the blink in our first test program that will
determine if we have correctly wired up basic Arduino functionality.
The bingo.ino sketch we will upload to the board will blink this
LED as an indicator each time the pushbutton is pressed for a
new Bingo number.
Refer to the pictorials.
Step 5: Building the Main Circuit, Part 3
the remaining support components.
A momentary contact mini-switch goes from pin 1 of the IC socket to ground.
This is the reset switch. Referring to the main schematic, we see
that pin 1 is also connected to +5v by a 10k-ohm pullup resistor.
This keeps the reset to the CPU disabled, unless the switch is pressed
to pull the pin down to ground. Note that pin 1 of the IC socket is also
connected to pin 6 (DTR) of the FTDI programming header through a .1
uF capacitor. Note also that pin 1 (ground) of the FTDI connector has a
black mark by it. Applying a dot or a stripe here with a black marking
pen will help you figure out how to hook up a programming cable to it.
Connecting the six pins of the bent-pin FTDI header is relatively
straightforward if we follow the schematic diagram and the appropriate
Pin # Function* Connects to
1 Ground (BLACK) Ground
2 CTS N/C [not connected!]
3 Vcc +5v
4 TxD ATM328, pin 2 (RxI)
5 RxI ATM328, pin 3 (TxD)
6 DTR ATM328, pin 1 (Reset)
[through .1 uF cap,
and with 10K pullup resistor,
* The "Function" designations correspond to the labeling of the pins
on a standard FTDI programming cable or breakout board. CP2102-based
cables and breakout boards also work and have compatible nomenclature.
Now, let's wire the female header strip that will serve as the LCD socket.
Use the pictorials and the diagram below. Notice that pins 1 and 16 are
marked in the pictorials.
LCD pin # Explanation ATM328 pin #
1 Ground (Ground)
2 +5 v. (+5v)
3 Contrast (pot, middle pin)
4 RS (register select) 14
5 R/W (read/write) (Ground)
6 EN (enable) 15
7 DB0 (data 0)
11 DB4 6
12 DB5 11
13 DB6 12
14 DB7 13
15 Backlight + (+5v.)
16 Backlight - (Ground)
- LCD pin 3 connects to the middle leg of the contrast pot for adjusting
- the contrast.
- Pins 7 - 10 of the LCD (DB0 - DB3) are not connected, because the LCD
- operates in 4-bit mode.
- Some LCDs do not have a backlight, and these only have 14 active pins.
- They either lack pins 15 and 16, or these two pins are not connected.
- Now would be a good time to double-check our wiring. Refer to the
- main circuit schematic once more and make sure you haven't left anything out.
- Are all the IC power connections (+5v and ground) in place?
- How about the 16 Mhz crystal and the two 22 pF capactors? Check for
- shorts between leads on the solder side of the board with a multitester,
- as appropriate. Remember -- catching a short sooner keeps the CPU from
- going up in smoke later. This is the electronic version of "A stitch in time ..."
Step 6: Building the Main Circuit, Part 4 [Testing]
We're ready to test the main circuit. We will apply power, but not yet
insert the ATMega 328 CPU. Let's do it! Does the power LED light up? Good.
Does a multitester show 5-volts on the positive side of the power rail? Good.
Now, we'll repeat the power test, but with the '328 plugged in. Carefully
insert the chip with the power off. You may have to bend the two rows
of pins inward so it will go into the socket. If so, bend one row at a time
but applying pressure against a hard surface (cardfully!).
Now apply power. Does the power LED light up?
Very gingerly (if there's a short, the IC will get very, very hot!)
touch the top of the CPU. Is it warm? If not, we're likely okay.
Everything okay so far? Time to program the '328. Fire up the
Arduino IDE on your laptop and attach the project to it with an
appropriate cable or adapter, such as the cable from Sparkfun
or Adafruit's FTDI Friend breakout board, among others.
Now, we'll program it with the blink sketch:
Arduino IDE: File --> Examples --> 1.Basics --> Blink
Does it blink? Great!
Step 7: Building the Main Circuit, Part 5 [Finishing Up]
Let's prepare the LCD. Break a 16-pin male header off a 40-pin strip.
Plug the header strip, long pins down, into a breadboard protoboard, to
fix it in position vertically . Now carefully position the LCD over the
exposed short pins of the header strip. You may need to prop up the LCD
with a shim or spacer to keep it at right angles to the strip. Carefully
solder all 16 pins.
Plug the LCD into its socket on the board. Make sure the pins line up
and go in the correct holes in the female header strip. Apply power.
All okay? Adjust the contrast pot until a row of squares shows on the LCD.
Turn off the power to the Bingo board. Attach the programming cable to
the FTDI header and hook up the USB plug on the other end of the cable
to your laptop's USB port. Fire up the Arduino IDE program, open the
bingo.ino sketch, and load it onto the board. Does it work? Bingo!!!
Yes, it can also be powered by a 9-volt battery, for additional
portability. The battery clip just needs to be terminated with an
appropriate power plug. Make sure the polarity on the plug is correct --
We're almost done.
Step 8: The Case for Our Project
A Tootsie Roll Midgies ® metal "mini-lunchbox" is just about the right size.
We may need to cut a narrow strip off one edge of the circuit board to
make it fit (see illustrations).
How will we secure the circuit board inside the box? Standoffs and screws?
That would work, but it's a lot of hassle, especially if you contemplate
occasionally removing the board for fixes and adjustments.
Double-sided Velcro ® tape is an interesting alternative. Cut two
strips of the tape to the width of the board, then position them after
peeling off one side of the non-stick layer. One side of the tape sticks
to the solder side of our protoboard. (See illustrations.)
Peel off the non-stick layer on the other side of the tape,
carefully insert the board into the Midgies box,
and press down firmly to affix the board.
One more step might be necessary. If there is not enough room inside
the box for a 9-volt battery to power the project, it can stay outside
(thinking outside the box, no?). If so you may need to cut a hole in
the lip of the box (and fold down a flap of tin to avoid a sharp edge),
so that when it's closed, the wires have clearance and are not pinched.
Note that there are many other options for project cases.
But, these little metal candy cases are just about the right size,
not to mention just plain cute.
Step 9: The Software
Download the bingo.ino sketch. Here's an alternate download site.
I have placed this sketch in the Public Domain, so there are no restrictions
on its use and distribution.
Essentially, what the sketch does is pick random numbers in the Bingo
domain (1 - 75) and match them up with the appropriate letter (B-I-N-G-O).
In any given run, duplicate numbers are filtered out, so you shouldn't
get any. To begin a new Bingo game, press the on-board reset button, or
cut the power to the board and turn it back on.
This starts a new sequence of numbers.
Certainly the sketch could stand some improvement. I don't claim to be
a master programmer, just a fearless tinkerer who dares venture into
unmapped territory with reckless abandon.
Step 10: Final Thoughts
wall-mount it. Perhaps you could figure out a way to audibly announce
the numbers using voice synthesis. You might even set up your own Bingo
parlor. Be aware that this may be illegal in some jurisdictions, and hey,
you wouldn't want to go to jail for violating local gambling statutes,
now would you?
Other projects using this very same Binguino board suggest themselves.
It would only be a matter of changing the software, i.e., the sketch.
- Electronic Dice, for use with board games, such as Monopoly.
- Even "hex dice" for RPGs.
- A chess clock, or similar countdown/countup timer clock. You may need
- to add an RTC clock chip to the board, but this is not particularly
- difficult. Optionally, you might want to add a second momentary contact
- switch, so that each player has one. Now this would be an interesting and
- challenging project, and I double-dog dare anyone to try it.
We have a be nice policy.
Please be positive and constructive.