(Title tribute to the much-missed web-comic)
Seeing as I’ve got too many painting-projects on the go at the moment, I have decided to resurrect an old idea I had: Adding some electronic circuits to my 40k vehicles, for keeping track of their in-game status, and, just for fun, some sound-effects.
For those familiar with Warhammer 40k, I started off with a Land Raider Crusader, destined for the Death Wing of my Dark Angels army. I already have a God-Hammer, so some anti-infantry fire might be useful (translation: tank with lots of machine-guns!). Initial thoughts included a switch to indicate speed, LEDs to show remaining Hull Points, and lights and sounds for the guns and engine.
After brushing the dust from my 20+ year old electronics box, and realising there was very little worth salvaging (I think the resistors are still OK, and a few unidentified transistors), I headed to Electronics Point to get some advice. The very kind people there talked me through the relative merits of Arduino microprocessors, and I plumped for a Nano 3.0 clone (£3.50 from e-bay, rather than £15 from Maplins). I then needed to start figuring out how to program it, and design a circuit.
Several false-starts later, and a visit to Bits Box, I have a breadboard stuffed with components, and some code that lights up LEDs by pushing buttons! 🙂 And I only blew up one Arduino!*
- Speed switch lights appropriate LED.
- Hull Points start with all 4 LEDs on. Buttons record Damage Taken and repaired, altering display.
- Status Lights: Tank may be Shaken, Stunned and/or Immobilised, with a button toggling each.
- While Immobile, Speed is set to STOP, no matter the position of Speed Switch.
I’m using Resistor-ladders (Voltage Dividers) on Analogue pins for the inputs, reading the voltage levels to determine which buttons are pressed. Outputs to the LEDs are done with two 74HC595 Shift-Register chips. While I’m a little rusty with C++, the code is relatively simple, once you get to grips with the Arduino-specific stuff (defining pin-Numbers, remembering to set them as input or Output).
For testing, I’m powering from my PC’s USB port, but for in the field, I’ve got a 4x AA battery holder, and designed (by which I mean Googled!) a Voltage regulator circuit (7805 Chip) to drop the 6V down to a stable 5V. I can build this on a small piece of veroboard that fits onto the end of the battery holder!
I am now waiting on several things, to progress. The Audio circuit is taking longer than I expected to design/get advice one/send for parts/build. It is based around a LM386 op-amp chip, powering an 8 ohm speaker. The sound quality will not be brilliant, as the Arduino can’t cope very well with hi-fi sound. But it should be good enough. I also have to rig up an SD card reader, as I am hoping to use several files for each sound effect, and randomly choose which plays (e.g. the “Gun” sound might be a long burst, or a few short bursts.)
A friend has access to PCB etching, so I am am learning ExpressPCB to design the boards I need. So far, so frustrating! Just about got them built though (subject to expert advice). The Main Section consists of the Arduino that will not be on a board, the Shift Registers, and wires leading to LEDs/Switches (with associated resistors). These will be built into the top plate of the Tank.
So, there you go!
There will be more updates as I go along, and more detail can be provided if you wish. And I may even add Turn Signals! 🙂
For now, I am going to start painting it, before loading in all the circuits, or I’ll just get paint over everything!
*(Pro-tip: Do not short-circuit the 5V pin of an Arduino directly to the GND pin!)