RC control and sound for a small railcar using Picaxe

gregh

electronics, computers and scratchbuilding
Country flag
I built a small railcar for my grandson Nick, a few years ago. Because he was young I just provided a for/off/rev switch on the roof.  (the little black ‘stalk’). It had a simple Picaxe sound system.
nick side.JPG

But now he wants radio control.
So I used a 433 MHz  keyfob type control. This is the transmitter
nick tx.JPG

The A button causes it to accelerate,  B for brake and D to toggle direction. (C is not used).
The Receiver is the green board in this pic, mounted below my veroboard circuit.
under board.JPG

Previously I have always used two, 8-pin picaxes – one for motor speed/direction and one for sound. But the new 08M2 version can run a 32 MHz, so I decided to try and do it all with one 8-pin picaxe.
I also tried to write a program to simulate gear changes.  I’m not very happy with the sounds, but it will have to do!  Still it’s pretty good to get motor speed, direction, sound and volume control  all from one small chip with 6 IO pins!
Nick cct board.JPG

And here is everything crammed in.  I used eight,  low discharge NiMH batteries.
nick inside.JPG

After writing and testing many different programs for the Picaxe, I decided on a control method that uses just 4 presses of the A button to get to top speed.  Pressing it once, runs the speed up to 25%, and motor RPM sound up to max, then changes into 2nd gear with reduced revs – ie just loping along in 2nd.  Pressing A again, increases the motor speed to 50% and RPM sounds to max and then changes into 3rd gear, with low RPM sound. Repeat to get into 4th gear at 75% speed and low RPM then the 4th press takes speed up to 100% and RPM to max.  Braking is just a continuous hold of B button for about 4 secs with no gears, just a gradual reduction of RPM sound.  Volume is reduced when slowing and stopped. Pressing D button toggles the direction.

I also added directional LED headlights and a cabin light for the passengers.

Now Nick is getting ready to travel around the world and hopefully get a run in the UK and USA.

Here’s a short video to demonstrate the sound.
[size=12pt]http://youtu.be/r9fd7v-OQ7M[/size]
 
We can always rely on you to be innovative Greg... My grandson has absolutely no interest in railways, he far prefers chasing sheep on his quadbike....
I hope the Keyfob transmitter does not raise any eyebrows with those who guard against bombings....
 
Amazing how much can be crammed into such a small space. Masterful, Greg. Speaker in the roof?

Rik
 
[quote author=ge_rik link=topic=299598.msg326007#msg326007 date=1409636362]
Amazing how much can be crammed into such a small space. Masterful, Greg. Speaker in the roof?
Rik
[/quote]
No, there is a 2" speaker facing outwards in the grill seen in pic 1.
In the final pic the speaker is under the red plug and green heatshrink wiring.
I think that`s why the sound isn`t so good - there`s too much stuff crammed behind the spkr. Here`s a pic of the compartment before all the stuff was pushed in.
IMG_0102s.JPG
 
Doesn`t look any less filled up then the inside of my boxcab. Make sure the box the speaker is in is completely airtight as this makes alot of difference.

IMG_1043 sm.jpg

The cab the speaker points out into, has a large hole in the bottom so the sound comes out from underneath the boxcab
 
Reading the section on sound installation brought the following to mind, and I thought I'd share it.
When I put sound into a loco or other piece of rolling stock, I am always looking for an amplifier. Not anything to do with electronics however. I'm speaking of the sound box that enhances the sound. I've found that spray paint can lids make excellent sound boxes. 2 1/2" diameter speakers fit perfectly, face down, on the open side of the lid. The speaker can be held in place by any number of options. A bit of epoxy, maybe some hot glue, or perhaps with silver foil duct tape, but just let the tape cover the metal frame of the speaker, then fold it down onto the plastic cap.
 
Back
Top