Easy Temperature and Humidity on Raspberry Pi

Step 1: Connection

EzTemp uses the serial port on your Raspberry Pi to communicate.

Identify the serial pins on your Raspberry Pi. Then connect:

  • RPi GND to EzTemp GND.
  • RPi Tx to EzTemp Rx.
  • RPi Rx to EzTemp Tx.
  • RPi 3.3V to EzTemp 3.3V.

Notice that a Tx pin must be connected to a Rx pin, and vice-versa.

Now you are ready to use the EzTemp!

[ You can get the EzTemp on Tindie ]

Easy Temperature and Humidity on Raspberry Pi

Step 2: Disable the Serial Console

By default, the Raspberry Pi uses the serial port for the shell. As noticed by MarcR on the comments (thanks for the tip), we need to disable the serial console to use the EzTemp.

Method 1: raspi-config script

The easiest way to disable the serial console is by running the raspi-config script. Open a shell and type:

sudo raspi-config

It will show a menu, just go to 8 Advanced Options > A7 Serial and select No.

Now reboot the Pi and go to the next step.

Method 2: Automatic script

We can disable and enable the serial console using the rpi-serial-console script. To install it, open the shell and type:

sudo wget https://raw.githubusercontent.com/lurch/rpi-serial-console/master/rpi-serial-console -O /usr/bin/rpi-serial-console && sudo chmod +x /usr/bin/rpi-serial-console

To display whether the serial console is currently enabled or not, simply run:

rpi-serial-console status

To disable the serial console, simply run:

sudo rpi-serial-console disable

To enable the serial console, simply run:

sudo rpi-serial-console enable

After enabling or disabling the serial console you'll need to reboot the Pi for it to take effect, and go to the next step.

Method 3: Manual

Then open this file with your favorite editor:

sudo nano /boot/cmdline.txt

Its content should be something like this:

dwc_otg.lpm_enable=0 console=tty1 console=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

Remove any reference to ttyAMA0, getting something like this:

dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

Save changes, and open inittab:

sudo nano /etc/inittab

At the end of the file, comment out this line:

T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100

Reboot your Pi and go to the next step.

[ You can get the EzTemp on Tindie ]

Easy Temperature and Humidity on Raspberry Pi schematic

Step 3: Download the example script

On your Raspberry Pi, you must download this script. You can do it opening the shell and typing:

wget <a href="https://raw.githubusercontent.com/CAIMANICS/EzTempRH-for-Raspberry-Pi/master/software/EzTempRH.py" rel="nofollow">https://raw.githubusercontent.com/CAIMANICS/EzTempRH-for-Raspberry-Pi/master/software/EzTempRH.py</a>

Now run the script typing:

python EzTempRH.py

And that's it! you have your EzTemp running.

EzTemp&RH build 2
Temperature: 24.0C
Humidity:    48.0%
External:    1018 / 2048 counts
Version:     2

Let's see how to use it in your programs.

[ You can get the EzTemp on Tindie ]

 

For more detail: Easy Temperature and Humidity on Raspberry Pi


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top