Sending PWM data with 433MHZ wireless

Good morning to all.
My project is to use simple 433 MHZ modules to send 2 PWM data on a short distance, a certain number of times per second (1000 or less, not really defined yet). This will use a joystick.
On the RX side, I wish to drive motors with a first PWM for Front/Rear direction, and a second PWM for Left/Right direction.
Those data are coming in parallell (at the same time) and are emitted in Series (one after the other). At this point they have to be a first and a second data: the 1st must always be Front/Rear and the 2nd must be L/R.
On the TX this is easy.

On the RX side, how will he figure out which is which ? I don't want F/R to be mixed up with L/R ...
Should I use shift register ?
Is there a simpler way to achieve this ?

Thanks a lot !

What are you sending the data to?

If it is to another Arduino you just need to send the number that is used by analogWrite() and sending it 5 or 10 times per second should be perfectly adequate.

I don't have experience of the 433MHz modules, only the nRF24L01+ 2.4GHz transceiver modules.

...R

Hi Robin
Yes, from an Attiny85 (preferably) to a Nano then to some transistorized power bridge.
I am sorry that I triggered such a basic question. Of course the analogWrite /Read will play the trick. I was getting confused.
I just was a bit worried that I would have to use the VirtualWire library and all its specificities, for such a simple data set. It seems I will be able to avoid it.
I will send 3 data: Back/front, L/R and a Kill security bit which would stop the whole machine.

Thanks a lot ! have a good day and excellent Xstmas.

The classical analog remote control PWM sequence consists of a frame sync of standard width (say 5 ms), followed by N channels of variable width (say 1 to 2 ms) where the width of the pulse represents the analog value being transmitted (e.g. 1 ms=0, 1.5 ms=half scale, 2.0 ms=full scale). On the receive end, a controller would detect the frame sync and know that subsequent pulses represent the channels in order. For servos, the received channel pulse widths are simply propagated to the servo, but a particular application (motor speed control) may require something different.

In a pristine RF environment at close range, there is no apparent reason why one couldn't directly modulate such a sequence on a cheap OOK 433 MHz transmitter and receive a good representation of it on the other end. In practice, 433 MHz is subject to interference and cheap super-regenerative receivers tend to output plausible looking PWM sequences even in the absence of a transmitter, so this may not be particularly robust.

For better reliability, consider using a digitally encoded link with error checking. e.g. the RadioHead library for microcontrollers. Alternately consider going with a radio with these sorts of protocols built in such as the NRF24L01.

MrMark:
The classical analog remote control PWM sequence consists of ....

I wonder if you are mixing up PWM as produced by the Arduino analogWrite() instruction and the signal produced by the Arduino Servo library which (unfortunately) also goes by the name PWM although it is very different.

The signal produced by analogWrite() represents the power presented to a motor whereas the signal produced by the Servo library represens the position of the servo arm.

...R

Good evening Robin and Mark

I plan to use the AnalogWrite (going from 0 to 255 via a 'mapping' of the joystick positions) as said, my wonder and worry comes from the link between TX and RX. Two pulses in serie will be transmitted as only a value (in ms), how does their position one vs the other get to be known by the RX ?

I got the point about the robustness of those OOK cheap modules, it is worth tryinG; In fact, It will be used outside and even out of town. So no pollution to expect. Will still keep an eye on the possibility still.

Thanks again

Robin2:
I wonder if you are mixing up PWM as produced by the Arduino analogWrite() instruction and the signal produced by the Arduino Servo library which (unfortunately) also goes by the name PWM although it is very different . .

I recognize the difference between the two schemes. What I was describing was a modulation scheme used for proportional control of model airplanes (at least when I was flying them decades ago).

As I see it the original poster has the following sub-problems.

  1. Detect the position of two joysticks (or one 2-axis joystick). This is usually just reading the value of a potentiometer with an Arduino analog input pin.

  2. Encode that value and transmit it to a receiver. The classical analog remote control scheme is as I described above, a mark pulse that is longer than any channel pulse to synchronize the frame, and then two variable length pulses where the control value is encoded as the width of the pulse, repeat indefinitely. This is one definition of pulse width modulation. There are alternate ways to encode the transmission such as using the RadioHead library to transmit encoded digital numbers for each channel.

  3. At the receiver decode the transmitted signal. Specifics obviously depend on the transmit encoding.

  4. Take the information received for each of the two channels and for each, set the control output pin to the appropriate AnalogWrite() value per the received transmission. This is a different definition of pulse width modulation, where the duty cycle (percent of on vs off time) of a rapidly toggling signal represents the proportional control.

Edit to add: If one had only a single channel (joystick) an Arduino AnalogWrite() PWM could perhaps be used to directly modulate the transmitter and the receiver would (generally but not robustly) reproduce this without further processing. Given two channels, there has to be some sort of more sophisticated encoding across the transmitter/receiver in order to resolve the two different channels.

This is probably an answer to Replies #3 and #4

I would not attempt to send "data" as the time difference between two pulses. IMHO it will be much simpler and more reliable to send data such as "<123,56>" representing the required PWM values to be produced by analogWrite() after they have been received.

For greater reliability you could send <123,56,CC> where CC is a checksum that the receiver can use to satisfy itself that it has received the data correctly.

The order of the two numbers will be sufficient to identify which value is for which axis.

I am using the characters < and > as start and end markers - but any convenient characters can be used.

As I said earlier I have no experience with the 433MHz modules but I believe they can easily be used to send text data and the examples in Serial Input Basics should be instructive.

...R

Hi Robin and Mark.
I understand that I will have to encode my two channels to let them be recongized by the RX.
I was thinking of sending a fixed frequency between my two data. Say, some KHZ when received would signal to the RX that the next data is about one axis, the 2nd being the other axis.
I could generate this sound with the 'tone' command.

Sending a character < or > is fine but comes to the same. When received would mean 'this is the start of the message'. I will be sending two bits HIGH with a different duration (PWM).
A pulseIn would measure those bits and translate them in a signal for the motors.

Is a Chacksum needed to transmit such primitive signals ? they will always be two high bits. The checksum will not discriinate between both. If one is corrupted, the next one will have a proper value.

What do you think ?

Guillaume60:
Hi Robin and Mark.
I understand that I will have to encode my two channels to let them be recongized by the RX.
I was thinking of sending a fixed frequency between my two data. Say, some KHZ when received would signal to the RX that the next data is about one axis, the 2nd being the other axis.
I could generate this sound with the 'tone' command.

That leads me to think that you have not at all understood what I have been suggesting.

What I am suggesting is the equivalent of Serial.print("<123,56>"); and has nothing at all to do with frequencies or tones.

...R

Sorry, maybe I have not understood or have explained well enough.

What I mean is that 123,56 are a chain of bits, 8 per character.
While I am only trying to send two bits. In your way it seems one concentrates on the High or Low to decide there is a bit. In my case, it will always be High. So it will always correspond to the same thing.
The information I want to transmit is contained in the duration of each bit, or pulse. Not in its existence as a Hi or Lo.
If the transmitted bit in a HI state has a x duration or a y duration, it will always be the same. Not for me since I am only interested in their duration.

Thanks again for your explanations, they will be useful the day I will have to transmit some text or chains of characters longer than 2 bits.

Guillaume60:
Sorry, maybe I have not understood or have explained well enough.

What I mean is that 123,56 are a chain of bits, 8 per character.
While I am only trying to send two bits. In your way it seems one concentrates on the High or Low to decide there is a bit.

I had assumed there is a library that sends data (bytes) over the wireless connection without you having to worry about the mechanics just as you don't need to worry about bit timing when you use the Serial library.

There must be hundreds of Forum Threads about 433MHz wireless. Do a bit of Googling.

...R

Robin2:
I had assumed there is a library that sends data (bytes) over the wireless connection without you having to worry about the mechanics . . .

http://www.airspayce.com/mikem/arduino/RadioHead/