Keyestudio KS0172–Humidity Sensor

I’ve had some previous experience with a temperature sensor on a few other boards:

Adafruit Huzzah temperature sensor

So this project seemed staright forward. The circuit diagram is:

Screenshot 2025-02-04 183750

and the code you will find here:

https://github.com/directorcia/Azure/blob/master/Iot/Keyestudio%20KS0172/Lesson_7/main.cpp

When I tried to use a generic DHT sensor library from the Platformio registry for the project wouldn’t work. I therefore needed to work out how to use thr provide library with Platformio. Turns out that is much easier than I thought!

  1. Inside your PlatformIO project, navigate to the lib/ directory.
  2. Create a new folder, e.g., MyLibrary/.
  3. Inside MyLibrary/, add your library files:
    lib/
    ├── MyLibrary/
    │ ├── src/
    │ │ ├── MyLibrary.h
    │ │ ├── MyLibrary.cpp
    │ ├── library.json (optional)
  4. In your src/main.cpp, include the library:
    #include <MyLibrary.h>
  5. PlatformIO will automatically detect and include the library.

This worked a treat and allowed my code to compile. Major learning there.

One thought on “Keyestudio KS0172–Humidity Sensor

Leave a comment