Plotly Graph For Sensly The Raspberry Pi Hat
About the project
Sensly is a portable pollution sensor capable of detecting the pollution levels in the air using its onboard gas sensors to collect information about the various gases present. We've developed the Sensly Hat for the Raspberry Pi. This is the section for all you graph lovers out there.
Project info
Difficulty: Moderate
Platforms: Arduino, Bosch, Raspberry Pi, STMicroelectronics
Estimated time: 1 hour
Items used in this project
Hardware components
Story
Step 1: Creating a Plotly Account and Getting Your Credentials
![](https://www.electromaker.io/uploads/images/projects/390/story/medium/Ali_Rohafza_story_image_1527862170862338.png)
![](https://www.electromaker.io/uploads/images/projects/390/story/medium/Ali_Rohafza_story_image_1527862171354199.png)
![](https://www.electromaker.io/uploads/images/projects/390/story/medium/Ali_Rohafza_story_image_1527862172032197.png)
![](https://www.electromaker.io/uploads/images/projects/390/story/medium/Ali_Rohafza_story_image_1527862172701362.png)
Next we need to create a plotly account. Head over to plot.ly to do this.
Once you’re done you need to head over to the settings to get your username, API key and streaming tokens. You’ll need 11 streaming tokens.
Step 2: Update the Config.json File
![](https://www.electromaker.io/uploads/images/projects/390/story/medium/Ali_Rohafza_story_image_1527862173484547.png)
To set up Sensly to log directly to plotly we need to first of all download the required files. These can be found at https://github.com/Altitude-Tech/Sensly_Plotly, to download these files on your pi, open the terminal and type the command
- $ git clone https://github.com/Altitude-Tech/Sensly_Plotly
Once you get your API Keys and Streaming Tokens we need to put these into your config.json file which is found in the Sensly Plotly file you downloaded at the start of this instructable.
- $ sudo nano /Path/To/Sensly_Plotly/config.json
Add your username, API_Key and streaming tokens to the file
Step 3: Run the Sensly_Plotly Script
![](https://www.electromaker.io/uploads/images/projects/390/story/medium/Ali_Rohafza_story_image_1527862174106586.png)
![](https://www.electromaker.io/uploads/images/projects/390/story/medium/Ali_Rohafza_story_image_1527862174649089.png)
Next, we need to ensure that you have put the R0 values you obtained during calibration into the Sensly_Plotly.py script you put them in the area shown in the first picture.
Make sure you are connected to the internet then press f5 to run the script, if successful your pi should open a web browser and start logging Sensly >
Finally if you would like this script to run at boot then we run the crontab command.
- $ crontab -e
Add this to the bottom of the file.
- $ @reboot python /path/to/Sensly_Plotly.py
Code
Credits
![Photo of Altitude_Tech](/uploads/images/profile_pictures/Ali_Rohafza_profile_picture_1539102582.png)
Altitude_Tech
Altitude Tech LTD is founded by professionals and students in the area of robotics, electronics and product design, which makes the team the heart of the company.
Leave your feedback...