Elec­tron­ic design­er Arduino is very pop­u­lar among tal­ent­ed teenagers and inquis­i­tive adults. Today we will ana­lyze how to use it to turn an ordi­nary LCD into a weath­er sta­tion.

How to set up the LCD

If you want to con­trol an LCD with an Arduino, you will need, in addi­tion to the kit and mon­i­tor, a con­nec­tion cable, a poten­tiome­ter, and a Bread­board. How­ev­er, on the Inter­net you will find many prac­ti­cal and afford­able Arduino kits that already have all these com­po­nents.
farduino-lcd-ansteuern

  • First, con­nect all the com­po­nents — as shown in the pic­ture — to the Arduino and start the Arduino IDE.
  • First, you must add the #include com­mand (with­out the quotes) to the code to import the Liq­uid­Crys­tal library.
  • Then you will need to define the LCD with the com­mand “Liq­uid­Crys­tal lcd (7, 8, 9, 10, 11, 12)”;. If nec­es­sary, you will need to adjust the con­tacts used in the com­mand.
  • You have to start your LCD in void set­up(). This can be done, for exam­ple, using the com­mand “lcd.begin (16, 2);”.
  • Now you can test the LCD. Using the com­mand “lcd.print(“Hello, World!”);” the words “Hel­lo, World!” — as in this exam­ple — will be shown on the dis­play. Using the com­mand “lcd.setCursor (0, 1)”; you can change the cur­sor. Note, how­ev­er, that the com­put­er always starts count­ing from 0. With the “lcd.clear();” com­mand. You can delete all record­ed data on the LCD.

Arduino: how to make a thermometer

Farduino-thermometer-bauen

  • After you have worked with your LCD, you can make a small ther­mome­ter your­self. For this you will also need an NTC and a 10 kΩ resis­tor.
  • Con­nect all com­po­nents as shown in the fig­ure.
  • Now you need to insert the com­mand “int temp­Pin = 0;” at the very begin­ning of your code so that the Arduino knows which (ana­log) pin you con­nect­ed the NTC to.
  • Then add to the void loop() the com­mand “int tem­pRead­ing = analogRead(tempPin);”, and then the com­mand “dou­ble tempK = log(10000.0 * ((1024.0 / tem­pRead­ing — 1)));”, and also the com­mand “tempK = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * tempK * tempK )) * tempK );” with­out quotes. Under the vari­able “tempK” the tem­per­a­ture in Kelvin has been set and stored.
  • You can change this with the com­mand “float tem­pC = tempK — 273.15;” and eas­i­ly con­vert units to Cel­sius.
  • Now add (still in the void loop) the com­mand “lcd.setCursor(0, 0);” to place the cur­sor at the begin­ning. After that, you need the “lcd.print(tempC)” com­mand; to show the tem­per­a­ture on the dis­play. Since the cur­sor will now always be placed at the begin­ning, you will not need to addi­tion­al­ly insert the lcd.clear() com­mand.

Pho­to: man­u­fac­tur­ing com­pa­nies

Read also:

  • Mini-PC Rasp­ber­ry Pi 3 Mod­el B + can become the cen­ter of the “smart” home
  • Xiao­mi launch­es E Ink weath­er sta­tion for just $9