Lessons Learned From Building an IoT Flamethrower Tank

tank-banner

Background

This project all started because I’m lazy and I hate yard work.  My goal with this project was to create a tank with a small weed torch (flamethrower sounds much more intimidating) that I could remotely drive around to burn any weeds that had the nerve to grow in my yard.

Disclaimer:  this should go without saying, but obviously a remote controlled flamethrower can be very dangerous!  Don’t try copying this & then blaming me if something goes wrong!

Since I had already worked with a Raspberry Pi for  my home arcade cabinet, I figured an Arduino microcontroller would be a good fit for this project. As an added bonus, it gives me a better understanding of a core component for future Internet of Things (IoT) projects.

Don’t feel like reading the whole article? Skip to the video and photo gallery!

Design Progression

  • Concept 1 – The controller was actually hard wired, I had the wrong types of motors, and this was pieced together with mostly spare parts.  This is a very sad looking “tank” – but I didn’t burn the house down, and it motivated me to put more time into it

tank-concept1

  • Concept 2 – This was using a simplified Android app that I wrote which sent commands over Bluetooth.  A Bluetooth receiver was hooked up to the Arduino to process the commands.  The frame was a little flimsy, and trying to send commands from the smartphone was not very user friendly.

tank-concept2

  • Concept 3 – The first fully working version!  Commands are now sent with an Xbox controller and there’s a USB Xbox wireless receiver which relays the commands to the Arduino.  Still not perfect, but it’s very close to being functional.

tank-concept3

 

Lessons Learned / Complications

  1. The Arduino IDE is a bit painful to program in, especially for anyone who’s used to an IDE with more features such as Visual Studio.  Luckily, there’s a Visual Studio extension called Visual Micro which lets you write the Arduino logic & debug your code.  I’m still trying it out, but so far it looks pretty good.  Just the Intellisense capability alone makes it worth it!
  2. Programming an Arduino is easier than I expected it to be.  The code itself is basically C++ (along with some custom wrappers), and it’s divided into 2 main sections – a setup() function that gets run once as the Arduino powers up (initialization logic goes here), and a loop() function which gets executed continuously (here’s where you can read inputs, run custom logic, then set outputs).  Obviously, as your program grows in complexity you probably want to break out the code into additional functions, but technically you only need these 2 functions to have  a fully working program.
  3. Arduino microcontrollers are amazing, and there’s a ton of variety both with the different models of Arduino’s and the “shields” (i.e. expansion boards) that are available.  I chose to use the Arduino Uno to keep the cost down – this is basically the entry level model.  I’m already starting to hit the limits of what it can do, so maybe a fancier model such as the Mega would have been better.  Halfway through the project, I abandoned my original plan to use a custom smartphone app sending commands over Bluetooth, and realized I could use a USB Host shield with a wireless receiver to process commands from a wireless Xbox 360 controller.  If you’re thinking of starting an IoT type project, I’d suggest researching the processors, shields, etc out there so you know what your options are.
  4. Now for the bad news with the Arduino shields – some of them try to use the same I/O ports.  For example, both the USB Host shield and the Motor Control shield tried to use pins 11-13, which is obviously a problem.  There are several workarounds for this.  One option is to use a Go-Between Shield to basically reroute the signals you need.  I was tempted to do this, and might have chose this option if I needed to reroute a lot of pins, but it seemed like overkill for my situation and might just introduce more failure points.  So to follow the “Keep It Simple” principle that’s popular in software development, I just decided to run jumpers to spare pins and that solved the problem.
  5. Can’t find a part you need?  3D printing is easier than you think!  There are some very complicated CAD programs out there with steep learning curves, but those are overkill for 90-95% of the situations.  For most of what I print, I use TinkerCAD – it’s web based so you do not need to install anything, you can access your designs from anywhere and it is extremely simple to use.  By making your parts partially hollow they are very cheap & quick to print.  The tank uses quite a bit of 3D printed parts, and the material for all of it was probably only about $10.  3D printers used to cost several thousand dollars, but they are rapidly dropping in price and some are as low as $250-300.
  6. OK, I’m cheating a bit on this point since I haven’t actually made the tank a true “smart”/connected device yet.  I should’ve thought about the connectivity issue a bit more up front, because one option is to use an Arduino Yun instead of the Uno.  The Yun comes with wifi connectivity built in, so it’s a great choice for IoT projects.  There are many other options to consider – one that looks pretty neat is Blynk, but I haven’t tried it out yet.
  7. Getting the treads to reliably run was much more tricky than I expected – too loose and they’ll pop off the sprocket & guides, too tight and they’ll stall the motors.  Even with the current design it’s still not great, and I’ll likely try to improve it further
  8. Configuring the USB Host shield shouldn’t have been difficult but I was referring to some conflicting & outdated information.  I finally figured it out, and posted a tutorial to help anyone else who might need to set one up.

Next Steps

  • Hardware upgrades to make it a true “smart”/IoT device.  This would enable features such as:
    • Data logging & reporting through RESTful web services on www.joshcaplin.com for reporting (total distance traveled, confirmed foliage kills, etc.)
    • Internet or smart phone integration for sending remote commands from anywhere in the world
    • Live video feeds
  • Increase speed, improve reliability for the tracks/treads
  • On/off control from the Xbox controller for the flamethrower
  • Swappable turrets for multitasking such as a beer drink delivery assistant, poor mans Roomba with a shop vac, etc.
  • Maybe a 3D printed drone with vision system to track and follow the tank?

 

Video

Photo Gallery

 

Final Words

For anyone looking to do something similar, two companies I’d suggest looking at are  SparkFun and ServoCity.  They both have a wide variety of parts, both ship very fast, and tech support for both of them are very helpful!

Hopefully this article was helpful – leave a comment below if there’s any details you want me to add, and follow me on Twitter to see my next experiment!

 

 

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s