Jump to content

OPi Zero - add DS18B20 temp sensor at RPi-Monitor


lukaszertel

Recommended Posts

Armbianmonitor:

 

Dear Armbian friends,

I have question about add  DS18B20 temp sensor at RPi-Monitor (web based interface).

Can somebody paste working config of this sensor?

On internet I found many tutorials but with DHT sensors.

 

On this page (Xavier is an author of RPi-Monitor I think) is described DS18B20 but in status "Working in progress".

I tried this but without luck.

https://xavierberger.github.io/RPi-Monitor-docs/32_sensors.html?highlight=ds18b20

 

Cheers,

Lucas

 

M6hxIST.png

Link to comment
Share on other sites

5 minutes ago, lukaszertel said:

I tried this but without luck.

Is the DS18B20 driver working fine from command line using "cat /sys/bus/w1/devices/28-000004fe1847/w1_slave" ?

 

In the link you've provided, it is mention that you only have to add a reg_expr, but there is also a note :

Quote

Note: In version 1.x of RPi-Monitor it is prohibited to use = in regular expression.

 

Link to comment
Share on other sites

Working like a charm :-)

root@orangepizero:/etc/rpimonitor# cat /sys/bus/w1/devices/28-020b92459bc7/w1_slave
6a 01 55 05 7f 7e 81 66 1d : crc=1d YES
6a 01 55 05 7f 7e 81 66 1d t=22625

I've lastest available version of RPi-Monitor on my Orange Pi Zero:

Version: 2.12-r0 by Xavier Berger

I tested both values:

t.(d+)$

and

t=(d+)$

Those values are used in conf file, in my case custo.conf witch is mentioned in main config file /etc/rpimonitor/data.conf

Of course, after each change I restart service with command:

service rpimonitor restart

======

Edited:

======

 

I found that this two sections are only important for drawing temperature stats:

dynamic.18.name=045
dynamic.18.source=/sys/bus/w1/devices/28-020b92459bc7/w1_slave
dynamic.18.regexp=t.(d+)$
dynamic.18.postprocess=sprintf("%.2f", $1/1000)
dynamic.18.rrd=GAUGE

web.statistics.1.content.18.name=045
web.statistics.1.content.18.graph.1=045
web.statistics.1.content.18.ds_graph_options.045.label=045 (°C)

What I'm not sure is regular expression, can someone tell me how to extract only temperature value from this command?

 

cat /sys/bus/w1/devices/28-020b92459bc7/w1_slave

 

Link to comment
Share on other sites

hi lukaszertel,

To create the sensor graph you have to decomment include=/etc/rpimonitor/template/dht11.conf in the file /etc/rpimonitor/data.conf
Then go with nano /etc/rpimonitor/template/dht11.conf and modify the temperature sensor code you can comment on the humidity parameters to not see them anymore.

Below here, there is the modified dh11 file for your external sensor

Spoiler

 cat /etc/rpimonitor/template/dht11.conf
########################################################################
# Extract temperature and humidity from DHT11/DHT22
#  Page: 2
#  Information               Status     Statistics
#  - tempetature             - yes      - yes
#  - humidity                - yes      - yes
#######################################################################
# Add new pages (number 2)
web.status.2.name=Living room
web.statistics.2.name=Living room
 
# Get dynamic data
dynamic.1.name=living_room_temp
dynamic.1.source=/sys/devices/w1_bus_master1/28-020b92459bc7/w1_slave
dynamic.1.regexp=t=(\d+)$
dynamic.1.postprocess=$1/1000
dynamic.1.rrd=GAUGE

dynamic.2.name=humidity
dynamic.2.source=Adafruit_DHT 11 27
dynamic.2.regexp=Hum = (\S+)
dynamic.2.postprocess=
dynamic.2.rrd=GAUGE

# Add a line of status in page number 2
web.status.2.content.1.name=Temperature
web.status.2.content.1.icon=cpu_temp.png
web.status.2.content.1.line.1="Ambient Temperature: <b>"+data.living_room_temp+"&deg;C</b>"
web.status.2.content.1.line.2="Ambient Humidity: <b>"+data.humidity+"%</b>"

# Add a statistic graph (with 2 curves suing separate scales) in page number 2
web.statistics.2.content.1.name=Temperature
web.statistics.2.content.1.graph.1=living_room_temp
web.statistics.2.content.1.graph.2=humidity
web.statistics.2.content.1.ds_graph_options.living_room_temp.label=Ambient temp. (deg C)
web.statistics.2.content.1.ds_graph_options.humidity.label=Humidity (%)
web.statistics.2.content.1.ds_graph_options.humidity.yaxis=2
#web.statistics.2.content.1.graph_options.legend= { position: "sw"}
web.statistics.2.content.1.graph_options.y2axis={ position: "right", min: 0, max: 100 }

 

Spoiler

23836871_Schermatadel2019-03-0411_47_20.png.4c9a437a5735a8b1ed51be132f77b75b.png

 

Link to comment
Share on other sites

Thank You Frank,

I will check it at friday. At the moment I don't have access to my Orange Pi.

And of couse I will write down my results.

 

Cheers!

 

=================

--------Edited-------- 

=================

 

It works!

I only commented out humidity parameters - rest is as You suggested.

Thank You once again for help FRANK333 :-)

 

One additional question:

I messed up a little bit with setting correct time on my Orange Pi Zero. I changed it and now it's correct, but not on stats graph.

On browser tab with Statistics there is still incorrect time displayed. 

 

=================

--------Edited-------- 

=================

 

SOLVED!

To solve issue with incorrect hours on stats page graph I found rrd file in /var/lib/rpimonitor/stat directory.

Simply remove and restart RPi Monitor did the trick.

 

Cheers!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines