« Back to jordanbalagot.com
Raspberry Jolt, My Mini Nerf Gun Robot

Posted on Tuesday 26 February 2013

The crime-fighting nerf-gun robot

The crime-fighting nerf-gun robot

Meet Raspberry Jolt, my mini nerf-dart-shooting robot with WIFI control and remote video recording. It’s powered by the first gen Romo by Romotive and a raspberry pi.

Parts list (linked to sources):

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.

raspberry jolt v2 mount – didn’t work

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).

raspberry-jolt-parts

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.


3 Comments for 'Raspberry Jolt, My Mini Nerf Gun Robot'

  1.  
    February 26, 2013 | 9:42 pm
     

    Hey Jordan!

    Adam here (from Romotive). This is absolutely awesome. Do you have one of the newest-generation Romos? If not, shoot me an email and I’ll get one out to you ASAP (for free!). We love seeing people hack on Romo in the real-world…

  2.  
    April 4, 2014 | 7:00 am
     

    […] This mini pi controlled robot has the potential to wreck havoc on your co-workers! Jordan B. has the full tutorial up on her blog. […]

  3.  
    Pop
    April 4, 2014 | 10:05 am
     

    Nice project. Love to see a Android version of Romo.

Leave a comment

(required)

(required)


Information for comment users
Line and paragraph breaks are implemented automatically. Your e-mail address is never displayed. Please consider what you're posting.

Use the buttons below to customise your comment.


RSS feed for comments on this post | TrackBack URI