Indonesia is a country located on the Ring of Fire, which causes a lot of volcanism to occur in Indonesia. The number of volcanic mountains that are still active in Indonesia makes it necessary to be aware of volcanic eruptions. In addition, there are many activities for nature lovers both domestically and abroad who are interested in climbing the active mountain. The lack of information about the conditions at the top of the mountain which includes some dangerous toxic gas activity and potential volcanic eruptions to climbers causes climbers not to know the actual conditions at the peak, so they cannot decide whether the climb is continued or not.
SolutionBy utilizing Lora for long-distance communication, I created a device that can monitor the condition of the top of the mountain. The device will capture some gases that can be dangerous to climbers and nearby residents. Thus the device immediately sends a signal to the device that will be brought by climbers or residents who install the device. The difference with the existing one is that early warning is only owned by the BMKG or referred to as a non-departmental government agency of meteorology, climatology, and geophysics in Indonesia. We are trying to extend it wider to all climbers or residents by using Lora helium technology.
How it works?
The device we made will be placed around the top of the mountain. By using a solar panel as power supply, The device Will be active standby for 24 hours. During standby, the gas sensor will continue to work to catch the noxious odor that surrounds the mountain top. When the device catches a suspicious or dangerous gas smell, it immediately sends a signal to the device that exists in climbers or residents around the mountain. The info from the device will give a dangerous warning and advises climbers or residents not to approach the mountain.
Process and Steps1. Read multichannel gas sensor
2. Check vibration sensor
3. Check Lora Connection
4. Design device case
Step 1 : Read multichannel gas sensorThe first step of this project is to try to collect the values from the multichannel gas sensor. Multichannel Gas Sensor V2 has 4 measuring units, each of them is sensitive to various kinds of gases, which means you are able to get four sets of data at the same time. And different sorts of gases can also be judged by these four sets of data. The gas sensor used in this module is based on MEMS technology and has the advantage of being in a small size with considerable measurement stability and is more suitable for qualitative than quantitative measurement.
The process to get a value from a multichannel gas sensor is very easy because on the official website there is a detailed explanation of how to do it. It is listed on the Grove - Gas Sensor V2 (Multichannel) explanation page, the Multichannel_Gas_GMXXX library is used on Arduino so that we can access and collect data from the sensor.
On the sensor there are four types of sensors that can be used in parallel, namely NO2 gas sensors, C2H5CH gas sensors, VOC gas sensors, and CO gas sensors. In this project, it will be used only to collect data on NO2 and CO gases which are dangerous gases emitted from volcanoes. C2H5CH gas will also be displayed as an additional parameter for climbers.
#include <Multichannel_Gas_GMXXX.h>
// if you use the software I2C to drive the sensor, you can uncommnet the define SOFTWAREWIRE which in Multichannel_Gas_GMXXX.h.
#ifdef SOFTWAREWIRE
#include <SoftwareWire.h>
SoftwareWire myWire(3, 2);
GAS_GMXXX<SoftwareWire> gas;
#else
#include <Wire.h>
GAS_GMXXX<TwoWire> gas;
#endif
static uint8_t recv_cmd[8] = {};
void setup() {
Serial.begin(9600);
// If you have changed the I2C address of gas sensor, you must to be specify the address of I2C.
//The default addrss is 0x08;
gas.begin(Wire, 0x08); // use the hardware I2C
//gas.begin(MyWire, 0x08); // use the software I2C
//gas.setAddress(0x64); change thee I2C address
}
void loop() {
uint8_t len = 0;
uint8_t addr = 0;
uint8_t i;
uint32_t val = 0;
val = gas.getGM102B(); Serial.print("GM102B: "); Serial.print(val); Serial.print(" = ");
Serial.print(gas.calcVol(val)); Serial.println("V");
val = gas.getGM302B(); Serial.print("GM302B: "); Serial.print(val); Serial.print(" = ");
Serial.print(gas.calcVol(val)); Serial.println("V");
val = gas.getGM502B(); Serial.print("GM502B: "); Serial.print(val); Serial.print(" = ");
Serial.print(gas.calcVol(val)); Serial.println("V");
val = gas.getGM702B(); Serial.print("GM702B: "); Serial.print(val); Serial.print(" = ");
Serial.print(gas.calcVol(val)); Serial.println("V");
delay(2000);
}
Step 2 : Check Vibration SensorThe next sensor to be checked is the vibration sensor. The sensors used is Analog piezoelectric vibration sensor with ceramic chip. This module is equipped with a ceramic vibration sensor which outputs an analog signal when vibration occurs. The sensor can measure vibrations of different strengths. Vibrations acting on the sensor generate a voltage signal depending on the strength of the vibration due to the piezoelectric effect. This allows you to monitor vibrations in your plant.
The program that will be used is a program to access analog data. This is because the sensor used to produce output in the form of analog data. The greater the vibration value, the greater the voltage value. And vice versa, the smaller the vibration, the smaller the voltage value.
int sensorpin = 0;
void setup() {
Serial.begin(115200);
pinMode(sensorpin, INPUT);
}
void loop() {
int datasensor = analogRead(sensorpin);
Serial.println(datasensor);
delay(5000);
}
Step 3 : Check Lora ConnectionFor this step, an experiment was conducted to connect two lora modules, Seeed Studio Grove LoRa-E5, between Wio Terminal and XIAO SAMD21. Seeed Studio Grove LoRa-E5 (STM32WLE5JC) Module is an easy-to-use wireless radio module that supports LoRaWAN protocol on the EU868 and US915 frequency. This module offers easy control by AT command via UART connection and features rapid prototyping with plug-and-play Grove interfaces. Typical applications include LoRaWAN sensor nodes, any wireless communication application, and IoT device testing and development.
Seeed Studio Grove LoRa-E5 uses ATTX serial communication to communicate with each other. This can be used to send sensor readings by XIAO SAMD21 to Wio Terminal. XIAO SAMD21 will read data from the multichannel gas sensor and vibration sensor. This data will be received by Wio Terminal and will be displayed on the tft screen.
- For XIAO SAMD21 (Transmiter)
#include <Arduino.h>
#include <SoftwareSerial.h>
#include <Wire.h>
SoftwareSerial e5(1, 2);
int data1=0;
int data2=0;
int data3=0;
int data4=0;
static char recv_buf[512];
static bool is_exist = false;
static int at_send_check_response(char *p_ack, int timeout_ms, char *p_cmd, ...)
{
int ch = 0;
int index = 0;
int startMillis = 0;
va_list args;
memset(recv_buf, 0, sizeof(recv_buf));
va_start(args, p_cmd);
e5.printf(p_cmd, args);
Serial.printf(p_cmd, args);
va_end(args);
delay(200);
startMillis = millis();
if (p_ack == NULL)
{
return 0;
}
do
{
while (e5.available() > 0)
{
ch = e5.read();
recv_buf[index++] = ch;
Serial.print((char)ch);
delay(2);
}
if (strstr(recv_buf, p_ack) != NULL)
{
return 1;
}
} while (millis() - startMillis < timeout_ms);
return 0;
}
static int node_send(uint32_t timeout)
{
static uint16_t count = 0;
int ret = 0;
char data[32];
char cmd[128];
memset(data, 0, sizeof(data));
sprintf(data, "%04X,%04X,%04X,%04X", data1, data2, data3,data4);
sprintf(cmd, "AT+TEST=TXLRPKT,\"5345454544%s\"\r\n", data);
ret = at_send_check_response("TX DONE", 2000, cmd);
if (ret == 1)
{
//send Airquality
Serial.print("Sent successfully!\r\n");
}
else
{
Serial.print("Send failed!\r\n");
}
data1++;
data2=data2+5;
data3=data3+10;
data4=data4+20;
return ret;
}
void setup(void)
{
Serial.begin(115200);
// while (!Serial);
e5.begin(9600);
uint16_t error;
char errorMessage[256];
Serial.print("ping pong communication!\r\n");
if (at_send_check_response("+AT: OK", 100, "AT\r\n"))
{
is_exist = true;
at_send_check_response("+MODE: TEST", 1000, "AT+MODE=TEST\r\n");
at_send_check_response("+TEST: RFCFG", 1000, "AT+TEST=RFCFG,866,SF12,125,12,15,14,ON,OFF,OFF\r\n");
delay(200);
}
else
{
is_exist = false;
Serial.print("No E5 module found.\r\n");
}
}
void loop(void)
{
if (is_exist)
{
//node_send_then_recv(2000);
node_send(2000);
delay(3000);
}
}
- For Wio Terminal Receiver
#include <Arduino.h>
#include "TFT_eSPI.h"
#include <SoftwareSerial.h>
SoftwareSerial e5(0, 1);
static char recv_buf[512];
static bool is_exist = false;
TFT_eSPI tft;
TFT_eSprite spr = TFT_eSprite(&tft); //sprite
static int at_send_check_response(char *p_ack, int timeout_ms, char *p_cmd, ...)
{
int ch = 0;
int index = 0;
int startMillis = 0;
va_list args;
memset(recv_buf, 0, sizeof(recv_buf));
va_start(args, p_cmd);
e5.printf(p_cmd, args);
Serial.printf(p_cmd, args);
va_end(args);
delay(200);
startMillis = millis();
if (p_ack == NULL)
{
return 0;
}
do
{
while (e5.available() > 0)
{
ch = e5.read();
recv_buf[index++] = ch;
Serial.print((char)ch);
delay(2);
}
if (strstr(recv_buf, p_ack) != NULL)
{
return 1;
}
} while (millis() - startMillis < timeout_ms);
return 0;
}
static int recv_prase(void)
{
char ch;
int index = 0;
memset(recv_buf, 0, sizeof(recv_buf));
while (e5.available() > 0)
{
ch = e5.read();
recv_buf[index++] = ch;
Serial.print((char)ch);
delay(2);
}
if (index)
{
char *p_start = NULL;
char data[32] = {
0,
};
int rssi = 0;
int snr = 0;
p_start = strstr(recv_buf, "+TEST: RX \"5345454544");
if (p_start)
{
spr.fillSprite(TFT_BLACK);
p_start = strstr(recv_buf, "5345454544");
if (p_start && (1 == sscanf(p_start, "5345454544%s,", data)))
{
data[16] = 0;
int data1;
int data2;
int data3;
int data4;
char *endptr;
char *endptr1;
char *endptr2;
char *endptr3;
char dataarray1[5] = {data[0], data[1],data[2], data[3]};
char dataarray2[5] = {data[4], data[5], data[6], data[7]};
char dataarray3[5] = {data[8], data[9], data[10], data[11]};
char dataarray4[5] = {data[12], data[13],data[14], data[15]};
data1 = strtol(dataarray1, &endptr, 16);
data2 = strtol(dataarray2, &endptr1, 16);
data3 = strtol(dataarray3, &endptr, 16);
data4 = strtol(dataarray4, &endptr1, 16);
spr.createSprite(100, 30);
spr.setFreeFont(&FreeSansBoldOblique12pt7b);
spr.setTextColor(TFT_WHITE);
spr.drawNumber(data1, 0, 0, 1);
spr.pushSprite(15, 100);
spr.deleteSprite();
spr.createSprite(150, 30);
spr.setFreeFont(&FreeSansBoldOblique12pt7b);
spr.setTextColor(TFT_WHITE);
spr.drawNumber(data2, 0, 0, 1);
spr.pushSprite(150, 100);
spr.deleteSprite();
spr.createSprite(150, 30);
spr.setFreeFont(&FreeSansBoldOblique12pt7b);
spr.setTextColor(TFT_WHITE);
spr.drawNumber(data3, 0 , 0 , 1);
spr.pushSprite(180, 185);
spr.deleteSprite();
spr.createSprite(100, 30);
spr.setFreeFont(&FreeSansBoldOblique12pt7b);
spr.setTextColor(TFT_WHITE);
spr.drawNumber(data4, 0, 0, 1);
spr.pushSprite(15, 185);
spr.deleteSprite();
Serial.print("data received displaying on the wio terminal");
Serial.print("\r\n");
}
p_start = strstr(recv_buf, "RSSI:");
if (p_start && (1 == sscanf(p_start, "RSSI:%d,", &rssi)))
{
String newrssi = String(rssi);
Serial.print(rssi);
Serial.print("\r\n");
}
p_start = strstr(recv_buf, "SNR:");
if (p_start && (1 == sscanf(p_start, "SNR:%d", &snr)))
{
Serial.print(snr);
Serial.print("\r\n");
}
return 1;
}
}
return 0;
}
static int node_recv(uint32_t timeout_ms)
{
at_send_check_response("+TEST: RXLRPKT", 1000, "AT+TEST=RXLRPKT\r\n");
int startMillis = millis();
do
{
if (recv_prase())
{
return 1;
}
} while (millis() - startMillis < timeout_ms);
return 0;
}
void setup(void)
{
tft.begin();
tft.setRotation(3);
Serial.begin(115200);
// while (!Serial);
e5.begin(9600);
Serial.print("Receiver\r\n");
tft.fillScreen(TFT_BLACK);
tft.setFreeFont(&FreeSansBoldOblique12pt7b);
tft.setTextColor(TFT_RED);
tft.drawString("NO2", 7 , 65 , 1);
tft.drawString("C2H5CH", 165 , 65 , 1);
tft.setFreeFont(&FreeSansBoldOblique12pt7b);
tft.setTextColor(TFT_RED);
tft.drawString("Vibration", 7 , 150 , 1);
tft.setFreeFont(&FreeSansBoldOblique12pt7b);
tft.setTextColor(TFT_RED);
tft.drawString("CO", 165 , 150 , 1);
tft.setFreeFont(&FreeSansBoldOblique18pt7b);
tft.setTextColor(TFT_WHITE);
tft.drawString("MON CHAN", 60, 10 , 1);
if (at_send_check_response("+AT: OK", 100, "AT\r\n"))
{
is_exist = true;
at_send_check_response("+MODE: TEST", 1000, "AT+MODE=TEST\r\n");
at_send_check_response("+TEST: RFCFG", 1000, "AT+TEST=RFCFG,866,SF12,125,12,15,14,ON,OFF,OFF\r\n");
delay(200);
}
else
{
is_exist = false;
Serial.print("No E5 module found.\r\n");
}
}
void loop(void)
{
if (is_exist)
{
node_recv(2000);
}
}
After all the codes have been uploaded, we can see the values of the harmful gases and the value of the vibration sensor on the Wio Terminal. Hikers can monitor real-time environmental conditions on the mountain by using this device.
I made two case for each different device using CAD Solidworks. before making a case for the device, first I will design some seeedstudio devices that are used so that the position and size of the box match the original.
then I will make a case for the device that we will put on the mountain. seen in the image below:
then the second design for a device that can be carried by climbers or residents. I will make this design as simple and attractive as possible. so I will make it with a model like a keychain. The design that I made is shown in the image below.
The next step is after the design is complete, it is continued by printing some parts using a 3d machine. To print 3d parts we can use Cura software or the like.
This the result of the 3D print.
Now we can see the result about the MonChan
Conclusions and future developments, namely the use of Lora will not only be used for gas and vibration detectors but like other disasters such as forest fires around mountains or the presence of wild animals
Comments