DHT11/DHT22 with Raspberry Pi

What do you mean?

And for the DHT library to work you’ll have to put it somewhere that Thonny knows about it. When you ran in in the terminal it looks like it worked.

Okay looking at the terminal, it looks like the pi is sending information. However, my cayenne dashboard has not yet populated. It still says waiting for board to connect.

Try re-copy/paste the credentials. Maybe they are wrong? Next thing to try is a a packet capture to make sure it’s sending data, and the right data. Have you ever done a packet capture?

Okay you were right the client ID was off by one letter. I now have a dashboard.

1 Like

now follow this tutorial and see if you reading from DTH11 Overview | DHT Humidity Sensing on Raspberry Pi or Beaglebone Black with GDocs Logging | Adafruit Learning System

Hello shramiksalgaonkar and adam, thanks for all your help. It’s working now and I could not be happier. on to the next project.

2 Likes

thanks for all your help. my code is working now with raspberry pi 3 and dht-11.

1 Like

Thanks for posting this. Been struggling with DHT22. Now all working. As for 'Waiting for board to connect" I had the same issue.

However the only real issue was my patience, stopped tried again, then realised client ID was changing every time, tried again, had a beer and it worked. :smiley:

Good topic

1 Like

Maybe someone can upload a video? because I can’t make it work…
Thnx

are you able to add a new device using GitHub - myDevicesIoT/Cayenne-MQTT-Python: Python Library for Cayenne MQTT API?
are you able to read DHT data using Overview | DHT Humidity Sensing on Raspberry Pi or Beaglebone Black with GDocs Logging | Adafruit Learning System?

How I add a new device? Sorry…

instruction is provided in the GitHub link.
in short, Get MQTT credential from dashboard and add it in the example code.

But when I copy the code of @adam how I send it to Cayenne? The Cayenne app get’s waitting to board to connect

you can also try cayenne DHT plugin for a much easier approach. GitHub - myDevicesIoT/cayenne-plugin-dht: A DHT sensor plugin for Cayenne

First, on your cayenne web dashboard, add a new pi device by navigating to add new—> devices/widget ----> raspberry pi —> which will provide you two command lines. run those lines on your pi terminal and it will install the pi agent on your raspberry pi. then follow this command:

cd /etc/myDevices/plugins
sudo git clone https://github.com/myDevicesIoT/cayenne-plugin-dht.git
cd cayenne-plugin-dht
sudo pip3 install .

Setting the sensor type and pin

Specify the sensor type and pin you are using by modifying init_args under DHT Temperature in the cayenne_dht.plugin file. For a DHT11 use 11 for the sensor argument, for a DHT22 use 22 and for a AM2302 use 2302 . Set the pin argument to the GPIO pin number your sensor is connected to. For example, a DHT11 on pin 17 would use the following:

init_args={"sensor": 11, "pin": 17}

Restart your agent with

sudo service myDevices restart

which will auto-populate your dashboard with widget.

It says that the file is only for reading

which file? can you share a screenshot of it.

Error%20edicion%202 Error%20edicion

can you try with command terminal.

I get the same problem…

As Shramik said you have to use the terminal to enter the commands to install it.

cd /etc/myDevices/plugins
sudo git clone https://github.com/myDevicesIoT/cayenne-plugin-dht.git
cd cayenne-plugin-dht
sudo pip3 install .

This also requires you to have installed the Cayenne Pi agent where as the the steps in the first post of this thread you don’t have to install anything.