Hello! I would like to implement a sensor on a plane, but it seems to need a 20ms delay for it to work! It works perfectly fine with an arduino (i used a delay function), but I am confused if there are any workarounds for the needed delay through lua scripts. Is there a possibility to just start the measuring process with LUA and readout at a later time?
here are some context:
The sensor tested is HDC1080 from Texas Instruments. It is tested on an Arduino Uno and it works perfectly fine, I tried testing it on Pixhawk4, ArduPlane V4.4.0 but it is not being detected, with the reasoning eventually found that the sensor data gathering was initiated by the sample script, because it starts a read on the address 0x00.
The Arduino script is the one that is given as a sample code from Texas Instruments
And the scan script is from the Lua example code
The same scan script can detect another sensor, Bosch BME280 and Bosch BME680. The bus address is set as 3 during the testing, as the sensors are plugged to I2CA port but it is not detecting the HDC1080.
here are the oscilloscope results:
- Bosch 680 connected to pixhawk (scanBoschTI.lua is used)
- HDC1080 connected to pixhawk (scanBoschTI.lua is used)
- scanBoschTI.lua loop while HDC1080 is connected to pixhawk
- HDC1080 connected to Arduino:
as in the arduino script 20ms delay :
Image conclusions:
-the scan.lua script does not have a 20ms delay (as far as I know there is no such function in the lua ardupilot wrapper).
-the address read on 0x00 for HDC1080 is to initiate the temperature and pressure readings
-the scan.lua sample code triggers HDC1080 temperature and pressure sensing
These are the datasheets for the sensors :
- HDC1080
- BME680
Thank you so much for your help!!
here is the scanBosch.lua code that I used
scanBoschTI.lua (819 Bytes)