IoT as a Diagnostic Tool (Part 2): IoT Hardware and Services
As I outlined in a previous article, my friend Pat was having problems with a freezer warming up and putting food at risk and it was my task to diagnose the issue.
I used the following IoT hardware to diagnose the issue:
- Raspberry Pi 3 (but any Pi would work for this)
- Waterproof DS18B20 Digital temperature sensor and 4.7k resistor
- Magnetic Door Switch
- A breadboard
- Wire or wire jumpers
Step 1: Configure Firebase
- Create an account or log in to Firebase.
- Open your Console using the link at the top right.
- Click “Create a Project” and give your project a name such as “FreezerTempAndDoor”.
- Select “Database” in the left navigation area.
- Note the url in your project that I’ve circled here for use later:
- In the Database section, click the “Rules” tab and alter the authentication rules to open it up. PLEASE change this before going live with an actual application.
Step 2: Configure the Raspberry Pi
Configure the Raspberry Pi with the Raspbian operating system. Follow my guide on how to do this if you haven’t before.
Step 3: Add OneWire support to the Pi
This is required for the temperature sensor and you can follow the tutorial from adaFruit (just this page).
Step 4: Make the IoT Hardware Physical Connections
Make the physical connections between the IoT hardware: Raspberry Pi and the temperature sensor and door switch. I am assuming you have used a breadboard before. If not, here is an excellent guide. Here is a diagram of the connections we will make:
- Connect the three leads of the temp sensor to the breadboard. In the diagram they are at 23-F, 24-F and 25-F. Note: the diagram depicts the non-waterproof version of the DS18B20 Digital temperature sensor. The waterproof version is the same but has a long lead and wires. The connections to make are identical.
- Plug the 4.7K resistor into the breadboard at 24-H and 28-H. This resistor will be used between two pins of the temperature sensor as we will see.
- Connect the Raspberry Pi’s GPIO-4 (general purpose input/output) pin to the breadboard’s 24-J. This makes a connection between R-Pi GPIO-4 and the middle pin on the temperature sensor via the resistor. This is depicted with the red wire in the diagram.
- Connect the Raspberry Pi’s GPIO-2 to the breadboard’s 28-J. This is the longer of the blue wires in the diagram.
- Finally, connect the breadboard’s 25-G to 28-G. This is the short blue wire in the diagram.
- Insert the two leads of the door switch into the breadboard’s 9-F and 15-F. Don’t worry, the orientation of the switch does not matter.
- Connect the Raspberry Pi’s GPIO-23 to the breadboard’s 15-J. This is the yellow wire in the diagram.
IoT Hardware 3: Ground connections (black wires in the diagram)
- Connect one of the Raspberry Pi’s ground GPIO (general purpose input/output) pins to one of the power rails of the breadboard.
- Connect breadboard 23-Y (or any Y) to 23-J, grounding one lead of the temperature sensor.
- Connect breadboard 10-Y (or any Y) to 9-J, grounding one lead of the door switch.
Watch this blog for the final article in this series where I will share how I coded the Pi to collect the data and send it to Firebase.
Working with IoT hardware or other IoT projects with your company and need help? Intertech has experienced IoT developers that can help you put the power of connectivity to work for you.