Enter Your Electronics & Design Project for a chance to win up to a $200 Shopping Cart of Product! | Project14 Home | |
Monthly Themes | ||
Monthly Theme Poll |
DHT temperature and humidity sensors are pretty useful for DIY environment monitoring applications. You can easily interface it with Arduino devices but when it come to other devices like PSoC from cypress semiconductors you wont find any library or ready made solution.
I was using this sensor in my project and successfully interfaced it with PSoC6 device after some effort. Therefore I have decided to share my adventure of interfacing PSoC devices with DHT sensors to help other.
Little bit about PSoC MCU:
Cypress PSoC devices are low power IoT enabled mcu. The best part of these micro controllers is that you can virtually use any GPIO pin for anything. Therefore unlike any other MCU where you simply configure GPIO either as INPUT or OUPUT, in PSoC almost any GPIO can be either INPUT, OUTPUT or Bidirectional pin with ton of configurations (glimpse is shown below).
Hardware Required:
- PSoC 6 (CY8CKIT-062) WiFi-BT Kit
- DHT sesnor (using DHT22)
- Wires to connect DHT sensor with PSoC kit
DHT22 senor connected at P5.4 (D4 of Arduino header) of PSoC62 Kit
If you are wondering about the other wire with a resistor then it is used to avoid burst of random data appearing at Com port during programming or when PSoC6 UART module (P5.1) connected to KitProg, is not initialized or used.
Interfacing DHT Sensor:
For this project I have used Modus Toolbox but you can use easily use this code in PSoC Creator or WICED Studio. In fact I have also used this library in WICED Studio and its details can be found HERE.
Step-1: Create new blink LED project for CY8CKIT-062-WIFI-BT Kit using Modus tool box and name it anything you like. For the simplicity I am naming it as DHT22 project.
Step 2: Download the DHT.c and DHT.h file from github repository C-library-for-DHT-sensors. Also download the main file from examples/psoc6 folder.
Step 3: Configure the UART and DHT sensor pin
Step 4: Replace the main.c file with dowloaded main.c file and add the two DHT.c and DHT.h files in source folder of DHT22 project.
Step 5: Connect the DHT sensor with PSoC kit and configure GPIO, build and upload the code on the kit.
Congrats you have successfully interfaced a DHT sensor with PSoC6 kit. Use the UART monitor to view the sensor outputs.
Video:
All steps required to successfully interface a DHT sensor with PSoC6 device
Git-hub repository: C library for DHT sensors
PART 1: Micro Monster - Succulent Plants Monitoring System
PART 2: Establishing and Testing the Secure Connection
PART 3: Remote Device Restart, Factory Reset and Data storage on External Flash
PART 4: Remote Firmware Download and Update
PART 5: Sensors Interfacing
PART 6: Final Testing and Demo