Skip to content

🌡️A Ruby Gem to easily interface with the DS18B20 temperature Sensor over 1-Wire

License

Notifications You must be signed in to change notification settings

owaiswiz/ds18b20

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DS18B20

Build Status Gem Version Gem

This gem makes interfacing with the DS18B20 temperature easier over 1-Wire.

After setting it up correctly make sure you have the correct file path where it's output is being recorded. The file name on raspberry pi should be w1_slave. If you don't know where the file is located - please read : DS18B20 - Temperature Sensing.

After making sure that you have the file path and that output looks similar to one in the tutorial above, you can easily use this gem following the instructions below.

Installation

Add this line to your application's Gemfile:

gem 'ds18b20'

And then execute:

$ bundle

Or install it yourself as:

$ gem install ds18b20

Usage

1. Require

require 'ds18b20'

2. Create Instance with Proper File Path

sensor = Ds18b20::Parser.new("/sys/bus/w1/devices/28-800000048d57/w1_slave")

3. Getting Temperature

sensor.celsius
#=> 28.5625


sensor.fahrenheit
#=> 82.0625


sensor.kelvin
#=> 300.9

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/owaiswiz/ds18b20.

License

The gem is available as open source under the terms of the MIT License.

About

🌡️A Ruby Gem to easily interface with the DS18B20 temperature Sensor over 1-Wire

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published