BlueWave Studio forum
How to: Install DS18B20 temperature sensor in OAP - Printable Version

+- BlueWave Studio forum (https://bluewavestudio.io/community)
+-- Forum: OpenAuto Pro (https://bluewavestudio.io/community/forum-86.html)
+--- Forum: Temperature sensor (https://bluewavestudio.io/community/forum-90.html)
+--- Thread: How to: Install DS18B20 temperature sensor in OAP (/thread-2551.html)



How to: Install DS18B20 temperature sensor in OAP - tthenrie - 04-06-2021

I successfully installed my DS18B20 temperature sensor and it's reading temps and correctly displaying them in OAP. Mine is the waterproof sensor that I intend to install outside the cab of my pickup to read outside air temps. Here's the  one I used:

DS18B20 Temperature Sensor

How to install and get it working:

1. Make correct connections: I used 3.3V (the sensor will handle 3-5v). The pins I used are 1 (3/3v), 25 (ground), and 7 (GPIO4 - default for One-Wire connection). Make sure you do not cross the + and - connections to the pi. The connectors that came with my sensor were crossed. If your sensor gets hot, check the connections again!
2. Exit OAP and open a terminal. In /boot/config.txt, under the section [pi4], set
     
       dtoverlay=w1-gpio

This will default to gpio pin 4 (you can also do this by going to Interfaces in raspi-config or the Raspberrypi Preferences-Raspberry Pi Configuration utility). If that pin is already used in your setup, or you want to set up more than one sensor, designate a different one-wire gpio pin as follows:

      dtoverlay=w1-gpio,gpiopin=whatever gpio pin number you designate

(note:  I have see "gpiopin=" as "gpio_pin=" also. I suppose they are interchangeable. I use the latter. If one doesn't work, try the other)

3. Reboot

4. In terminal, go to /sys/bus/w1/devices.

5. If all connections are correct and the device is working, the command "ls" should show a directory something like 28-xxxxxxxxxxxxxxx. This is the serial number of your device. Under that directory, you will find a file labeled w1_slave. That is where your data will be.

6. Check to make sure your device is functioning:

     cat /sys/bus/w1/devices/28-your device's serial number/w1_slave

This should give a readout something like this:

    38 01 55 05 7f a5 81 66 5e : crc=5e YES
    38 01 55 05 7f a5 81 66 5e t=19500

The last number (t=19500) is the temperature in Celsius. Hold the device in your hand and wait a minute or two and cat the file again and you should see an increase in the temperature reading.

7. Go into the OpenAuto Pro settings under Appearance and enable Show Temperature and select C or F for your temperature display.

8.  Exit OAP and go back to terminal. Go to /home/pi/.openauto/config/openauto_system.ini and enter the identifiers for your device.

    sudo nano .openauto/config/openauto_system.ini

Look for the line:
   
    TemperatureSensorDescriptor=


Add to the end of that line your device's location. The line should look something like:

    TemperatureSensorDescription=/sys/bus/w1/devices/28-your device's serial number/w1_slave

9. Reboot and you should see the temperature showing in the top bar. Note that OAP isn't set up to display more than one temperature sensor. If you have more than one installed, you will select which one OAP shows by setting the serial number of the device in .openauto/config/openauto_system.ini.

That should do it.

Maybe a function suggestion for our developers...would it be difficult to add an Appearance setting to select and display two devices - one for outside air temp and one for inside air temp?

TH


RE: How to: Install DS18B20 temperature sensor in OAP - Daniel_BlueWave - 04-06-2021

Thank you for posting your solution and configuration.

Everything can be implemented. The thing is that there is no much space left at the top bar. We would like to keep good readability of that area and new OBD features are coming:
https://bluewavestudio.io/community/showthread.php?tid=610&pid=14094#pid14094


RE: How to: Install DS18B20 temperature sensor in OAP - gammelobst - 04-26-2021

Hi,

multiple sensors sounds useful. An own Temp-Tile would be nice to display multiple sensors with additional configurable Names.
Maybe they could be integrated in the OBD-Section as additional widget.
For outside-, trunk- or Amplifier-Temp use as examples.
Amplifier-Temp value display would be needed by myself.


RE: How to: Install DS18B20 temperature sensor in OAP - GSPW - 04-27-2021

(04-26-2021, 09:24 PM)gammelobst Wrote: Amplifier-Temp value display would be needed by myself.

That's a very good point!


RE: How to: Install DS18B20 temperature sensor in OAP - gkathan - 06-06-2023

hi,
i successfully enabled my tempsensor as described ... but it shows just a 00-20000000000 directory within /sys/devices/w1_bus_master1/ directory after startup without a w1_slave file ... it has driver, subsystem, power directories and id, name rw and uevent files inside .. any ideas what is missing ?
cheerz from vienna

(06-06-2023, 07:30 AM)gkathan Wrote: hi,
i successfully enabled my tempsensor as described ... but it shows just a 00-20000000000 directory within /sys/devices/w1_bus_master1/ directory after startup without a w1_slave file ... it has driver, subsystem, power  directories and id, name rw and uevent files inside  .. any ideas what is missing ?
cheerz from vienna

.. and even stranger - it is creating a new 00-xx00000000 directory every minute ?? very straneg behaviour


RE: How to: Install DS18B20 temperature sensor in OAP - gkathan - 06-15-2023

solved my problems ... i bought in the first try just "naked" tempsensors without the required resistor ... second try with integrated resistor and everything worked as described by you
cheerz
gerold


RE: How to: Install DS18B20 temperature sensor in OAP - tthenrie - 10-12-2023

Daniel, if you're listening:

The temp sensor tutorial I posted above is no longer working. It seems that OAP overwrites the openauto_system.ini file upon reboot. I have tried several times to enter the temperature sensor identifiers, verified that it saved properly, but upon reboot the file goes back to what it was before I edited it. OAP provides no other means for installing the temp sensor that I know of. How can we fix that?


RE: How to: Install DS18B20 temperature sensor in OAP - KreAch3R - 10-12-2023

Did you make sure that OAP isn't running when you are trying to edit the file?


RE: How to: Install DS18B20 temperature sensor in OAP - tthenrie - 10-12-2023

Yes. I'll try your other suggestion and see if a new SD card fixes the problem.