Skip to content

Commit 1fb518c

Browse files
committed
Conversions in firmware release
1 parent a90c67b commit 1fb518c

File tree

9 files changed

+1521
-0
lines changed

9 files changed

+1521
-0
lines changed

.DS_Store

0 Bytes
Binary file not shown.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
//
2+
// AccumulatorFilter.h
3+
// AccumulatorFilter
4+
//
5+
// Created by Oriol Ferrer Mesià on 09/06/13.
6+
//
7+
//
8+
9+
#ifndef AccumulatorFilter_AccumulatorFilter_h
10+
#define AccumulatorFilter_AccumulatorFilter_h
11+
12+
#define GHETTO_VAL 0.02f
13+
class AccumulatorFilter{
14+
15+
public:
16+
17+
AccumulatorFilter(){
18+
val = GHETTO_VAL;
19+
upSpeed = 0.5f;
20+
}
21+
22+
void setup(float upSpeed_){
23+
val = 0.0f;
24+
upSpeed = upSpeed_;
25+
}
26+
27+
void goUp(){
28+
//Serial.println( "goUP!");
29+
if (val <= GHETTO_VAL){
30+
val = GHETTO_VAL;
31+
}
32+
val *= (1.0f + upSpeed * 2.0f * (1.0f - val) );
33+
}
34+
35+
void goDown(){
36+
//Serial.println( "goDown!");
37+
if (val >= 1.0f - GHETTO_VAL){
38+
val = 1.0f - GHETTO_VAL;
39+
}
40+
val /= (1.0f + upSpeed * 2.0f * (1.0f - val) );
41+
}
42+
43+
float getVal(){
44+
return val;
45+
}
46+
47+
float getSpeed(){
48+
return upSpeed;
49+
}
50+
51+
float upSpeed;
52+
float val;
53+
};
54+
55+
#endif

sck_beta_v0_8_7_SDCARD/Constants.h

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#define debuggSCK false
2+
#define decouplerComp true
3+
#define DataRaw false
4+
5+
#define AWAKE 4 //Despertar WIFI
6+
#define PANEL A8 //Entrada panel
7+
#define BAT A7 //Entrada bateria
8+
9+
#define IO0 5 //MICS5525_HEATHER
10+
#define IO1 13 //MICS2710_HEATHER
11+
#define IO2 9 //MICS2710_ALTAIMPEDANCIA
12+
#define IO3 10 //MICS2710_ALTAIMPEDANCIA
13+
#define FACTORY 7 //factory RESET/AP RN131
14+
#define CONTROL 12 //Control Mode
15+
16+
#define S0 A4 //MICS_5525
17+
#define S1 A5 //MICS_2710
18+
#define S2 A2 //SENS_5525
19+
#define S3 A3 //SENS_2710
20+
#define S4 A0 //MICRO
21+
#define S5 A1 //LDR
22+
23+
#define DEFAULT_TIME_UPDATE "30" //Tiempo entre actualizacion y actualizacion
24+
#define DEFAULT_MIN_UPDATES "1" //Minimo numero de actualizaciones antes de postear
25+
26+
#define POST_MAX 20 //Maximo numero de posteos a la vez
27+
28+
//Direcciones I2C
29+
#define RTC_ADDRESS 0x68 // Direcion de la RTC
30+
#define E2PROM 0x50 // Direcion de la EEPROM
31+
32+
#if F_CPU == 8000000
33+
#define MCP1 0x2E // Direcion del mcp1 Potenciometros que controlan los MICS
34+
#define MCP2 0x2F // Direcion del mcp2 Potenciometros que controlan la ganancia del microfono
35+
#define MCP3 0x2D // Direcion del mcp3 Ajuste carga bateria
36+
#define bh1730 0x29 // Direcion del sensor de luz
37+
#define Temperature 0x40 // Direcion del sht21
38+
#define ADXL 0x53 //ADXL345 device address
39+
#else
40+
#define MCP1 0x2F // Direcion del mcp1 MICS
41+
#define MCP2 0x2E // Direcion del mcp2 REGULADORES
42+
#endif
43+
44+
//Espacio reservado para los parametros de configuracion del SCK
45+
#define EE_ADDR_TIME_VERSION 0 //32BYTES
46+
#define EE_ADDR_TIME_UPDATE 32 //16BYTES Tiempo entre actualizacion y actualizacion de los sensores en segundos
47+
#define EE_ADDR_NUMBER_UPDATES 48 //4BYTES Numero de actualizaciones antes de postear
48+
49+
50+
#define MICS_5525 0x00
51+
#define MICS_2710 0x01
52+
53+
#define Rc0 10. //Ohm Resistencia medica de corriente en el sensor MICS_5525/MICS_5524
54+
55+
#if F_CPU == 8000000
56+
#define Rc1 39. //Ohm Resistencia medica de corriente en el sensor MICS_2714
57+
#else
58+
#define Rc1 10. //Ohm Resistencia medica de corriente en el sensor MICS_2710
59+
#endif
60+
61+
#if F_CPU == 8000000
62+
float Vcc = 3300.; //mV
63+
#define VMIC0 2734.
64+
#define VMIC1 2734.
65+
#else
66+
float Vcc = 5000.; //mV
67+
#define VMIC0 5000.
68+
#define VMIC1 2500.
69+
#endif
70+
71+
#define reference 2560.
72+
73+
#if F_CPU == 8000000
74+
#define VAL_MAX_BATTERY 4200
75+
#define VAL_MIN_BATTERY 3000
76+
#else
77+
#define VAL_MAX_BATTERY 4050
78+
#define VAL_MIN_BATTERY 3000
79+
#endif
80+
81+
82+
#define DHTLIB_INVALID_VALUE -999
83+

sck_beta_v0_8_7_SDCARD/README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
SD data format
2+
==============
3+
4+
When using the **SD firmware** on the SCK, data is stored as **CSV** (comma separated) file on the SD card.
5+
6+
This is an example of the output file once opened on a spreadsheet application:
7+
8+
| Temperature | Humidity| Light | Battery | Solar Panel | CO | NO2 | Noise| UTC |
9+
|-------------|---------|---------|---------|-------------|--------|------|------|----------------------|
10+
| 2821.20 | 4072.00 | 4413.10 | 96.40 | 0.00 | 94.67 | 0.65 | 5.23 | 2000-01-01 00:00:02 |
11+
| 2784.40 | 4236.80 | 5936.70 | 96.10 | 0.00 | 278.27 | 1.05 | 2.39 | 2000-01-01 00:00:02 |
12+
13+
###Data Conversions
14+
15+
The data stored is automatically converted to the proper units in firmware.
16+
17+
If you prefer to do the conversions manually set `DataRaw false` in the `Constants.h` file and apply the formulas on the following table:
18+
19+
20+
| ID | Sensor | Units | Conversion Formula
21+
|-----|--------------|-------|---------------------------------------------|
22+
| 0 | Temperature | ºC | T = -53 + 175.72 / 65536.0 * ( Traw * 10 ) |
23+
| 1 | Humidity | %Rel | H = 7 + 125.0 / 65536.0 * ( Hraw * 10 ) |
24+
| 2 | Light | Lux | L = Lraw / 10 |
25+
| 3 | Battery | % | Not required |
26+
| 4 | Panel | mV | Not required |
27+
| 5 | CO | kOhm | Not required |
28+
| 6 | NO2 | kOhm | Not required |
29+
| 7 | Noise | dB | Apply the conversion table from mV to dB: [CSV](https://gist.github.com/pral2a/d767cc45874361fd38bf)
30+
| 8 | Date | DD:MM:YY | Not required |
31+
| 9 | Time | hh:mm:ss | Not required |
32+
33+
34+
35+
36+
37+

0 commit comments

Comments
 (0)