Skip to content

Latest commit

 

History

History
53 lines (36 loc) · 2.12 KB

README.md

File metadata and controls

53 lines (36 loc) · 2.12 KB

esp32_bme280_ws

Arduino code for streaming BME280 sensor data from a websocket. Uses soft AP configuration, so doesn't require a router. The output is in a csv or JSON format. Most of the code is taken other sources: Setting up the ESP32 and setting it as a soft AP and BME280 from Random Nerd Tutorials. I have also included code which allows a second temperature sensor (TMP102) to be added via I2C. I followed the wiring instructions from a video from Garage Geek Guy.

Requirements

  • ESP32 - I used the HUZZAH32 – ESP32 Feather Board from Adafruit

  • BME280 - I used Sparkfun Atmospheric Sensor Breakout - BME280 from sparkfun

  • TMP102 - If you want to include a second sensor, I used the SparkFun TMP102

Usage

Wire up as follows: esp32_bme280

Install code and libraries described in the links above.

If the you encounter an error using I2C communication protocol for the BME, try switching the address from 0x76 to 0x77 at status = bme.begin(0x77).

To switch to a Json output, remove

sprintf(msg, "%f,%f,%f,%f", temperature,pressure,altitude,humidity);
webSocket.sendTXT(0,msg);

and uncomment

//Using JSON format

//DynamicJsonDocument  doc(200);

//doc["Temperature"] = tempstr;
//  doc["Pressure"] = presstr;
//
//  doc["Pressure"] = altstr;
//
//  doc["Humidity"] = humstr;

//String output;
//serializeJson(doc, output);
//webSocket.sendTXT(0,output);

Works well with the python application socscrollsave, which allows real-time plotting of sensor data and saving data as a csv file. See my website for examples.

License

The project is distributed under MIT License