Star Wars DF.9 Turret
So this project from a random search for Star Wars on Thingiverse I discovered thing:3041805. This intrigued me as I remember it vividly from the 5th Star Wars movie The Empire Strikes Back. I had wanted for a while to make a turret and this looked like a great platform to try.
Printing
So I used my Prusa i3 Mk3 printer, with some Orange filament. This was what I happened to have available at the moment. I downloaded the files from https://www.thingiverse.com/thing:3041805 and doubled each part. Now the parts were great, but they were meant for a board game. I have attached the modified barrel and turret files to accommodate for the wires and LED. The base should be downloaded from Thingiverse. I printed at .15 mm a layer, without rafts or supports. The base was the longest part taking almost 15 hours.
The servo holder is the only piece that I custom made myself. It fits snugly in the center of the tower and prevents the servo from rotating instead of rotating the turret. It will be glued in for the final product.
The Electronics
Parts:
NodeMCU: https://www.amazon.com/HiLetgo-Internet-Developmen...
9G Servo: https://www.amazon.com/American-Robotic-Supply-Aut...
Unfortunately I glued the barrel into the turret, so I don't have any photos of that, but I super glued the led into place after running the wires though the hold i had made down the barrel. The servo arms were screwed into two small holes I hand drilled into the turret top, before you attach it to the top, screen it into the servo (because it may float around otherwise. These need to be nice and snug, but don't over screw them or you'll break the plastic.
The brain brain of the device is the NodeMCU which is an Esp8266 based, Arduino compatible board. It has built in wifi and is generally a great low power board. I pay on average $6 a board for these, and they are my go to standard for most of my projects. You can see the wiring here, and my code in the next stop will explain the full pinout.
Software/Code
So I tried something new for me this time around. I have known about the Blynk IoT libraries/services for a while now but had never tried them out. Their website is https://www.blynk.cc. I was very impressed with the simplicity of using it. To start off, I downloaded the app onto my iPhone and created an account. I then created a very basic UI of the two controls I would need, one for rotating the servo controlling the turret, and a second, a non toggling push button for the LED (laser). I then went and assigned either virtual or physical pins for each controller. This was done at first with a couple rounds of trial and error, but with some googling was able to easily get past it.
Next was getting the Blynk library into the Arduino IDE. The Arduino code was one of the simplest I have ever written with the exception of the LED Blink I did in my earliest days of developing on Arduino. To see what I mean look at my code, and you'll see it's not much more complicated than a basic blank project. The Blynk library does a lot of the heavy lifting for you.
I have added the QR Code for my app so that you can download it and load my code directly on your own board (you'll need to change the username, password and auth token).
Downloads
Plans for the Future!
So this is a great basic template, but it's............drab. Over the next couple of weeks/months (I have a kid so dev time is limited) I plan on painting the model to look more realistic. Next I want to add some sound to this for at least two noises, a rotating noise and a shooting noise. I think also some sound bites from the battle scenes would be nifty as well.
PIE IN THE SKY is to make it auto follow using either OpenCV or PixyCam. Then my son can play with it solo without me manually tracking him.