Академический Документы
Профессиональный Документы
Культура Документы
I had a few DS18B20 sensors lying around, and decided to create a easy temperature
monitoring system with the old Raspberry Pi Model B+ (Version 1). It turned out to be a
lot more challenging than expected, but hopefully this guide helps you get started.
NOTE: I have opted to go with the DS18B20P for Parasitic sensing and this
guide will cover that - this is different in circuitry to the DS18B20!
Things you'll need
A few wires
puTTY
If the sensor starts getting hot, you've connected it wrong. Because we're in parasitic
mode, remember to use short length cables and don't plug in the power.
Disable Device Tree
With Raspbian 3.18 and above, we need to disable the device tree. go to 'sudo raspiconfig' > Advanced > Device Tree > Disable. Ensure you restart.
Code
I want my python script to display the temperature every second for the purposes of
testing. I also want it to be able to swap out sensors, etc. The following script, adopted
from a number of sources, lets me do just this:
Create the file: sudo nano temp.py
Errors
If you get '85000', then there is a problem. This is can be caused by
Faulty sensor
Conclusion
And there you go! A simple temperature sensing device using the Raspberry Pi!
As always, feel free to drop me a line, comment below or hit me up at @jayjanarthanan.