Reading the Temperature and Humidity from the DHT11 Sensor

Installation

Pin connections

rpi_pin connects_to
3.3v VCC(leg1)+resistor(10k)+DATA(leg2)
GPIO4 DATA(leg2)
GROUND GND(leg4)

Usage

require "dht-sensor-ffi"

val = DhtSensor.read(4, 11)
val.temperature  #=> 14
val.humidity     #=> 40

Resources