IOT – Automating a Nerf Gun

BlueChilli > Blog > Blog > IOT – Automating a Nerf Gun

Although I rarely (never) code on our startups these days, I still do enjoy software development and on some weekends I muck about on small projects, just so I can keep my mothballed skills somewhat relevant.   So when Intel pitched an idea at me through my friends at to build some cool tech using their new Galileo and Edison boards and RealSense camera, I jumped at the opportunity.

The thing that excited me the most, wasn’t that I got to play with electronics and software again (I’ve done that quite a bit recently, as our music door hack demonstrates) – it was that this was a chance to play in IoT, an area I believe is set to explode and one which BlueChilli is developing models and frameworks to support.

Toys and more toys with thanks to Intel

What is IoT?

Internet of Things is a buzz word used to describe, in my view, the next generation of technology. We’ve moved from main frame computing, to personal computing, to mobile computing and we’re now looking at “embedded” computing.  Wearables, smart devices, connected appliances – all embedded systems connected to the now ubiquitous internet.  Embedded systems is nothing new, in fact I studied embedded systems as a student 10 years ago in my engineering degrees, developing an optical attitude sensor in my undergrad and landing a UAV on the back of a platform with lasers in my Masters studies.  What’s new however is that embedded systems are now married with micro-sensors, ubiquitous connectivity, cloud based computing and big data analysis.  It’s this combination of elements which has made this next generation of computing possible.

An internet connected and enabled Nerf Turret

So with all these ingredients, what to do? I wanted to do something amusing.  I’ve got a dozen or so IoT themed commercial ideas up my sleeve, but this was a chance to play, demonstrate the power of the tech and have a bit of fun in the office.  So I  decided on upgrading our old office’s automated Nerf Turret to something a little more powerful.

A few years ago I hacked a mini USB foam dart launcher to be controlled by an Arduino and which was connected to a server that triggered a “shoot” whenever an engineer crashed our automated build process.  It was grossly underpowered and when we moved office to our current HQ, it significantly lacked the range to “target” the 50-or-so desks on our development floor.  So ever since we moved, it has sat as a sad disconnected trinket in our boardroom.

Time for an upgrade

We’ve got an arsenal of Nerf Guns in the office (standard issue in most tech-startups) and there’s an awesome battery operated model which packs quite a punch.  I wanted to use this as the “weapon” and build a turret around it.  That’s the embedded part.  I then wanted to connect it to the internet and have it remotely controlled based on an event.  Also, given we have the door system hack already in place, I wanted to connect it to that so that it knows when people walk in the room.

The concept is simple.  When one of the product team writes code that fails a build on our development servers, I want the gun to aim at their seat and gently pop a harmless nerf dart in their direction.  Ok, ok, so I want to shoot my developers when the write bad code.

Sensor fusion

But, we have a problem.  Because we have a liberal work from home policy, a lot of the time our engineers are not in the office.  So if they trigger a response (write bad code) I don’t want them to turn up the next day and see a pile of nerf darts on their empty chair. Because of a dedicated Slack channel we do know when our team members are not in the office.  Ok, but how to work out when they arrive? Well that’s where the door hack comes in.   Our door system knows who you are as it plays a custom theme music when you enter in the room.  Connecting this sensor and slack to the sensor environment will mean my turret instead will know when you’re working from home and know when you enter into the room and so it can shoot you then and there instead.  Sensor fusion complete.

(I do need to add that none of this data is stored, it’s all anonymous-keyed data and it’s all voluntary based.  IoT does open up the possibility of abusing data and people’s privacy and it’s worth considering the ethical standards of which you operate under. And I’m fully aware I’m discussing privacy ethics when I’m shooting people with a nerf turret when they do something bad.)

Embedded system

I’m going to be using an Intel Galileo board with a couple of Arduino Shields.  The Galileo runs linux as a System on Chip (SOC) and includes header pins for plugging on standard Arduino shields.  An interpreter for Arduino code runs in the linux environment.  This means you can use all the 1000’s of Arduino shields for interacting with the environment and have a powerful linux based OS to run more complex code, one of the significant limitations of Arduino systems.

On the Linux side, I’ll be writing a module to communicate to a remote server to receive firing commands over the internet.  I’ll use Arduino shields to control the actual movement and firing of the turret, a stepper motor shield to control the movement and a relay shield to control the firing mechanism trigger.  I’ll probably write the Arduino control logic using the Arduino PDE and have it communicate to the linux module.  Finally a small script on a server will handle the fusion of data from the various sources and enable me to program and calibrate the system.

The Turret

I’m going to hack the battery operated Nerf gun to work from mains power and to be fired from an electronic signal.  I’ll need to build a turret with two degrees of motion to hold the gun, giving me rotation in azimuth and elevation (pan and tilt).  I’ll use Actobotics hardware to make the manufacture of this arm simpler, with the added benefit all the standard parts have CAD files readily downloadable so I can model the build before I buy the right parts.  Calibration of the turret will be done with a couple of hall effect sensors and magnets.

The cool thing here is that I’ve still got the Edison and RealSense to do something with 🙂

Intel Australia provided the development kits for this project.

Read part two of the Turret here