Skip to content
Go to file
This branch is 71 commits ahead, 8 commits behind wnasich:master.

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Collect measurements from sensors connected to NodeMCU and transmit them to InfluxDB.

This project is intended as starting point for projects where you have to collect data from a set of sensors connected to ESP8266 and any other IoT platform that support NodeMCU firmware.



  • You want collect data from sensors without interaction
  • You need the most fiability as possible. It means support wifi or influxdb shutdowns with minor data loss.
  • You supply energy to module using a mini UPS device.

Hardware Setup

We have been having success (and have been officially supporting) using bme280s, bme680s and DHTs for temperature, humidity, pressure and bh1750 for light, however there is no reason why this project couldnt be extended to handle other sensors (see lfs/reader_slots.lua)


  • Clone or Download this repository.
  • Using nodemcu-PyFlasher flash the firmware in this repository to the nodemcu. Reset the device after flashing.
  • Edit config.lua according to your environment.
  • important fields to add/change:
    • wifiSsid - your wifi ssid
    • wifiPass - your wifi password
    • altitude - your altitude (for calibrated pressure)
    • influxDB: host - the hostname for your influxdb service
    • influxDB: dbname - the database name for influxdb
    • influxDB: username - a user for the influxdb service
    • influxDB: password - a password for the user
    • influxTags: node - a name for the node
  • Upload all .lua files and .img files to NodeMCU module and reset it
  • Inspect output of serial console of module, you should see a succesful wifi connection info.
  • Check data captured on InfluxDB. You will get these measurements: heap_size_b and rssi_db

example config.lua:

cfg = {
  wifiSsid = "My-Wifi",
  wifiPass = "my-password",
  otaHost = "",
  otaPath = "/files/nodemcu-collector/lfs.img",
  otaRefresh = 24, --hours
  dns1 = '',
  telnetPort = 23,
  production = true,
  transmissionBlock = 10, -- Measurements to send
  transmissionInterval = 23000, -- miliseconds
  readRoundInterval = 60000, -- miliseconds
  toFileWhenHeap = 15000, -- lower than in bytes
  dataFileName = 'data.csv',
  altitude = 577, --altitude for calibrated reading of relative pressure at SL
  parCalibration = 0.0263157894, --calibration value for par on a bh1750
  -- parCalibrationDivisor = 38.0,
  influxDB = {
      host = '',
      port = '8086',
      dbname = 'mydb',
      username = 'user',
      password = 'my-influxdb-password'
  influxTags = {
    node = 'node51',
    location = 'someplace',
    area = 'somewhere',
    chipid = tostring(node.chipid())
  sntpServerName = '',
  sntpServerIp = '',
  sntpRefresh = 24, -- hours
  nodeCpuFreq = node.CPU80MHZ, -- node.CPU160MHZ


The LFS image is compiled using Terry Ellison's web service. If you make changes to any of the lua code in lfs/ then you will need to zip that directory and upload it to the web service, or you can use my script.

There is now a and scripts, must be run prior to, however you can just use


Collect measurements from sensors connected to NodeMCU and transmit them to InfluxDB




No releases published


No packages published
You can’t perform that action at this time.