RFM12-Lib in operation: Remote control of toy train Royal Express [130160-I]
What can you do as Electronic-based grandfather if you have two grandsons, two toy trains and two remote control units, but only one control path? How to avoid the problems if each remote control unit does operate both trains simultaneously?
What can you do as Electronic-based grandfather if you have two grandsons, two toy trains and two remote control units, but only one control path? How to avoid the problems if each remote control unit does operate both trains simultaneously?
My grandsons own toy trains branded Royal Express, which are battery powered and controlled via infrared control. It runs back and forth with different speeds and produces nice sounds like bell and horn. The remote control cannot be changed, so with one control unit both trains do react. In order to keep piece during play sessions, I must separate the control systems. Because I had finished the adaptation of the RFM12 transceiver (433 Mhz) for my house control, I took this solution for the control of one train.
The infrared control unit has been exchanged by a RF transmitter, the infrared receiver of the train has been disconnected and a little RF receiver was integrated instead. Both units, transmitter and receiver, are equipped with a small PIC18F14K22 and a RFM12. The schematics are rather simple and attached. PIC and RFM12 communicate via SPI protocol. The RF communication is simple as well, the status of some push buttons for sound and an analog value for speed control are transmitted several times per second. The receiver firmware decodes the transmitted packets and converts it to telegrams, which originally would be sent by the infrared control.
These telegrams go then to the MC of the train doing the requested actions. With this solution, the control effort of the receiver is rather small and the nice sound is still available. The firmware is compiled with Pascal Pro version 5.60 from MikroElektronika. The projects for both items, transmitter (Sender) and receiver (Empfang), are attached.
Discussion (6 comments)
Peter PO Odaglas 8 years ago
waltro 11 years ago
Your PCB designs look great. Will you offer these for purchase?
Many thanks for your support.
Walter
ClemensValens 11 years ago
waltro 11 years ago
Hi Krishna,
The SPI transmission between MCU and RFM12 is softcoded.
I do not yet use the SPI-modul of the PIC, which is planned for a future release. Because there are around 16 nops embedded for delay in the software, the actual speed is rather low. I think the clock period is about 6 uS.
But the RFM12 is much faster, the shortest clock period is specified as 50 nanoS.
In case you would address more than 2 objects, you have to consider this in your code. In the message format the target and sender addresses are specified. But not yet encoded in the higher level, which should be rather easy.
Best regards
waltro
waltro 11 years ago
krishna 11 years ago
krishna 11 years ago
Hi Waltro,
How much the clock speed of SPI ???
Also i have something in my mind , if you have more than two grandchildren (i mean more than two trains), i thing this is not going to work in that scenario. In this case you have to adapt the addressing system. Awaiting your reply.
Thank you
Krishna
ClemensValens 11 years ago
waltro 11 years ago
ClemensValens 11 years ago
Hello waltro,
Maybe you can re-upload the attachements you mention because they seem to have been lost somewhere. Do not forget to click the Upload button after you have selected a file with the Browse button.
Regards,
Clemens
waltro 11 years ago