Parts list (linked to sources):
- Jolt gun by Nerf
- First-gen Romo by Romotive
- Raspberry Pi (Currently backordered but available on ebay)
- 16 GB SD Card with Raspbian
- Adafruit 16-Channel 12-bit PWM/Servo Driver
- Adafruit Pi Cobbler Breakout Kit for Raspberry Pi
- Futaba S-148 Servo (included in kit below)
- JOMAR Linear Servo Conversion Kit for Futaba Servo
- Raspberry Pi Case
- 4-AA 6V battery case
- Edimax EW-7811Un USB Nano Wifi Adapter
- High Quality 5200mAh External Battery Pack Power Bank Charger
- Female Jumper Wires
- Male Header
I used the Adafruit 16 Channel 12-bit PWM/Servo Driver tutorial with this circuit and Adafruit’s Python Library to hook up the servo to the Pi. After I had the circuit working on a breadboard I used the male header pins and female jumper wires to slim down the bot. Getting the Raspberry Pi to auto-connect to WIFI and run headless took some work; I used wpa_supplicant.conf to do it, and installed vncserver and SSH to control it remotely. I installed Avahi, which is the same as Apple’s Bonjour, so that I could always connect to the pi via http://raspberrypi.local once it boots and connects to the router. (However, once you have its IP address, shooting the dart is faster via IP address rather than by DNS lookup).
I modified Adafruit’s Servo_Example.py script to pull the servo back for 1 second and then return to front position. To access the Pi’s GPIO pins you need to be root, so I followed this tutorial to write and compaile a simple C script that could temporarily run commands as root. (I skipped the shell script part and just ran the python command from the C script). Finally I installed apache and PHP, and wrote a simple PHP script that calls the pulltrigger python script.
Mounting the servo to the trigger was the hardest part. My first two versions had the servo placed next to the trigger, but that was really hard to mount onto the round barrel of the gun. I also tried an all-lego chasis with reinforcement, but it was too heavy and bulky to mount onto the Romo.
Then I realized that the servo would work best if it was behind the trigger, hanging off it like an Ewok choking a Storm Trooper. I used zip ties to connect it all (the Jolt has handy holes drilled into the trigger already), and then it was just a question of keeping them squished in a single plane together. The box from the USB battery case I bought worked fine for this, and was also transparent and light.
The bot actually has two separate WIFI connections and 4 battery sources. The USB battery powers the Raspberry Pi, and the 4 AA battery pack powers the servo circuit. (Adafruit recommends separate power sources because servos are noisy and might damage your Pi.) The Pi and servo are actually totally separate from the Romo, and are just mounted on its back. The Romo has its own battery, and uses an iPhone (which also has its own battery) to control movement (via analog headphone out) out and sends video back to the app. Romo has a Desktop and iPad version of its control app, and then I can control my pull-trigger script from any web browser. (Technically you could control the app with just an iPad by switching between the Romo app and Mobile Safari, but I found using a separate iPhone was smoother).
This was my first robot and it was a lot of fun to make. The Romo has aux ports that you could use, however that signal wouldn’t be able to drive a servo. A simpler circuit would just be to use an Ardrino to convert the aux signal from the Romo into a PWM signal for the servo, but I had a Raspberry Pi and understood it better. Plus I like the idea of having a headless weaponized webserver that can move on its own.