Skip to content

Commit

Permalink
v1
Browse files Browse the repository at this point in the history
  • Loading branch information
McOrts committed Mar 9, 2024
1 parent bd1224b commit be41b9e
Show file tree
Hide file tree
Showing 17 changed files with 570 additions and 95 deletions.
Binary file added 3D/Jaleometro_Microphone_Case2.chitubox
Binary file not shown.
Binary file added 3D/Jaleometro_Microphone_Case2.stl
Binary file not shown.
Binary file added data/1002 Llogeta 7.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/1004 Corderia 15-5_1.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/1004 Corderia 15-5_2.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/1004 Corderia 15-5_3.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/1006 Cordería 15-1.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/1006 Cordería 15-1.mp4
Binary file not shown.
Binary file added data/1006 Cordería 15-1_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
567 changes: 482 additions & 85 deletions data/sensor_catalog.json

Large diffs are not rendered by default.

Binary file added img/Logos_Channel/Llotja.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/Logos_Channel/leaf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/leaf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/jaleometro_OTAA/conf/.DS_Store
Binary file not shown.
20 changes: 20 additions & 0 deletions src/jaleometro_OTAA/conf/1104_settings.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// LoRaWAN Configuration

/* OTAA para*/
static uint8_t appEui[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
static uint8_t devEui[] = { 0x16, 0x7E, 0x5E, 0x17, 0x82, 0xA1, 0x52, 0x45 };
static uint8_t appKey[] = { 0x0C, 0xF8, 0x58, 0x60, 0x84, 0xAB, 0xD9, 0x22, 0x91, 0xA5, 0xB1, 0xF3, 0xDA, 0xD7, 0x7F, 0xDF };

uint16_t userChannelsMask[6]={ 0x00FF,0x0000,0x0000,0x0000,0x0000,0x0000 };
static DeviceClass_t lorawanClass = LORAWAN_CLASS;

// Devise location
const float latitude = 39.572813;
const float longitude = 2.637521;
const int alt = 9;

// Other params
float SensorId= 11.04;// Sensor identifcator number
const int DutyCycle = 600000; // Transmision and reading period
const int Sleep4NoNoise = 300000; // Sleep period when low noise
const int LowNoiseLevel = 39; // Limit for low noise mode
20 changes: 20 additions & 0 deletions src/jaleometro_OTAA/conf/jaleometro-test.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// LoRaWAN Configuration

/* OTAA para*/
static uint8_t devEui[] = { 0x70, 0xB3, 0xD5, 0x7E, 0xD0, 0x05, 0x77, 0x79 };
static uint8_t appEui[] = { 0x76, 0x15, 0xF3, 0x09, 0x37, 0x72, 0xA6, 0x55 };
static uint8_t appKey[] = { 0x42, 0xDD, 0xB2, 0x28, 0x09, 0xC0, 0x9E, 0xF3, 0x29, 0x10, 0xD9, 0xCB, 0xE7, 0xC7, 0xDA, 0x27 };

uint16_t userChannelsMask[6]={ 0x00FF,0x0000,0x0000,0x0000,0x0000,0x0000 };
static DeviceClass_t lorawanClass = LORAWAN_CLASS;

// Devise location
const float latitude = 39.53573;
const float longitude = 2.71832;
const int alt = 20;

// Other params
float SensorId= 10.01;// Sensor identifcator number
const int DutyCycle = 600000; // Transmision and reading period
const int Sleep4NoNoise = 300000; // Sleep period when low noise
const int LowNoiseLevel = 180; // Limit for low noise mode
58 changes: 48 additions & 10 deletions src/jaleometro_OTAA/jaleometro_OTAA.ino
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ unsigned int noise_min; // noise minimun value
unsigned int noise; // current noise value
unsigned long noise_sum; // noise level addition

uint16_t battery;

unsigned long tmp_ini;
long CountStart = 0;
long now_DutyCycle = 0;
Expand Down Expand Up @@ -50,11 +52,22 @@ static void lowPowerSleep(uint32_t sleeptime)
void setup() {
Serial.begin(115200);

// This enables (with LOW) the output to power the sensor
pinMode(Vext, OUTPUT);
digitalWrite(Vext, LOW);
Serial.printf(" | Vext: ");
Serial.println(digitalRead(Vext));
delay(500);

// Sensor identification
Serial.printf(" | SensorId: ");
Serial.println(SensorId);

tmp_ini = millis();
noise_avg = 0;
noise_avg_pre = LowNoiseLevel;
noise_peak = 0;
noise_min = 1000;
noise_min = 1000;
noise_sum = 0;
loops = 0;
cycles = 50;
Expand All @@ -80,10 +93,16 @@ void setup() {
Serial.println("JOIN FAILED! Sleeping for 60 seconds");
lowPowerSleep(60000);
} else {
Serial.println("JOINED");
Serial.println("JOINED");
if (LORAWAN_CLASS == CLASS_A) {
Serial.println("CLASS A Confirmed");
} else {
Serial.println("ERROR MOT CLASS A");
}
break;
}
}

}

void transmitRecord()
Expand All @@ -109,6 +128,7 @@ void transmitRecord()
lpp.reset();
lpp.addAnalogInput(1,SensorId);
lpp.addAnalogInput(2,cycles);
lpp.addAnalogInput(3,battery);
lpp.addLuminosity(1, noise_avg);
lpp.addLuminosity(2, noise_peak);
lpp.addLuminosity(3, noise_min);
Expand All @@ -130,14 +150,18 @@ void transmitRecord()
}
}
///////////////////////////////////////////////////
void loop()
{

void loop() {
// Noise reading each second
noise = analogRead(ADC );
if (noise > 4500) {
Serial.println("outlier removed");
if (digitalRead(Vext) == 0) {
noise = analogReadmV(ADC);
} else {
digitalWrite(Vext, LOW);
}

if (noise > 4500) {
Serial.print("outlier removed: ");
Serial.println(noise);
} else {
if (millis() - tmp_ini > 1000) {
noise_sum += noise;
loops ++;
Expand Down Expand Up @@ -172,6 +196,15 @@ void loop()
Serial.println(noise_sum);
Serial.println(loops);

// Swith off-on the power of the sensor in order to read the battery
digitalWrite(Vext, HIGH);
delay(1000);
battery = getBatteryVoltage();
digitalWrite(Vext, LOW);
Serial.print("Battery: ");
Serial.println(battery);
delay(100);

transmitRecord();

noise_peak = 0;
Expand All @@ -181,15 +214,20 @@ void loop()

// Low Noise Mode if two Noise Overage are under LowNoiseLevel
if (noise_avg < LowNoiseLevel && noise_avg_pre < LowNoiseLevel) {
if (lorawanClass == CLASS_A) {
if (LORAWAN_CLASS == CLASS_A) {
cycles -= icycles;
digitalWrite(Vext, HIGH);
Serial.println("Switch OFF Micro");
Serial.println("Sleep");
delay(400);

lowPowerSleep(Sleep4NoNoise);
digitalWrite(Vext, LOW);
Serial.println("Switch ON Micro");
}
}
noise_avg_pre = noise_avg;
}

}

///////////////////////////////////////////////////
Expand Down

0 comments on commit be41b9e

Please sign in to comment.