Updated documentation and added example code

pull/2/head
gshau 2017-10-21 11:27:57 -05:00
rodzic 228a959fd2
commit a8215e9e28
8 zmienionych plików z 71 dodań i 1 usunięć

3
.gitmodules vendored 100644
Wyświetl plik

@ -0,0 +1,3 @@
[submodule "wxserver"]
path = wxserver
url = https://github.com/gshau/wxserver

Wyświetl plik

@ -1 +1,13 @@
# SQM_TSL2591
# Arduino compatible Sky Quality Meter using the TSL2591
This is an application of the TSL 2591 sensor to measuring sky brightness for astronomical applications. It returns the sky brightness in units of magnitude per square arc-second. Also accessible to the user are the raw counts of the visible and IR channels.
Some features:
- Adaptive exposure and gain control to reduce noise in low light environment.
- Calibration offset can be adjusted by user with ```setCalibrationOffset```
- Noise estimates given assuming signal counts follow a Poisson process
This, along with other Arduino projects, can be placed on an ESP8266 module. I have written a library for using these modules to push data to an influx time-series database and display these results using Grafana. Below is a screenshot the Grafana frontend with of one night. Shown are two sensors, one in a weatherstation taking measurements from the sky, and another in a cabinet to illustrate the noise floor.
![SQM Chart](/screenshots/SQMdual.png?raw=true "SQM Chart")

Wyświetl plik

@ -0,0 +1,54 @@
/*
SQM_example
Uses a TSL2591 sensor as a Sky Quality Meter
This example code is in the public domain.
Gabe Shaughnessy
Oct 21 2017
*/
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include "SQM_TSL2591.h"
SQM_TSL2591 sqm = SQM_TSL2591(2591);
void readSQM(void);
void setup() {
Serial.begin(9600);
pinMode(13, OUTPUT);
if (sqm.begin()) {
Serial.println("Found SQM (TSL) sensor");
sqm.config.gain = TSL2591_GAIN_LOW;
sqm.config.time = TSL2591_INTEGRATIONTIME_200MS;
sqm.configSensor();
sqm.showConfig();
sqm.setCalibrationOffset(0.0);
} else{
Serial.println("SQM sensor not found");
}
}
void loop() {
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
sqm.takeReading();
digitalWrite(13, LOW); // turn the LED on (HIGH is the voltage level)
Serial.print("full: "); Serial.println(sqm.full);
Serial.print("ir: "); Serial.println(sqm.ir);
Serial.print("vis: "); Serial.println(sqm.vis);
Serial.print("mpsas: "); Serial.print(sqm.mpsas);
Serial.print(" +/- "); Serial.println(sqm.dmpsas);
Serial.println("======================================");
delay(5000);
}

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 93 KiB

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 477 KiB

1
wxserver 160000

@ -0,0 +1 @@
Subproject commit ac77dc31eac922befc4fdb745548ae9ee77ee600