Introduction: Wireless RF Controlled Fire Effects
This piece was recently featured on Tekzilla! Please check out this video for a quick overview of the piece:
IMPORTANT SAFETY STUFF
This instructable contains information that could lead to injury, death, burning your house down, burning your neighbors house down, burning your hair off, land you in a hospital, etc. This information is not guaranteed to be complete, it has not been "approved" by any regulatory body which can ensure your safety, because there isn't one for this project. I can't take responsibility if you hurt yourself, and I really don't want you to. Knowledge is power...use this knowledge at your own risk. Sheet Metal Alchemist does not take any responsibility for the consequences.
Step 1: Fire Effect Basics
The basic parts of creating a fire effect can fill an entire instructable. In fact, someone has already done a good job explaining this process! Check out:
For anyone trying to build propane flame effects, there is a critical element which needs controlling: a solenoid valve. Solenoid valves are basically electrically controlled valves. These come in a variety of different versions depending on your voltage / polarity requirements. Fenrir uses 120V AC solenoid valves. In short, connecting 120V to the 2 lead wires of the solenoid valve opens the valve. Disconnecting voltage from the solenoid closes the valve. I got my solenoid valves from ebay seller valves4projects (http://myworld.ebay.com/valves4projects/)
SAFETY NOTE AGAIN:
If you buy solenoid valves from anywhere for use with propane, make sure they are properly rated for use with propane. Water valves will *NOT* work. They will degrade...you will hurt yourself, or something will explode. Valves seals should be viton. Valve bodies should be brass or stainless steel. Valves should be rated at 200psi or greater.
To control the valve, we'd like to use microcontroller to do the RF sensing, and the opening and closing for us. A microcontroller is like a miniature computer that can't do a lot. Actually, I tell people to think of microcontrollers as little gremlins that you can poke with a small electrical current and they will flick a switch on or off for you...its a bit closer to reality. Arduino is a really popular and useful microcontroller if you are familiar with those. For this project, we are going to be using Pololu's Wixel instead (http://www.pololu.com/catalog/product/1336)
Step 2: Life Is a (relay) Race...
For anyone that has used microcontrollers before, you probably know what I'm going to say next...you can't just drive your solenoid valve from the microcontroller directly. Microcontrollers work on DC voltage, whereas solenoids work on AC.
Can't I just buy a DC solenoid?
Alas, nope. Not that simple. Solenoids take quite a bit of power to run - nearly 1 Amp at a time. Your microcontroller pins can only source milliamps at best.
Well, what do I do?
Simple! Use something called a relay. A relay works just like runners in the races. When one runner is too tired to continue, he hands off the baton to a faster runner.
In microcontroller land, a relay is used so we can control a big, beefy voltage and current with a tiny little voltage and current (like the one coming from our microcontroller). Sparkfun has a great little kit that gives you a relay, and all the little control bits you need to run it (https://www.sparkfun.com/products/11042). Get yourself one of those dudes and solder it together!
Step 3: Wire Your Wixel to Your Relay Board
OK! Step 1 of actually doing something other than spending cash and making kits! Time to solder your own wires.
You'll need to connect your wixel to your relay board. Note there are 3 leads on the relay board. One is 5V power and its associated ground, the other is for control. You need 5V power for your relay in order to control the mechanical relay mechanism and the LED onboard. If you are powering your wixel with a 5V USB charger (like I am!), then you'll be able to source 5V from the wixel VALT pin. Connect that to 5V, connect your favorite ground to ground, and then connect one of the Wixel GPIOs to CTRL (I'm using P1_0).
Step 4: Connect Your Relay Board to Your Solenoid
Cool! Now your wixel can control your relay, but your relay needs to get connected to your solenoid valve. The relay acts like a break in a single part of your AC line. Same with the solenoid. Check out the circuit diagram to see how it all fits together. Note: the black line and the dotted black line are the black and white lines inside of an AC power cord (if that is what you are using). The green wire inside of your AC power cord is the ground line and will not actually power anything if you connect something to it!
Step 5: Power Your Wixel and Your Relay Board
So, you have AC power flowing through the relay. However, your wixel runs on DC. Plugging wall current directly into a microcontroller is a perfect way to make a microcontroller lose its magic smoke, and every electronics person knows that after the magic smoke leaves your electronic component, it will never work again.
To keep the magic smoke inside your circuits, we're going to use an AC-DC converter to convert 120V AC current to 5V DC current. I'd recommend using this 5V AC-DC Coverter from Jameco.
Why should you use a dedicated power supply instead of a wall wart and USB cable? Mostly for robustness. If you have a small power supply inside your housing, you can use screw terminals and solder connections to make sure your wires stay in place. USB connectors and wall plugs are not really designed to take a beating in the back of a pickup truck on the way to an event. Additionally, the added bulk of the plastic casing on all the connectors will take up valuable real estate inside your receiving boxes.
I have tried using wall wart regulators and USB cables instead of a dedicated PSU and have had some pretty shoddy luck over long periods of time. I would definitely recommend using the power supply.
After you have your power supply, you'll need to attach it to the wixel and AC input. The Green wire from your (grounded) power cord goes to the ground symbol, the white wire from the AC input goes to the "N" (for neutral), and the black wire from the AC input goes to "L" (for live). If you don't have a green wire, you aren't using a grounded power cord!
Next, you'll want to attach a wire from the DC+ output to VIN on the wixel, and DC- output to an available GND on the wixel. Check out the wiring diagram below!
Step 6: Make an Enclosure for Your Creation
OK! Now all the wiring is done. Time to make an enclosure to house all these components.
1/4" thick Acrylic is my favorite thing to make enclosures out of. Its pretty durable. Its non-conductive. You can get it in zillions of colors including clear, and the best part is it cuts like butter on a laser cutter! I'm lucky enough to have access to one of those beasts, so I used it to make my own enclosure.
To get the pattern, I used boxmaker from Rahulbotics. Making a box is simple with his tool. Type in LxWxH and material thickness and voila! PDF file for laser cutting! I usually spiff them up a bit and add graphics and interior cutouts for wires and the like. I made a 5x5x3" box for this example.
Step 7: Side 1 Works!
Didja turn it on? didja, didja?? If you did everything well, you should get some light up blinkies, but nothing else should be happening yet. If you got a puff of smoke...uuuum...you messed something up. If lights are a blinking, then head on to the next step!
See the image? All those receiving boxes were made with the instructions I just gave you...kind of. These were the examples where I used a 5V USB wall wart. Almost all of these boxes needed repairing after some time in the field. Like I said...use the power supplies.
Step 8: Begin Side #2, the Wireless Transmitter + Button Side
Constructing side #2 is similar to side #1 in that we'll need to get power over to our (second) wixel. Yes...you need 2 wixels in total to do this project. One to encode on the sending side, and the other to decode on the receiving side.
To start, let's get power running to our wixel. Since we won't have AC power nearby, and we want this box to be as portable as possible, power is going to come from a set of 3x AAA batteries (yes...only 3...the wixel is a 3.3V microcontroller). I'm using this neato little enclosure from sparkfun which not only neatly holds my batteries, but also provides a way to switch them off quite simply and save some power. Wire this up to your microcontroller according to the below diagram.
Step 9: Add a -pull-down- Button to Your Microcontroller
Next step...add a button!
The wixel comes with 20k pull-up resistors installed on the PCB. What does this mean? You could wire one side of your button to the input pin, and the other side of the button to ground, an you'd have a fully functional switch. However, remember the safety note about us running fire effects with this instructable. As such, I'm not very comfortable having to maintain a steady connection to the base station in order to produce a constant output on that end. What would happen when the battery dies in my transmitter?
Instead, I reconfigured my wixel to work with a pull down resistor. That way, if the power cuts out on my transmitting side, the signal gets dropped going to the other wixel, and the relay can be quickly closed turning the fire effect off. Safety first!
To do this, we're going to have to wire up our own pull down resistor. Check out the cartoon for how I did the wiring. Which button did I use? This slick one from sparkfun!
Brand new to wiring and have no idea what I am talking about when I say pull up and pull down? Check out this great article...it will help get you up to speed.
Step 10: Harness Your Wiring!
I can't stress how important this step is.
Harnessing your wiring essentially means tying it down so it can't move around a bunch. I know you think your solder connections are solid and aren't going to move anywhere, but they really are. You want to harness your wiring in such a way that when the wiring moves it doesn't put any stress on the solder joints or on any of the components with little bitty legs (i.e. resistors or LEDs). Additionally, I wire everything with stranded wire. It takes a bit more time to get into through hole connections, but it is much more flexible and can take many more bend radii before it snaps.
Harnessing has to be done after your mechanical enclosure is made. Again, I made this acrylic box with boxmaker (see step 6). Also, you'll use a ton of 4" zip ties, and I'm a huge fan of using adhesive backed zip tie holders for doing the harnessing work.
Note how this is done. The wires going to the battery holder are also tied down to the base of the acrylic. This takes tension off the microcontroller connections. Note that the wires coming from the micro to the button are harnessed in 2 places! This is because the top part of the box (which holds the button) has to be removed quite a bit to get at the battery housing. Therefore, more strain relief is needed on this joint.
Step 11: Program Your Wixels: Install IDE
If you've done all the wiring properly, you should have a set of wixels set up, powered, and ready to talk to each other. The trouble is, right now they don't have anything to say! :-(.
To fix that little problem, we'll need to program the wixels. Wixels have a built in FTDI chip (needed to read commands from USB), so all we need to do is connect the mini-USB port on the wixel to our computer. Yes, I said mini-USB. Not micro-USB like your phone uses. Its unlikely you have this cable hanging around, so you may have to buy your first one from your favorite electronics store. (Note: my favorite electronics store isn't amazon.com, but they do have lots of stuff :) ).
Before you plug in you wixel to your computer, you'll want to install the Wixel development environment that Pololu supplies. The Wixel IDE is really simple for beginners - its a nice, little graphical interface where you get quick, direct access to the GPIOs you need. If this is too constricting for the experts out there, you are always welcome to plow through the scripting language and get things tweaked for yourself. We won't need to do much of that for this project.
A link to the windows software bundle you'll need is right here!
Do you have the software? Install it following the steps outlined in the Wixel User Guide for your particular OS. Not a Windows user? Links to the software are included inside the wixel user guide for linux and mac too!
Step 12: Install Sample Scripts on Sending and Receiving End
For this project, Wixel has a set of sample scripts that do pretty much exactly what we wanted to do!
Download the wixel code and check out the description of the code here
Here is how I set up my code to test:
On the sending wixel (the one with the button), I have set P1_0 to the value -1 since that is where button has been connected
On the receiving wixel (the one with the relay and fire), I have set P2_1 and P0_1 to a value of 1. The relay is connected to P0_1, and the a red LED is connected to P2_1. Therefore, the LED should turn on, *and* the relay should activate at the same time. This helps out immensely for debugging.
Test this out by uploading those images to both wixels. Upon pressing the button on the sending side, you should hear the relay "click" open or closed, and you should see the LED turn on.
Step 13: Switch to "pull Down" Script
Remember how the wixel is normally configured for pull up resistors? Remember how we wired our wixel with a pull down resistor? I bet you are getting the reverse of what you expect on your wixel right now :). In other words, as soon as it is powered on, the relay opens. Pressing the button closes the relay.
We want to reverse this :).
Thankfully, I've done the work for you already! I plowed through one of the stock examples, and flipped a bit of logic around to get this to work with our pull down example. The code is attached to this example. Going through how to write your own wixel app is enough info for an entire instructable on its own, so I'm not going to go into much detail here. If you get interested, the place to start is getting the SDK installed on your computer...start here!
Note: I think this is currently supported on Windows only. Sorry other kids :-(
Step 14: PLAY!
OK, so if all went to plan, you should now be able to turn on your wixel, and go nuts! I've had luck getting flame effects to trigger from about 100' away. Hope you have just as much luck!