PiBrewing / craftbeerpi4

GNU General Public License v3.0
57 stars 29 forks source link

No DS18b20 Onewire sensors being listed #135

Closed stamandster closed 2 months ago

stamandster commented 3 months ago

EDIT: I found that https://github.com/PiBrewing/craftbeerpi4/blob/master/cbpi/extension/onewire/config.yaml is showing name as "DummySensor" instead of "OneWire". Changing this to OneWire allowed only a single sensor to show up, oddly. Numerically it's the first one, if that means anything for the array.

chris@brewpi:~/.local/pipx/venvs/cbpi4/lib/python3.11/site-packages/cbpi/extension/onewire $ sudo nano config.yaml also deleted the cache folder

Also uninstalled some unneeded plugins, seems to have fixed the issue.

------------------ Afternoon, I followed the latest CBPI4 Gitbook for setting up server. Everthing was going well until attempting to load the DS18b20 sensors. I have 4 setup (and tested with an arduino) on onewire using 3v3, GPIO4 and GND. For whatever reason, CBPI is unable to see any sensors. I tried re-enabling Onewire in the raspi-config and restarting CBPI, no avail. I tried to move to another GPIO pin and nothing. I don't see anything glaring in the logs using the 20 parameter and it looks to be loading onewire plugin. Just at a loss as to what to do. I followed the directions of removing the python3-RPi.GPIO as I'm using a RPI4. The installed server is Serverversion: 4.4.0 - Codename: Yeast Starter || GUIversion: 0.3.13.

Also performed some additional testing and confirmation, connecting a relay works fine and I can via data from a sensor via bus command so I know it's not a GPIO Pin issue.

chris@brewpi:~ $ cbpi onewire --setup
--------------------------
Welcome to CBPi 4.4.0
--------------------------
config folder path :   ./config
logs folder path   :   /home/chris/logs
*******************************
Debug-log-level is 30
*******************************
Setting up 1Wire
/boot/config.txt created
chris@brewpi:~ $ pipx runpip cbpi4 uninstall RPI-GPIO
WARNING: Skipping RPI-GPIO as it is not installed.
chris@brewpi:~ $ pipx runpip cbpi4 install RPI-LGPIO
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: RPI-LGPIO in ./.local/pipx/venvs/cbpi4/lib/python3.11/site-packages (0.6)
Requirement already satisfied: lgpio>=0.1.0.1 in /usr/lib/python3/dist-packages (from RPI-LGPIO) (0.2.2.0)

I'm able to see data from a sensor via


chris@brewpi:~ $ cd /sys/bus/w1/devices/
28-0d4c26015000/ w1_bus_master1/  
chris@brewpi:~ $ cd /sys/bus/w1/devices/
chris@brewpi:/sys/bus/w1/devices $ cd /sys/bus/w1/devices/28-0d4c26015000
chris@brewpi:/sys/bus/w1/devices/28-0d4c26015000 $ ls
alarms     eeprom_cmd  hwmon  power       temperature
conv_time  ext_power   id     resolution  uevent
driver     features    name   subsystem   w1_slave
chris@brewpi:/sys/bus/w1/devices/28-0d4c26015000 $ cat w1_slave 
2f 01 4b 46 7f ff 01 10 2e : crc=2e YES
2f 01 4b 46 7f ff 01 10 2e t=18937
chris@brewpi:/sys/bus/w1/devices/28-0d4c26015000 $ 

Then I added a second sensor, and that is showing up also.

chris@brewpi:/sys/bus/w1/devices $ ls
28-0d4c26015000  28-0d4c26645100  w1_bus_master1

So I have no idea why it's not populating into the list in the hardware tab.

avollkopf commented 3 months ago

EDIT: I found that https://github.com/PiBrewing/craftbeerpi4/blob/master/cbpi/extension/onewire/config.yaml is showing name as "DummySensor" instead of "OneWire". Changing this to OneWire allowed only a single sensor to show up, oddly. Numerically it's the first one, if that means anything for the array.

chris@brewpi:~/.local/pipx/venvs/cbpi4/lib/python3.11/site-packages/cbpi/extension/onewire $ sudo nano config.yaml also deleted the cache folder

Also uninstalled some unneeded plugins, seems to have fixed the issue.

I don' think, that the config file is an issue as it was always there since Manuel created it. Probably a copy and paste thing.

Plugin registration is basically done here:

https://github.com/PiBrewing/craftbeerpi4/blob/92f1433530d321de24a6b69b4b34ccfa041b4aab/cbpi/extension/onewire/__init__.py#L170

But I will change the name in one of the next releases as it might be confusing

stamandster commented 3 months ago

Thanks @avollkopf I was able to get consistent DS18b20 sensors to show up by doing a few thing:

  1. Only connect sensors when CBPI is in a stopped state, connecting a restarting app doesn't seem to register
  2. Run'cbpi onewire --setup'before running cbpi main program
  3. Making sure that the DS18B20 is on GPIO 4 (not mentioned in the Gitbook that I could find). An aside, additional buses configured running commands (can also add to rc.local to run at startup, each line without sudo) which I will likely need for more than a few probes on a single pin
    sudo dtoverlay w1-gpio gpiopin=4 pullup=0  # header pin 7
    sudo dtoverlay w1-gpio gpiopin=17 pullup=0 # header pin 11
  4. Adding to sudo nano /etc/modules
    w1-gpio
    w1-therm

My only suggestion regarding DS18b20 is potentially using the following code for more reliant connections to the probes - https://github.com/danjperron/BitBangingDS18B20

stamandster commented 2 months ago

Working