No commit activity in last 3 years
No release in over 3 years
A Humble RPi plugin to read the ambient temperature and humidity from the DHT sensor.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0.1.4, ~> 0.1
 Project Readme

Introducing the Humble_Rpi-plugin-dhtsensor gem

Testing the gem

require 'humble_rpi-plugin-dhtsensor'

class Echo

  def notice(s)
    puts "%s: %s" % [Time.now, s]
  end
end

rpi = HumbleRPiPluginDhtSensor.new(settings: {pin: 4}, 
                                      variables: {notifier: Echo.new})
rpi.start

Output:

ready to monitor temperature and humidity
2016-02-20 13:14:35 +0000: pi/dht11_sensor: temperature: 15.0 humidity: 39.0
2016-02-20 13:15:13 +0000: pi/dht11_sensor: temperature: 16.0 humidity: 39.0
2016-02-20 13:16:15 +0000: pi/dht11_sensor: temperature: 17.0 humidity: 38.0
2016-02-20 13:18:22 +0000: pi/dht11_sensor: temperature: 18.0 humidity: 38.0
2016-02-20 13:24:47 +0000: pi/dht11_sensor: temperature: 17.0 humidity: 38.0
2016-02-20 13:25:49 +0000: pi/dht11_sensor: temperature: 16.0 humidity: 38.0

In the above example I tested the sensor by adding a cup of water (that was previously warm) next to the DHT11 sensor at 1315hrs. I then removed the cup of water at 1319hrs and I observed it took 1 or more minutes for the temperature to change.

Notes:

  • By default the temperature and humidity is refreshed every 3 seconds
  • The temperature and humidity will be published when ever the temperature value changes by 1 or more, or if the humidity value changes by 2 or more.

Using the plugin with the Humble RPi gem

require 'humble_rpi'
require 'humble_rpi-plugin-dhtsensor'

r = HumbleRPi.new device_name: 'ottavia', sps_address: '192.168.4.140',\
  plugins: {DhtSensor: {pin: 4} }
r.start

Resources

humblerpidhtsensor gem dhtsensor humblerpi