zaber5:
I am trying to read a PWM signal from a receiver powered by an ESC. This causes me to get corrupted random readings as shown in the attachment.
When I remove the ESC and power the receiver from arduino (3.3v) it works fine and I get a consistent signal of 1500 unless I change it.
I am using an interrupt on pin2 to read the pwm signal.
Any guesses why this is happening?
You have the entire system right in front of you and you expect the forum to "guess"? What is the priz if we "guess" correctly?
Explain how the ESC key powers your project. When you use acronyms you need to define them. Below are a few in alpha sequence.
Acronym Definition
Esc Escape (character or keyboard key)
Esc Education Service Center
Esc Embedded Systems Conference
Esc Empire State College (New York)
Esc Electronic Speed Control (DC motor)
Esc European Society of Cardiology
Esc Electronic Stability Control
Esc Employment Security Commission
Esc Eurovision Song Contest
Esc Extended Service Contract (consumer products)
Esc Electronic Systems Center
Esc Equitable Stroke Control (golf scoring modifier)
Esc Electronic Still Camera
Esc Escudo (Portuguese currency)
Esc Embryonic Stem Cell
Esc École Supérieure de Commerce (French)
Esc Economic and Social Council
Esc EISA (Extended Industry Standard Architecture) System Component
Esc Engineering Student Council
Esc Economic and Social Committee (EU)
Esc East Surrey College (UK)
Esc Escalator
"I am trying to read a PWM signal from a receiver powered by an ESC"
That may require a little more explanation. ESCs usually don't power receivers. What are you trying to measure, input to the receiver. receiver output, ESC input, or ESC output?
My apologies for the ambiguous post. I assumed it was some very obvious error on my part which an expert could quickly point out as I am completely new to Arduino. I will explain the system.
Receiver is powered through the 5V Battery Eliminator Circuit on the ESC (signal-power-ground connection between ESC and receiver on 1st channel). ESC is powered by a LiPo battery. I am taking a signal wire from a separate channel of the receiver into digital pin2 of Arduino to measure the signal pulse width which I am varying with the transmitter. Arduino is powered via the laptop. Whenever I remove the ESC from the circuit and power the receiver directly via the Arduino everything works perfectly.
My code -
#define rPin 2
volatile unsigned long t = 0;
volatile int pwidth = 1500;
volatile boolean newpulse = false;
Also, whenever I am connecting either the power and ground wire from the PWM channel to any random pin on the arduino it works fine and returns the expected readings. I am assuming the ESC signal pin is somehow managing to stop the interrupt.