Current version of the OpenAuto Pro is 13
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to: Install DS18B20 temperature sensor in OAP
#1
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 and devices - one for outside air temp and one for inside air temp?

TH
Reply
#2
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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)