Chat freely about anything...

User avatar
By bernman
#10499 Hi

I would like to use the ESP8266 as a sensor node that pushes data (or data gets pulled) to a central storage for later analysis. There are some nice examples of this that people have shared, but none that are quite like what I am looking for. All the examples that I have found are at a low-ish frequency. Something on the order of one to two samples per minute...or even per hour. I am looking for something like 10 to 20 samples per second with a network of 10 to 20 sensors. I am thinking to interface to the sensor using I2C to the ESP8266 controller, and then use the wireless connection of the ESP8266 to send data to the central storage. I have enough electronic background to design and build the hardware part. Where I am struggling to get started is on the software side.

By the way, 10 to 20 samples per second might be overkill for my current need. If I could even get 1 Hz, that would be ok for now. If I can transfer at higher rates, then this same framework could support future applications. Also, the reason I am looking at the ESP8266 is the extremely low cost, and grass roots community. An opportunity to have some fun, and solve a need at the same time .

If someone could point me in the right direction for the software for a project like this, I would really appreciate it. Of course, if this project actually gets off the drawing board and toward something resembling reality, I will share with the community.

Thanks
Bernman
User avatar
By EadF
#10513 It all depends on how you want to code your esp. Do you want to write in script or are you comfortable with C?

I you won't shy away from C i've got an example that almost does what you need : https://github.com/eadf/esp_mqtt_ports
It's a little hack that allows you to connect 32* mcp23017 port extenders over i2c. It is connected over WiFi with MQTT (the IoT protocol of choice). Right now it only outputs the pin settings. To add a 2 Hz poll timer that instead read pin values and publish over mqtt would be trivial.

Edit: I've just uploaded a MQTT sensor example: https://github.com/eadf/esp_mqtt_ping. It periodically (4Hz) sends the result of an ultrasonic distance sensor over mqtt (make sure that you use a local mqtt broker and not a public one).