Log noise level on cloud using Arduino & 1Sheeld

Nowadays people started integrating stuff with the internet for their daily uses, and fortunately, it’s not hard to do so..! as there are a lot of hardware/software tools that ease the development of such applications.
One of these tools is the 1Sheeld’s Internet shield, which allows your arduino board to connect to a mobile application and then to the internet and update/retreive data over http protocol or through REST api’s.

In this blog, we will go through the process step by step:
1- Making a simple noise level sensor depending on your smartphone’s mic.
2- Choosing the best API service for our application.
3- Finally, code deployment and getting the noise level sensor connected to the internet.


Making noise level example

If it’s your first time to deal with 1Sheeld, please visit our Getting Started tutorial to check how to use your 1Sheeld board and upload a simple example which is ironically the same we are going to use for our application. but i am gonna simply explain what to do step by step.

1-First make sure to add the preprocessor keys to allow certain shields to be used from 1Sheeld library, preventing the library from eating your memory, especially if you have an Arduino UNO.

2-Include OneSheeld library

3-In the setup function add the line OneSheeld.begin() to initialize the serial communication between your Arduino and 1Sheeld board. And assigning pin 13 in your Arduino board to work as an ouptut calling pinMode(13,OUTPUT).

4-In the loop just use the Mic shield functions which you can find them here in 1Sheeld documentation section, and check if the noise level is more than 80 db turn on an LED.

5-That’s it, just adjust an LED to your arduino’s pin 13 and connect your 1Sheeld and open the mic shield and try to make noise to see the LED turns on and off according to the noise level.


Choosing your API

Before we find your best API service and getting your application working, i really recommend watching the following video,it will help you get the basic information to deal with most of the API’s available, along with simple tools like (apigee or postman).

Ok now it’s time to search for API’s. I have been through the search myself and ended up with some custom API’s, most of them have free plans, but sure they have some restrictions on data rate and other stuff. So make sure to check all the plans before implementing your application, and see if it meets your requirements.
If you are interested in API’s for certain applications like Twitter, Instagram, facebook etc. please check this link having all the new API’s available for such applications.

My small API’s List:

Log noise level on cloud using Arduino & 1SheeldLog noise level on cloud using Arduino & 1Sheeld      Log noise level on cloud using Arduino & 1Sheeld

Log noise level on cloud using Arduino & 1SheeldLog noise level on cloud using Arduino & 1Sheeld

even more out there but i have chosen google’s Firebase api for its free plan.


Firebase GET/PUT/POST walkthrough

Just a simple step before connecting with the internet, we need to define what the application should do exactly.
The sketch should add your smartphone’s mic noise level to Firebase’s database,so make sure that you have checked Firebase documentation section to know how to add new values to the database.

I will give you a hand if you still find it hard to get Firebase’s documentation,and will walk you through the actions of its Restfull api.


Each API implements its own way of communication and verbatic actions, for example an API has the verb PUT to add new values and POST to update them, while another flips them making these verbs not standardized, mainly it depends on the developer, so please make sure to read the provided documentation when you choose your API.

We have got these three verbs for our application (Get,Put,Post),so lets check them :).

GET method

It’s implemented to get the response of your request by several forms (like the XML-JSON etc.) but we are interested in the JSON part, so you should append the (.json) at the end of the request URL or use the setContentType method 1Sheeld library provides.


1-Create your Firebase account then get the url provided in the red section.Log noise level on cloud using Arduino & 1Sheeld

2-Change the rules (read&write) sections to have the true values, allowing you to read and write values to your database.Log noise level on cloud using Arduino & 1Sheeld

3-Manually add a child by clicking the ‘+’ sign name the key “Mic” and write down a value say “1234”.Log noise level on cloud using Arduino & 1Sheeld

4-Then with Postman tool place the URL in the field and append the Mic.json at the end of your url. click “Send”,then you will notice the Mic  value returned in the response body.Log noise level on cloud using Arduino & 1Sheeld


PUT method

Updates the values of Mic by adding them as a raw data entity.


1-In the put method you will have to specify which child you will be updating, otherwise you will mess the whole data.
2-With the same postman tool all you have to do is just choose PUT method, then add the raw data, lets say “9999” then click “Send”. It will respond with the updated value if the request is OK, and you can now check your updated data over your account.

Log noise level on cloud using Arduino & 1Sheeld


POST method

In case you would like to add new values for your sensor readings this will do the job. It will also return a response with a unique ID to access the new created child.


1-With the last postman settings just write down a new value in the body, and change the PUT method to POST and press “Send”.(hint: I have tried to post characters instead of numbers but it responded with a “not valid json object” error,so in case you would like to add characters make sure to create a valid json object inside the body)Log noise level on cloud using Arduino & 1Sheeld


JSON stands for “java script object notation”, which is a light weight data-interchange format, easy for human to parse and read instead of other representation like the XML. If you still want to know much about json check this link.


Connecting your sketch with the internet

We gonna mimic what we have done using postman, but this time with Arduino, and it’s really easy, just bear with me.



With simple lines of code you will be able to connect your Arduino to the internet:

1-Add the preprocessor key for the Internet shield library included in OneSheeld library #define INCLUDE_INTERNET_SHIELD.

2-Above the setup function, create your first request object by calling HttpRequest myRequest(“YOUR_URL”).

3-Then in the setup function and with the request object created, we will send the data as raw data using the addRawData(“123”) function, and call Internet.performPost() to post the new values.

4-Now after successfully uploading the sketch, make sure you’ve switched the UART switch to the communication mode and internet shield is opened and connected to your board, then hit Arduino’s reset button and check the response in the internet shield, it should be returning a json object with the unique ID of the new created value.



1-With the same HttpRequest created when posting, we will just subscribe to couple of callbacks (there are several ones so please check them in the documentation).

2-Now in our sketch we are interested in the “setOnSuccess(userFunction)” & “setOnJsonResponse(userFunction)”, the setOnSuccess callback is a function which will be invoked once the request is a success, while the setOnJsonResponse callback will be invoked when your json request is processed and returned with your required json’s object value.

3-We made it easy for you to create your json objects chain to access certain keys and get their values. So, with the returned response in the setOnSuccess callback we will create the chain that would access the (Xkey) and return its value in the setOnJsonResponse callback to deal with.

4-In the setOnJsonResponse callback you have both the key and the value you already requested in the setOnSuccess callback, so you are ready now to do whatever you want with the data.

5-Here’s the code, instead of the Internet.performPost() we added Internet.performGet(), then hit Arduino’s reset button and check the data.



This case we will just update a certain child with a new value,but the challenge comes here by creating the json object as a char string and passing it to the addRawData function, but thanks to the backslash enlcousers where the string will be created easily, here are the steps:

1-With the same request created in the past two actions, we will just create the json object in a c char string. So, for example we would like to access the X child in the json object, so we would create the strings and pass it as the follow addRawData(“{\”GENERATED_UNIQUE_ID\”: \”2000\”}”) since all the backslashes are called string enclosures preventing the c string to be disorganized giving compiler error.

2-Hit Arduino’s reset button to call the Internet.performPut() function and check the value updated.



Check the final code that posts mic values each 5 minutes.

Pretty simple and easy ;), and with this I hope you guyz get this blog easily and make your own internet connected stuff all by yourself, and if you have any questions please leave it below in the comments.

Related Blogs

Arduino Robotics

Arduino Robotics Series, from a car to a robot arm

Arduino keeps standing out from the crowd of all-around development boards due too its ease of use and budget price. As a result, this has enabled almost anyone to get his own idea into life no matter how crazy or even useless to the whole world it was, except for its maker! Also, it has …

Arduino Robot Arm

How to build an Arduino Robot Arm placed on RC Car

Arduino robots are always funny and definitely more enjoyable when combined with robotic arm! And today, I will walk you through the making of a simple Arduino Robot Arm that’s made of cardboard and how you can attach it over your Arduino Bluetooth RC Car / Robot that you have made so far through this series. …

Arduino Line Following Robot

How to build an Arduino Line Following Robot using Cardboard

Arduino Line Following Robot is one of the easiest and most well-known projects that anyone can make to learn the basics of programming, electronics, and mechanics all in one project. It’s known that this project is common for most of the makers and tech students and today I am going to give it a revisit …

Arduino Obstacle Avoiding Robot

How to build an Arduino Obstacle Avoiding Robot using Cardboard

Back again with another Arduino Bluetooth RC Car tutorial but with an advanced feature that makes your car autonomous by adding ultrasonic sensors to the RC Car you have made before!. Yeah, I know that you may have seen other tutorials using ultrasonic to make the car/robot avoid obstacles ahead, but I am going to …

Arduino Bluetooth RC car

How to make an Arduino Bluetooth RC Car using Cardboard

  Cardboard crafts are one of the most popular and easy to make DIY stuff. Mixing this with the unmatchable enjoyment of RC Cars and the ease of using Arduino, I am going to show you how to make a Cardboard Arduino Bluetooth RC car that you can control via Bluetooth from your smartphone.  …

Arduino Security Camera

Arduino Security Camera System (Arduino Home Hacks #4)

Arduino Security Camera Have you ever wanted to check your home in real time? Afraid that maybe someone has stormed in, don’t remember if you shut the door or not or maybe wanna check if your Hyper-energetic dog has broken any of your dishes AGAIN!! 🙂 Then this is the perfect place for you cause today …