Hans.KK
Posts: 7
Joined: Thu May 31, 2018 3:36 pm

Re: Problem with temperature sensor ds18b20

Wed May 20, 2020 9:21 am

bensimmo wrote:
Wed May 20, 2020 6:52 am
for more than one pin you don't need to use the Cron tab to schedule to schedule (you can of course :-))
just having
dtoverlay=w1-gpio,gpiopin=17
dtoverlay=w1-gpio,gpiopin=22
dtoverlay=w1-gpio,gpiopin=28

in config.txt

so enable 1-wire on the on the three pins.
I have tried that approach too, but no luck, only the last 1-wire is enabled in that way.
I have tested this on two installs with all updates of the system.
To use config.txt would be my preferred way to go, I do not like the way I do it now, but it works.

ancris00
Posts: 52
Joined: Sun Jan 19, 2020 8:56 pm
Location: Miranda de Ebro, Spain

Re: Problem with temperature sensor ds18b20

Tue May 26, 2020 2:16 pm

Hi Hans.KK, bensimmo, thanks

Bensimmo your way is really easy thank you

Hans.KK:
a) I do not put dtoverlay=dht11 and it worked as you can read above
b) What crontab does?

To all, what the command dtoverlay electronically does ?

Thanks
:lol: :lol: Pi 4 Model B :lol: :lol:
Raspbian Buster with desktop 4.19

Hans.KK
Posts: 7
Joined: Thu May 31, 2018 3:36 pm

Re: Problem with temperature sensor ds18b20

Tue May 26, 2020 7:50 pm

ancris00 wrote:
Tue May 26, 2020 2:16 pm
b) What crontab does?
Sort of programmable timer, you can schedule when a given command, or program get started, I use it to start stuff at bootup time and on regular basic (every two hours). Some people claim that it is not 100% guaranteed that programs will run this way but it had never failed for me (yet)

ancris00
Posts: 52
Joined: Sun Jan 19, 2020 8:56 pm
Location: Miranda de Ebro, Spain

Re: Problem with temperature sensor ds18b20

Thu May 28, 2020 6:22 pm

Hi Hans.KK, thanks

could you put me a photo of your crontab?
:lol: :lol: Pi 4 Model B :lol: :lol:
Raspbian Buster with desktop 4.19

Hans.KK
Posts: 7
Joined: Thu May 31, 2018 3:36 pm

Re: Problem with temperature sensor ds18b20

Fri Jun 12, 2020 3:05 pm

ancris00 wrote:
Thu May 28, 2020 6:22 pm
could you put me a photo of your crontab?

Code: Select all

# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').
#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h  dom mon dow   command
@reboot sudo dtoverlay w1-gpio gpiopin=27
I only added the last line to an otherwise empty cronjob.
To edit the crontab thing I used "crontab -e", I will think "sudo crontab -e" will do the same.

Fyi: my /boot/config.txt looks like:

Code: Select all

[all]
dtoverlay=w1-gpio,gpiopin=17
dtoverlay=dht11,gpiopin=22
So I have two set of W1 temperature sensors on two pins (17 + 27), and a DHT11 on pin 22.
It give this lay out in /sys/bus/w1/devices: (with one sensor on each channel in this example)
w1_bus_master1
w1_bus_master2
28-0215c1142fff
28-80000027145b

Hans.KK
Posts: 7
Joined: Thu May 31, 2018 3:36 pm

Re: Problem with temperature sensor ds18b20

Fri Jun 12, 2020 4:22 pm

paul stoffregen wrote:
Fri Jun 12, 2020 3:09 pm
please re-check your temperature sensor connections with PI
Done, things are working ok, I do read temperature on both w1 busses, and the DHT11.

It may confuse somebody out there that I use the term "pin" about the GPIO connections when the number is not a reference to the physical pin number, sorry.
In my setup the "pin" numbers 17, 27 and 22 are the GPIO numbers and refer to the physical pins 11, 13, and 15, a closer look at the contains of my crontab and my /boot/config.txt will tell the same:
dtoverlay w1-gpio gpiopin=27
dtoverlay=w1-gpio,gpiopin=17
dtoverlay=dht11,gpiopin=22

Return to “Troubleshooting”