-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME
More file actions
73 lines (59 loc) · 2.48 KB
/
README
File metadata and controls
73 lines (59 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
phpTempReader - reading temperatures from sensors and put them in arrays.
Copyright (C) 2017 Ole-Henrik Jakobsen
Software requirements:
php-cli To run PHP code at command line interface
-----------------------------------------------------------------------------------------------------------
Supported sensors: | Information:
-----------------------------------------------------------------------------------------------------------
Dummy | For testing purposes, based upon DS18B20
-----------------------------------------------------------------------------------------------------------
DS18B20 | DS18B20 sensors and similar like DS18S20
|
| Sensor installation:
| To install and enable the sensors you need to add dtoverlay=w1-gpio in the boot config:
| automatic:
| sudo bash -c 'printf "\n#Enable GPIO\ndtoverlay=w1-gpio" >> /boot/config.txt'
| manual:
| sudo nano /boot/config.txt
| enter this at the bottom:
| dtoverlay=w1-gpio
| and save the file (ctrl+o <enter>) and then exit (ctrl+x).
| Reboot the system.
|
| To enable the sensor(s) after a boot, you must either run (root permission is required):
| sudo modprobe w1-gpio
| sudo modprobe w1-therm
| or, add the modules for automatic load at startup:
| automatic:
| sudo bash -c 'printf "\nw1-gpio\nw1-therm" >> /etc/modules'
| manual:
| sudo nano /etc/modules
| enter this at the bottom:
| w1-gpio
| w1-therm
| and save the file (ctrl+o <enter>) and then exit (ctrl+x).
|
-----------------------------------------------------------------------------------------------------------
Configuration of phpTempReader:
Choose type of sensor(s) to include and also enable and disable the test mode.
Config file: config.ini
Configuration of sensors:
Usually you don't have to configure anything unless you want the sensors to output in a specific order,
or if you want to choose less amount of sensors than listed/available.
Use phpTempReader:
CLI:
cd /path/to/tempreader
php tempreader.php [sensor]
PHP:
$path = "/path/to/tempreader";
chdir($path);
include_once("" . $path . "/tempreader.php");
Use phpTempReader function:
$newArr = tempreader(int $combine = 0);
Output (array):
$newArr["sensortype"]["unit"]
$newArr["sensortype"]["serialnumber"]
$newArr["sensortype"]["temperature"]
or if $combine is set: $newArr = tempreader(1);
$newArr["sensortype"]["unit"]
$newArr["sensortype"]["data"]