inav icon indicating copy to clipboard operation
inav copied to clipboard

Feature request: I²C temperature sensor support

Open Kryptooo opened this issue 8 years ago • 20 comments

Please add a uart temperature sensor for Longrange flights with lion batteries.

Kryptooo avatar Sep 06 '18 21:09 Kryptooo

Do you have some kind of hardware to suggest?

giacomo892 avatar Sep 07 '18 08:09 giacomo892

I was thinking of this the other day. It would be logical to use the same sort of temperature probes used in Spektrum telemetry, EagleTree telemetry etc as these are available everywhere and for cheap. It wouldn't make any sense to use up a digital UART for this, just an ADC pad would do I should think.

leeph avatar Sep 07 '18 12:09 leeph

I would think an i2c temp sensor would be better. They're more accurate than an analog sensor that needs calibration and using i2c means you wouldn't use a dedicated port (just share the i2c with whatever). I've done this with Arduino and it's super straight forward and cheap.

teckel12 avatar Sep 07 '18 21:09 teckel12

This issue / pull request has been automatically marked as stale because it has not had any activity in 60 days. The resources of the INAV team are limited, and so we are asking for your help. This issue / pull request will be closed if no further activity occurs within two weeks.

stale[bot] avatar Nov 06 '18 21:11 stale[bot]

Automatically closing as inactive.

stale[bot] avatar Nov 20 '18 22:11 stale[bot]

I bought some LM75A sensors. Cheap and seems like a good solution for on board temperature measurements. Up to 8 can be used on the same bus, 2.8 to 5.5V power supply, temperature range from -55°C to 125°C with 0.125°C resolution. I will try to add support for it

shellixyz avatar Nov 28 '18 17:11 shellixyz

@shellixyz another popular one which can be had REALLY cheap is the venerable DS18B20. I know it's not I2C but it only requires 1 pin (outside of power/Ground) and can be purchased in a TO92 case which makes them perfect for sticking in small places

https://cdn-shop.adafruit.com/datasheets/DS18B20.pdf https://www.adafruit.com/product/374

wx4cb avatar Nov 28 '18 18:11 wx4cb

Probably 1-wire is even easier to implement using an UART - https://www.maximintegrated.com/en/app-notes/index.mvp/id/214

digitalentity avatar Nov 28 '18 18:11 digitalentity

@digitalentity REALLY easy to implement and the good thing is, those DS1820B's can be parasitically powered so you literally only need, data and ground

wx4cb avatar Nov 28 '18 18:11 wx4cb

@wx4cb It is an interesting sensor. Not as cheap as the LM75A but the possibility to only use 2 wires in total to connect the sensor is really nice. We would have to implement the 1-wire protocol though.

shellixyz avatar Nov 28 '18 18:11 shellixyz

@digitalentity We could also add support for the DS2482 I²C bus master

shellixyz avatar Nov 28 '18 18:11 shellixyz

most of the work has already been done: https://stm32f4-discovery.net/2014/05/13-reading-temperature-with-dallas-ds18b20-on-stm32f429-discovery-board/

wx4cb avatar Nov 28 '18 18:11 wx4cb

@shellixyz it would be nice to see DS2482 put on the FC itself 😄 @wx4cb implementing it for INAV would require considerably more work

digitalentity avatar Nov 28 '18 18:11 digitalentity

@digitalentity Indeed. Suggestion for Matek for their next FC ? :smile:

shellixyz avatar Nov 28 '18 18:11 shellixyz

@digitalentity I realise that, if i was a better coder with more understanding of STM32s i could help lol and i agree a bus master would be nice on board. no need to worry about - oh crap how do i connect this LOL

wx4cb avatar Nov 28 '18 18:11 wx4cb

Any idear how far it is? I hope it will work with the MCP9808

sniperxnl avatar Dec 12 '18 20:12 sniperxnl

@sniperxnl I'll start working on it when I get the sensors. I bought some LM75 and DS18B20. They have been shipped but I'm still waiting for them. If you want to contribute some MCP9808 chips I can add support for it too.

shellixyz avatar Dec 12 '18 21:12 shellixyz

@shellixyz was searching and stumbled on this feature. I'm brand new to iNav. I think it's an important addition. Look forward to your work!

brokndude avatar Dec 20 '18 17:12 brokndude

@shellixyz I'll start working on it when I get the sensors. I bought some LM75 and DS18B20. They have been shipped but I'm still waiting for them. If you want to contribute some MCP9808 chips I can add support for it too.

I look forward to the support release for the DS18B20 Dallas sensor.

Constructively, the LM75, being a SOIC 8. Needs to be board mounted. As most are. This makes for a rather large temp sensor for most application. Its a bit hard to just slip it under the heat shrink on the VTX or ESC.
While mounting it directly to the VTX RF shield or the ESC heatshink; reduces thermal dissipation efficiency on those devices.

Any reason that an NTC Thermistor isn't considered to connect to a spare ADC? The ET Vector uses the Thermistor approach. I have used many different cheap 10K NTC thermistors with it. And I've tested the Vectors calibration with multiple digital thermometers, and have found the output reading doesn't fluctuate more than a few degrees from actual.

ghost avatar Jan 28 '19 02:01 ghost

@kardon18

Constructively, the LM75, being a SOIC 8. Needs to be board mounted. As most are. This makes for a rather large temp sensor for most application.

That's why the DS18B20 in TO92 package is nice. And only 3 wires needed instead of 4 for the LM75. For some applications using a LM75 is fine though. The PCB doesn't need to be larger than 10x10mm. Would be fine for measuring the air or battery temperature. But as you said not ideal for measuring the motor or VTX temperature for example.

Any reason that an NTC Thermistor isn't considered to connect to a spare ADC?

It would be possible and would be pretty easy. The downsides are that there are often not a lot of analog inputs on the FCs and electrical interference can have a big impact on analog signal. Also you need one signal wire per sensor so if you want say 4 sensors then you need 2 wires for power and 4 wires for signal (and also 4 resistors or 4 caps). 6 wires in total. The DS18B20 has the disadvantage to need an interface chip but it is very small and can be put close to the FC then you only need 3 wires total for the bus whatever the number of sensors used.

shellixyz avatar Jan 29 '19 02:01 shellixyz