gmag11 / EnigmaIOT

Secure sensor and gateway platform based on ESP8266 and ESP32
https://gmag11.github.io/EnigmaIOT
MIT License
240 stars 46 forks source link

Support for BMP280 sensor #29

Closed ator1811 closed 3 years ago

ator1811 commented 3 years ago

Hi, impressive work you have done. I try to understand how to make a sensornode with a BMP280 pressure/temperature sensor, but I get lost in the number of examples. So if you can help me a little...?

What example node should I use as a starting point? And where do I put library, setup and loop functions for this sensor? I like to use the EnigmaIOT MsgPack example because I have no experience with Cayenne.

Thx in advance. Aernout

gmag11 commented 3 years ago

Thank you @ator1811. I've documented about the internals but basic starting point lacks some words :)

Right now I'm preparing a how-to-start guide to help others to begin programming their own nodes. It will take a while though. I hope less than one month.

Anyway I will leave some guidelines here. Let me know if it is useful and what challenges you find. It will be useful for my guide.

You can start with a regular Arduino Sketch where you design what you want your node does. A simple setup() and loop() is enough. You can use Serial.printf() where you will finally place message sending.

Point of start is EnigmaIOT JSON Controller Template. It is an empty but already configured template where you can add your code.

Inside BasicController.cpp there are a setup () and loop ()methods where you can insert your code. You can rename CONTROLLER_CLASS_NAME if you like, but it is not mandatory.

You can look at EnigmaIOT-Sensor-Controller example. It is very close what you need but using DS18B20 instead of BMP280.

If you want to make your board go to deep sleep mode after sending data you need to add #define SLEEPY 1 to BasicController.h, then all your code will be contained on setup() method.

If SLEEPY is not defined or it is not 1, then you need to do your periodic stuff inside loop ()

gmag11 commented 3 years ago

@ator1811 First version of how to guide is finished in dev branch. Check it there. I will be releasing last version before 1.0 in a few days anyway.

gmag11 commented 3 years ago

How to guide is released in main branch: https://github.com/gmag11/EnigmaIOT/blob/master/docs/howto.md