mLink TMP36 Temperature Sensor (HCMODU0187)

mLink serial I2C modules
Post Reply
admin
Site Admin
Posts: 867
Joined: Sun Aug 05, 2012 4:02 pm

mLink TMP36 Temperature Sensor (HCMODU0187)

Post by admin » Mon Dec 04, 2023 3:23 pm

Image




The mLink TMP36 module is a tiny serial (I2C/IIC) device that includes a precision TMP36 temperature sensor. This alows the module to measure temperatures over a wide range of -40 to 125oC. The module continuously takes measurement from the TMP36 sensor and provides the result as a temperature in degrees centigrade via its serial I2C interface. It is compatible with other mLink or standard I2C modules allowing you to daisy-chain several different types of modules together using only the two I2C pins of your microcontroller. Its default I2C address can be changed via software so that multiple TMP36 modules can be connected to one microcontroller.


For Arduino users you can use the mLink library (see below) to control any type of mLink module. Only one single instance of the library is needed to control multiple types of mLink modules resulting in very little resources overhead and therefore making it great for Arduinos with small amounts of memory and pin counts.

For Raspberry Pi users we have a Python module which can be installed via pip or downloaded and installed directly from our forum. Please see the mLink Python forum thread for requirements and download link here: viewtopic.php?f=131&t=3062&p=8592#p8592


Module specifications:

Module code: 						HCMODU0187
Supply Voltage (VDD): 				4.5V to 5.5V
Operating range (recommended):		-40 to 125oC
Temperature resolution:				±0.16oC
Temperature accuracy (@25oC):		±1oC
Temperature accuracy (-40 to 25oC):		±2oC
Current consumption (idle):			5.5mA
Current consumption (sleep):			0.75mA
Interfaces:						mLink (I2C) in and out
I2C Interface speed: 					400kbits/s (fast mode)
I2C default address (HEX): 			0h58
Maximum number of modules: 			5 with pullups fitted, 112 with pullups removed*
Module dimensions (ex headers):		47.5mm x 10.6mm x 10.5mm


*Note the maximum number of connected modules will depend on cable lengths and power requirements of each module. Do not exceed 5 mLink modules connected in series with all pullups fitted.



Arduino Connection Example:

Image

Image


Because the modules use an I2C interface this also means multiple modules can controlled from a single Arduinos I2C interface simply by daisy-chaining them together. Note to control multiple mLink modules of the same type requires changing the default I2C address of the additional modules. See mLink Library Quick Start Guide for how to do this.


Image




Read temperature example

Arduino Temperature Example:

This sketch uses the mLink library to read the temperature (in oC) from the mLink TMP36 temperature sensor module (SKU: HCMODU0187).

  1. #include "mLink.h"                          // Include the library
  2.  
  3. mLink mLink;                                // Create an instance of the library
  4.  
  5. #define I2C_ADD 0x58                        // Default I2C address
  6.  
  7. void setup()
  8. {
  9.   Serial.begin(9600);
  10.  
  11.   mLink.init();                             // Initialise the library
  12. }
  13.  
  14.  
  15. void loop()
  16. {
  17.   float temp = mLink.TMP36_Temp(I2C_ADD);     // Get the temperature in oC
  18.  
  19.   Serial.print("Temperature: "); Serial.println(temp);
  20.  
  21.   delay(1000);                              // Wait a second before reading again
  22. }

Low power mode example

Arduino Low Power Mode Example:

This sketch uses the mLink library to read the temperature (in oC) from the mLink TMP36 temperature sensor module (SKU: HCMODU0187). Once the sensor has been read the sketch will then put the module back into a low power sleep mode.
  1. #include "mLink.h"                          // Include the library
  2.  
  3. mLink mLink;                                // Create an instance of the library
  4.  
  5. #define I2C_ADD 0x58                        // Default I2C address
  6.  
  7. void setup()
  8. {
  9.   Serial.begin(9600);
  10.  
  11.   mLink.init();                             // Initialise the library
  12. }
  13.  
  14.  
  15. void loop()
  16. {
  17.   while(mLink.busy(I2C_ADD));               // Wait for the new measurement
  18.   float temp = mLink.TMP36_Temp(I2C_ADD);   // Get the temperature in oC
  19.  
  20.   mLink.sleep(I2C_ADD);                     // Put the module to sleep
  21.   Serial.print("Temperature: "); Serial.println(temp);
  22.  
  23.   delay(1000);                              // Wait a second before reading again
  24. }



Raspberry Pi Connection Example:

Image


Read Temperature Example

Raspberry Pi Temperature Example:
This Python script uses the mLink python library module to read the temperature (in oC) from the mLink TMP36 temperature sensor module (SKU: HCMODU0187).

This program requires the mLink Python library module to be installed. Please see the following forum thread for more information on how to install the Python module and requirements:

viewtopic.php?f=131&t=3062

  1. from mLink import mLink             # Import the mLink module
  2. import time
  3.  
  4. ml = mLink.mLink(1)                 # Create an instance of the module
  5.  
  6. I2C_ADD = 0x58                      # Default I2C address is 0x54
  7.  
  8.  
  9. while 1:
  10.     print(ml.TMP36_Temp(I2C_ADD))       # Read and print out the current temperature
  11.     time.sleep(1)
  12.  



Image

mLink Arduino library
viewtopic.php?f=58&t=3001


mLink Raspberry Pi Python module
The mLink python module can be installed with the following terminal command:

  1. pip install hc-mlink

Alternatively the library can be manually installed by downloading it from the forum and unzipping it to your project folder. See the Python module forum thread for more information and download link:
viewtopic.php?f=131&t=3062&p=8592#p8592

Please note that in some cases there may be additional configuration required. If you have issues getting your Raspberry Pi to communicate with the mLink module then please see the Python module forum thread here: viewtopic.php?f=131&t=3062



mLink Specifications and Register Map For The TP36 Temperature Sensor Modul
https://hobbycomponents.com/downloads/m ... er_Map.pdf


Libraries, example code, and diagrams are provided as an additional free service by Hobby Components and are not sold as part of this product. We do no provide any guarantees or warranties as to their accuracy or fitness for purpose.

Descriptions and diagrams on this page are copyright Hobby Components Ltd and may not be reproduced without permission.

Post Reply

Return to “mLink”