Arduino simulator with RC PWM inputs?

Is there an Arduino simulator that can simulate PWM inputs from an RC receiver so I can work on and test my code. The few I played with, none seemed to have any component to simulate PWM input from an RC receiver.

Why not simply set up Servo outputs on different pins?

RC recievers don't output PWM, so your question is nonsense!

As far as I can tell mine does, because I am reading. I am doing similar to this article form this site. It seems to indicate RC receivers output PWM also.

Here is another article that indicates RC receivers output PWM, So what every you want to call it, I want to simulate what an RC reciever outputs into the arduino simulator to test my code that operates on the changes in that RC signal.

So, do as Awol suggested. If you don't want the test code polluted with the simulation stuff, have another Arduino use the servo library to emit servo commands for the test.

I thought of that, but how would I then force the arduino simulator to change those values for different ranges. I need to test as that range on an input changes. Tired of having to take my laptop to the area where my project is to test it. I hope some simulator has a simple way to do an input from an RC receiver so I an control those changes. Wokwi was nice and easy and had the mpu6050 I also use to check angles, and that was easy to click on to change the angle it sends as input to the arduino, hoping to find the same to input the RC receiver signal. Plus if I do the servo output then my code is no longer exactly what my project wold use.

You don't say what board/processor you're using but you should be able to set up a pin or two or three to produce the same 50Hz output as an RC receiver and feed those outputs into your input pins on real hardware to test function. @ TheMemberFormerlyKnownAsAWOL alluded to this in his reply.

With an Uno, for example, you can set up two pins to produce that output without software running to maintain them:

const uint8_t pinRC1 = 9;   //OC1A output
const uint8_t pinRC2 = 10;  //OC1B output

void setup() 
    TCCR1A = _BV(COM1A1) | _BV(COM1B1) | _BV(WGM11);    //COM1x clear on match, set on bottom
    TCCR1B = _BV(WGM13) | _BV(WGM12)| _BV(CS11);        //WGM=14, /8 prescaler
    ICR1 = 39999;   //20mS period for timer 1
    OCR1A = 3000;   //1.5mS pulse on pin 9
    OCR1B = 4000;   //2mS pulse on pin 10

    pinMode( pinRC1, OUTPUT );
    pinMode( pinRC2, OUTPUT );

void loop() 

You can easily change the values if you like by updating the OCR1x registers.

Ah, an RC reciever to pwm unit, that will output PWM.

RCs normally use Timed Pulse outputs, similar to driving a servo motor!

I do appologise for the misunderstanding.

On the subject of misunderstanding, I now realize that the ask is to find an online simulator to do this testing. The OP doesn't want to use real hardware.

The Arduino function analogWrite() generates a low frequency (500Hz) PWM signal.
The Arduino Servo library creates a servo signal. It is a special kind of PWM signal, therefor I prefer to call it "servo signal".

I took the code from Reply #5, Sams Blog, using interrupts to measure the time between interrupts.

Added Smoothing to the sketch.
The Wokwi simulator is only for one Arduino board. If you want to use two boards, then you can spend some money on that feature.
Tinkercad can have more boards running at the same time, so you could use one board to generate the Servo signal and another one to read that signal. Can you show your sketch ?

Doesn't the Servo library work under simulation?

It is a low duty-cycle (5 to 10% typically) PWM signal.

Nothing at all "special"

I would expect so, but I haven't used Wokwi or any other sim, so my ability to help here is rather diminished.

Yes, yes they do.

Not all r/c receivers, and many that supply PWM for servos also provide a single output, variously encoded, that contains the data of all channels.

But for sure there are currently available r/c receivers intended to be connected directly to servos and ESCs.


This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.