INTRODUCTION
The aim of this project is to provide a collaborative noise measurement to map noise levels in different places. The Tessel allows us to easily measure the noise level and provide the necessary connectivity to get its location through the Google Location API and then communicate with Ubidots.
BACKGROUND
Measuring Noise levels can be helpful to determine the characteristics of an environment, like the amount of people, disturbance, emergency, party levels, etc. The objective of this work is to present a low-cost instrument to detect noise and take a desired action when the noise levels are above a certain threshold.
As an example, we will monitor the noise at a specific location and then display the values in a real-time dashboard using Ubidots.
SETUP YOUR UBIDOTS ACCOUNT
First of all, we'll use the Ubidots service to store and analyze the sensor data, so let's start by creating a Ubidots account here.
Log in to your account, create a datasource called "Tessel Monitoring" and add a new variable called "Noise Level":
Please take note that the variable has an ID. We'll need this ID later for our device code.
Also, you'll need to create a token under "My profile" tab. A token is like a password for your device to authenticate to the Ubidots API and send data to it. Take note of this value as we'll also need it the device code.
CODING
Now it's time to code your Tessel and send data to Ubidots. The first step is to configure your Tessel Board to connect to your WiFi.
We'll assume you're already familiar with the Tessel and wrote at least a "Hello World" program with it. From the command line type this command to connect to your Wifi:
$ tessel wifi -n [network name] -p [password] -s [security type*]
*
The security type flag is optional; default is wpa2.
Now let's create a file called "levelnoise.js" with the following code. Make sure to use your Variable ID and Ubidots Token in the code.
Note the function "data2googlelocation" which implements a call to the Google Location API following these instructions.
Connect ambient module to the Tessel and upload the code with the following command:
$ tessel run levelnoise.js
You should now start seeing the Noise levels in your Ubidots account!
But wait, this code will only run while the Tessel is connected to your computer. To make sure the Tessel runs the code when it's turned off and on again, you need to push it using this command:
$ tessel push levelnoise.js
USING AN EXTERNAL POWER SOURCE
After configuring your Tessel, you may want to leave it running on batteries. We used a Li-ion battery of 3.7V 1000 mAh. The wiring is as follows:
vi (Tessel) ---> V+ (battery)
gnd (Tessel) ---> V- (battery)
we recommend the following link for more information about power supply for the Tessel:
SCALING YOUR DATA
In Ubidots you can add a specific formula to create new data from existing raw data. You can do it by creating a "Derive Variable" inside your data source and then entering your formula, in this case:
Noise level (dBm) = 20*log(noise_level_raw*5000)
WRAPPING UP
Now that your data is in Ubidots, you can create widgets to display the noise levels and location. If you have several Tessels, you can paint them in the same widget map. You can also create a event to take a desired action (SMS, Email or custom request...) when the level is too high:
Comments
Please log in or sign up to comment.