<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="it">
	<id>https://www.raspibo.org/wiki/index.php?action=history&amp;feed=atom&amp;title=Thermal_sensor_and_I2C_lcd</id>
	<title>Thermal sensor and I2C lcd - Cronologia</title>
	<link rel="self" type="application/atom+xml" href="https://www.raspibo.org/wiki/index.php?action=history&amp;feed=atom&amp;title=Thermal_sensor_and_I2C_lcd"/>
	<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=Thermal_sensor_and_I2C_lcd&amp;action=history"/>
	<updated>2026-05-07T05:47:01Z</updated>
	<subtitle>Cronologia della pagina su questo sito</subtitle>
	<generator>MediaWiki 1.35.5</generator>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=Thermal_sensor_and_I2C_lcd&amp;diff=6581&amp;oldid=prev</id>
		<title>Maldus: Creata pagina con 'Simple temperature + humidity sensor displayed by a 16x2 lcd screen. Both are controlled via I2C.  This is the temperature sensor: http://www.farnell.com/datasheets/1780639.pd...'</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=Thermal_sensor_and_I2C_lcd&amp;diff=6581&amp;oldid=prev"/>
		<updated>2018-04-03T16:02:53Z</updated>

		<summary type="html">&lt;p&gt;Creata pagina con &amp;#039;Simple temperature + humidity sensor displayed by a 16x2 lcd screen. Both are controlled via I2C.  This is the temperature sensor: http://www.farnell.com/datasheets/1780639.pd...&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Nuova pagina&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Simple temperature + humidity sensor displayed by a 16x2 lcd screen. Both are controlled via I2C.&lt;br /&gt;
&lt;br /&gt;
This is the temperature sensor: http://www.farnell.com/datasheets/1780639.pdf&lt;br /&gt;
&lt;br /&gt;
This is the I2C lcd controller: https://opencircuit.nl/ProductInfo/1000061/I2C-LCD-interface.pdf&lt;br /&gt;
Normally any lcd display has a parallel communication protocol which requires 15 connections. By using an I2C controller we only need 4 pins, significantly reducing the circuit setup.&lt;br /&gt;
&lt;br /&gt;
Since the two devices (temperature sensor and lcd controller) have different operating voltages (3V3 and 5V, respectively) we will power them with the two different power sources from the Arduino.&lt;br /&gt;
Note: I initially connected them both to the 5V pin, and everything worked normally. Still, the datasheet for the SHT21 indicates an operating current ranging from 2.1V to 3.6V.&lt;br /&gt;
&lt;br /&gt;
By default, the Arduino Nano uses A4 for I2C clock and A5 for I2C data. They can be relocated if needed.&lt;br /&gt;
&lt;br /&gt;
The circuit is simple: power each device with its source and connect their I2C pins to the Arduino. Having a different address, he will be able to distinguish when communicating.&lt;br /&gt;
&lt;br /&gt;
[[File:TempNano.png|800px]]&lt;br /&gt;
&lt;br /&gt;
The sketch is little more than an hello world. We use two specific libraries, HTU21D.h for the temperature sensor and LiquidCrystal_I2C for the I2C controller.&lt;br /&gt;
The temperature library already knows its device's address. For the I2C controller, we know it's 0x27.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang='C'&amp;gt;&lt;br /&gt;
#include &amp;lt;Arduino.h&amp;gt;&lt;br /&gt;
#include &amp;lt;Wire.h&amp;gt; &lt;br /&gt;
#include &amp;lt;LiquidCrystal_I2C.h&amp;gt;&lt;br /&gt;
#include &amp;lt;HTU21D.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
HTU21D myHTU21D(HTU21D_RES_RH12_TEMP14);&lt;br /&gt;
&lt;br /&gt;
LiquidCrystal_I2C lcd(0x27,20,4);  // set the LCD address to 0x27 for a 16 chars and 2 line display&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
     &lt;br /&gt;
     int counter = 0;&lt;br /&gt;
  while (myHTU21D.begin() != true &amp;amp;&amp;amp; counter++ &amp;lt; 5)&lt;br /&gt;
  {&lt;br /&gt;
    delay(1000);&lt;br /&gt;
  }&lt;br /&gt;
  lcd.init();                      // initialize the lcd &lt;br /&gt;
  lcd.backlight();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
  lcd.setCursor(0,0);&lt;br /&gt;
  lcd.print(&amp;quot;Temp.   : &amp;quot;);&lt;br /&gt;
  lcd.print(myHTU21D.readTemperature());&lt;br /&gt;
  lcd.setCursor(0,1);&lt;br /&gt;
  lcd.print(&amp;quot;Humidity: &amp;quot;);&lt;br /&gt;
  lcd.print(myHTU21D.readHumidity());&lt;br /&gt;
  delay(500);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
End result:&lt;br /&gt;
&lt;br /&gt;
[[File:Experiment_m.jpg|500px]]&lt;/div&gt;</summary>
		<author><name>Maldus</name></author>
	</entry>
</feed>