Skip to content

Commit

Permalink
And more writting...
Browse files Browse the repository at this point in the history
  • Loading branch information
lokijota committed Jan 23, 2020
1 parent fe7d4b6 commit 4fb8ccc
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 22 deletions.
27 changes: 17 additions & 10 deletions BME680Setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,27 @@ pi@rpi0:~/bsec_bme680_linux $ sudo i2cdetect -y 1

6. Run the resulting executable with `./bsec_bme680`.

7. By now you should be getting readings printed out every few seconds, such as:

```
2020-01-23 21:22:45,[IAQ (0)]: 25.00,[T degC]: 16.60,[H %rH]: 55.10,[P hPa]: 965.48,[G Ohms]: 4270,[S]: 0,[eCO2 ppm]: 500.000000000000000,[bVOCe ppm]: 0.4999999403953552246093750
```

## Install Azure IoTHub Client SDK for Python

This is a Python client library to talk with Azure IoT Hub. There's also a C version available (https://github.com/Azure/azure-iot-sdk-c), but while I got it to work, I don't know enough about C anymore to know how to add the references to a new C application, so after spending some hours around CMake/Makefiles, I gave up and decided to go for Python SDK.

1. Run `pip3 install azure-iot-device` (you should have installed pip3 in the [previous setup step](DeviceSetup.md))

The SDK's documentation is here: https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-sdks (scroll down to the "Azure IoT Hub device SDK for Python" section).

And that's it. You now have a working Zero, the sensor is working, and all the requirements are installed. The next step includes the remainig steps to [get the Zero to do readings in an interesting format and then upload them to Azure](DeviceUploadData.md)


banana

**Add here**: PIMIDORI / Adafruit

Also:
**Add here**: Download of BSEC and copy into RPI / PIMIDORI / Adafruit

Also -- for another page, not here:
- secondary I2C in my case
- change the checkpointing interval
- every 3 seconds
- change 5ºC to 4ºC ??

## Install Azure IoTHub Client SDK

https://pypi.org/project/azure-iot-device/ and https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-sdks
- change 5ºC to 4ºC ??
8 changes: 4 additions & 4 deletions DeviceSetup.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Setting up a Raspberry Pi0 from scratch
# Setting up a Raspberry Pi Zero 0 from scratch

## Base setup
Follow these instructions to install a Zero from scratch. This is pretty standard, I'm including in part so that I don't forget it myself in case I want to repeat it.

1. Flash the [Raspian image](https://www.raspberrypi.org/downloads/raspbian/) into a MicroSD Card (the [Balena Etcher](https://www.balena.io/etcher/) is a good tool, remember to run it -on Windows - in Administrator mode)
2. Log in (pi/raspberry as the default credentiaals) and update the settings in `sudo raspi-config`, including:
Expand All @@ -10,12 +10,12 @@
- configure the Wifi
- configure Boot to automatically log into the command line
- change the password
- when you're done, reboot for the wifi to take effect
- when you're done, reboot for the Wifi and remaining configurations to take effect

3. After the reboot you can start `sudo raspi-config` again and update the tool, in case new settings appear
4. Back in the command line, update applications by running `sudo apt-get update` followed by `sudo apt-get upgrade -y`. This will probably take a while on the Zero.
5. Install pip3: `sudo apt-get install python3-pip -y` (to later install Python3 packages)
6. Install Vim: `sudo apt-get install vim -y` (because I prefer Vim to Vi/Nano/Emacs)
6. Install Vim: `sudo apt-get install vim -y` (because I prefer Vim to Vi/Nano/Emacs when editing text files)
7. Install Git: `sudo apt-get install git -y` (to get files from this and other repos)

That's it. Continue with the setup of [BME680 and Azure libraries](BME680Setup.md).
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
# Using the BME680 sensor in a Raspberry Pi Zero connected to Microsoft Azure

Sample of using the Bosch BME680 sensor connected to a Raspberry Pi Zero and uploading/processing data in Azure. I'm using Adafruit's breakout (https://www.adafruit.com/product/3660).
This is a sample of using the Bosch BME680 sensor connected to a Raspberry Pi Zero and uploading/processing data in Azure. I'm using Adafruit's breakout (https://www.adafruit.com/product/3660) and using it to gather information including temperature, humidity and air quality.

Bosch has a library (compiled C) to handle this sensor, including proprietary code to calculate the Interior Air Quality (IAQ) score adjusting for humidity/pressure, so I decided to not use either Adafruit's (https://github.com/adafruit/Adafruit_BME680) or Pimoroni's (https://github.com/pimoroni/bme680-python/) Python Libraries. What Bosch's code does exactly is not clear because the code is closed. You can also simply use either of the above libraries with the Adafruit breakout, both work.
*Note: This project is Work in Progress as of 23/01/2020. I'm actively working on it and will be adding daily.*

**To-add: Add photo of it with the connections**

**Note**: This project is Work in Progress as of 22/01/2020. I'm actively working on it and will be adding daily.
## Note on reading data from sensor

## Base setup instructions
Bosch has a library (compiled C) to handle their BME680 sensor, including proprietary code to calculate the Interior Air Quality (IAQ) score adjusting for humidity/pressure. This led me to decide to not use either Adafruit's (https://github.com/adafruit/Adafruit_BME680) or Pimoroni's (https://github.com/pimoroni/bme680-python/) Python Libraries. What Bosch's code does exactly is not clear because the code is closed. You can also simply use either of the above libraries with the Adafruit breakout, both work.

Start by following these instructions to set up the Zero: [Basic Device Setup](DeviceSetup.md) . If you already have one running, just remember to enable I2C. After this, you'll need to install some aditional libraries in the device, related either to the BME680 sensor or to Azure. To do this, follow the steps here: [Libraries setup](BME680Setup.md) .
## Base setup instructions (if you're starting from scratch)

To-add:

- Link to Adafruit and to the setup I did, maybe a photo of it with the connections
Start by following these instructions to set up the Zero: [Basic Device Setup](DeviceSetup.md) . If you already have one running, just remember to enable I2C. After this, you'll need to install some aditional libraries in the device, related either to the BME680 sensor or to Azure. To do this, follow the steps here: [Libraries setup](BME680Setup.md) . When you finish these two, you'll have a C application installed that prints out the sensor's readings, and all the required dependencies for what follows.

## Get sensor readings and push them to Azure

Expand Down

0 comments on commit 4fb8ccc

Please sign in to comment.