|
Arduino YunArduino
|
x 1 | |
|
DHT11 Temperature & Humidity Sensor |
x 1 | |
|
Jumper Wires |
x 1 |
|
Arduino Web Editor |
|
|
Temboo |
|
|
Actions on Google |
|
|
Google Sheets |
Monitemp (Monitor Temperature And Humidity)
Abstract
Figure 1: A Monitemp device
Not everyone has a thermostat in their home, and even if they do, most of the time you can only check the temperature by looking at a physical screen. One can’t check their home’s temperature or humidity levels online, from any device.
My solution to this problem is Monitemp. Monitemp is a small device which continuously monitors the temperature and humidity of its environment and utilises Temboo’s Google Sheets choreo to upload this data to a spreadsheet. Monitemp makes it easy to access environmental data from any device (which can connect to Google Sheets).
Monitemp is unique in that through its connectivity with Google Sheets, users can visualise the temperature and humidity in their homes from anywhere. The device can be implemented in a home, by shipping companies, or even by farmers to monitor the conditions of a greenhouse. This project is designed to improve accessibility and inspire creativity among those wishing to learn more about IoT.
Table 1 shows the cost of deployment of one Monitemp device.
Table 1: The cost of deployment for one Monitemp device
Monitemp has no maintenance costs apart from those incurred through power supply.
Project Architecture
Figure 2: Project architecture
The project architecture consists of a frontend, which involves the Monitemp device collecting and processing data, and a backend, which includes Temboo and Google APIs.
First, the DHT11 temperature and humidity sensor and Arduino Yun will read the necessary environmental data, process it into as json file, and send it to Temboo. Afterwards, Temboo will redirect the data to Google APIs, which will upload it to Google Sheets. The information will then be displayed on a spreadsheet. After a specified amount of time, the microcontroller will begin this process again. This cycle is illustrated in figure 2.
User Feedback
Figure 3: Spreadsheet displaying temperature and humidity data
The user will receive temperature and humidity data in the form of a spreadsheet on Google Sheets (figure 3). This approach was chosen due to the technology’s compatibility with Temboo and its ease of accessibility. Additional functionality and more types of data can be easily displayed here if desired.
Microcontroller – Arduino Yun
Figure 4: Arduino Yun
I chose the Arduino Yun for this project because it is easy to use and comes with built in WiFi connectivity. This is essential to transmit data to Google Sheets.
The Arduino Yun can also be programmed over a network connection; this can allow you to scatter them throughout your home and set them up to measure more kinds of environmental data (not just temperature and humidity) later on.
Making the Project
This section will talk about the steps needed to construct the project from start to finish and everything needed to construct it.
Step 1: Required Apparatus
This project consists uses very little components, so it is easy to build. See the BOM for a detailed list of required items.
Figure 5: Components necessary to build the project
Step 2: Connecting The Circuit
Figure 6: Device circuit schematics
The device is quite easy to assemble, figure 6 showcases the circuit schematics.
Note I am going to power my DHT11 sensor with 5V, so make sure that your sensor supports 5V, and if it does not, use 3.3V.
Step 3: Acknowledging the Code
The projects consists of two sketches, the main code and a header file containing the user’s account data for Google and Temboo. The code is explained in greater detail in this section.
Read Sensor Value
This function reads the data from the DHT11 sensor using a library. When the results are read, they are stored in separate variables for temperature and humidity (temp and hum ).
Append to Buffer
This code appends the sensor values to a buffer (sprintf will add characters to a buffer). [[%02d,%02d,]] is the layout required by Google to be able to read the values.
Parse Buffer to Temboo
This section of code initialises Temboo, begins the choreo, sets the Temboo account credentials and the Google account credentials, and runs the choreo.
Setting Up the Variables
All variables are set up in the Accounts.h header file which comes with the project's main sketch. You have to define the variables in the header file to allow the choreo to run. The inputs will be explained in "Backend Program" below, where we will setup Temboo and Google APIs for the project.
Step 4: Arduino Yun Setup
For this project, you will need an Arduino Yun which has been set up and initialised. View this guide on?getting started with the Yun. Here is a link with information about?Temboo?and?Running Choreos on your Arduino Yun.
Step 5: Backend Program
For this project to work, we need to configure two platforms: Temboo and Google APIs. This section shows a step-by-step demonstration of this. If the setup does not work out for you the first time, try it again (it took me a while to get it to work).
Step 1: Create your Temboo Account
The first step is to create a Temboo Account; you can do this here. Enter a username into the field in the middle of the page. Click "Try it Out" and follow the instructions on the fallowing page for setting up your account. Temboo is free to use on the basic plan, this will provide you with 250 choreo runs per month.
Step 2: Create and Setup your Google Account
To create a Google Account, visit?this page. After you set up your account. Go to?Google Accounts and sign in if you have to.
Now, navigate to the Sign-in & Security header and select “Signing into your Google Account”. Make sure that you enable "Two Step Verification" in your account.
Step 3: Setup Google APIs
Next, visit?Google Console. The page may ask you to sign in, do so. You will see a blank page, if you do not have a project created, create one by clicking the "Create a Project" button. Now follow the steps needed to make a project. Once the project has loaded, you should see a page similar to the one in figure 7.
Figure 7: Google Console after signing in
Click the “Credentials” option in the menu on the left hand side of the screen. Next, click "Create Credentials" and select “OAuth Client ID” from the drop menu. You will now be asked which type of application you want to create. Select "Web Application". Give your app a name, I called it Temboo. Underneath, you should see a field saying "Authorised redirect URIs"; in it, write “https://ACCOUNT_NAME.temboolive.com/callback/google”
Enter your Temboo Account's name instead of “ACCOUNT_NAME”. When you are done, your URL should contain your username, e.g.?https://myaccount.temboolive.com/callback/google
Your screen should look like figure 8 (do not fill in "Authorized JavaScript origins").
Figure 8: Credentials filled in
Next, click "Create". When you do so, you will be redirected to your dashboard. A window will appear, giving you your client ID and client secret. Make sure you save these codes as they are necessary in the next steps. Now click on "Dashboard" again and then click on enable APIs at the top of the page.
Search for "Google Sheets" in the search field and click on the Google Sheets API. Click the "Enable" button and you will be redirected to your dashboard.
Step 4: Initialise OAuth
First, go to Temboo and sign in. In the menu on the left hand side, scroll down until you see "Google" and then click on the arrow next to it. After you do so, a drop menu will appear, open OAuth, and then click on “InitialiseAuth”. Your window should look like figure 9.
Figure 9: InitializeOAuth screen on Temboo
Now, put your Google ClientID in the "ClientID" field and then scroll down until you see a section labelled "notes", there you can find the necessary scope for your project. We will be using Google Spreadsheets. Copy the contents of the section, which should be:
- https://spreadsheets.google.com/feeds/
- https://docs.google.com/feeds/
- https://docs.googleusercontent.com/
Paste them in the scope field at the top. Your screen should look like figure 10.
Figure 10: InitializeOAuth scope field filled in
Afterwards, click "Run Now" to run your code. When the code has finished running, two fields will appear (a URL field and a callbackID field). Make sure that you save your callbackID for further use. Now visit the URL that appears in the section above. You should get a request from Google requesting you sign in, do so. Google may inform you that the website is not safe, if it does, click "advanced" at the bottom of the page and click "open temboolive.com" below that. Now you will receive another notification telling you that the app wants to have access to documents and files, click "Allow". You should see a blank page, if you do, proceed to the next part of the setup, if you do not see a blank page, start this step from the beginning.
Step 5: Finalise OAuth
To finalise your OAuth, go to Temboo. On the left side menu select Google - OAuth - Finalise OAuth.
Fill in the fields with the data collected previously and click on "Run Now", if the code works, you should receive an “Access Token” and a “RefreshToken”, make sure that you save both of them as they will be needed in the next step. If you succeed, you can go on to the next step, if you did not, try this step again from the beginning, make sure that the URL in the "Authorised Redirect URL" field on Google is typed correctly and that your clientID and client secret are correct.
Step 6: Run a Probe
To check that your configuration is correct, we will try a test sketch. Visit Temboo and go to Google - Sheets – AppendValues.
Fill in the ClientID, Client Secret and Refresh Token received in the previous steps. Next, go to Google Docs. Create a new document, after you did so, give it a name. The spreadsheet ID is located in the URL of the spreadsheet, e.g. if the spreadsheet's URL is “https://docs.google.com/spreadsheets/d/1wn9R5vPJLIulgxKjDflqnN6X84Xe7zu6925mRQO-tVo/edit#gid=0”, then the ID is “1wn9R5vPJLIulgxKjDflqnN6X84Xe7zu6925mRQO-tVo”, now copy your spreadsheet ID and paste it in the spreadsheet ID field in Temboo. Lastly, copy the array [ [ "100", "200", "300" ] ], and paste it in the "Values" field.
For more information on how to format the values, scroll down to the notes on the page. Your window should look like figure 11.
Figure 11: Values filled in on AppendValues
Scroll down until you see a section with code, labelled "Code", copy the contents of the section and paste them into the Arduino IDE. Below that is another sectopm labelled "Header File", copy its contents too, and in the Arduino IDE, create a new tab and call it "TembooAccount.h". Paste the contents into the new tab and compile the code.
Figure 12: Data pasted in new tab
Connect your Arduino Yun to a computer via a USB type A to C cable and wait until it has connected to WiFi, this is indicated by the rapid flash of a blue LED labelled WLAN. When your Yun is connected to WiFi, upload the code and open the Serial Monitor. In the event of success, you should get a response in the monitor from Temboo. Now, go back to Google docs and click on the spreadsheet you created earlier. You should see three values 100, 200 and 300 printed in separate cells.
Figure 13: Test values pasted in spreadsheet
Step 7: Uploading the Code
Open the code below and make sure to edit the Header file to your preference (this includes the values that were previously received).
The default delay between choreo runs is one minute, you can change it if you want. I would recommend to turn proDebug on (setting it to 1), on the first try. You need to open the Serial Monitor to receive progress data and debug information. Using this project without connecting to a computer requires proDebug to be set to 0 (its initial value).
That’s it, just upload the sketch to the Yun and you are all set.
Conclusion
Monitemp utilises a sensor, an Arduino Yun, Temboo and Google APIs to flexibly and rapidly upload temperature and humidity data to a Google Sheets spreadsheet. This allows one to monitor the temperature of an environment remotely.
I was inspired to build this project when I heard of food waste which occurs as a result of poor shipping practices; however, this project’s main goal is to inspire others, who may find it difficult to start a project with IoT themselves, to create and implement their own solutions.
Monitemp (Monitor Temperature And Humidity)
- Comments(0)
- Likes(0)
- 0 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
More by Andrei Florian
- PhoneLocator AbstractFigure 1: PhoneLocator’s instant responseHave you ever forgotten your phone in your friend's...
- SmartWristband Abstract Figure 1: The SmartWristband device being worn Monitor patients sent to self-isolate with t...
- Senso (Identification of Ilegal Logging) AbstractFigure 1: The Senso device attached to a treePeople are always told to recycle and turn off ...
- SmartWay (Geolocation Monitoring) AbstractFigure 1: The SmartWay device attached to the child's bag is glowing orange (meaning they ha...
- FlowerPot Monitor Abstract Growing and maintaining a flower or plant can be difficult. It takes time, dedication and c...
- Monitemp (Monitor Temperature And Humidity) AbstractFigure 1: A Monitemp device Not everyone has a thermostat in their home, and even if they do...
- SmartPostBox AbstractFigure 1: Post box powered by SmartPostBox Figure 1: Post box powered by SmartPostBox SmartP...
- MyPulse (Heart Rate and SpO2 Sensor) Abstract Now-a-days so many of us wear an array of sensors on our wrist all the time, keeping track ...
- CityGuide (Digital Tour Guide) AbstractCityGuide is a digital tour guide application which allows people to sightsee throughout a c...
- IntlAir (Air Quality Monitoring and Automatic Purification) Project Overview People spend most of their day at home, they wake up, go to work, then come back an...
- UnifiedWater AbstractFigure 1: UnifiedWater device being held above canal Yearly, over 8 billion tonnes of plasti...
-
-
-
kmMiniSchield MIDI I/O - IN/OUT/THROUGH MIDI extension for kmMidiMini
113 0 0 -
DIY Laser Power Meter with Arduino
163 0 2 -
-
-
Box & Bolt, 3D Printed Cardboard Crafting Tools
156 0 2 -
-
A DIY Soldering Station Perfect for Learning (Floppy Soldering Station 3.0)
566 0 3