WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: DHT22 sensor  (Read 1884 times)

Offline VMat

  • Newbie
  • *
  • Posts: 14
DHT22 sensor
« on: March 29, 2021, 11:59:30 AM »
Hello,

Has anybody tried to read a DHT22 sensor from piCore? Any pointers on where to start? I see a topic here in the forum from 2016, but I'm wondering if there's something more straightforward after 4+ years.

The previous topic points to an article on Adafruit, but it seems to require a few libraries, and I'm not sure how to install them, as I can't find them in tinycore repo (with tce-ab) - kind of expected. Or maybe I did the wrong searches.

So again, I'd appreciate any pointers. Worst case, I can try to build my own low-level "driver" based on the sensor documentation I've found if there's nothing pre-built out there.

Thanks,

VMat

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: DHT22 sensor
« Reply #1 on: March 29, 2021, 01:48:54 PM »
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline VMat

  • Newbie
  • *
  • Posts: 14
Re: DHT22 sensor
« Reply #2 on: March 29, 2021, 02:31:20 PM »

Offline VMat

  • Newbie
  • *
  • Posts: 14
Re: DHT22 sensor
« Reply #3 on: May 11, 2021, 02:00:47 PM »
Finally got around to work on this again... I'll leave some notes here other newbies might find useful.

I've tried different things and haven't installed the OS from scratch in between, so maybe not all steps are covered here, because I can't remember everything I did from the start. Anyway, here are my high-level steps:

  • Install piCore (obviously).
  • Install python3.8 and python3.8-dev (I used tce-ab).
  • Install/upgrade pip, setup tools, and wheel: python3 -m pip install --upgrade pip setuptools wheel
  • Install Adafruit's module: pip3 install Adafruit_DHT
  • Add a call to my python script to .profile.
  • Save everything to the persistent storage: sudo filetool.sh -b

A note on #5: first I tried to call my script from bootlocal.sh, but it couldn't find Adafruit's module. Then I added it to .profile instead. It's working fine.

Thanks, @bmarkus, for the tip on that website!

Cheers,

VMat