This last Saturday, I exhibited my Raspberry Pi Gizmo at the Microsoft booth at the Chicago Southland Maker Faire. It was very rewarding because the kids that came by the booth found it very engaging. For the Maker Fair, I had my Gizmo set up in “Test” mode rather than “Vote” mode, for two reasons. One, I had control of 3 lights and two motors working, but hadn’t had time to write the software changes to make the internet-connected voting work. Two, the kids that visited the booth were middle school age and younger. Most kids were interested in taking the keyboard and clicking the onscreen buttons to turn on and off the LEDs and the motors. One motor controlled the yellow flappy bird and the other controlled the a red fan. The fan was minus the floaty ball which had gotten lost. For the youngest kids, I had a bubble wand they could hold over the red fan to blow bubbles. They liked that ALOT.
In the week leading up to it, I struggled to get motor control of the second motor working. I control each motor with a relay switch circuit. A fellow MVP had given me one. It looks like this:
On one side (the right side in the picture) are the inputs, labeled G, V, and S for Ground, Voltage, and Signal. Ground (brown) connects to a ground pin on the Pi. Voltage (red) connects to a 5V pin on the Pi. Signal (orange) connects to the pin we will turn on and off. On the other side are the wires that the relay switch will connect when the switch closes.
For the second motor, I ordered a nearly identical board:
However, I couldn’t get it to work. In the process of trying to debug the problem, I touched a wire to ground and make the board START TO SMOKE. Not good. At this point, it was Monday night and the Maker Faire was Saturday. There was no way I could be sure to obtain a replacement board in time. The two local electronics retailers I was aware of did not sell them. I consulting with my electrical engineering friend Rob, and he sent me instructions for making one from components I could get at RadioShack.
In the above picture, you see the schematic that Rob sent, the documentation from the component packages, and how I converted that to a diagram I could implement. Except I initially got it a little wrong: I thought the motor wires should connect to the two pins at the top of the relay when one of the motor wires really needed to connect to the pin at the bottom left. That’s because I didn’t fully understand the package documentation for the relay at first:
Once I got that figured out, I had motor control working!
I then proceeded to make changes to my application. That’s a whole other story that I may write about later – I had trouble getting my code to work with Windows 10’s anniversary update on one of my development (coding) machines, so I stuck with Windows 10 1511 (the November Update from last year). With some help from my coworker Cole, who knows XAML forms better than I do, I reworked the user interface into a set of tabs: Configure, Test, Vote, and Log. The code’s up in GitHub, but I still have a backlog of changes I need to make. Fortunately, none of those changes were needed in time for the Maker Faire. I do need to have them in place by the time I present a theater session at Ignite on getting started with Windows 10 IoT Core and the Raspberry Pi.
–Michael