APM2.5 - PWM input reading values can't increase any further ?

I'm trying to read the data from a PWM-output proximity sensor. This is my code for reading it:

//Init:

RC_Channel rc_6(5);

//Inside a loop:

rc_6.set_pwm(hal.rcin->read(5));
hal.console->printf("\rch%u: %4d ", (unsigned)6, (int)rc_6.radio_in);

I plugged my sensor on the CH6 PWM input pin of my APM. The displayed output values was giving me good results until it reached to the point where the values can't increase anymore. This is an example when I set the distance farther and farther:

ch6: 980

ch6: 1034

ch6: 1405

ch6: 1887

ch6: 2012

ch6: 2013

ch6: 2012

// and so on

As you can see, the output value just stuck in 2000s and it was just approximately at a distance of ~40cm. I want to expand this so I can read up to 3 meters and I guaranteed that my proximity sensor can read up to that distance (3m) because I tested it first using an oscilloscope..

By the way, I'm using the Arducopter firmware code and what I saw that CH6 has only a  range of 800-2200 so what I've done was to use the set_range() function to set the range from 0-10000, but same results in the end.

My question is that is there any other way to remove or lengthen the upper and lower limit of the PWM input readings of Arducopter? 

P.S.: I'm using the Ardupilot-Arduino IDE for editing,compiling, and uploading.

Thanks in advance :D

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • Hi, I think I saw somewhere there was a "hard" absolute min. and max. limit in addition to the configurable limits. And I wouldn't be surprised if that were in the APM implementation of the HAL somewhere. The PX4 implementation by the way does not seem to have that.

    Regards

    Soren

This reply was deleted.

Activity