R/C Animator lets you add sounds and lighting to your R/C car, airplane, helicopter, or boat. Effects are triggered with your R/C controller and can be combined. Here's a demo;
Effects can include changing the position of a secondary servo, playing back CD quality audio, or changing lights. On my R/C car, I'm using four LED's and a mono speaker for audio playback. First, I'll answer a few questions, then I'll show you how to make it.
How does it work?
R/C Animator triggers effects based on the position of the servos in your vehicle. So, you can trigger the playback of a rumbling V8 when the throttle servo opens up. Or you could connect a spare servo channel to the R/C Animator to turn on an LED 'light bar' and play a siren.
I'll show you how to customize the logic for whatever effects you want, too.
What effects are available?
Up to 32GB of audio samples can be stored and played back in CD quality stereo. An onboard audio amp will drive speakers up to 1/4 Watt.
Up to 25 LED's can be turned on, blinked, or faded.
Secondary servo movements
Multiple servos can be directly controlled by R/C Animator, so a single wireless channel can trigger secondary servo animations
R/C Animator is designed to chain and combine these effects.
Will it work with my vehicle?
Most likely. Digital and analog servos use the same signalling method. If you're using old airtronics servos (non-z connector), you'll need to flip a wire.
How many batteries does it take?
None — It runs off the servo power and only draws a few mA.
What are the dimensions?
7.2cm x 6.3cm x 2.54cm (2.8" x 2.5" x 1.0"). The basic R/C Animator weighs about 40g (1.5oz). If you use audio, you'll also need to include the weight of the speaker.
Preparation: Parts and Tools
For the R/C animator, you'll need a few parts;
A kit is also available here.
- Propeller Platform USB (Source)
- ProtoPlus board (Source)
- 46 Straight Pin Headers
- 7 position pin socket
- Spare servo header
- 4.7k resistor
- Hookup wire
- LED's, any color
Assembly takes about an hour, including setting up the lights. If you've never soldered before, there are a bunch of great instructables to guide you, like this one. You'll need a few tools:
- Soldering Iron and solder. Leaded solder is easier to work with, and a 15-40 watt iron is just fine.
- Dikes. Diagonal cutters are used to trim the excess leads from components after soldering them down. I use a pair I got from Ikea for two bucks.
I recommend leaded solder, especially if you're just starting out. Leaded solder is easier to work with, melts at lower temperatures, and results in better connections, particularly when you're inexperienced. Leaded solder is also poison, so don't put it in your mouth and wash your hands after soldering. The flux smoke aren't nearly as toxic, but they irritate my nose, so I try to avoid breathing them in.
Here's the circuit for reading servo states;
We draw a little power (through Vcc) to run the R/C Animator and the rest goes on to the servo. We spy on the servo status through a 4.7k ohm resistor connected to the servo signal wire.
Start building the circuit by adding the hookup wire as indicated in the photo above. There are seven wires;
- Three wires in the middle will connect both sets of servo headers
- Two wires connecting P12 and P13 pull power from the R/C receiver to power the Propeller Platform USB
- One jumper from the base of R1 to the top of C2 connects Ground
- One jumper from the base of R2 to V50 connects power
Now the connectors to the radio receiver and the servo, there are a few options here — An easy one is to take an old or broken servo and use your dikes to cut off the header and the wire. If you do that, don't connect the right angle header — Instead, connect the wires here;
The black wire goes where the black circle is. Same with the red and orange. Now, add the resistor as shown, it connects the signal line to the Propeller Platform.
Add the pin socket from P7 - P13, as shown below. Our lighting LED's will be added to the R/C vehicle shell, so these sockets allow us to easily disconnect the R/C Animator from the shell.
Finally, add pin headers pointing down, as shown in the photo.
- A strip connecting P4..P12
- Two headers connecting P14..P15
- Connect P16..P32
- And don't forget to connect Vin, V50, V33, and GND on both sides of the board.
All done with the circuit board! Now we'll add lighting to the vehicle body.
Start by planning where you want your lights. On my car, I've added four lights;
- Two act as brake lights
- Two act as headlights
Affix the lights where you want them using some tape or hot glue;
I wanted the headlights to take a crisp, rectangular shape when turned on. An easy way to do this is to use masking tape to block off the parts of the shell that shouldn't get illuminated, as I've done in the photo. Chipboard works well, too.
LED's are polarized devices. The shorter lead of the LED is the cathode, and the longer lead is the anode;
The mnemonic I use is that getting 'less lead' is a negative thing, hence it's the cathode. Getting more lead is a positive thing, so it's the anode. Here's the circuit we'll build;
All of the LED's on the body will have their cathodes (short leads) connected together, in a chain. At the end of the chain, add a foot or so of hookup wire, this will eventually connect back to the R/C Animator;
The LED's don't share anodes, though. Connect hookup wire to each anode separately. Start at the end of the chain, twisting the wires together as you add each LED. If you're connecting four LED's you'll have five wires;
- one wire that's connected to the long lead (cathode) of all the LED's.
- four wires that each connect to the short lead (anode) of a single LED.
Curl each wire around a pin header, making a 'pin header connector', and solder them together. Important: The shared cathode wire goes on the rightmost pin.
It doesn't matter what position the other wires are in, you can even skip a pin if you'd like. But make sure the shared cathode wire is on the rightmost position. This is a pretty weak connector, I suggest re-enforcing it with some hot glue.
The final step of the build is to connect the R/C Animator to the Servo, radio receiver, and the lights installed on the vehicle.
Loosely connect the R/C animator to your vehicle and test it by turning on the receiver and transmitter;
Everything should work the same as before the R/C Animator was connected. If you're having a problem here, first check the batteries on your vehicle and transmitter. Then check to make sure the servo connections are correct.
Once the test is passed, mount the R/C Animator securely in the chassis. Zip ties are handy for this.
Install the Propeller Tool on your computer (Mac, Linux, Windows Instructions). First, let's figure out which LED is connected to which pin. Open up The Propeller Tool and enter the following program;
Turn on your R/C transmitter and the receiver on the vehicle, and hit F10. The first LED that lights up is connected to P7, the second is connected to P8, and so on. Write it down. Here's what my setup looks like;
If one of your LED's doesn't light up, check the wiring for that LED. Make sure the cathode is connected to all the other LED's and make sure the Anode is connected to the R/C Animator. If none of the LED's light up, check the cathode wire to make sure they're all connected.
R/C Animator is meant to be customized! Start by downloading the code, and unzip it into a new directory on your desktop. Open up Animator_Demo.spin. This is the same code that's running on the demo video earlier.
The demo is a good starting point for making your own custom effects, so I'll break it down, starting at the beginning;
First, we have the CON block. The first two lines set the clock speed of the Propeller Platform. You won't ever need to change these. The next line is what pin the servo is connected to. The next four lines are the pins each LED is connected to.
After that, there's an OBJ block. This includes the RC_Animator_010.spin object, which was included in the zip file and is where most of the heavy lifting occurs.
Everything is set up, here's the program;
This starts monitoring the pin connected to the servo. Once monitoring has started,
animate.servoposition will return the current position of the servo.
R/C Animator will run the code in this repeat loop as long as it's powered up.
IF animate.servoposition > animate#servomax
animate.servoposition returns the position of the servo. If it's at the maximum position, the code under this if statement will run.
fade the left headlamp for 500 milliseconds. The third argument selects whether we want it to fade down, or fade up.
animate.fade(llamp,500,1) will fade the lights up, but we could use
animate.fade(llamp,500,2) to fade the light down. The next line,
animate.fade(rlamp,500,1) does the same thing, but for the right headlamp.
Pause things for 3,000 milliseconds, or three seconds.
animate.wait(5000) would pause for five seconds, and
animate.wait(500) would pause for a half second.
In addition to fading a light, we can simply turn it on with this command. A light can be turned off with
animate.ledoff(llamp), as well.
Playback an audio file stored on the microSD card with the filename duke.wav. Files must be 16-bit stereo wavs, and stored on the root directory of the microSD card (no subdirectories).
ELSEIF animate.servoposition < animate#servomin
If our servo isn't at the max position, our next test is if it's at the minimum position. If so, the code under this statement will run.
If our servo isn't at max or min, this code will run. In this demo, we just make sure all the lights are turned off.
Play a wave file stored on the microSD card with the filename given. Note that R/C Animator doesn't support directories, everything has to be on the root of the card. But SDHC (cards greater than 2GB) are supported.
turn the LED connected to pinnum on
turn the LED connecto to pinnum off
Hold up for the number of milliseconds given. There are 1,000 milliseconds in a second. This is helpful for creating realistic complex animations - like pausing before blinking a light or playing an audio file
Fade an LED connected to pinnum. The duration of the fade will be milliseconds. If you set selector to 1, you'll get a fade up, if selector is 2, the light will start full and fade down.
This is for controlling a secondary servo. Before you can do this, be sure to first call servoSlaveStart, once in the program. The max position is 2,500 and the minimum position is 500.
To add the audio circuit, you'll need a few additional parts;
The kit includes all the parts for the audio circuit except the speaker and microSD card. Here's the circuit we'll build;
- Small Speaker
- LM368 Audio Amp
- 220uF Electrolytic capacitor
- 10k ohm potentiometer
- Screw Terminal connector
- microSD card to hold samples
Start by adding a few jumpers;
there will be seven jumpers, total, and I've marked them with a black line in the photo.
Add the audio amp (the LM386). Note the position of the notch on the chip in relation to the board;
Now, add the volume knob;
The middle pin on the knob connects to P4 on the Propeller Platform. One leg connects to the third pin on the amp, and the other pin connects to ground.
Now, add the big capacitor;
Note the stripe on the Capacitor. It indicates the negative side, and it should go as shown in the photo.
Finally, add the Audio connector;
Speakers have two leads, one lead goes in each screw terminal connector. They aren't polarized, so it doesn't matter which lead goes to which terminal.
I hope you enjoyed putting together the R/C Animator! The first thing to do is to customize it for your particular animation needs, and that's covered in step 8.
We're triggering effects based on servo positions, but we could also trigger effects with other sensors. Maybe a photoresistor would trigger the lights to go on automatically when it's dark. Or an accelerometer could trigger a secondary servo when acceleration is sensed.
You can define triggers like 'Move throttle to max, back to min, and back to max within 2 seconds' to get the most out of limited servo channels.