At our daughter’s school, all the 2nd graders put together a “state board” project. They are randomly assigned a state (in our daughter’s case, Vermont) and the students work to put together a poster on a tri-fold piece of cardboard. From what I’ve heard, the projects often have 3D aspects like animals and products attached and several over the years have had buttons to play things like the state song. We brainstormed possible elements we might include on the board and thought about sound, light, and even considered EL-wire animated rivers. I wanted to make sure that if we chose a more elaborate design that our daughter would actually carry out most of the work and that we document that — so I used a flip video recorder to film most of the process. In terms of electronics, our daughter jumped in fairly quickly having learned to solder at the recent Makerfaire in New York. She’s built a couple of kits since then. There was a fair amount of soldering required on the Perma-Proto. The video below shows our daughter working on the Perma-Proto and button boards.
In order to have the desired sound and light elements we needed to choose an appropriate controller. I debated whether it would be best to recommend an Arduino-based design or to use a Raspberry Pi. An Arduino approach might use an Arduino and Wave Shield combination. It would have the advantage of fast start up and shutdown and would have clear uninterrupted audio. A Raspberry Pi would potentially be less expensive as it could play the audio off its own filesystem, has networking built in (Model B), and can use Adafruit’s WebIDE which would simplify our daughter’s Python-based programming tasks (the Arduino wouldn’t have been Python). The Pi could multi-task which would make some things easier but would make smooth sound playback more challenging. As the project would be in place at the school for the rest of the year, power management was important also — so a graceful auto-shutdown would be essential. I’d done many past projects with the Arduino/Wave Shield combination so I really wanted to see how well it could be done with the Raspberry Pi. The WebIDE helped convince me it would be easier for our daughter to work with (and she’d just started working through Python for Kids).
We started with a rough idea of how we thought things would come together. First, we would need to have the outline of the state. One of the goals was to avoid having a lot of wires and connections on the back of the tri-fold. To accomplish that, the state boundary outline would have to be a separate piece. That also satisfied creating a 3D look for the state. We could have used foam board but I thought quarter inch plywood would hold up better and allow for more precise cuts. The plan was to use actual state boundary data to generate g-code for our CNC. We would also plan the precise location of the LEDs and drill holes at those locations on the wood. The legend would also be wood and would have holes for LEDs and buttons. The hope was that a single strand of RGB LEDs could be routed around the back side of the state and legend boards and hit all the holes. We planned to use 50 LEDs in total, 15 on the legend and 35 on the map. As it turned out, we should have adjusted the holes somewhat but we did pretty well wasting only 2 on the strand which didn’t reach a hole and having to add 2 more to compensate which were plugged into the end of the strand (we wanted to keep the two 25 LED strands we used intact).
Other parts of our plan included use of a wireless remote in addition to the 8 buttons we planned on using on the board. Since the remote receiver operated at 5 volts, we needed to introduce a level-converter for use with the 3.3 volt Raspberry Pi. We then needed a switch module which could trigger a full power up from the press of a momentary switch while using very little current to monitor the switch. We also needed to amplify audio from the Pi to drive a small set of speakers. As the Pi audio is not always smooth and has occasional clicks and pops (even with some filtering) — this can cause problems if the amplifier is driven from the same supply as the Pi as it can draw enough current to crash the Pi. So the amplifier would have to have its own power which could be connected when the main power came up. So all together the hardware needed consisted of:
- Raspberry Pi Model B (Rev 1)
- Adafruit Full Sized Perma-Proto Raspberry Pi Breadboard PCB
- Raspberry Pi GPIO Ribbon Cable
- 2 Strands of 25 12mm Diffused Flat Digital RGB LED Pixels (and 2 LEDs clipped from another WS2801-based 20 RGB LED Chain from Sparkfun as I needed 52 total)
- 4-pin JST SM Plug Set (to connect/disconnect from the LED strand and in our case to fasten a couple extra LEDs to the end of the chain)
- Round tactile buttons
- Stereo 3.7W Class D Audio Amplifier
- 4-channel Bi-directional Logic Level Converter (for optional RF)
- Simple RF M4 Receiver – 315 MHz Momentary Type (for optional RF)
- Keyfob RF Remote Control — 315 MHz (for optional RF)
- 4 D-Cell Battery Holder (joined with the 1 D-Cell holder below)
- 1 D-Cell Battery Holder
- 4 AA-Cell Battery Holder (converted to a 3-cell holder by wiring across one of the cell positions)
- 2 Dual Mini Boards (to cover 4 button areas)
- Right-Angle Audio Adapter (to fit into the Pi’s audio out)
- Stereo Mini Plug
- 5mm Wide-Angle Red LED
- Size M Coaxial DC Power Plug (for fun I attached a Remove Before Flight tag to the drilled out plug to make it clear to pull the plug out when you want to operate it)
- Panel-Mount Size M Coaxial Power Jack
- 2 2″ Paper Cone Midrange Tweeters (4 Ohm)
- Pololu Step-Down Voltage Regulator (for 5 volts, 3.5 Amps)
- Pololu Pushbutton Power Switch SV
- 5VDC SPDT Micro Relay
- 9 2-Position PCB Terminals
- Board Edge Mounting Kit (for the Pi Model B Rev 1 since it doesn’t have mounting holes)
- #8 5/8″ Round Head Wood Screws (with the fender washers below for fastening through cardboard into wood)
- 1/8″ x 1″ Fender Washers
- #4 Machine Screws, Washers, Nuts (for attaching Perma-Proto and battery holders)
- #8 x 1/2″ Sheet Metal Screws (work in lieu of the screws in the board edge mounting kit above to get through 1/4″ plywood — maybe with a washer or two to diminish their length)
We used modular 6-conductor modular phones jacks and plugs for connecting with the button panels. The legend panel used all 6 conductors for the 5 buttons and we were able to find 6-conductor modular phone cable at a local Radio Shack (this is harder to come by than 4-conductor). For the power and other buttons we just used two more 4-conductor modular cables. The cheapest jacks were in 10-packs at Home Depot but the modular cable we had was stranded so it wasn’t quite so easy as just using a punch down tool — we had to work to make sure it made contact — sometimes tinning some of the wire where it came through the channel. It might be easier although slightly more expensive just to use RJ45s and CAT5 for switch wiring.
Planning LED Placement
An important part of the project was planning the placement of all the LEDs on the map as well as what colors they should be to indicate different products on the legend. Since the LEDs can change to any color, single LEDs could be used to indicate different products at different times with different colors. So in planning, one could conserve LEDs by using one LED to represent each region in the state.
Cutting Out Your State with a CNC
In our case, we had a small CNC machine we could use to cut the state outline (laser cutting the wood would have been easier). Since the desired size of the state was larger than the CNC, the plan was to cut it in 4 pieces and join them together. Ultimately, it all came down to how to generate the g-code for the CNC. This was accomplished with a mixture of some Python and Java code and could be adapted for other state boundaries. One million scale U.S. state boundaries can be downloaded here. I’ve also made a local copy of the statep010_nt00798.tar.gz 2012 boundaries file here. The archive file has a shape format file inside with boundary data for all the states. A simple Python program can be used to copy out the latitude, longitude values for the boundary of a given state as follows:
import shapefile import sys r=shapefile.Reader("statep010.shp") sr=r.shapeRecords() for s in sr: if s.record=='Vermont': shape=s f=open("vermont.txt",'w') for pt in shape.shape.points: f.write(str(pt)) f.write(",") f.write(str(pt)) f.write("\n") f.close()
The Python program above will need the Python shapefile extension to be installed. It finds the record associated with the desired state, in this case Vermont, and writes out the latitude, longitude values for the state outlines to an ASCII datafile called vermont.txt that will be used by our next program. The next set of programs (written in Java and available in vermont.jar) generate g-code for various parts of the project. These all give graphical previews of the parts they will cut. The first program (called Plot.java) plots the state boundary from the vermont.txt file but also uses resource files that have the locations of the lights (as interpolated from a Vermont product map) and some city locations (from the lat/lon) to help in understanding where to place city labels. The holes are roughly to scale which gave us an idea of whether they were too close to the edge or to boundaries of the state quarters. Some polygon intersections were used in Java to produce the 4 smaller polygons for the parts of the state we needed to cut separately. We tweaked the cut boundaries until they didn’t cross any of the light hole positions but yet kept the state quarters small enough to cut on the CNC. Ultimately the program produces 4 g-code files, one for each of the state quarters (vermont1.nc, vermont2.nc, vermont3.nc, and vermont4.nc).
Cutting Title Letters
We also used the CNC to cut the individual letters for Vermont. I tried out NCPlot which worked pretty well for generating g-code for the letters. I had to re-order the cuts though on letters like the “R” and “O” since I discovered a little too late that it didn’t cut the holes before it cut the letter boundary itself.
Planning/Cutting the Legend
We sized the legend panel so that it could accommodate the 15 product entries with LED holes spaced sufficiently. It also had to fit in the center cardboard panel to the bottom right of the state. The primary control buttons were also located on the legend panel at the bottom. So mostly the CNC was used to drill the legend pilot holes for all the LEDs as well as for 5 buttons and to cut out the rectangular border for the panel.
Gluing/Sanding/Painting the Wood Parts
The four quarter pieces of the state were glued together with wood glue. These joins were along straight edges. Thin strips of wood were used along the seams in the back to strengthen the seams (these had to be cut away from a couple of the holes with a dremel). The state, letters, and legend pieces were all sanded and painted. The rivers and water areas on the state were painted with blue glitter paint.
Attaching the LEDs
All the LED holes were drilled so the LEDs protrude through the holes and the flat part containing the ICs are flush against the wood on the back side. Hot-melt glue holds each LED in place. The LED chain begins at the bottom of the legend panel where the LEDs fill all the holes from bottom to top and then they jump over to the map where they traverse the 35 holes there. In a couple of cases an LED didn’t reach a hole and had to be skipped (since we didn’t want to cut the two 25 LED strands). I debated about actually writing some code to search for the best way to cover the holes with a minimum of skipped LEDs (a familiar algorithms problem) — but missing 2 wasn’t so bad. As a result, we need to put together a 2 LED extension (using the other JST plug from the set) and add that to the chain. The photo below shows a top view of the board where you can see the cardboard layer, mounting blocks, and map layer.
There are 4 areas where buttons are needed: at the bottom of the legend panel, an “on” button at the bottom left of the state (which includes a power LED), and buttons for the song and the bird located to the left of the upper portion of the state. All of these are backed by small proto boards whose buttons and leds extend through either the wood or cardboard and which are hot-melt glued on the back. The 5 legend buttons are connected with a single 6 conductor modular phone cord. The power button/led is connected with a 4 conductor modular phone cord and then bird and song buttons jointly utilize another 4 conductor modular cord.
Mounting the Boards to the Cardboard Tri-Fold
Both the state and legend boards have wood blocks wood-glued to them in the back to allow space for the LED strand (and buttons) behind them but in front of the cardboard. Fender washers and wood screws come through the backside of the cardboard into those wood blocks, holding the boards securely on the cardboard.
Design of the Control Box Enclosure
The electronics control box is attached to the bottom of the central cardboard panel on the back. The box is 24″ long (to match the central tri-fold panel). Electronics, batteries, and speakers are laid out linearly along the full 24″. To make access easier, an acrylic sliding top is used which can open fully to give access to electronics and batteries. The components themselves are also mounted to a slideable 1/4″ plywood base which is mounted slightly above the bottom of the box. The bottom of the box can therefore be flat without the various mounting screws for the board and batteries being exposed. It’s also convenient to be able to slide the electronics out. One end piece on the box has both a network jack and an external power jack. Originally, we used external power but once the battery circuit was fully in place that became much more convenient and we never used external power again during development. The power jack is wired so that battery power cuts off when external power is applied (but a jumper needs to be removed if you want to provide regulated 5 volt power through the external jack — otherwise a slightly higher voltage needs to be supplied as the internal 5 volt regulator needs a slightly higher voltage — as the 5 “D” cells are providing when it’s on battery). A dummy plug inserted in the external power jack serves as an effective “safety” so the system isn’t accidentally triggered during transport. In a nod to the aviation community, it seemed reasonable to attach a “Remove Before Flight” banner to the dummy plug to clearly show its purpose (and I recently witnessed parents at our daughter’s school removing the plug without needed explanation to give it a try).
The photo below shows the end of the enclosure with the network/power connection end removed. This shows the bottom that the components are connected to. You can see the Pi board with the circuit board clips which hold it to the base. Sheet metal screws of the appropriate depth were used with the clips to allow a mount on the 1/4″ plywood. The speaker normally occupies the space at the center of the photo. A very short RJ45 male-to-male cable was created to bridge the gap between the Pi and the female-to-female RJ45 which was used as the network connector on the end panel.
The control box is fastened to the cardboard using the same fender washer and wood screws as the state and legend except they come through from the front side of the board and are covered by stickers and maple leaves. There are three screws, one on the left, one in the middle, and one on the right. The box has a wiring hole that comes out behind the bottom side of the legend. The 6-conductor modular cord and 4-pin JST go through that hole. Here’s a clip of our daughter sanding the control box pieces prior to assembly:
One fun detail was to create some sound/ventilation holes in the acrylic slide cover to the enclosure. The AcrylicTop class included in the vermont.jar generates the g-code for the vent holes. Since these were vent hole patterns, the code doesn’t actually need to access the strokes for the font characters. The code renders the characters to a small image and then iterates the pixels of the image to determine where the pixels are filled. The location of these are then scaled and translated as desired for the position and location on the cover.
For more detail: A Raspberry Pi-based State Poster Project