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

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
lfs
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

nodemcu-collector

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.

Requirements

Assumptions

  • 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)

Installation

  • 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 = "my-ota-host.com",
  otaPath = "/files/nodemcu-collector/lfs.img",
  otaRefresh = 24, --hours
  dns1 = '8.8.4.4',
  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 = 'my-influxdb-host.com',
      port = '8086',
      dbname = 'mydb',
      username = 'user',
      password = 'my-influxdb-password'
  },
  influxTags = {
    node = 'node51',
    location = 'someplace',
    area = 'somewhere',
    chipid = tostring(node.chipid())
  },
  sntpServerName = '0.au.pool.ntp.org',
  sntpServerIp = '203.7.149.150',
  sntpRefresh = 24, -- hours
  nodeCpuFreq = node.CPU80MHZ, -- node.CPU160MHZ
}

Contributing

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 compilelfs.py script.

There is now a build_firmware.sh and build_lfs.sh scripts, build_firmware.sh must be run prior to build_lfs.sh, however you can just use compilelfs.py

About

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

Resources

License

Releases

No releases published

Packages

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