PHP Classes

PHP Raspberry PI DS18B20: Read values from RaspberryPI DS18B20 sensors

Recommend this page to a friend!
  Info   View files Example   View files View files (10)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 152 This week: 1All time: 9,057 This week: 560Up
Version License PHP version Categories
ds18b20 1.0MIT/X Consortium ...7.1Hardware, PHP 7
Description 

Author

This package can read values from RaspberryPI DS18B20 sensors.

It can read a Raspberry PI Linux system file that returns the list of a available sessions in a DS18B20 device.

The class can also read the values of each available sensor.

Innovation Award
PHP Programming Innovation award winner
February 2019
Winner


Prize: One year server license IP to country, region, city, latitude, longitude, ZIP code, time zone, area code database
RaspberryPI is a concept of small hardware boards that work as small computers connected to sensors that can collect data from the environment.

This package can read values from RaspberryPI DS18B20 sensors allowing to develop interesting applications that can act upon the values read from those sensors.

Manuel Lemos
Picture of András Zoltán-Gyárfás
Name: András Zoltán-Gyárfás is available for providing paid consulting. Contact András Zoltán-Gyárfás .
Classes: 4 packages by
Country: Romania Romania
Age: 44
All time rank: 187342 in Romania Romania
Week rank: 416 Up11 in Romania Romania Up
Innovation award
Innovation award
Nominee: 1x

Winner: 1x

Example

<?php
require_once __DIR__ . '/vendor/autoload.php';
use
azolee\DS18B20;

$data = DS18B20::loadSensors();

header('Content-type: application/json');
echo
json_encode( $data );


Details

A Simple DS18B20 Sensor Handling PHP Package

This package can be used to read the popular DS18B20 Sensor data from multiple sensors on a Raspberry PI.

Tested on Raspibian OS.

Note: Previously the Raspibian needs to be configured to handle the sensor.

Example usage (See _tests_ folder)

Read the raw data:

use azolee\DS18B20;

$respone =  DS18B20::loadSensors();

var_dump($respone);

Read the raw data and process it:

use azolee\DS18B20;
use azolee\DataFormat\{CelsiusDataProcessor, FahrenheitDataProcessor};


//in Celsius
$celsiusDataProcessor = new CelsiusDataProcessor();
$celsiusDataProcessor->setPrecision(3);

$respone =  DS18B20::loadSensors($celsiusDataProcessor);

var_dump($respone);


// in Fahrenheit
$fahrenheitDataProcessor = new FahrenheitDataProcessor();
$fahrenheitDataProcessor->setPrecision(0);

DS18B20::setProcessor($fahrenheitDataProcessor);

$respone =  DS18B20::loadSensors();

var_dump($respone);

License: MIT

Author: ANDRAS Zoltan Gyarfas


  Files folder image Files  
File Role Description
Files folder imagesrc (1 directory)
Files folder imagetests (3 files)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file index.php Example Example script
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  src  
File Role Description
Files folder imageazolee (1 file, 2 directories)

  Files folder image Files  /  src  /  azolee  
File Role Description
Files folder imageContracts (1 file)
Files folder imageDataFormat (2 files)
  Plain text file DS18B20.php Class Class source

  Files folder image Files  /  src  /  azolee  /  Contracts  
File Role Description
  Plain text file SenzorDataProcessor.php Class Class source

  Files folder image Files  /  src  /  azolee  /  DataFormat  
File Role Description
  Plain text file CelsiusDataProcessor.php Class Class source
  Plain text file FahrenheitDataProcessor.php Class Class source

  Files folder image Files  /  tests  
File Role Description
  Accessible without login Plain text file test.php Aux. Auxiliary script
  Accessible without login Plain text file testCelsius.php Example Example script
  Accessible without login Plain text file testFahrenheit.php Example Example script

 Version Control Unique User Downloads Download Rankings  
 100%
Total:152
This week:1
All time:9,057
This week:560Up