Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arduino sensor logging #4

Open
wants to merge 65 commits into
base: master
Choose a base branch
from
Open

Arduino sensor logging #4

wants to merge 65 commits into from

Conversation

quinnc0
Copy link
Contributor

@quinnc0 quinnc0 commented Mar 27, 2022

No description provided.

quinnc0 and others added 30 commits March 27, 2022 01:05
This file more closely mirrors the function of simplelogger.py, so renamed to reflect that.
renamed .ino file
Sensorlogger.ino adds support for ds18b20 sensor
Through ADS1015 ADC
also shortened error messages to decrease sketch size slightly
Changed from using ads1015 to 1115. Optimized settings for bme280 after testing.
Multiple DS18B20s can now be used on the same pin. NodeMCU printed pin numbers are now converted to esp8266 GPIO pin numbers in an enum.
Clarifies some hw and sw configuration parameters
Log file's first line is now column labels. Throw this line out when plotting data.
INA219 I2C address option added to allow multiple INA219 instances/devices.
Use to find individual DS18B20 addresses.
Can now specify which DS18B20 sensor is which, provided you know its address.
How to flash NodeMCU with Arduino IDE, library installation, parameter description, DS18B20 address finding
Added error message for missing/invalid INA219 to aid troubleshooting. Removed current reading and added power reading, since current reading isn't that useful unless as a means to get power. The INA219 can do that computation for us so we'll take it.
Closes #5 and also changes ADS1115 implementation so gain can only be set to one value. This avoids possible conflicting gain settings between anemometer and phototransistor, for example.
Update DS18B20 labels to describe what they are measuring. Activate polling of all sensors.
When booting the device with SD card inserted, it often fails boot. The delay allows insert SD card after boot.
Added .f3d source files for all printed parts
added shelter design source file, as well as OBJ, since that can be viewed without CAD software
adds argument parser for polling interval, sensor log filename, and whether same file should be rewritten each time script is run
Allows failed sensors to send NAN as a reading instead of blocking code, which caused the nodeMCU to time out and reboot
Closes #9 , along with previous commit, which is really the one that fixed that issue.
Copy link
Member

@itsrachelfish itsrachelfish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this code works and we've been using it in the field for months. However you should refactor sensorlogger.ino and sensorserial.ino to separate all of the classes for getting data from different sensors into different files. I think that would be a more maintainable structure for the project going forward


Now you should be able to open the sensorlogger.ino sketch in the Arduino IDE and upload it to the NodeMCU ESP board.

## sensorlogger.ino parameters
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## sensorlogger.ino parameters
## sensorlogger.ino parameters

There's a typo here, you need to remove the space at the beginning of the line

sensorlogger.ino Outdated

/*
// DHT sensors
class DhtWrap : public SensorWrap
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DHT sensors are commented out?

sensorlogger.ino Outdated
* pin_num = OneWire data pin number
* If using an invalid address or there is a sensor missing, it will just read -196.6F
*/
class DS18B20Wrap : public SensorWrap
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is pretty long and contains a lot of different classes. Maybe it would be better to structure each type of sensor into their own file which gets imported into this main file?

sensorserial.ino Outdated
* pin_num = OneWire data pin number
* If using an invalid address or there is a sensor missing, it will just read -196.6F
*/
class DS18B20Wrap : public SensorWrap
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nearly all of this code is duplicated from the sensorlogger.ino file. I think it would be better to refactor this so both files are pulling classes from separate files

#define LED_PIN 8 // led pin for indicator. not required.


class DHTLogger
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When would the simplelogger.ino file be used instead of sensorlogger.ino? Just for testing?

quinnc0 and others added 24 commits December 26, 2022 15:08
Rename a temperature sensor to match its use and make sure main board's LED is lit when program is running successfully.
create readme and separate directory for nodemcu sensorlogger program
Add files in platformio's project structure
separating class definitions into separate files
move ifndef
move ifndef
sensor classes in main.cpp disabled and moved to separate files
added some curly brackets
remove commented code blocks
move sensorserial to its own folder and refactor classes into separate files. changed filename to from a .ino to main.cpp to work better with platformio.
there are over 600 files, so they are zipped. Two zip files to keep each under 25MB.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants