Digital I/O – #Raspberry PI with Temperature Sensor

In this tutorial you will learn a computerized “1-wire” sensor associated straightforwardly to the Raspberry Pi’s GPIO port to quantify temperature, raspberry_featuredand research how the deliberate temperature can be utilized to control an advanced yield to reenact a focal warming indoor regulator. You will then interface a LED driver chip to the Raspberry Pi and utilization it to show the deliberate temperature on a multi-digit seven portion LED coming in upcoming tutorial.

The GPIO pins are situated at one side of the Raspberry Pi, as demonstrated as follows. There are 26 pins on the whole, and they are utilized for an assortment of diverse things. It isn’t imperative to recall what every one of the pins do, however it is essential to take note of how they are numbered.

raspberry_pi_io_pins

On the off chance that vital, set up your Raspberry Pi by performing the below steps:

  • Insert the arranged SD(HC) memory card into the card opening on the underside to the Raspberry Pi
  • Connect the USB Keyboard and Mouse to the two USB.
  • Connect the PC screen or TV screen to the HDMI attachment utilizing the HDMI link

Be that as it may, don’t interface the force supply to the Micro USB connection at this stage.

You Need

  • Raspberry PI with all required accessories. For more, read this Article
  • DS18B20 sensor or LM35 Tempreture Sensor-Buy Now
  • Breadboard for connecting external Components-Buy Now
  • 4.7 kilo ohms resistor-Buy Now

Buy Raspberry PI from our store

Temperature Reading

If it’s not too much trouble verify your Raspberry Pi is killed and the force supply separated before continuing.DS18B20

In this activity you will set up correspondence between your Raspberry Pi and the “1-wire” advanced temperature sensor and after that take a temperature perusing.

The temperature sensor you are going to utilize is a DS18B20 “1-wire” computerized sensor. It is known as a “1-wire” sensor in light of the fact that separated from force (VDD) and ground (GND) terminals, the main other terminal is a solitary information (D) terminal.

Assemble the circuit for this activity by performing the accompanying undertakings:raspberry_pi_temp_connection

  • Insert the DS18B20 sensor into the breadboard with its level side left.
  • Insert a 4700 Ohm (4K7, or 4.7K Ohm) resistor into the breadboard with the goal that one end join with pin number 3 (base terminal) on the DS18B20 and the and the flip side associate with pin number 2 (center terminal) on the DS18B20.
  • Connect one end of the Red wire to pin number 1 on the GPIO header and unite the flip side to the force rail on the right half of the breadboard.
  • Connect one end of the Red wire to the force rail and unite the flip side to pin number 3 (base terminal) on the DS18B20 senso.
  • Connect one end of the Black wire to pin number 6 on the GPIO header and associate the flip side to the ground rail on the left half of the breadboard.
  • Connect one end of the Black wire to the ground rail and interface the flip side to pin number 1 (top terminal) on the DS18B20
  • Connect one end of the Orange wire to pin number 7 on the GPIO header and interface the flip side to stick number 2 (center terminal).

Power on force supply to the Micro USB attachment on the Raspberry Pi and turn the force supply on.

Allow your Raspberry Pi to boot up and after that sign in and dispatch the Graphical User Interface (GUI). In case you’re not certain how to do this please take after the directions in Step 2 of the Setup Gui

Double tap on the LX Terminal symbol on the desktop to open a LX Terminal window.

LXTerm_1

Enter the following command “sudo modprobe w1-gpio” at the Linux command  line and press Enter.

Type “sudo modprobe w1-therm” at the Linux command line and press Enter

Type “album/sys/transport/w1/gadgets/” at the Linux coomand line and press Enter

Type “ls” at the Linux command line and press Enter

This will show a few numbers and letters like the accompanying:

 

Make a note of the 15 digit series of numbers and letters.

This is the serial number of the temperature sensor you are utilizing. For my situation, the serial number was “28-000005036f89” however yours will be return.

  • Type “cd xx-xxxxxxxxxxxx” at the Linux command line and press Enter ;where xx-xxxxxxxxxxxx is the serial number of your temperature sensor.
  • Type “feline w1_slave” at the Linux command line and press Enter

This will take a temperature perusing and showcase two lines of letters and numbers. The main part you are truly intrigued is the end of the second line which ought to peruse “t=” trailed by a 5

LXTerm_2

Take the 5 digit number toward the end of the second line and gap it by 1000 to give you the temperature in deg C

In this manner for my situation the temperature was 23.375 deg C

  • You can keep on taking temperature readings by re-entering the “feline w1_slave” charge on the off chance that you need (an alternate way for dong this is to press the “up” bolt on your console and press Enter)
  • When you’re done, tap on “Record” and after that “Quit” to close the LXTerminal window.

In upcoming tutorials we will learn making Python Scripts and connecting various modules with Raspberry PI.

That’s it.. Thank you..