Melexis MLX90614 IR sensor
In the picture above the assembly of the sensor is shown. Solder the pre-assembled cable for the FMU connector with the sensor to a small breadboard and plug the other ends of the cables into the connector as shown. For better power stability, you can attach a capacitor between Vdd and ground.
Example code for using the MLX90614 under PX4 is available under the NXP HoverGames GitHub:
The example was written in C++ and is based on the "px4_simple_app" in the examples folder of the PX4 Firmware. This example is in the folder "hg_mlx90614" and includes the files "CMakeLists.txt", "hg_temp.h" and "hg_temp.cpp".
For running the example the command
hg_mlx90614has to be added under the keyword "EXAMPLES" in the file "default.cmake" from the folder ".../src/Firmware/boards/nxp/fmuk66-v3" . Also copy the folder "hg_mlx90614" in the folder ".../src/Firmware/src/examples".
Within the example there are two public functions for reading the object temperature and the ambient temperature. These will be called as follows:
double objectTemp = 0;
double ambientTemp =0;
objectTemp = temp.readAmbientTempC();
ambientTemp = temp.readObjectTempC();
First creating an object of the "HG_Temp"-Class. Then you can call the functions for reading the temperature. Both functions
readObjectTempCreturns the temperature as a double type in degrees Celsius.