How to read analog data for other temperature sense on ADC pin? (pixhawk 2.1 Cube + Mission Planner)

Hello everyone!. I tried to read analog data on ADC pin for temperature sense.
I followed the steps on this site one by one: https://ardupilot.org/plane/docs/common-rangefinder-maxbotix-analog.html. I read the values ​​in the sonar voltage indicator (1.19) but when I discard temperature sense in pixhawk I keep reading analog data.
Actually, I want to ask how to read analog data temperature sense on mission planner?
Is it possible to read analog data on adc pins?

I also have the same problem, i as well want to detect temp from an external component through pix hawk orange plus ADC and get the temperature.

What i’m doing is since we can’t directly find the temperature, i’m using an NTC in a Voltage Divider Circuit and then reading the voltage in the junction and processing that internally using NTC characteristics R vs T to find the temperature.

But what problem i have is that is, when i read the voltage from the divider circuit, i’m getting double the actual voltage if i use my own code that i did b4,
and i’m getting half the original voltage if i use the code in this link:-
ardupilot/libraries/AP_Scripting/examples/analog_input_and_GPIO.lua at master · ArduPilot/ardupilot · GitHub.

what kind of changes should i make in my code ??
or is there a problem with the voltage_latest() or voltage_average() functions
available as part of the lua script ardupilot library ??

I’m desperate to solve this problem and find a solution,
can some one help me ??

what ADC are you using? some have a 2:1 resistor divider for using 5v airspeed sensors.

1 Like

I’m using the ADC in the pix hawk itself, not using an external one, and i’m using cube orange plus(+).

If u can be more specific on what u want, i can provide more info sir.
pls forgive me if i don’t know things, i’m new to using ardupilot, pix hawk, mission planner and other flight related stuff.
this is my first project, so i’m willing to give what u need to help me out.

if you read the spec for the ADC port, it says up to 6.6v so it has a 2:1 resistor divider on it. so 6.6v will show as 3.3v.

ADC

Pin Signal Volt
1 (red) VCC +5V
2 (blk) ADC IN up to +6.6V
3 (blk) GND GND
1 Like

So what ur saying is it will read double the actual voltage in any and all scenario’s is it ??

besides i hv a couple of questions,

  1. when i start recording the voltage values in the misson planner, it takes a while to stabilize the values, so for how many readings should i wait ?

  2. it does’nt matter what circuit i connect it to, the signal pin will read the double of the real voltage, so when i connect it to my ntc and constant resistor’ed divider circuit, it doesnt matter if my ntc is being an pull up or a pull down resisitor.

  3. Besides why did it read half voltages when i uploaded the program in the examples from GitHub ??

  4. what would be a suitable resistor value suitable for my ntc given below ??
    it takes value from 200 to 0.5 kohms
    Temperature Sensor Datasheet.pdf (873.7 KB)

It would be great if u or some one can answer this as well.

some body pls help me out, just tell me what i need to do atleast. :smiling_face_with_tear:

so the limit is that the signal pin can read only till 3.3 Volts then ??
so i have adjust the other resistor value appropriately is it ??