Whilst away on holiday earlier in the summer, I decided that I’d investigate how to put together an IoT device based on a Raspberry Pi to gather environmental data, initially temperature only but then moving on from there as I become more familiar with putting the hardware together.
I found a tutorial online, and ordered myself some hardware:
- Raspberry Pi 3b (frustratingly, the Pi 4 was announced the day that my order was delivered!)
- Micro SD card
- A breadboard
- Some resistors (4.7k ohm)
- some jumper cables
- Temperature sensor
It’s been many many years since I built any electronic circuits (I was relieved that a soldering iron wasn’t required), so I did wonder if I was going to order this kit and never manage to get it to work.
I followed the linked tutorial to get a Pi up and running without a monitor and keyboard. All fine, so that was the straightforward part out of the way. After about an hour, I had the temperature sensor working too.
Rather than repeat all my steps, I’ll summarise:
- this blog is a very useful additional / replacement reference. Using terminal blocks was a great help and definitely recommended, and the wiring diagram worked for me.
- when the sensor drivers are loaded and the sensor is correctly connected, the device’s directory is created, eg /sys/bus/w1/devices/28-020491763b5d3. I found that if the directory was not created, then the circuit was not wired correctly (specifically in my case, the temperature sensor was not correctly wired to the breadboard).
cat /sys/bus/w1/devices/<deviceid>/w1_slaveto show the temperature data that’s streamed to the file from the sensor
Now that your Pi is grabbing temperature data, it needs to do something with it. Stand by for post on how to stream that data to the cloud.