Encoder and decoder for remote control (RC car)

Thread Starter

Ladia

Joined Jul 30, 2021
4
Hi, I am creating my own RC car, which, of course, includes a transmitter (a device commanding the car) and a receiver (the car itself). As for the design of the transmitter, the plan is to use an encoder that encodes the signals onto a serial line, which will be used by an RF transmitter to wirelessly transport the commands to the car's RF receiver.

I did some research, and I found two chips capable of accomplishing this goal. These are TX2 (and RX2) and HT12E (and HT12D).
https://datasheetspdf.com/pdf/1077441/HIGHLAND/RX2/1
https://www.farnell.com/datasheets/1899539.pdf

However, these are rather simple, because they differentiate between two states—go forward, or don't go forward. I want the transition to be more continuous, which means that the chip should also support values in-between the two states.

Do you know of any circuits capable of accomplishing the intended goal?
Should I rather create a custom circuit for this purpose?

Thanks for any advice.
 
Still take a look at Holtek.com. It my not be plug and play. Some chips send serial information and you would have to turn that into PWM and create the serial protocol.

maybe something like
00 +128 is full right
01 +128 is full left
10 +128 is full fwd
11 +128 is full reverse

The joystick increments or decrements depending on direction at some rate. The receiver interprets the codes.
For FWD and REV PWM. For steering, that's position. For a simple car, it could be time or some sort of feedback mechanism.
 

Thread Starter

Ladia

Joined Jul 30, 2021
4
This is usually done using multi-channel PWM signals to servos.

https://learn.sparkfun.com/tutorials/hobby-servo-tutorial/all
You're right. But I need a way to communicate the information from the transmitter to the car. Let's say the user pushes the joystick on the controller only halfway, which means that the car should neither stand still and neither go full throttle. Basically, I need to transform (encode) the information from the joystick into a serial signal, which will be transmitted using an RF transmitter. For example, the HT12E chip is capable of encoding only 4 bits of information, which is not enough for my needs.
 

LesJones

Joined Jan 8, 2017
4,190
You would NOT use the HT12E series chips. For a 5 channel system you would generate a string of 5 pulses (One pulse per channel.) You would control the duration of each pulse between 1 mS and 2 mS long. 1mS would move the servo for that channel to for example the full left position, 1.5 mS pulse would give the center position and 2 mS would give the full right position.
A better description is in the "Control signal" section of the link provided by MrChips. I don't know of a family of chips designed to provide this encoding and decoding but it could be done using an 8 bit microcontroller.

Les.
 

Thread Starter

Ladia

Joined Jul 30, 2021
4
You would NOT use the HT12E series chips. For a 5 channel system you would generate a string of 5 pulses (One pulse per channel.) You would control the duration of each pulse between 1 mS and 2 mS long. 1mS would move the servo for that channel to for example the full left position, 1.5 mS pulse would give the center position and 2 mS would give the full right position.
A better description is in the "Control signal" section of the link provided by MrChips. I don't know of a family of chips designed to provide this encoding and decoding but it could be done using an 8 bit microcontroller.

Les.
If I understand your message correctly, you explained to me how to use PWM to control motors. However, I believe the logic for generating a PWM signal is to be a part of the car and not the joystick. I am trying to solve how to transmit commands from the joystick to the car. I need to send commands from the joystick's controls via an RF transmitter and to do so, I need some kind of a protocol, which would allow me to communicate by how much the car should steer, etc.

I'm sorry if I misunderstood you somehow. Thanks for helping!
 

LesJones

Joined Jan 8, 2017
4,190
The logic to generate the variable length pulses is in the transmitter unit. The transmitted signal is modulated with this pulse chain. The logic in the receiver circuit separates out the string of pulses and routes them to the servo associated with that channel.
The pulse string method is the protocol. The puse string directly modulated the transmitted carrier. (I think amplitude modulation is used. As the signal is just pulses it is just on / off keying of the carrier.)
As LowQCab said in post #4 it is probably cheaper to buy ready made transmitter and receiver units than to design and build your own.

Les.
 

KeithWalker

Joined Jul 10, 2017
3,091
It is a very complex task to design your own RF transmitter and receiver circuits. I know because I have done it in a number of occaisions over the last 50 years, so I assume you will be using off-the-shelf modules. For the transmitter encoder, all you need is an Arduino nano and a potentiometer (or joystick) for each channel of control. Details are given in some of the tutorials in the URL AlbertHall supplied. For the receive decoder, all you need is a 4017 decade counter chip and a few minor components. I have used it successfully for up to 8 separate channels. See attached,

RC Decoder.jpg
 

MrChips

Joined Oct 2, 2009
30,805
You need to read up on how RC systems work.
Assuming that you want to build your own RC and you have selected the TX and RX for frequency, power and range, here is what you need to know.

What you have described is known as ON/OFF control.
What you are requesting is known as proportional control.

The RF carrier signal is modulated with an on-off signal, This can be used to send a proportional signal in two ways.

1) A PWM digital pulse is transmitted with a pulse width between 1ms and 2ms.
1ms represents 0% control and 2ms is 100% control. The control is linear and hence 1.5ms is 50% control.
The control signal for the next channel is sent 6-10ms after the preceding channel. The entire frame is repeated every 15-25ms.
This signal can be used directly with commercial RC servos.


1627739536076.png


2) A digitally encoded signal of any number of bits or bytes can be transmitted to the receiver. Typically an MCU at the transmitter is used to encode values from potentiometers. At the receiver, an MCU is used to decode the received control signal. The message form can be of any computer generated format in binary or text. For example, a command to control the RC car forward at 25% speed might look like F25. How the RC car is controlled is entirely up to the designer. For example, you can use PWM to an H-bridge for motor speed and a servo for steering.
 

LowQCab

Joined Nov 6, 2012
4,071
It's enough serious work to build your own RC-Vehicle,
but when it comes to the Electronics, for Control,
you are opening-up a much bigger bucket-of-worms.

RC Electronics has been refined to a mind-bending degree of sophistication.
( and the Transmitters are "Legal" and approved, and provide well over a Mile of reliable connectivity )

They have Gyros and Accelerometers built-in,
which can automatically control any Motion or Attitude of the Vehicle.

They come with a Barometer built-in for assistance with Altitude-Control, (if You need it),
and a Battery-Current-Sensor.

Most Receiver-Boards, (Flight-Controllers), come with "Plug-In" provisions for a GPS-Receiver
and can control the position of your Vehicle on the ground, or in the Air.

They can have up to 16-Control-Channels, (as if anyone needs that many),
which can control BLDC-Motors, or Servos, or Lights, or anything else You can think of,
and also collect Battery-Voltage and Current, as well as other Data,
and send it back to the Transmitter, in virtually "Real-Time".

They come standard with UART, I2C, USB, SBUS, Smart-Port, iBUS, Spectrum, Crossfire,
and several other Networking/Communication-Formats.
( But they are finally phasing-out the old-school PPM, and PWM, Communication Formats ).

They also have on-board provisions for "Black-Box-Logging" to a separate removable Memory-Chip,
if You want to find out what happened right when it exploded.

They can also insert Text-Format-Data into a Video-Signal-Stream for display in your Googles or
on a stand-alone Video-Display at the Transmitter.

Some of the available Softwares can make the Vehicle "Return-to-Home" if the Signal is lost.

And all this is on a 30mm X 30mm Circuit-Board,
with a 32-Bit Processor running at some ridiculously high-speed, ( STM32F745 ).

You can not even come remotely close to duplicating all this by yourself.
And, it's already been heavily tested, and proven to have bullet-proof-reliability.

All this for only ~$45.oo ........

There are, of course, much simpler versions that can be had, but why limit yourself ?
.
Holybro Kakute F7 V1.5  a FLAT .pngHolybro Kakute F7 V1.5  b FLAT .pngHolybro Kakute F7 V1.5  c FLAT .PNG
 

Attachments

Thread Starter

Ladia

Joined Jul 30, 2021
4
You can not even come remotely close to duplicating all this by yourself.
And, it's already been heavily tested, and proven to have bullet-proof-reliability.

All this for only ~$45.oo ........

There are, of course, much simpler versions that can be had, but why limit yourself ?
Thanks for all this information. That sounds awesome! But only for someone that wants to have an impeccable RC car for driving. As for a student like myself, this would only weaken my interest in doing this project. I might as well buy an already-built model. The main goal is to learn something new on the way! And buying a complete solution won't help me much in that regard! Anyway, it's always good to broaden one's perspective on the possible solutions! Thank you!
 

LowQCab

Joined Nov 6, 2012
4,071
You obviously haven't ever built your own Car/Truck/Quad/Plane,
and experienced just how much study is required to get all of the
individual parts to "play-nice" with each other.
Then there's learning how to Tune the Model's performance to your liking.
Then there's learning how to operate the damn-thing without crashing ........

It's a seriously steep learning-curve.

Learning how old-school "Pulse-Position-Modulation" works is fine I suppose,
but there's not much point in "re-inventing-the-Wheel".

PPM Proportional-Modulation is quickly being phased-out as a means of RC-Model-Control,
and is being replaced with extremely fast and reliable Encoded-Digital-Packet-Control.

I found a very interesting YouTube Video about the early beginnings of RC Airplanes,
but sorry, I didn't save a Link.
Back then they were using Ham-Radio-Tube-type-Transmitters with
the Binary-ON-OFF-Controls You described earlier,
with small Solenoids and Rubber-Bands to move the Control-Surfaces of the Plane.
.
.
.
 

KeithWalker

Joined Jul 10, 2017
3,091
You obviously haven't ever built your own Car/Truck/Quad/Plane,
and experienced just how much study is required to get all of the
individual parts to "play-nice" with each other.
Then there's learning how to Tune the Model's performance to your liking.
Then there's learning how to operate the damn-thing without crashing ........

It's a seriously steep learning-curve.

Learning how old-school "Pulse-Position-Modulation" works is fine I suppose,
but there's not much point in "re-inventing-the-Wheel".

PPM Proportional-Modulation is quickly being phased-out as a means of RC-Model-Control,
and is being replaced with extremely fast and reliable Encoded-Digital-Packet-Control.

I found a very interesting YouTube Video about the early beginnings of RC Airplanes,
but sorry, I didn't save a Link.
Back then they were using Ham-Radio-Tube-type-Transmitters with
the Binary-ON-OFF-Controls You described earlier,
with small Solenoids and Rubber-Bands to move the Control-Surfaces of the Plane.
.
.
.
I still have a couple of my planes from the 60s, complete with home-made three channel "Galloping Ghost" actuators. If you don;t know what that is, it's worth looking up!
GG 003.jpg
 

MrChips

Joined Oct 2, 2009
30,805
Can’t beat my first single channel RC plane.
It had what is known as an escapement control. You could only control rudder left, rudder right, and neutral. The plane had a natural climb. To bring it down you had to wiggle the rudder back and forth.
 

Juhahoo

Joined Jun 3, 2019
302
There are times when software can help you so much. Buy a cheap evaluation card and learn how to write a simple code and learn how the serial port works, and you will be amazed what you can do with it. Then you add a radio link in between and voila! You can build complex systems, telemetry, dozens of channels to control everything etc.
 

KeithWalker

Joined Jul 10, 2017
3,091
I tested some Bluetooth audio transmitters and receivers for remote speakers. They have a high enough bandwidth for a number of PPS channels but there is a delay of almost half a second. That makes them completely unsuitable for controlling vehicles of any kind.
 
Top