We’re sharing a demo based on an IoT device that we call RoomBot. This is a simple device that we designed for educational demos. It’s easy to assemble and easy to integrate with PI.

 

We want you to replicate this setup for use in your classroom! We documented the RoomBot setup steps and are sharing it here. We also share the sketch that we used to program the Arduino and the associated Python code that writes the data to PI using PI Web API.

 

We used this device to collect room data at the Johnson City office. We spotted interesting trends right away!

 

Slide.png

 

 

Getting Started:

 

This project had a small start-up cost. Arduino devices are cheap and the learning curve is small.

 

I’ll admit to being a little intimidated at the start of this project. I was not at all familiar with Arduino devices or any kind of microcontroller. I also don’t know Python, although I am competent with scripting in other languages.

 

I was excited to find that working with Arduino devices is simple! I was writing sensor data to PI within two hours of unpacking the device.

 

To start, I downloaded the Arduino IDE software, as instructed by the packaging, and loaded an example Sketch called “Accelerometer”. The sketch programs the device to read data from the sensors (accelerometer and gyroscope sensors) that are built into all Arduino 101 devices.

 

I then found an example Python script that reads data from Arduino devices using a quick Google search. I modified this quickly and added some lines of code to write data to PI using REST calls through PI Web API. And that was it! A quick and dirty prototype, with sensor data writing to PI.

 

We then passed the project over to a team of two engineers in the OSIsoft Johnson City Office: Steve Edwards and Caleb Steiner. They experimented with different Arduino sensors before coming up with the final RoomBot setup. The RoomBot has temperature and light intensity sensors, as well as a knob that is attached to a potentiometer; adjusting this knob mimics a set point change. They built an Arduino sketch for their setup, perfected and documented the associated Python code, created a schematic of the Arduino wiring, and documented their work. We’re sharing all of their work with you here.

 

Steve and Caleb also did some setup in PI for the demo and documented their steps. They setup the Arduino device in PI, using a template, and created a web-based visualization. We later brought a second Arduino online. Now we’re able toggle the display to look at data from either device.

 

Other Projects:

 

We've had a number of projects collecting data from Arduino devices and sending to PI that were posted to PI Square.  These include the following posts:

  1. https://pisquare.osisoft.com/people/DLopez/blog/2015/04/14/how-to-connect-phidget-and-arduino-sensors-to-a-pi-system-via-powershell Daniel Lopez used Powershell scripts to pull in data from various sensors, including solar cell output, ambient sound levels, equipment vibration, air temperature and humidity,     and motor current and position.
  2. https://pisquare.osisoft.com/community/developers-club/blog/2015/11/11/arduino-to-pi-with-pi-web-api Barry Shang hooked up his Arduino with a simple temperature sensor to monitor in his office, and collected the data with similar Python code, also writing data through the PI Web API.
  3. https://pisquare.osisoft.com/people/bpayne/blog/2015/12/30/iot-arduino-to-pi-via-eventhubs-and-ufl-connector Butch Payne had a similar setup as Barry to collect temperature data from an Arduino, but instead passed the data through a Microsoft Azure Event Hub, before consuming the data with the PI UFL Connector

 

We’ve found many ideas for IoT projects with Arduinos or similar devices. Using the above methods, this data could also be collected in PI.

 

Some links with these project ideas include:

 

Some interesting ideas included:

  • Collecting additional environmental data (humidity, pressure, soil moisture)
  • Intelligent bug zappers
  • Gas detection (e.g. natural gas leaks, radon)
  • Smart meat smoking