Humidity sensor SHT2x for ArduPilotMega

I have implemented an i2c temperature+humidity sensor on my ArduPilotMega. This could be useful for anybody, so I will try to explain here how I did it.

 

What is needed:

3689425376?profile=original

the sensor i used is the SHT21 from Sensirion, but it should also work for the SHT25. On the manufacturer website you can find technical data about the sensors, and they also sell their sensors themselves:

I received the sensor from Sensirion mounted on a breakout board.

 

 

3689425326?profile=original

3689425416?profile=original

a connector to easily change the sensor breakout borad.I used one from samtec(ref SMS-104-01-G-S).

 

 

 

3689425387?profile=originalAn I2C/SMBus Voltage Traslator (I2C Level Shifter) With adapter because the sensor uses 3.3V i2c when the APM outputs 5V

 

 

 

 

3689425335?profile=originalAn EM-406/uBlox/MTK Adapter Cable 10 cm , or whatever length.

(only 4 wires are required. So you can remove the red one and the black one standing next to it)

 

 

 

Code:

I did include all the files I modified here.

 

Code features:

-I did not implement mavlink code for data transmission. It seems it requires changes in Mission Planner, which I cannot do.

-In the Command Line Interpreter (CLI), in the test "menu", the "meteo" command output temperature and humidity, until "enter" is pressed.

-It can log temperature and humidity about every second (I have to check if the logging interval is really 1 sec). The logged data can be retrieved in Mission Planner. Logging can be enabled or disabled in the "logs" menu.

 

So far it seems to work fine. I will test more in the next days.


a)     ArduPilotMega.pde

E-mail me when people leave their comments –

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

Join diydrones

Comments

  • I wasn't able to use this code with the SHT21 and an APM2.5. The new I2C libraries for latest Arducopter and Arduplane are also much more complicated to program, so I opted for a stand-alone temp and humidity sensor http://www.logtagrecorders.co.za/products/haxo.htm

  • hi making an unmanned ground vehicle , wanted to know if it was possible to put humidity and temperature sensor on it so that it shows reading on laptop.. i have around 22.2 V NiMh battery for power supply..Since i am new to ardurover .. any suggestions?

  • hi making an unmanned ground vehicle , wanted to know if it was possible to put humidity and temperature sensor on it so that it shows reading on laptop.. i have around 22.2 V NiMh battery for power supply..Since i am new to ardurover .. any suggestions?

  • I'm also interested in integrating the DHT11. Has anyone tried?

  • hello ... I am also looking for information to get reading Humidity / Temperature sensor DHT11 in APM2.5. Is that possible? Does anyone have news?

  • I just ordered similar sensors to play around with this weekend.  Just wondering if anyone else had dabbled with measuring relative humidity and temperature using ardupilot?  Thanks a bunch for posting the code - it will be a big help - and thankfully the link still worked.

  • Thanks so much Eric and Ellison. I was able to download the zip successfully.

  • thank you Ellison!

  • Well looks like Ning didn't like the filename or the rar format.

    Re-packed to zip with a different name, and download ok for me.

  • i have updated the link. contact me if the link becomes dead again.

This reply was deleted.