Remote storage places often faces missing, misplacement and theft of goods in the place. One good example is cell tower backup battery theft in remote areas. Most of the times authorities were alerted on the situation whether it is a theft or misplacement only after too much time passed. Having a high bandwidth continuous streaming solution is not a practical one in these situation.
The solution here tracks each asset in the storage and detect any human presence. Once it detect any presence or movement of any asset it will immediately send alert to the authorities.
Overall Setup :
BLE beacon device is made with esp32 and mpu4050. Using this device we train the data for "MOVING", "FALLING", "IDLE" and "TAMPERING". We will use these trained data in arduino to send different advertisement data based on the state.
EDGE IMPULSE : Data Acquisition and TrainingEdge impulse command line is installed in a ubuntu sytem.
refer this : https://github.com/edgeimpulse/ei-install-scripts
Create a project in edge impulse.
Connect the sensor device to PC.
Upload the following code to get comma seperated date from device.
#include <Adafruit_MPU6050.h>
#include <Adafruit_Sensor.h>
#include <Wire.h>
#define FREQUENCY_HZ 60
#define INTERVAL_MS (1000 / (FREQUENCY_HZ + 1))
Adafruit_MPU6050 mpu;
static unsigned long last_interval_ms = 0;
void setup() {
Serial.begin(115200);
Wire.setPins(19,21);
if (!mpu.begin()) {
Serial.println("Fail MPU6050 chip");
while (1) {
delay(10);
}
}
Serial.println("MPU6050 Found!");
mpu.setAccelerometerRange(MPU6050_RANGE_8_G);
Serial.print("Accelerometer range set to: ");
switch (mpu.getAccelerometerRange()) {
case MPU6050_RANGE_2_G:
Serial.println("+-2G");
break;
case MPU6050_RANGE_4_G:
Serial.println("+-4G");
break;
case MPU6050_RANGE_8_G:
Serial.println("+-8G");
break;
case MPU6050_RANGE_16_G:
Serial.println("+-16G");
break;
}
mpu.setGyroRange(MPU6050_RANGE_500_DEG);
Serial.print("Gyro range set to: ");
switch (mpu.getGyroRange()) {
case MPU6050_RANGE_250_DEG:
Serial.println("+- 250 deg/s");
break;
case MPU6050_RANGE_500_DEG:
Serial.println("+- 500 deg/s");
break;
case MPU6050_RANGE_1000_DEG:
Serial.println("+- 1000 deg/s");
break;
case MPU6050_RANGE_2000_DEG:
Serial.println("+- 2000 deg/s");
break;
}
mpu.setFilterBandwidth(MPU6050_BAND_21_HZ);
Serial.print("Filter bandwidth set to: ");
switch (mpu.getFilterBandwidth()) {
case MPU6050_BAND_260_HZ:
Serial.println("260 Hz");
break;
case MPU6050_BAND_184_HZ:
Serial.println("184 Hz");
break;
case MPU6050_BAND_94_HZ:
Serial.println("94 Hz");
break;
case MPU6050_BAND_44_HZ:
Serial.println("44 Hz");
break;
case MPU6050_BAND_21_HZ:
Serial.println("21 Hz");
break;
case MPU6050_BAND_10_HZ:
Serial.println("10 Hz");
break;
case MPU6050_BAND_5_HZ:
Serial.println("5 Hz");
break;
}
Serial.println("");
delay(100);
}
void loop() {
sensors_event_t a, g, temp;
if (millis() > last_interval_ms + INTERVAL_MS) {
last_interval_ms = millis();
mpu.getEvent(&a, &g, &temp);
Serial.print(a.acceleration.x);
Serial.print(",");
Serial.print(a.acceleration.y);
Serial.print(",");
Serial.println(a.acceleration.z);
}
}
On the command line type:
edge-impulse-data-forwarder
it will prompt sign in and to choose project.
Device will apper in edge impulse.
On the Data aquisition tab add label and get sample data from device.
Train the data:
Download arduino code from edge impulse and add as library.
Rewrite the esp32 with new code for beacon.
Raspberry PI:Once OS is boot upload the python code to RPi and Run it
Data will appear in cloud:
Comments