Creating the Dart Texter
Now that you’ve boned up on web-connecting technology, let’s modify the Dart Sentry as I described earlier. We’ll add a WiFi card (see Figure 8) so that when a dart is loosed, a text message is sent to your phone so you know what happened.
Figure 8 The Dart Texter lets you know when it shoots.
Assuming you’re beginning with a finished Dart Launcher, you’ll need only a few parts for this rig:
- Adafruit CC3000 breakout board, P/N 1469
- Jumpers, such as SparkFun P/N 11026
- Mini breadboard, SparkFun P/N 12046
- Wire, just one piece a few inches long
Follow along with these easy steps to set up the hardware:
Attach the mini breadboard to the gun-holding rig, as shown in Figure 9. Most of these boards have adhesive backing, or you could use double-sided tape.
Figure 9 Attach the breadboard to the gun-holding rig.
Plug in the CC3000 with the supplied header pins. (If you haven’t yet done so, I suggest soldering the pins into the breakout board, allowing you to plug it into a breadboard.) Give yourself room to add jumpers—one row will do it, as Figure 10 shows.
Figure 10 Plug the WiFi card into the breadboard.
Next, you’ll need to adjust a couple of wires from where they were in the Dart Launcher. First, move the LED’s wire from pin 13 to pin 8. Next, move the PIR’s data wire from pin 3 to pin 2. This change will make room for the CC3000’s pins. Figure 11 shows how it should look.
Figure 11 Move a couple of wires around to make room for the WiFi card.
Wire up the individual pins of the CC3000: GND goes to GND on the Arduino, CLK plugs into pin 13, MISO into pin 12, MOSI into pin 11, CS into pin 10, VBEN into pin 5, and IRQ into pin 3 (see Figure 12).
Figure 12 Plug the WiFi card into the breadboard.
Solder a wire to the power bus of the solderless breadboard, and then plug it into the pin of the CC3000 marked VIN. (The red wire in Figure 13 is marked with a blue arrow.)
Figure 13 Grab 5V from the power bus of the breadboard.
Programming the Dart Texter
It probably goes without saying that the code for the Dart Texter is exceedingly complicated. Instead of trying to describe the code here, I’ll briefly cover the steps involved with programming the Dart Texter.
- Test the CC3000 to ensure that it’s wired correctly. First, download the CC3000 library and install it. Launch the buildtest example sketch, add your WiFi network name and password at the right place in the sketch (it’s pretty obvious), and launch it. This step will test your WiFi card and do stuff like ping websites and make a test connection to a domain name server.
- Sign up with Amazon Web Services (AWS), which includes among its applications the SNS messaging service. Click the SNS icon and follow the directions to sign up. You should end up with a couple of long strings of letters and numbers—access keys that will allow you to send a text remotely.
While on AWS, you’ll need to create a “topic”—a specific set of procedures that results in the text being sent.
- Next, “subscribe” to the topic, choose SNS for the delivery method, and enter your phone number. The service should send you a confirmation text, and you’ll need to reply to it to confirm your subscription. Now all you have to do is trigger the snsPublish function in the sketch, and your message will be sent.
You’re done! If you get confused, check out the really great help files and forums at AWS. If you have a question, you’re sure to find the answer there. If you’re looking for more fun robotics projects, check out my book Robot Builder: The Beginner’s Guide to Building Robots.