Master SIAME | Université Toulouse 3

Internet of things and System on Chip

Master SIAME | Université Toulouse 3

Internet of things and System on Chip

User Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

rpi:temp_sensors [2015/08/26 20:37] (current)
Line 1: Line 1:
 +====== Temperature monitoring | the RECS use case ======
 +\\
 +The FP7 European project ​ [[http://​www.coolemall.eu|CoolEmAll]] tackles energy efficiency in datacenters. The [[http://​recs.irit.fr|RECS]] platform developped by our partner ​ [[http://​www.christmann.info|Christmann]] is a 1U ComputeBox hosting up to 18 boards.\\
  
 +{{ :​recs:​recs_irit.jpg?​direct |The RECS2.0 platform at IRIT}}
 +
 +\\
 +===== Context =====
 +The RECS2.0 is a 1U compute box that hosts up to 18 nodes splitted in two lanes. On each lane there are 9 fans. Fans on a lane are either on the inlet or the outlet airflow side.\\
 +
 +{{ :​recs:​recs_airflow.png?​direct |Side view of RECS inner airflow}}
 +
 +As shown in figure above, current temperature sensors are located under the compute boards. However, these sensors exhibit a 1°c resolution that is not enough for our purposes.\\
 +Hence, we decided to add new temperature sensors to both evaluate airflow output temperature and to increase its intrinsic resolution.\\
 +
 +===== Objectives =====
 +In an attempt to collect airflow temperature at the outlets and to increase temperature precision, we want to add temperature sensors.\\
 +
 +{{ :​recs:​recs_overview.png?​direct |Airflow overview at the RECS2.0 platform}}
 +
 +On each of the nine output, we'll add a temperature sensor. In addition, we'll also add two temperature sensors at the air intake side. This will lead to a total of eleven temperature sensors.\\
 +We then want that these values to be sent to a Zabbix monitoring system using JSON frames format. This way, it will be easily to collect, synthesize and show the evolution of temperature within the RECS platform while running experiments.\\
 +
 +\\
 +
 +====== Hardware | Sensors & Board ======
 +{{ :​recs:​tcn75a_mr312.jpg?​direct&​300|Microbot.it TCN75A based temperature sensor.}}
 +In order to reduce the overall development time, we will make use of off-the-shelf hardware. Therefore, the whole system will be composed of:\\
 +  * a type B Raspberry Pi board,
 +  * 11 x {{:​recs:​mr312_datasheet.pdf|MR312}} temperature sensors based on the {{:​recs:​tcn75a.pdf|TCN75A}} chip.
 +
 +While popular and very cheap, the TCN75A temperature sensor is shipped **uncalibrated** => This means that it will require some calibration process. On the other hand, there exists some already calibrated temperature sensors but they cost **ten times the price** :|\\
 +
 +{{ :​recs:​tcn75a_1_and2.png?​direct&​800 |TCN75A pinout and addresses bits}}
 +\\
 +=====  I2C address issue =====
 +An I2C bus enables users to connect up to **128 devices**. However, integrated circuit manufacturers tend to reduce the pin count of their devices. This leads to a partially user configurable I2C address. Hence, each I2C device address has a fixed part set by the manufacturer along with a user configurable part.\\
 +
 +As you may have noticed, the TCN75A only features 3 bits of address ''​[A0,​ A1, A2]''​ to differentiate sensors from each others ... which means **up to 8 sensors :(**
 +
 +{{:​rpi:​rpi2.0_hidden_p5_header.png?​direct&​500|The RPi 2.0 hidden P5 header}}{{:​rpi:​rpi_p5_connector.png?​direct|P5 header pinout}}
 +
 +To overcome this limitation, we'll make use of the **hidden second I2C bus**.\\
 +Basically, the second I2C bus (I2C0) is intended to drive the camera connected to the CSI header. However, the Raspberry Pi version 2.0 board features an unpopulated P5 header whose pinout gives access to additional I/O .\\
 +
 +Care must be taken because the P5 header features an unconventionnal pinout numbering. This came from the fact that this unpopulated P5 header is intended to be soldered from the rear side of the RPi board.\\
 +
 +Moreover, to enable this hidden I2C0 bus, 1K8 pull-up resistors ought to be added on the SDA and SCL lines (already soldered on the I2C1/P1 header. Additionnally,​ some code is required to re-map functionnalities of the BCM 2835 to the P5 header.\\
 +
 +===== Sensors to RPi board interconnect =====
 +According to address configuration capabilities of the TCN75A, I2C address of these devices will range from ''​0x48''​ to ''​0x4F''​.\\
 +
 +You can check I2C sensors availability through the ''​i2cdetect''​ shell command:
 +<​code>​
 +root@raspirecs[~] i2cdetect -y 0                           ​root@raspirecs[~] i2cdetect -y 1
 +     ​0 ​ 1  2  3  4  5  6  7  8  9  a  b  c  d  e  f             ​0 ​ 1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
 +00:          -- -- -- -- -- -- -- -- -- -- -- -- --        00:          -- -- -- -- -- -- -- -- -- -- -- -- --
 +10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --        10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
 +20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --        20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
 +30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --        30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
 +40: -- -- -- -- -- -- -- -- 48 -- 4a 4b -- -- -- --        40: -- -- -- -- -- -- -- -- 48 49 4a 4b 4c 4d 4e 4f
 +50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --        50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
 +60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --        60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
 +70: -- -- -- -- -- -- -- --                                70: -- -- -- -- -- -- -- --
 +</​code>​
 +Below is a description of the interconnection between the various devices ​ and the I2C0 and I2C1 bus of the RPi board:\\
 +
 +^ I2C bus     ​^ ​ ''​0x48'' ​ ^  ''​0x49'' ​ ^  ''​0x4A'' ​ ^  ''​0x4B'' ​ ^  ''​0x4C'' ​ ^  ''​0x4D'' ​ ^  ''​0x4E'' ​ ^  ''​0x4F'' ​ ^
 +^  I2C0  |  recs9  |   ​| ​ recs18 ​ |  recs10 ​ |
 +^  I2C1  |  recs1  |  recs2  |  recs3  |  recs4  |  recs5  |  recs6  |  recs7  |  recs8  |
 +
 +Below are pictures of the sensors interconnect.\\
 +{{:​recs:​recs_i2ctemp_sensors3_web.png?​direct&​270|RECS one lane TCN75A interconnect details}} ​ {{:​recs:​recs_i2ctemp_sensors2_web.png?​direct&​250|Two TCN75A interconnect details}}
 +\\
 +**Interconnection details **
 +^             ​^ ​ VCC (3.3v) ​ ^  SDA  ^  SCL  ^  GND  ^  Notes  ^
 +^  I2C0  |  beige(noir) ​ |  noir(beige) ​ |  beige(blanc) ​ |  blanc(beige) ​ |  2 paires torsadées ​ |
 +^  I2C1  |   ​rouge ​ |  orange ​ |  jaune  |  vert  |    |
 +\\
 +====== Software | Python and JSON frame formatting ======
 +{{ :​recs:​recs18_external_temperature.png?​direct|RECS18 node monitoring with external temperature sensor}}
 +The expected behaviour of our temperature monitoring system is to collect values from sensors on the RECS platform and then to forward these values to a [[http://​www.zabbix.com|Zabbix]] monitoring system.\\
 +
 +Figure on the right side shows what has been obtained from the Zabbix server regarding the various monitored parameters tied to the RECS18 node:
 +  * **temperature** are values from sensor under the board,
 +  * **ext_temperature** are values from our TCN75A sensor.
 +
 +In order to spread the load on the Zabbix server, we collect sensors values every second and after of 45s harvesting, we send a JSON frame. Such frame contains all values and timestamps from all sensors tied to a peculiar I2C bus.\\
 +===== Python code @ RPi =====
 +The Python code executed on the RPi board is mainly composed of 3 parts:
 +
 +  * {{:​recs:​adafruit_i2c.py|}} Adafruit'​s I2C library,
 +  * {{:​recs:​enable_second_i2c.py|}} I/O remapping to enable second I2C bus,
 +  * {{:​Xrecs:​temperature_zabbix_recs.py|}} the main application.
 +
 +As a first step, you may write a simple python code that setup and read a TCN75a sensor {{:​Xrecs:​TCN75A_temperature_sensor.py|}}
 +\\
 +
 +===== Extension | Humidity sensor =====
 +{{ :​recs:​hih6130.png?​direct&​200|Honeywell HIH6130, calibrated humidity and temperature sensor}}
 +To extend capabilities of our monitoring system, we'd like to add a humidity sensor. The Honeywell HIH6130 device is a calibrated temperature and humidity sensor featuring an I2C interface (//note that it is also configurable as a SPI interface ---command mode//).
 +
 +We provide below some links and documents related to this sensor:
 +  * [[http://​www.phanderson.com/​arduino/​hih6130.html|Arduino code]], HIH6130 sample code,
 +  * {{:​recs:​hih6130_i2c-comm_details.pdf|HIH6130_I2C.pdf}},​ the HIH6130 I2C communication protocol,
 +  * {{:​recs:​hih6130_commandmodeinstructions.pdf|}},​ the HIH6130 Command mode (advanced use).
 +
 +**[WORK]:** we require you to write some python code to access the HIH6130 and to send back to the zabbix server both humidity and temperature.\\