Reading signal output from RC Transmitter

So I've successfully been able to program LED flashing at various intervals and all is well with the world.

BUT now I am trying to read the PWM signal from a 3 position switch on my Futaba T8FG transmitter and I am getting weird numbers. From what I have seen this should be a very simple routine using PulseIn (might move to interrupts later but for now I can't even get PulseIn to work).

I have the signal wire ONLY from my Receiver plugged into digital pin 7. The power for the receiver is being supplied by a battery pack. The Arduino is getting power from the PC through the USB cable.

Here is the code:

byte PWM_PIN = 7;
 
int pwm_value;
 
void setup() {
  pinMode(PWM_PIN, INPUT);
  Serial.begin(115200);
}
 
void loop() {
  pwm_value = pulseIn(PWM_PIN, HIGH);
  Serial.println(pwm_value);
}

Here is the data being output depending on the position of the switch:

To me the data appears all over the place and un-usable.

I know it is reading SOMETHING because when I remove the pin out of 7 it goes to all zeros.

Any ideas? Spent a few hours on this and am a little ticked off.

Thanks.

An oscilloscope trace might clear up what you are trying to do.

Paul

Paul_KD7HB:
An oscilloscope trace might clear up what you are trying to do.

Paul

appreciate the response, but lets see if someone has another idea, i would have no idea what to do with an oscilliscope at this point.

but seriously, what i am trying to do should be dead simple, from what i have googled.

peterjwDC9:
I have the signal wire ONLY from my Receiver plugged into digital pin 7. The power for the receiver is being supplied by a battery pack. The Arduino is getting power from the PC through the USB cable.

If you really mean that then try connecting the negative from the receiver to the Arduino GND. No circuit works properly with a single connection and no ground reference.

Steve

slipstick:
If you really mean that then try connecting the negative from the receiver to the Arduino GND. No circuit works properly with a single connection and no ground reference.

Steve

YES you got it, but I also had that thought and re tried with the receiver taking +ve AND ground from the UNO. voila.

thanks bud : )