Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] How to transmit and receive a PWM signal over RF

Status
Not open for further replies.

ibmace

Newbie level 5
Joined
Feb 26, 2008
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,387
Hello Friends ;-),

I have successfully programmed a PIC12F628 to generate a 1 ms to 2 ms RC PWM signal every 20 msecs. I'm able to change the pulse width of the PWM signal by turning a potentiometer knob.

Using radio frequency modules such as TWS-434 and RWS-434, I would like to transmit this PWM signal to the receiving end. The receiving end should be able to receive the PWM or PPM signal and pass it onto a servo motor or to a PPM decoder.

Last week I purchased a pair of TWS-434 and RWS-434 RF transmitter/receiver modules along with the remote control IC's HT12-E and HT-12D.

The trouble is, the TWS-434 and RWS-434 modules do not seem to accept an RC PWM signal directly. I guess it might be because they expect to see a manchester encoded signal with a 50% duty cycle on the data lines.

So can you suggest a means by which I can use easy to interface RF modules similar to the one mentioned above to transmit PWM/PPM signals? Thanks in advance for your responses :wink:. They are very valuable to me.

With Regards,
John Reid
 

goldsmith

Advanced Member level 5
Joined
Dec 14, 2010
Messages
3,986
Helped
739
Reputation
1,482
Reaction score
725
Trophy points
1,413
Location
Tehran - IRAN
Activity points
24,529
Dear John
Hi
To understanding the problem , you can give it a sine wave , as input , or a 50 percent D.C square wave, and then if it working good, you can be sure that it can't accept your PWM. however i don't think that the problem is with your pulse width .
Best Wishes
Goldsmith
 
  • Like
Reactions: ibmace

    ibmace

    Points: 2
    Helpful Answer Positive Rating

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
15,161
Helped
4,947
Reputation
9,915
Reaction score
4,760
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
128,783
What you are proposing could be dangerous to your RC equipment. When the signal is weak or no signal is being received, the RX will produce random pulses which your servo may interpret as control signals. The pulses will be 'best guess' of pulses in the background noise from the receiver but obviously will not be valid for proper control. A better method would be to send a command from the transmitter to the receiver to tell it the pulse width to use but actually generate the PWM at the servo end. For example, you set the potentiometer at half position, the transmitter sends "50" to indicate 50% setting, the receiver picks up the "50" and uses it to generate 50/50 PWM. Doing it this way allows you to take a fail-safe action if the signal isn't recognsed and also by carefully coding the data you can control several servos over a single radio channel.

Brian.
 
  • Like
Reactions: ibmace

    ibmace

    Points: 2
    Helpful Answer Positive Rating

ibmace

Newbie level 5
Joined
Feb 26, 2008
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,387
Dear Goldsmith,

Thanks for responding so quickly :wink: What you have suggested is a good idea. I'll give it a sine or 50 % square wave and see whether it gets transmitted over.

Supposing it does get transmitted then what do I do? Any suggestions on how I could get my PWM across. Do you feel that the 20 msec interval between pulses could be a problem with these RF modules? Thanks once again for your help. Really appreciate it.

With Regards,
John Reid
 

goldsmith

Advanced Member level 5
Joined
Dec 14, 2010
Messages
3,986
Helped
739
Reputation
1,482
Reaction score
725
Trophy points
1,413
Location
Tehran - IRAN
Activity points
24,529
Supposing it does get transmitted then what do I do?
If this event happened you should ask the manufacturer about that chip, they will tell you , how to do that with their chip .
Good luck
Goldsmith
 
  • Like
Reactions: ibmace

    ibmace

    Points: 2
    Helpful Answer Positive Rating

ibmace

Newbie level 5
Joined
Feb 26, 2008
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,387
Thanks Brian,

I've actually experienced what you're talking about with my cheap E-Sky radio. On more than one occasion I have made the mistake of turning on the receiver before turning on the transmitter. Doing so causes all the servos connected to the receiver to go into fits. Thanks for mentioning this.

Yet the generic RC transmitters do transmit PPM or PWM over RF right. I would like to do it this way only for the sake of remaining compatible with the mainstream RC equipment. And if I can get the TWS-434 transmitter to handle a PWM signal, there's nothing like it because I have already spent some money to buy them. So if you have any suggestions on how I might be able to achieve this with easily available RF modules, kindly let me know.

Thank you Goldsmith.

Today once I return from work I'll try supplying the square waves to the RF modules and see how they respond. In case the response is not as expected then I guess contacting the manufacturer is the way to go.

With Regards,
John Reid
 
Last edited:

FvM

Super Moderator
Staff member
Joined
Jan 22, 2008
Messages
48,938
Helped
14,338
Reputation
28,940
Reaction score
13,084
Trophy points
1,393
Location
Bochum, Germany
Activity points
282,362
I doubt that RWS-434 implies an unique product specification, there are different devices with this name, exposing different specifications. In most cases, they don't tell exactly about the supported data bit rate and duty cycle. It sounds reasonable to evaluate it with a pulse generator and an oscilloscope.

I agree, that the RC PWM duty cycle may be a problem, but I don't know for sure. In my view, the ultimate solution would be to generate the PWM waveform by a small µC at the receiver side, allowing for any "on air" digital coding of your choice.
 
  • Like
Reactions: ibmace

    ibmace

    Points: 2
    Helpful Answer Positive Rating

ibmace

Newbie level 5
Joined
Feb 26, 2008
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,387
Thanks for your response FvM,

Thus far I have been suggested to do the following two things.

1) Generate the PWM at the receiver side.
2) Apply square waves to the RF module and see how it responds.

Both of these are very useful suggestions. While generating the PWM at the receiver side will work 100%, checking how the RF module responds to the square waves will help me to know whether the RF module can be used for this purpose at all.

I'll definitely try both suggestions and update you all as soon as I return from work.

With Regards,
John Reid
 

ibmace

Newbie level 5
Joined
Feb 26, 2008
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,387
Problem solved ! ;-)

Yesterday when I fed the transmitter with a square wave and checked the output signal from the RWS-434 using a scope, I noticed a lot of distortion/noise in the received signal. I immediately knew something is not really ok with the RF module. Since I had another pair of RF modules with me I replaced them and tried again, but the distortions were still very much there.

Today morning I tried the same thing with a pair of 315MHz RF modules and I was able to obtain a noticeably clean square wave output from it. So I hooked up my RC PWM circuit to the transmitter and successfully received it at the receiver. So I guess the 433MHz RF modules I had purchased are substandard junk imported from the far east if you know what I mean.

Thanks a million for your suggestions Goldsmith, Brian and FvM.
 

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
15,161
Helped
4,947
Reputation
9,915
Reaction score
4,760
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
128,783
I live in a very rural area with only a few houses nearby but monitoring 433MHz on a 'real' radio picks up constant buzzing from car keys, remote weather stations, automatic gates openers and other domestic radio linked devices. Some of these must be several Km away but still provide a noticable signal. Quite possibly you are seeing the same thing, just normal background noise on that busy frequency rather than poor quality modules. You will have to hope that nobody else nearby uses 315MHz !

Brian.
 
  • Like
Reactions: ibmace

    ibmace

    Points: 2
    Helpful Answer Positive Rating

ibmace

Newbie level 5
Joined
Feb 26, 2008
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,387
Dear Brian,

Just now I tried that on my radio and yes, your observation is very much correct ! There's hell of a lot of activity going on in that frequency. As you have mentioned, I too feel that the very same thing can happen with 315MHz. In that case what can I do to ensure a clean reception in the presence of undesirable background activity? Encryption and error correction perhaps?

With regards,
John Reid
 

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
15,161
Helped
4,947
Reputation
9,915
Reaction score
4,760
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
128,783
It's difficult to eliminate interference frm a PWM eadio signal because by it's nature it can look like interference. You could use FM and also use the received signal strengtrh (RSSI) to 'qualify' the reception so a weak signal was ignored. I would still advise a data link with the PWM being generated at the receiver. You can do a lot to protect the integrity of a normal data stream but protecting PWM is almost impossible. What I would propose is you send a pre-conditioned data stream containing the PWM settings from the transmitter to the receiver. At the reciver the data would be verifed then converted back to a positiion control voltage.

Brian,
 
  • Like
Reactions: ibmace

    ibmace

    Points: 2
    Helpful Answer Positive Rating

ibmace

Newbie level 5
Joined
Feb 26, 2008
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,387
Makes complete sense Brian. Transmitting the PWM really is a bad idea. I'll rewire my brain cells and do as you have proposed. I simply cannot convey with words how much you have helped me. Thank you dear Friend !
 

jpanhalt

Advanced Member level 3
Joined
Jun 28, 2010
Messages
724
Helped
216
Reputation
442
Reaction score
219
Trophy points
1,323
Activity points
6,952
Here is one link of interest: https://www.aerodesign.de/peter/2000/PCM/PCM_PPM_eng.html

There are many more. I searched on: "PCM PPM explained." (PCM = pulse code modulated; PPM = pulse position modulated)

In the early days of RC, we used CW with on/off keying and escapements. That is, one pulse gave one extent of control surface movement (e.g., hold 1 pulse = right; 2 pulses, hold second pulse = left; 3 pulses, hold third pulse = up; 4 pulses, hold 4th pulse = down). Those days are long past, thankfully. Even the cheapest garage door opener with a fixed code is more reliable and sophisticated.

For your experiments, you may want to look into how the fixed code garage door openers work. There are/were single chips available for that form of coding. I suspect they may be getting rarer, but are still available.

Regards,

John
 

ibmace

Newbie level 5
Joined
Feb 26, 2008
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,387
Very informative link John, thank you very much for sharing it! I'd prefer not to take the fixed code route because the controls would then be just "ON" or "OFF". My PPM encoder uses a 10 bit ADC converter to sample each RC channel, which will give me exactly 1024 servo steps in between the "ON" or "OFF" positions and therefore that much more control over the model. So at the moment here's what I'm planning to do. I am going to modify Bruce's 4 bit remote control encoder/decoder code and convert it into a 10 bit encoder/decoder. After that all I need to do is sample each RC channel POT and transmit the corresponding ADC value via the encoder and RF transmitter. As suggested by Brian, the ADC value will be used to produce a PWM at the receiving end, which will in turn drive the corresponding servo. I guess that should do it. Please do share your experience, suggestions, do's and don'ts, how to's, etc. Thanks in advance for your valuable help.

Bruce's remote control encoder/decoder code can be found at the following link for those who might be interested in doing something similar.

https://www.picbasic.co.uk/forum/showthread.php?t=12554

With regards,
John Reid
 
Last edited:

FvM

Super Moderator
Staff member
Joined
Jan 22, 2008
Messages
48,938
Helped
14,338
Reputation
28,940
Reaction score
13,084
Trophy points
1,393
Location
Bochum, Germany
Activity points
282,362
The method your asking for (digital encoding of servo position data) is used by any multichannel RC on the market. I previously addressed it as using an "on air" digital coding of your choice, because suitable coding methods depend on the properties of the used RF modules. If the modules support UART like data transmission, the options are quite obvious. If not, you need to design an adapted coding scheme.
 
  • Like
Reactions: ibmace

    ibmace

    Points: 2
    Helpful Answer Positive Rating

ibmace

Newbie level 5
Joined
Feb 26, 2008
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,387
Dear Friends,

Since I had a pretty serious health problem last year, I am returning to this thread after a very long gap. I have steadily recovered since then and now I would like to complete the little project I had begun during that time.

Both Brian and Fvm had suggested that I better transmit the pulse width information as a data stream and generate the actual PWM signal at the receiver end. Since their idea made a lot of sense to me, I started to work along those lines and now I have a fully functioning Proteus circuit based on PIC16F877A which transmits the resistance values of 4 rotary POTs to the receiver circuit using manchester encoding.

At the receiver side, a 1ms to 2ms 4 channel PWM signal is generated using the decoded manchester data. Both the transmitter and receiver are working perfectly in the simulator. So far so good.

What I would like to know is, is there a way to find out whether the RF signal that's being transmitted is really free of the dreaded DC component or not. How can I see this for certain? Kindly let me know. Thanks a million for your help ;-)
 

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
15,161
Helped
4,947
Reputation
9,915
Reaction score
4,760
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
128,783
Welcome back and it's good to hear you are in good health again.

To check for DC components there is a crude test you can carry out. It's best with an oscilloscope and from the sounds of it you have one, take a note of the logic zero voltage level of the data you are transmitting, it should be almost 0V, take a note of the logic high level which should be almost supply voltage then calculate the mid point between them. For example, with a 5V supply the mid point will be close to 2.5V but possibly a bit higher or lower due to the logic signals not being exactly 0% and 100% of supply.

Now connect an RC network with a long time constant to the digital data, I suggest 100K in series and 10uF to ground. Run run it for a short while to allow the voltage to settle then see if the voltage across the capacitor matches the voltage measured earlier. If the logic signal doesn't have equal 0 and 1 bits, the average will be skewed toward the dominant logic level. If the bits are equal the averaged voltage will be mid way between 0 and 1 voltages.

Brian.
 
  • Like
Reactions: ibmace

    ibmace

    Points: 2
    Helpful Answer Positive Rating

BradtheRad

Super Moderator
Staff member
Joined
Apr 1, 2011
Messages
14,186
Helped
2,808
Reputation
5,624
Reaction score
2,746
Trophy points
1,393
Location
Minneapolis, Minnesota, USA
Activity points
105,823
I had a radio controlled airplane with a 4-channel system. I watched my oscilloscope while operating the transmitter. It was sending a carrier most of the time.

The PWM train consisted of several empty gaps in the carrier. Each gap was between 1 and 2 mSec (typical servo command).

The receiver (on board the plane) inverted the signal, turning the gaps into pulses. Then it split up these pulses, sending each pulse to its respective servo.

I believe the idea is to broadcast a radio signal most of the time, so that your signal drowns out noise on that frequency.
Since your transmission is strong, the receiver has an easier time detecting the empty gaps in it.

It might be worth a try to see if it works that way.
 
  • Like
Reactions: ibmace

    ibmace

    Points: 2
    Helpful Answer Positive Rating

ibmace

Newbie level 5
Joined
Feb 26, 2008
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,387
Dear Brian, I'm so happy to see your reply.

I just tried the crude test as you have put it and the signal seems quite clean. So I guess there is no DC component in the data stream. Thanks a lot for your concern and guidance :smile: It proved to be extremely helpful.

Best regards,
John
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top