Skip to content

Program that reads the data from an DHT22 sensor on Raspberry Pi with the C language using the wiringPi library.

License

Notifications You must be signed in to change notification settings

rmzamith/DHT22-RaspiberryPi-C-reader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

DHT22-RaspiberryPi-C-reader

Program that reads the data from an DHT22 sensor on a Raspberry Pi using C language with the WiringPi library.

Dependencies

For this project you will need:

  • One RaspberryPi of any model.
  • One DHT22 sensor: Datasheet1, Datasheet2
  • GCC installed for code compilation.
  • WiringPi installed on your raspberry. Details on how install it here.

Hardware Installation

In the default configuration of the project, you should connect the sensor pins to Raspberry like this:
alt tag

The resistor is a 10KΩ with +-5% tolerance.
You can change the data pin, but make sure you change it on the code too.
Use the WiringPi pin numeration. See the pin numbers by executing this command in shell gpio readall. On the default code, we are using GPIO 12, that is equivalent to the WiringPi pin number 26.

Software Compilation

To compile, execute the folowing:
sudo gcc -odht22.out DHT22.c -lwiringPi

Software Execution

After compiled, you should run the compiled artifact this way:
sudo ./dht22.out

About

Program that reads the data from an DHT22 sensor on Raspberry Pi with the C language using the wiringPi library.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages