I am using a cheap HC-SR04 sonar range module and use an Arduino with PWM to build a analog signal from 0-3.3V via an RC filter.
The flightcontroller I am using is a Pixhawk and I am using the RNGFND_PIN = “14” for Pixhawk’s ADC 3.3v to read the voltage.
See here for reference:
While my “standalone” testing was successfull, I got very unstable readings from MissionPlanner as I connected it to the Pixhawk.
That is strange, because on my testings before, the output voltage was rock solid and with good dynamics (regarding to range changes)…
I took my oscilloscope and measured the voltage at the ADC 3.3v pin #2 as my solution (HC-SR04 + Arduino + RC filter) was connected to the Pixhawk.
I saw, that there is a periodic voltage drop with 2 pulses…
I had a look at the Pixhawk and I am sure, that the voltage drops everytime the LED of the Pixhawk is flashing (yellow in my case).
I checked the PWM signal and this has also the “periodic” changes… and also the readings from the Arduino does have this periodic fault.
The Arduino + HC-SR04 is powered by the Pixhawks ADC 3.3V port.
The “5V” voltage from the ADC 3.3V port is 4.6V while the Pixhawk is powered via USB from my PC.
This might be a problem.
The “5V” of the ADC 3.3V is connected to the 5V Pin of the Arduino (so it runs on 4.6V… in that case)
I dont know how much current the ADC 3.3V port can drive at the 5V pin so maybe this is the main problem here… (I hope someone of you can tell me)
There is a connection between wrong readings and LED flashing but I dont know exactly where this is coming from.
Just to tell you that:
If I power the Pixhawk via USB (only) and power the Arduino + HC-SR04 from the ADC3.3V -> fault appears, PWM HIGH level 4.6V, PWM width changing on constant range everytime the yellow LED flashing.
If I power the Pixhawk via USB AND the Arduino via its USB poart -> fault appears, PWM HIGH level 4.6V, PWM width changing on constant range everytime the yellow LED flashing.
If I power the Arduino (only) and dont connect the Pixhawk via USB to the PC -> the range reading is ok, the PWM width is constant on constant ranges BUT the PWM HIGH level is changing from 4.6V to 4.35V everytime the LED is flashing…
So is there a good way to power my Arduino with stable voltage and enough current from the ADC 3.3V port of the Pixhawk?
Any ideas would be welcome