Other Projects

Banana Pi + CT Ewell Case (Part 3 - DHT11)

6 7158
Edited by actkk2000 at 2014-10-22 01:23

This is an update for http://forum.lemaker.org/thread- ... art_2_ds18b20_.html

Seeing that the temperature sensor DS18B20 was quite unstable or very sensitive, but in the end I was not sure, and since I found another sensor for humidity, I decided to buy it for a test.

It is the famous DHT11:

The DHT22 would be better, but I got this one (two, one for the Raspberry) very cheap ... (Not from Adafruit: P)
I was going to lose the decimals, but I would gain the possibility to measure humidity...

I used this tutorial as a guide:
http://forum.lemaker.org/thread- ... ure_from_dht11.html

And again I had to adapt the output to show it on the character display.
This time it was more difficult because despite this software worked, it wasn't enough...

Previously when connecting DS18B20 in 1-wire mode, the software modules write a file and update it with temperature.
If you run this at the end you get temperature and you can read it with a program in Python:

  1. sudo modprobe w1-gpio
  2. sudo modprobe w1-therm
  3. cd /sys/bus/w1/devices
  4. ls
  5. cd 28-xxxx (change this to match what serial number pops up)
  6. cat w1_slave
Copy the Code
With the DHT11 I had to make the program create two files, one for temperature and one for humidity, constantly updated and available for reading from Python.
Then I had to modify the program written in C++ to generate those files in an infinite loop, and also to be implemented as service on the Pi.

Nevertheless, I was unable to find other programs to do the reading from DHT11 sensor on BPI, and the only one that worked is this tutorial from julie20082004.

One more drawback was that because of lack of decimals, I had to replace the last two digits with special characters to differentiate humidity from temperature: °C and %
But leaving the previous sequence when changing temperature / humidity with the switch key, the 3rd. digit was always fixed in a small circle.

So I also had to change the sequence and decided to use a model I saw on a street clock where both temperature and humidity appear replacing time, based on a fixed scale of time. The switch key now change time / temperature <-> time / humidity.

Here some pictures and video of how it turned out and how the sensor works.
There are a couple when I tried to attach DHT11 to the front, but in the end I decided to leave it on the top.
I like it more because it is mounted on a little board with a red LED:

click to enlarge:

What I also added is the RPI-Monitor program to monitor BPI from a web page, with configurable parameters:

There are also tutorials on how to customize it and add sensors. Of course DHT11 and DS18B20 as well:
http://rpi-experiences.blogspot. ... -advance-usage.html
http://rpi-experiences.blogspot. ... dht22-humidity.html

It works like this (I marked the part with temperature and humidity):

Another problem I found is that from time to time the character display hung, stopping clock or temperature / humidity.
The only solution was to restart the service to load it again.

But it was annoying have to restart manually every time it happened, so I also had to find a program to monitor services and automatically restart them when needed.

The best program for that is Monit. It is also good to show BPI parameters and send alerts, and more.
To me was enough if the service stopped to crash. And it really works:

https://www.digitalocean.com/com ... and-configure-monit

Monit looks like this, for now with just one service which is good enough:

See you soon on the next update!
like it。。。。

Edited by actkk2000 at Mon Oct 27, 2014 00:38
tony_zhang replied at Sun Oct 26, 2014 10:20
like it。。。。

Then you gonna love the next update:  
http://forum.lemaker.org/thread- ... art_4_lapdock_.html

Edited by actkk2000 at Sun Nov 23, 2014 04:35

And one more time:
http://forum.lemaker.org/thread- ... _5_monitoring_.html

How have you configured the lcd to display all these information?
I have a small 16x2 lcd and would love to use it as a system monitor..

Edited by actkk2000 at Fri Jun 5, 2015 19:19

You're right, I haven't explained much about LCD display, just mentioned that I used lcdproc (www.lcdproc.org) on the second part of this log: http://forum.lemaker.org/forum.p ... 37&fromuid=1602

Maybe in the near future I will elaborate a little more about it, although my display is USB and perhaps yours is not...

In the meantime you can read something about 16x2 display here:
http://forum.lemaker.org/forum.p ... 92&fromuid=1602
http://forum.lemaker.org/forum.p ... 57&fromuid=1602

DTH11 is very good when compared to the product you have used. I have read a comparison of the two from rushmypapers me. No wonder it has worked great for you.

You have to log in before you can reply Login | Sign Up

Points Rules