OpenXSensor HoTT Temperature

Development & General Chat for the superb openxvario project.

Moderator: rainer

Post Reply
gravity
Posts: 8
Joined: Wed Feb 21, 2018 10:16 pm
Country: -

OpenXSensor HoTT Temperature

Post by gravity »

Hello Folks.
Does anyone know how to use 2 NTC sensors from temperature?
I only have one temperature gauge working. My plane has 2 Gas engines.

Thank you.
oXs_config_advanced.h
(18.52 KiB) Downloaded 380 times
oXs_config_basic.h
(11.17 KiB) Downloaded 423 times

mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: OpenXSensor HoTT Temperature

Post by mstrens »

In file advanced you made several mistakes.
Please read the file oXs_config_description.h
About NTC sensors it says:
* oXs reuses the mVolt calculated by oXs. The config must be adapted in a such a way that this mVolt is equal to the raw value returned by the ADC * 1000 (for better accuracy)
* Therefore, in section 6.1 and 6.2 ,
* USE_INTERNAL_REFERENCE must be as comment (so with // in front off)
* USE_EXTERNAL_REFERENCE must be as comment (so with // in front off)
* REFERENCE_VOLTAGE must be as comment (so with // in front off)
* RESISTOR_TO_GROUND must be set on 0 (for the index being used)
* OFFSET_VOLTAGE must (normally) be set on 0 (for the index being used)
* SCALE_VOLTAGE must be set on 204.6 (=1000 * 1023/5000) (for the index being used)
* Then you have to define some parameters in section 6.4
* FIRST_NTC_ON_VOLT_NR specify index of first voltage being used for conversion to temperature (e.g. 3 means VOLT_3) (so it is not the code of analog pin; this one is define in section 6.2)
* LAST_NTC_ON_VOLT_NR specify index of last voltage being used for conversion to temperature (e.g. 5 means VOLT_5)
* In this expample, it means that you expect to measure 3 temperatures based on NTC connected to the pins used for VOLT_3, VOLT_4 and VOLT_5
* note: if you use only one NTC, you must specify the same value for FIRST_NTC_ON_VOLT_NR and for LAST_NTC_ON_VOLT_NR
* if you do not use NTC, keep this line as comment
* SERIE_RESISTOR specify the resitance (in Ohm) connected between Arduino Vcc and NTC (and analog pin); select a value nearly equal to the resistance of NTC in the range of temperature you expect best accuracy

Here the corrections:
1) this line should be as comment (as said here above)
#define REFERENCE_VOLTAGE 3300 // set value in milliVolt; if commented, oXs will use or 1100 (if internal ref is used) or 5000 (if internal ref is not used)
becoming
//#define REFERENCE_VOLTAGE 3300 // set value in milliVolt; if commented, oXs will use or 1100 (if internal ref is used) or 5000 (if internal ref is not used)


2) There are 2 small (but important) typo fout.
You currently have:
#define FIRST_NTC_ON_VOLT_NR_1 // uncomment this line when thermistor are used; specify index of first voltage being used for conversion to temperature (e.g. 5 means VOLT_5)
#define LAST_NTC_ON_VOLT_NR_2 // specify index of last voltage being used for conversion to temperature (e.g. 6 means VOLT_6)

You can see that you have a "_" between NR and the digit. Then the compiler consider the digit as part of the name.

You should have space(s) instead. So it should be.
#define FIRST_NTC_ON_VOLT_NR 1 // uncomment this line when thermistor are used; specify index of first voltage being used for conversion to temperature (e.g. 5 means VOLT_5)
#define LAST_NTC_ON_VOLT_NR 2 // specify index of last voltage being used for conversion to temperature (e.g. 6 means VOLT_6)

3) The program has to know which arduino pin are connected to the NTC. This has to be done in line
#define PIN_VOLTAGE 0 , 8 , 8 , 8 , 8 , 8 // Fill 6 values; set to 0 up to 7 for analog pins A0 up to A7 ; set the value to 8 for the voltage(s) not to be measured.
But in you line, you only specified one pin for VOLT_1.
You have to specify too the pin used for VOLT2. If you connect it to pin A1, the line should become
#define PIN_VOLTAGE 0 , 1 , 8 , 8 , 8 , 8

4) Resistor to ground must be set to 0. (see above)
You have
#define RESISTOR_TO_GROUND 0 , 10 , 10 , 10 , 0 , 0
It should be
#define RESISTOR_TO_GROUND 0 , 0 , 10 , 10 , 0 , 0

5) Scale voltage must be set to 204.6
You have
#define SCALE_VOLTAGE 310.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0
It should be
#define SCALE_VOLTAGE 204.6 , 204.6 , 1.0 , 1.0 , 1.0 , 1.0

6) In the file basic, you also have this line
#define NUMBEROFCELLS 1
This line should be put as comment because you do not measure cell voltages.

Let already try those changes.
I presume it should be ok.
If not let me know.
gravity
Posts: 8
Joined: Wed Feb 21, 2018 10:16 pm
Country: -

Re: OpenXSensor HoTT Temperature

Post by gravity »

I have followed your instructions.

Now 2 temperatures are displayed but they are not correct and are crazy.
At the SCALE_VOLTAGE value of 204.6, temperatures of ~150 ° C are displayed in the cold basement. I think 15 ° would be correct.

Changes at the SCALE_VOLTAGE shift the temperature but then the temperatures Jump from -17 to 222 ° like Crasy.

What value does the decimal point of the temperature shift?

Oh, that's one 5V Arduino and 2 100k OHM NTC.
oXs_config_description.h
(112.2 KiB) Downloaded 404 times
oXs_config_basic.h
(11.17 KiB) Downloaded 433 times
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: OpenXSensor HoTT Temperature

Post by mstrens »

Perhaps there is a bug in oXs.
Perhaps temperature is calculated internally with 1 decimal and the Hott protocol does not accept one decimal.
In file oXs_out_hott.cpp, there is a line with
TxHottData.gamMsg.temperature1 = (voltageData->mVolt[TEMPERATURE_1_SOURCE - VOLT_1].value ) + 20 ; // Hott applies an offset of 20. A value of 20 = 0°C

Can you try to change it by this (so adding "/ 10 "
TxHottData.gamMsg.temperature1 = (voltageData->mVolt[TEMPERATURE_1_SOURCE - VOLT_1].value ) / 10 + 20 ; // Hott applies an offset of 20. A value of 20 = 0°C

Let me know if it solves the issue for temperature .
Note : use the recommended scale voltage of 204.6.
If it is ok for temperature 1, then you should change in the same way the line of code for temperature 2. It is
TxHottData.gamMsg.temperature2 = (voltageData->mVolt[TEMPERATURE_2_SOURCE - VOLT_1].value ) + 20 ; // Hott applies an offset of 20. A value of 20 = 0°C
gravity
Posts: 8
Joined: Wed Feb 21, 2018 10:16 pm
Country: -

Re: OpenXSensor HoTT Temperature

Post by gravity »

It can be.
I remeber at Cleanflight (GPS Speed) it was exactly the same, there the comma was not understood.
My copter threatens to break the sound barrier. ;)

Proposal has brought me close to realistic values ​​but this information is not useful.
Reminds more of a random generator. ;)
https://youtu.be/BsAiUJdVf7k

https://youtu.be/WhclVzHr42o
#define FIRST_NTC_ON_VOLT_NR 0
#define LAST_NTC_ON_VOLT_NR 0

mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: OpenXSensor HoTT Temperature

Post by mstrens »

Can you send me your latest config files (basic and advanced).
In previous post you put the file description but not the advanced.
gravity
Posts: 8
Joined: Wed Feb 21, 2018 10:16 pm
Country: -

Re: OpenXSensor HoTT Temperature

Post by gravity »

Sorry
oXs_config_basic.h
(11.17 KiB) Downloaded 460 times
oXs_config_advanced.h
(18.51 KiB) Downloaded 354 times
#define LAST_NTC_ON_VOLT_NR 0 must be 1, That was just a test
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: OpenXSensor HoTT Temperature

Post by mstrens »

You currently have
#define FIRST_NTC_ON_VOLT_NR 0
#define LAST_NTC_ON_VOLT_NR 0

It must be
#define FIRST_NTC_ON_VOLT_NR 1
#define LAST_NTC_ON_VOLT_NR 2

Please try this
gravity
Posts: 8
Joined: Wed Feb 21, 2018 10:16 pm
Country: -

Re: OpenXSensor HoTT Temperature

Post by gravity »

Good Morning.

I've already experimented with the values.
This is what it looks like when I set the values.
I have put the divider into the hott.cpp

https://youtu.be/nWiNEDhtQ54
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: OpenXSensor HoTT Temperature

Post by mstrens »

This is strange. It looks like the voltage measured by arduino changes a lot.
Do you have have the right connection to Arduino pins.
You should have
- one pin of NTC 1 connected to Gnd
- the other pin of NTC 1 connected to arduino pin A0
- one pin of a 10k resistor connected to Arduino pin A0 (so connected to NTC1 too)
- the other pin of the 10k resistor connected to Adruino Vcc
- one pin of NTC 2 connected to Gnd
- the other pin of NTC 2 connected to arduino pin A1
- one pin of a 10k resistor connected to Arduino pin A1 (so connected to NTC2 too)
- the other pin of the 10k resistor connected to Adruino Vcc.

Please check if this is right (e.g. with a multimeter to avoid bad soldering).

If this is OK, I could explain later on, how to go deeper to debug the issue
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: OpenXSensor HoTT Temperature

Post by mstrens »

To further debug the issue, we can first force a fix value (this just to check if the issue is in the transmission part or in the measurement part).
To do this, you can change the line
TxHottData.gamMsg.temperature1 = (voltageData->mVolt[TEMPERATURE_1_SOURCE - VOLT_1].value ) + 20 ;
by
TxHottData.gamMsg.temperature1 = 41 ;

And line
TxHottData.gamMsg.temperature2 = (voltageData->mVolt[TEMPERATURE_2_SOURCE - VOLT_1].value ) + 20 ;
by
TxHottData.gamMsg.temperature2 = 42 ;

This should normally give you dummy fixed temperature 1 = 21 and temperature 2 = 22 on your display.
gravity
Posts: 8
Joined: Wed Feb 21, 2018 10:16 pm
Country: -

Re: OpenXSensor HoTT Temperature

Post by gravity »

Tonight you get a feedback. Then I'll try it.

In any case, many thanks for your time!
gravity
Posts: 8
Joined: Wed Feb 21, 2018 10:16 pm
Country: -

Re: OpenXSensor HoTT Temperature

Post by gravity »

Success. :mrgreen:
I've got the bad wiring switching a small QnD Shild.
changes in the adv. :
#define SERIE_RESISTOR 99000
I chose 100K Ohm Resistors.

In any case, the change in Hott.cpp was important.

RPM also seems to be functional.

thanks so much!

Image

Image


Yes, that can be done better :roll:
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: OpenXSensor HoTT Temperature

Post by mstrens »

OK, Great.
Note that a resistor of 100K (associated with a 100K NTC) is good to measure temperature around 25 degree but probably that it will be less sensitive for high temperature.
Probably that accuracy will be a little better is the resistance is about the same as the NTC resistor at the temperature that you would like to measure.

Anyway, I will add the division by 10 in the next release of oXs.
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: OpenXSensor HoTT Temperature

Post by jhsa »

I presume you will be installing those NTC sensors on the engine's cylinder head? If so, I have similar sensors and would be interested in knowing how you did it :)

I did glue mine with epoxy glue to the cylinder head near the glow plug, and between 2 of the cooling fins. But when the engine gets hot, the epoxy tends to become a bit softer, and I am afraid it could come off?

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
gravity
Posts: 8
Joined: Wed Feb 21, 2018 10:16 pm
Country: -

Re: OpenXSensor HoTT Temperature

Post by gravity »

yes, exactly. one engine was placed in the middle of the fuselage. (Do-335) I'm worried about the cooling.

That will be the next challenge.
Remove grease with petrol and stick it on with Kapton Tape !?
or drill a small hole in a cooling fin.
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: OpenXSensor HoTT Temperature

Post by mstrens »

I think (not 100% sure) that silicone is better than epoxy for high temperature.
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: OpenXSensor HoTT Temperature

Post by jhsa »

Yes, I have high temperature (Red) silicone here.. how is it called? Liquid gaskets or something like that? :)
The problem is that it doesn't harden enough... it is just like soft rubber when dry. I don't think it would hold the sensor for long. When I was experimenting with it (and still have to finish this model), I have noticed that I really needed a good contact between the sensor and the cylinder head base, or the reading would not be accurate. The sensor would read too low.

João

Sent from my BLN-L21 using Tapatalk



My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
Carbo
Posts: 467
Joined: Fri Aug 02, 2013 6:55 pm
Country: Germany
Location: Freinsheim RP

Re: OpenXSensor HoTT Temperature

Post by Carbo »

Often only a mechanical solution works permanent, where the sensor is pressed with spingtension to the device. Easy to do between cooling fins, crankcase is more difficult.
uragano47812
Posts: 9
Joined: Fri Aug 25, 2017 11:47 am
Country: -

Re: OpenXSensor HoTT Temperature

Post by uragano47812 »

Hello i'm trying to do an openxsensor for reading ignition rpm from CDI (Rxcell) and reading temperature of the engine. I will need two temp since it is a twin motor but at the moment i'm tring to read only one temp.

I'm using MZ-24 Pro with a GR-24 Pro RX, the TX sees the General module under telemetry but on temp it read a fixed value of +229°C

I read carefully the description section and the info on this topic but i don't know what i'm doing wrong.
i'm using an Arduino Nano board in this way.
Pin D4 is for tememetry signal to RX
VIN and Ground goes to RX telemtry port to pick power supply
A0 is used to connect to temperature sensor NTC which is a Termistore NTC 3950 100K ohm from a 3D printer.
The A0 and VIN pins have a 100K ohm resistor.

Reading Voltages with a multimeter i see: 5.18V from VIN and ground (same as RX of course) and from A0 amd ground with all connected as above i read 4.79V

I didn't test the RPM yet.

I attach my basic and adv config files.

Let me know thanks
Attachments
oXs_config_basic.h
(11.46 KiB) Downloaded 145 times
oXs_config_advanced.h
(15.94 KiB) Downloaded 156 times
uragano47812
Posts: 9
Joined: Fri Aug 25, 2017 11:47 am
Country: -

Re: OpenXSensor HoTT Temperature

Post by uragano47812 »

I have also tried with Frsky Sport but here i read a value of -273°C and i tried another NTC with the same result. The sensor are discovered also the RPM. I changed only basic.h with those lines
#define PROTOCOL FRSKY_SPORT
#define T1_SOURCE VOLT_1

I think it is something wrong in my wiring...

EDIT:
I tried to use those lines
//#define USE_INTERNAL_REFERENCE // uncomment this line if you use 1.1 volt internal reference instead of Vcc (voltage divider mst be used to reduce voltages to 1.1 volt max)
//#define USE_EXTERNAL_REFERENCE // uncomment this line if you use an external reference instead of Vcc
#define REFERENCE_VOLTAGE 4970

And i solder the resistance to +5V of the Arduino and now on Frsky i read a negative value -42°C and it goes to -30°c if i apply hot and so on.
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: OpenXSensor HoTT Temperature

Post by mstrens »

Is the other side of the NTC connected to gnd?
Normally if you have 100K between A0 and Vin and the NTC (also about 100k at 25°) between A0 and gnd, the voltage on A0 shoud be 5/2 = 2.5V

Have you read this (extract from description)
Therefore, in section 6.1 and 6.2 ,
* USE_INTERNAL_REFERENCE must be as comment (so with // in front off)
* USE_EXTERNAL_REFERENCE must be as comment (so with // in front off)
* REFERENCE_VOLTAGE must be as comment (so with // in front off)
* RESISTOR_TO_GROUND must be set on 0 (for the index being used)
* OFFSET_VOLTAGE must (normally) be set on 0 (for the index being used)
* SCALE_VOLTAGE must be set on 204.6 (=1000 * 1023/5000) (for the index being used)
* Then you have to define some parameters in section 6.4
* FIRST_NTC_ON_VOLT_NR specify index of first voltage being used for conversion to temperature (e.g. 3 means VOLT_3) (so it is not the code of analog pin; this one is define in section 6.2)
* LAST_NTC_ON_VOLT_NR specify index of last voltage being used for conversion to temperature (e.g. 5 means VOLT_5)
* In this expample, it means that you expect to measure 3 temperatures based on NTC connected to the pins used for VOLT_3, VOLT_4 and VOLT_5
* note: if you use only one NTC, you must specify the same value for FIRST_NTC_ON_VOLT_NR and for LAST_NTC_ON_VOLT_NR
* if you do not use NTC, keep this line as comment
* SERIE_RESISTOR specify the resitance (in Ohm) connected between Arduino Vcc and NTC (and analog pin); select a value nearly equal to the resistance of NTC in the range of temperature you expect best accuracy
* Next 3 parameters are specific to the NTC you use. Values between brackets are nominal value for a cheap NTC available on aliexpress.com with 100k ohm at 25°C and a Beta coefficient of 3950 for range 25/50
* STEINHART_A (e.g. 7.00111E-4 )
* STEINHART_B (e.g. 2.1644E-4 )
* STEINHART_C (e.g. 1.0619E-07 )
* If you do not know those 3 parameters, you can caluclate them measuring the NTC resistance at 3 different temperatures. Use then e.g. the formula given on wikipedia for thermistor
* When you use 1 or 2 NTC, the temperature(s) will be registered in VOLT_X and VOLT_Y where X is the value of FIRST_NTC_ON_VOLT_NR and Y the value of LAST_NTC_ON_VOLT_NR
* If you use more than 2 NTC, oXS will register in :
* VOLT_X the lowest temperature
* VOLT_X+1 the index of the highest temperature (1 being the index of the first NTC)
* VOLT_Y the highest temperature
*
uragano47812
Posts: 9
Joined: Fri Aug 25, 2017 11:47 am
Country: -

Re: OpenXSensor HoTT Temperature

Post by uragano47812 »

This are the lines in advanced config that i use. At the moment i'm testing with only one temp sensor connected to A0

#define PIN_VOLTAGE 0 , 8 , 8 , 8 , 8 , 8
#define RESISTOR_TO_GROUND 0 , 0 , 0 , 0 , 0 , 0
#define RESISTOR_TO_VOLTAGE 0 , 0 , 0 , 0 , 0 , 0
#define OFFSET_VOLTAGE 0 , 0 , 0 , 0 , 0 , 0
#define SCALE_VOLTAGE 204.6 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 /

#define FIRST_NTC_ON_VOLT_NR 1
#define LAST_NTC_ON_VOLT_NR 1
#define SERIE_RESISTOR 99000
#define STEINHART_A 7.00111E-4
#define STEINHART_B 2.1644E-4
#define STEINHART_C 1.0619E-07

The Arduino used pins are:
VIN+GND+D4 goes to RX telemetry port S_Port. The RX is powered with a 2s lipo direct.
A0 is connected to one wire of the probe and to 100k and the other side of 100k is connected to +5V oin of Arduino
The other wire of the probe is connected to a free GND pin of arduino board.

One think that i don't understand is that i measure a V on A0 of 4.90V and not 5/2 as you said.

The displayed temp is -62°C (at 18.5°C real temp) and if i heat up it goes toward 0°C

Is there the need to use a different scale or an offset?
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: OpenXSensor HoTT Temperature

Post by mstrens »

Do you have an Ohmmeter?
If yes, then mesures the resistance of the probe when it is not connected.
I would expect that at 25°C, the resistance should be about 100K.
Do you have the reference (or a link to the site where you purchase it) of your probe?
uragano47812
Posts: 9
Joined: Fri Aug 25, 2017 11:47 am
Country: -

Re: OpenXSensor HoTT Temperature

Post by uragano47812 »

Here is a link of the probe i use:

https://www.tripyoux.com/index.php?main ... _id=234381

At 18.5°C i read on 200k scale of multimeter 2.2 and with the same scale the resistance i used is correctly at 1.0.

Some R --> T Table can be found here:

https://www.makeralot.com/download/Repr ... 0-100K.pdf
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: OpenXSensor HoTT Temperature

Post by mstrens »

There is probably a bad soldering somewhere.
If you make the folowing connection
5V <-- 100K resistor --> A0 <-- Probe --> Gnd,

The voltage on A0 should be 5V * (Probe resistance ) / (Probe resistance + 100K)
So at 18.5 °c it should be 5V * 2.2 /3.2 = about 3.8V
uragano47812
Posts: 9
Joined: Fri Aug 25, 2017 11:47 am
Country: -

Re: OpenXSensor HoTT Temperature

Post by uragano47812 »

I changed the resistor to a 10k and i updated arduino config accordingly, but i stiil need to use an offset in opentx of +46.0. Using another thermometer the readings seems to be almost the same. The change in temperature is very quick compared to the digital thermometer i use as comparison.

All seems good so i will try to use 2 resistor and two NTC now.

Only ine question related to RPM. Using the output of CDI is it better to use a small capacitor like 220uF in line on D8 --> CDI signal wire?

Thanks for your help
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: OpenXSensor HoTT Temperature

Post by mstrens »

uragano47812 wrote: Mon Apr 27, 2020 4:04 pm I changed the resistor to a 10k and i updated arduino config accordingly, but i stiil need to use an offset in opentx of +46.0. Using another thermometer the readings seems to be almost the same. The change in temperature is very quick compared to the digital thermometer i use as comparison.

All seems good so i will try to use 2 resistor and two NTC now.

Only ine question related to RPM. Using the output of CDI is it better to use a small capacitor like 220uF in line on D8 --> CDI signal wire?

Thanks for your help
About RPM, it is difficult to answer without knowing the type of signal generated by the CDI.
If the signal is (as I expect) pulses between 0 and 5V there is no need for a capacitor.
In order to protect the D8 pin I would suggest to put a 10K resistor in line D8 -> CDI signal wire.
Then if the mesured RPM is much to high, it could be that there are some noise on the CDI signal. Then I would suggest to add a capacitor connected between D8 and Gnd. The value of the resistor has to be tested (try and error) but I suggest to try with values between 100nf and 100uf.

About you thermistor, I suggest that you check if the reported value is correct in the range of temp you will use (probably around 100°C) because it is very stange that you have to apply such an offset and that you have to use a 10k resistor instead of a 100K

Post Reply

Return to “OpenXVario - an open source vario supported by the open source firmwares!!”