BlueChilli > Blog > Blog > Introducing the Turret

Over the summer break, my friends at Intel were kind enough to give me a couple of dev kits to have a play, and quite literally they said “build something cool”. In a previous post, I wrote about the idea of building an automated nerf turret, which brings together the elements that is driving the next wave of technology evolution – the “internet of things”.

So, introducing the automated nerf turret mount!

Firstly, the environment. On the electronics front I’m using an Intel Galileo gen 2 with a couple of Arduino shields (Dual bipolar stepper motor controller and relay shield), a couple of hall effect sensors to detect cutouts and a little bit of custom tinkering for power distribution. Hardware, I’m using actobotics channels and gears, a couple of 0.9deg NEMA17 3A stepper motors and a heavily modified Nerf Stampede gun. On the software side, custom C++ classes to handle the bulk of the Turret control plus a lightweight Arduino C shell to handle the runtime flow. Server was put together using Slim PHP lightweight framework with a bunch of packages from Packagist.

The Nerf Turret (in its temporary “home” before being permanently bolted to a different wall)

Challenges (aka “fun”)

Part of the fun of tinkering with electronics is the challenges you face to get things working.  So here’s a couple of weird ones that took a while to figure out.

It’s a standard for a reason!

The Intel board doesn’t like USB cables longer than the USB standard of 1.8m.  This caused all sorts of issues as the platform worked on my bench but didn’t work when it was “in situ” with a long 3m USB cable.  I didn’t think it would be a problem running a virtual serial link over 9600 baud, but it dropped data and caused issues when trying to upload code and debug.

Hacking the nerf gun firing mech

There’s a safety lockout switch in the nerf turret attached to the physical trigger which had to be bypassed to fire electronically.  As the switch used all three of the C, NC and NO connectors to safety fire the weapon, I had to install a small relay.

Hacking the guts of the Nerf Stampede, the little switch at the top needed to be bypassed

A balancing act

I had to make sure the nerf gun was perfectly balanced, otherwise the stepper motors would be straining to keep the gun steady in elevation.   The first attempt mounted the gun using the “top rail” but it overloaded the stepper driver and couldn’t move the full elevation range. So to find the centre of gravity I balanced the gun on its side on a pencil tip and bolted the the drive shaft directly to the nerf gun using a small aluminum side plate. I couldn’t quite get it perfect, so you’ll see a few AA batteries taped to the front of the gun turret to act as counterbalance. Of course I could just say that I’m allowing “space and weight” for a future gun camera to be mounted….

Heatsink definitely needed

The stepper motor controller board I used is pretty cool as you can have two bipolar 4-wire steppers on one controller and there’s a bunch of  connectors arranged around the I/O pins grouped with individual GND and VCC pins.  You can’t stack another shield on top of it, however as I found out, you wouldn’t want to.  The A4988 driver chips get HOT and definitely need a heatsink. Alas the design of these boards is pretty shit as you can’t flush mount any standard decent sized heatsink due to the surrounding components being higher than the driver. So I had to get all industrial on the heatsinks to make them fit, and secured them with a couple of cable ties.

Modified heatsinks to sit on the stepper controller chips, the brown SMD resistors stood “higher” than the chip itself

The problem with shields

I love Arduinos, I love how they can just stack together.  The problem is though, when you start stacking multiple boards together you’re going to get some conflicts for the I/O pins used.  In this case, my relay shield and stepper motor shield both used the same Digital pins, so some “modifications” were required.  The relay shield was simpler, so a bit of surgical scalpel work on the tracks and some precision soldering fixed that. (This is the reason I didn’t add an LCD like I normally do to my projects, so had to rely on the Serial Monitor for debugging)

Circuit card surgery
Circuit card surgery

Where to from now?

Ok, now on to the sensor fusion part.  At the moment the Turret is integrated in to Slack and our build server.  Anyone in the team can trigger a shoot by typing in /shoot and a user’s name.  When a build server crashes, it shoots a message to the turret bot via a simple webhook.  Shortly, BlueChilli will be rolling out SpaceConnect devices for space management, and we’ll be able to pinpoint the location of where people sit when they “check in”.  Finally I’m going to throw a webcam on the front of the Gun to take a “kill shot” and post it in slack when it’s activated, using the USB host on the Galileo.

In Summary

So in summary, this was a great little project that has caused plenty of laughs already and was a lot of fun.  The intel Galileo is fast than most other general dev boards of a similar price and the combination of a linux x86 card with built in ethernet, USB host, mini PCIe and an Arduino controller makes for a powerful combo to play with.


Intel Australia provided the development kits for this project.