651.288.7000 info@intertech.com

IoT as a Diagnostic Tool (Part 2): IoT Hardware and Services

by | Apr 11, 2017

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:

Step 1: Configure Firebase 

  1. Create an account or log in to Firebase.
  2. Open your Console using the link at the top right.
  3. Click “Create a Project” and give your project a name such as “FreezerTempAndDoor”.
  4. Select “Database” in the left navigation area.
  5. Note the url in your project that I’ve circled here for use later:
    Image of the url in your project that we've circled here for use later.
  6. 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. Image of what you should change in the "Rules" tab. Alter the authentication rules to open it up.

Step 2: Configure the Raspberry Pi

Configure the Raspberry Pi with the Raspbian operating system. Follow my 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:
A wiring diagram image of the IoT hardware connections we will make.

IoT Hardware 1: Temperature sensor IoT Hardware 1: Temperature sensor

  • 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.

IoT Hardware 2: Magnetic Door Switch IoT Hardware 2: Door Switch

  • 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.

Since this was intended only as a temporary installation I tossed the Raspberry Pi and breadboard into a plastic container and taped it to the top of the freezer.
An image of what the IoT hardware looks like put together attached to the freezer.

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.

The Code

Part 1  https://www.intertech.com/iot-as-a-diagnostic-tool-part-1-a-simple-iot-case-study/

Part 3 IoT as a Diagnostic Tool (Part 3): The Code

Working on an IoT project with your company and need help? Intertech has experienced IoT developers that can help you put the power of connectivity to work for you.

About Intertech

Founded in 1991, Intertech delivers software development consulting to Fortune 500, Government, and Leading Technology institutions, along with real-world based corporate education services. Whether you are a company looking to partner with a team of technology leaders who provide solutions, mentor staff and add true business value, or a developer interested in working for a company that invests in its employees, we’d like to meet you. Learn more about us.