Skip to main content

Google Cloud IotCore with Raspberry PI

In my previous blog post, I have written about the integration of Google Cloud IoTCore using UDOO and how the temperature information is sent up to Pub/Sub. In the post, I will describe the integration of Raspberry PI to Google Cloud IoTCore. The primary communication protocol between the sensors and the IoTHub is mosquitto MQTT.

For this setup, I have a temperature sensor using ESP8266 flashed with ESP Easy firmware. The ESP and sensor are battery power which set to wake up every 60 minutes to take the measurement and transfer this to Raspberry Pi. The IOT bridge is written in Python which bridges the internal MQTT messages and Google Cloud IoTCore.

The sensor is battery power using a 3rd party Nokia BL-5C (1020 mah) rechargeable battery. This can be cheaply purchased from many battery shops or online. I have used 2 versions of the Wemos Mini charging shield version (1.1and 1.2). The details on how to modify the version 1.1 to be able to read the voltage level of the battery can be found at this blog post.



The diagram above shows the entire process flow. The telemetry data from the sensors are stored in the BigQuery database and the Device State information is stored in Cloud Firestore. 


Comments

Popular posts from this blog

Xiaomi Mi Flora Chinese and International version comparison

Xiaomi Miflora sensor allows monitoring of the surrounding environment of the plant. It can monitor temperature, soil moisture, conductivity (acidity of the soil), ambience light. There are 2 versions of the sensor, international and Chinese version. Realistically, I cannot see the difference between the 2 versions. The left-hand side is the Chinese version and the right is the international version. Other than the packaging, the main difference is the price of the sensor. The International version cost 2x more. In other forums, there are discussions that the Chinese version cannot connect to the MiHome App. I have set my MiHome app to connect to China server and it is able to register the sensor correctly. For my usage, I will be connecting to Openhab to monitor the plants andusing  Thomas Dietrich MiFlora mqtt daemon  as the bridge between Openhab and the sensor. The International version is detected as Flower care and the firmware version is 3.1.9 wh...

Using ESP-Link transparent bridge (ESP-01 and Arduino Pro Mini)

Recently stumbled across an interesting open source project ESP-Link . Its main purpose is to network-enable a non-network microcontroller (MCU) such as Arduino Uno, Pro mini or Nano using ESP8266. The author termed it as "Transparent Bridge". The ESP and MCU  communicate via the serial link and there is a companion Arduino library EL-Client  for the MCU to connect up the network using MQTT, REST, TCP and UDP. Setup I have put together an ESP-01 and an Arduino Pro Mini for this experiment. I have chosen a 3.3 version Pro mini so that I do not need to do any voltage level shifting between the I/O pins. In order to have a stable voltage source, the ESP8266 is powered by Pro Mini and the Pro Mini "RAW" pin is connected to a 5v USB power source. The RAW pin can take voltage up to 12V. The reset pin of Pro Mini is connected to GPIO 0 of ESP-01. This enables the ESP-01 to reset the Pro Mini.   I have linked up an APDS 9960 sensor to it and periodically se...