northernwidget / margay_library Goto Github PK
View Code? Open in Web Editor NEWA library to enable the hardware functionality of the Margay data logger
License: GNU General Public License v3.0
A library to enable the hardware functionality of the Margay data logger
License: GNU General Public License v3.0
Allow each sensor to have a fault function which returns a category (?) of fault. This can be based on out of bounds errors, lack of sub module working on a slave, etc, but would allow for a more general fault case than simply if an I2C connection is there, and would work for non-I2C devices as well (bigger issue)
On first glance, the lack of compatibility may stem from some directory-related commands, but not sure yet.
We could update to work with SdFat v2 (the best solution) and/or update https://github.com/NorthernWidget/NorthernWidget-libraries to include the most recent SdFat v1.
I am guessing that this issue will also affect https://github.com/NorthernWidget-Skunkworks/Resnik_Library.
When a hardware SD card failure occurs, a red OBFailure
light is indicated, but printout reads SD: PASS
, looking briefly at the code, looks as though it would never throw a true SD card failure
Reconcile difference/use of SDError
vs. SDErrorTemp
Look into triggering caused at like 386
and 387
(End of Margay::SDTest
in Margay.cpp
Margay:run() does not permit the user to access the on-board (but also external) ADC. This component is needed to read analog voltages, but cannot be accessed if one is also reading data from an external I2C unit.
Enhancement addressed here by @bschulz1701 in 8afa026.
Original issue in the hardware repository:
NorthernWidget/Project-Margay#10
Duplicating here for completeness
Battery voltage is off by a large margin due to the high input impedance of the voltage divider. Find low level work around.
Adjusted the default voltage reference (unsure of what default state is), and set to use AREF pin, this was done with ADMUX = 0b00000000;
, also sets mux to ADC0 for some time before the measurement is made, allowing the sample and hold cap to charge up beforehand.
Also set clock divider to maximum, again, allowing for the longest sampling interval for the Sample and Hold cap to charge. This was done with ADCSRA = 0b10000111;
Finally, measured VRef pin (1.8v reference) and used this to compensate for errors in 3.3v reference voltage assumption. Important, this measurement should be made after the divided battery voltage measurement, otherwise this defeats the precharge we performed.
Note: Hardware solution would be to use a lower value voltage divider, or use a unity gain buffer on the input stage of the ADC to compensate for the very high output impedance of the voltage divider
Find a way to bundle all of the required libraries with the main library for version control and ease of install
DS3231_Logger.h
SdFat.h
MCP3421.h
Improve the way pinout is selected between various margay boards
Add a color indicator for low battery, test at startup, maybe yellow?
On branch Dev_v2
commit ade9e0f, when using Margay v1.0
hardware, when the log button is pressed the system resets
Most likely an interrupt vector problem, make sure the vector is setup properly for the pin
Currently when no clock battery is installed, the message printed is
Clock: PASS, BAD TIME
FAIL
This triggers both an OBError
and a TimeError
, fix such that if the clock does not increment (which will correctly cause an OBError
), then this invalidates a TimeError
and the resurned result should simply be
Clock: FAIL
Triggering just an OBError
, not a TimeError
since this (while technically correct) is confusing and can give the illusion from light states that the clock is not the problem
troubleshooting/general: line 3: "is"->"in", line 4: "unexpected results" is awkward
troubleshooting/orange: line 3: "lose"->"loose"
I'll double check again to be sure of others
Within this function (starting Line 319):
void Margay::InitLogFile()
{
String FileName = "Log";
int FileNum = 1;
String NumString = "01";
(FileName + "01"+ ".txt").toCharArray(FileNameC, 11);
while(SD.exists(FileNameC)) {
FileNum += 1;
NumString = String(FileNum, DEC);
(FileName + NumString + ".txt").toCharArray(FileNameC, 11);
}
(FileName + NumString + ".txt").toCharArray(FileNameC, 11);
LogStr("Time [UTC], Temp OB [C], Temp RTC [C], Bat [V], " + Header); //Log concatonated header
}
Currently:
NumString = String(FileNum, DEC);
has no zero padding, though the first (01
) does.
This could be fixed using:
sprintf('%02d', FileNum)
(or perhaps%03d
if we want to be safe)
And then finding a way to convert a char*
to a String
(I haven't done this before; tend to avoid String due to memory issues... thanks 1284p for making that easier).
@bschulz1701 -- sorry for raising an issue and not just fixing; don't have a Margay at home and don't want to commit unless I test!
General comment, but placement of installation/examples/operation/etc. fits better (and is consistent with other logger pages) when placed in the Project_Margay page instead of the Library page. Either there is a reason for this that I am blind to, or it should be changed to be like the others.
Add check of PG line on regulator before writing to the SD card to make sure the voltage is sufficient, if not, print one line to the file, then lockout future writes until a power cycle using a flag
Per NorthernWidget/Project-Margay#24
Opening the issue here in case it ends up being firmware rather than hardware.
Try to link the version given in the library.properties
file with the library version reported by LibVersion
Two includes are given in the header file. I would remove one, but I'm not sure if this is a weird way to get around include dependencies.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.