Cannot read PWM signal from the Rc Receiver

I’m trying to read the PWM signal from my RC receiver on the Seeeduino XIAO arduino board, but reading values jump crazy from 0 up to 10000. I look at the tutorial on Youtube and their value only ranges from 1000 - 2000. I’m now sure how and where did I do wrong? Here is my code

#define pin 3

unsigned long pwm_value;

void setup(){
  pinMode(pin, INPUT); //set the pin to input
  Serial.begin(9600); //begin serial comms
void loop()
  pwm_value = pulseIn(pin,HIGH); 

According to experience, the pulseIn() function will produce errors when detecting signals with too short pulse intervals. The pulse interval time range that Arduino can detect is 10 microseconds to 3 minutes. Please note that if the pin that reads the signal is already high when the pulseIn() function is called, the Arduino will wait for the pin to turn low before starting to detect the pulse signal. In addition, pulseIn() can be used only when the interrupt of Arduino is turned on.

1 Like

Hi Hung_Nguyen,

I connected my RC receiver to the 4th pin of XIAO and tried to execute your sketch. My transmitter is set to output from 1050 to 1950 centering on 1500 μsec, so I got the following serial monitor output. I don’t think there is a problem with your sketching. There may be a problem with your transmitter or receiver.


It turned out that I had to connect the power supply from my receiver to XIAO while plugging to USB cable. Finally solved the problem, thanks for your input :slight_smile:

1 Like