Skip to content

Node-RED Energy Harvesting dashboard example, weather forecast, temperature and humidty measurement. MQTT, ESP32, u-blox NINA-W10, HTU21D, IBM Cloud, CloudMQTT

License

Notifications You must be signed in to change notification settings

ldab/Node-RED-Energy-Harvesting-dashboard

Repository files navigation

Node-RED-Energy-Harvesting-dashboard

Node-RED Energy Harvesting dashboard example, weather forecast, temperature and humidty measurement. MQTT, ESP32, u-blox NINA-W10, HTU21D, IBM Cloud, CloudMQTT

GitHub version Build Status License: MIT

GitHub last commit

dashboard

Sumary

  1. How to build PlatformIO based project
  2. TODO
  3. Energy Harvesting
  4. MQTT Broker
  5. IBM Node-RED Hosting
  6. Node-RED Flow
  7. OpenWeatherMap API
  8. Node-RED Notification
  9. Programming
  10. Calibrating ADC for ESP32
  11. Partition Table and Flash size
  12. Erase Flash
  13. Power Measurement
  14. PCB
  15. Final Thoughts or Improvements
  16. Credits

How to build PlatformIO based project

  • More information can be found on their comprehensive Docs. But Basically:

    1. Download and install official Microsoft Visual Studio Code. PlatformIO IDE is built on top of it
    2. Open VSCode Package Manager
    3. Search for official platformio-ide extension
    4. Install PlatformIO IDE.

PlatformIO installation

TODO

  • More detailed IBM deploy;
  • Details on the flows;
  • Node to be installed;
  • Energy Harvesting details;

Energy Harvesting

Energy Budget

While Communicating

Component ~Typ mA
NINA-W102 120

While Sleep (TPL5110)

Component ~Typ μA
TPL5110 0.035
Cap leak 30
LDO 1
Passive 5
  • The code takes in average 2000ms to execute;
  • Wakes up every hour;
  • 10 hours of charging soruce;

energy budget

MQTT Broker

The MQTT Broker used is CloudMQTT they offer Free accounts 😉 that works just fine.

IBM Node-RED Hosting

The process was a bit tedious and took a while to get it properly running as of today (2019/06/15) the information provided on the tutorial had few broken links.

https://nodered.org/docs/platforms/bluemix

  1. Sign-up/Log in to https://cloud.ibm.com/;
  2. Using the top search bar, search for Node-RED Starter;
  3. Fill the required fields, App name, Host name, etc...
  4. Select Lite for SDK for Node.js and Cloudant, those are free, you can upgrade later if required;
  5. Click Create at the bottom right, the circle will spin, take few seconds;
  6. You will be redirected to the next page and should see running when everything is ready for use:

IBM Cloud Start

  1. Go to your App URL, something like http://AppName.eu-gb.mybluemix.net and complete the initial set-up;
  2. The Node-Red GUI Flow Editor is available at http://AppName.eu-gb.mybluemix.net/red

Node-RED Flow

Install required nodes

  • Menu -> Manage Palette -> Install tab. You will need node-red-node-openweathermap and node-red-dashboard

Import Node example

  • Copy the flow below and import to your Nore-RED available at yournode.eu-gb.mybluemix.net/red Import > Clipboard, paste it.

You will find the flow.json here.

Node-RED Flow

Cloudant Credentials for cleaning database

  • Generally Cloudant autheticate via IBM cloud therefore we need to create new Credentials and use the username and password for authentication on the delet inputs on database node.

IBM Cloudant Credentials

OpenWeatherMap API

  • In order to get the weather forecast information for the OpenWeatherMap node, you will need to get your API at https://openweathermap.org/api
  • Then define your location and the information you would like to show on the "Forecast String" node:
{
  "coord":{"lon":139,"lat":35},
  "sys":{"country":"JP","sunrise":1369769524,"sunset":1369821049},
  "weather":[{"id":804,"main":"clouds","description":"overcast clouds","icon":"04n"}],
  "main":{"temp":289.5,"humidity":89,"pressure":1013,"temp_min":287.04,"temp_max":292.04},
  "wind":{"speed":7.31,"deg":187.002},
  "rain":{"3h":0},
  "clouds":{"all":92},
  "dt":1369824698,
  "id":1851632,
  "name":"Shuzenji",
  "cod":200
}

Node-RED Notification

  • Via the catch node, you can enable notification, for your phone for example. Below I have quickly show few options:
  1. Email
  • Use the email output, configured with your email provider info;
  1. PushSafer
  • Offers several customizations, sound, vibration, icons, etc:
  • GET request url: https://www.pushsafer.com/api?k=YOURKEY&c=%23ff0000&v=1&a=1&m={{payload}}
  1. Twilio SMS
  • SMS API, built-in to the Node-RED and IBM example;
  1. IFTT
  • If this than that, with android and iOS apps can be accesible via webhooks;
  • GET https://maker.ifttt.com/trigger/YOUR_EVENT/with/key/YOUR_KEY?value1=MESSAGE

NINA-W1 Programming

  • An external 3.3V UART/USB Converter is required in combination with jumper configuration and button pressing:

    1. Remove the 2 jumpers and set it to Flash Position:

    board flashing

    1. Power or reset the board while keeping BOOT low/pressed.
  • In order to program the Nano Timer TPL5110 the DIP switch needs to be set before connecting power/supercap.

Calibrating ADC for ESP32

  • ADC on ESP32 has been reported being innacurate, therefore one can use adc2_vref_to_gpio( GPIO_NUM_25 ); to route Vref to GPIO_NUM_25 that can be measured over NINA PIN 16 -> R7 in order to calibrate during ADC measurement.
  • Calling for esp_adc_cal_characterize(ADC_UNIT_1, ADC_ATTEN_DB_6, ADC_WIDTH_BIT_11, Vref, adc_chars);

Partition Table and Flash size

  • You can create a custom partitions table (CSV) following ESP32 Partition Tables documentation.

  • Partitions examples are available at GitHub arduino-esp32

  • minimal.csv is the default defined on nina_w10.json however I changed it in order to free some space up used by spiffs found on partitions_custom.csv here

    • No OTA;
    • No SPIFFS;
    • No EEPROM;

Erase Flash

pio run -t erase - > all data will be replaced with 0xFF bytes.

Power Measurement

  • The overall power/current can be measure by diconeting the Storage element and connecting the meter in series;
  • Alternativelly, to analyze NINA-W1 power profile, remove Vbat jumper and measure the current on the following position:

PCB

3D board u-blox E-PEAS

Schematic

u-blox E-PEAS

u-blox E-PEAS

Enclosure

u-blox E-PEAS

BOM

BOM u-blox E-PEAS

u-blox E-PEAS

Final Thoughts or Improvements

  • Use 3.0V LDO, HT7830;
  • Replace LDO for a smaller drop-out voltage or lower power-down current;
  • Use a Buck/Boost converter instead of LDO in order to discharge super cap until 2.8V;

Credits

GitHub Shields and Badges created with Shields.io

Weather information from OpenWeatherMap

Webcam picture from webcam.travel

Adafruit HTU21D GitHub Library

About

Node-RED Energy Harvesting dashboard example, weather forecast, temperature and humidty measurement. MQTT, ESP32, u-blox NINA-W10, HTU21D, IBM Cloud, CloudMQTT

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages