In a situation where farmers who suffer damage to rural crops due to wild animal invasions occur every year.
we thought about ways to reduce such damage and identify information on harmful animals around farms across the country to reduce farmers' damage.
To this end, IOT technology was grafted. UWB motion sensor, which can detect movement in hidden locations around the farm, detects the animal before it enters the field, and then generates a warning sound and warning light to the animal in real time to warn the animal and send warning message to the farmer. Appearance and disappearance information is notified.
2.OverviewTo perform demo scenario, we support on the following AE's:
- DETECTION_AE1(Uwb sensor, MLX90614 sensor, Led, Buzzer)
- main controller board is Adafruit Feather M0 WiFi Board
- DETECTION_AE2(Uwb sensor, MLX90614 sensor, Led, Buzzer)
- main controller board is feather M0 with wifi module
- CAMERA_AE3(ESP32-CAM, 28BYJ-48 motor)
- main controller board is ESP-32 CAM
- AnimalDetectionServer(node-js based webapp)
[ Hardware ]
- 3D Design
you can download 3d design file(step file) from github
- partial assembly
- full assembly
[BlockDiagram]
[scenario]
- When it detects an animal, it sends detection information (presence or no presence, object temperature) to the mobius server.
- The server notifies these information to the animal detection server, and the anmal detection server judges the detected value and sends a command to DETECTION_AE1, DETECTION_AE2 and CAMERA_AE3 to turn on the buzzer and the led, capture the photo.
[Resource Brower Tree]
- DETECTION_AE1
This creates buzzer, led, temp, uwb container and buzzer and led container register sub
- DETECTION_AE2
- CAMERA_AE3
This source code is modified version of nCube-Thyme-Arduino by KETI
(link : http://developers.iotocean.org/archives/module/ncube-thyme-arduino)
Installation
- Download Arduino IDE.
- Install Arduino IDE.
- Download code from Animal-IDS_IoT_oneM2M-Standard/animalDetectionNode/DETECT_AE1 at main · LaonRnD/Animal-IDS_IoT_oneM2M-Standard · GitHub
- Copy the lib file to Arduino IDE libraries folder.
“c:\Users[user name]\Document\Arduino\libraries”
- Download libraries from nCube-Thyme-Arduino/libraries at master · IoTKETI/nCube-Thyme-Arduino (github.com)
- Copy the libraries to Arduino IDE libraries folder.
“c:\Users[user name]\Document\Arduino\libraries”
- Board selection
This source code is modified version of Random Nerd Tutorials and nCube-Thyme-Arduino/libraries at master · IoTKETI/nCube-Thyme-Arduino (github.com)
(link :ESP32-CAM HTTP Post Images/Photos to Server | Random Nerd Tutorials )
Installation
- Download Arduino IDE.
- Install Arduino IDE.
- Download code from Animal-IDS_IoT_oneM2M-Standard/animalDetectionNode/CAMERA_AE3 at main · LaonRnD/Animal-IDS_IoT_oneM2M-Standard · GitHub
- Copy the lib file to Arduino IDE libraries folder.
“c:\Users[user name]\Document\Arduino\libraries” - Installing the ESP32 Board
a. Open the preferences window from the Arduino IDE. Go to Arduino > Preferences
b. Enter https://dl.espressif.com/dl/package_esp32_index.json into the “Additional Board Manager URLs” field Then, click the “OK” button:
c.Open boards manager. Go to Tools > Board > Boards Manager…
d.Search for ESP32 and press install button for the “ESP32 by Espressif Systems“:
e.Board selection.
f. To upload the code, follow the next steps:
Go to Tools > Board and select AI-Thinker ESP32-CAM.
Go to Tools > Port and select the COM port the ESP32 is connected to.
Then, click the upload button to upload the code.
f. When you start to see these dots on the debugging window as shown below, pressing RST button connecting GPIO 0 to GND and press the ESP32-CAM on-board RESET button to put your board in flashing mode.
After a few seconds, the code should be successfully uploaded to your board.3) How to execute animalDetectionServer
Installation
- Install Mobius Platform(mysql,Mosquitto server,mobius server)
install guide link : Mobius – OCEAN DEVELOPERS (iotocean.org)
- Download code from Animal-IDS_IoT_oneM2M-Standard/animalDetectionServer at main · LaonRnD/Animal-IDS_IoT_oneM2M-Standard (github.com)
- Install animalDetectionServer and mysql for demo and make users table
In this demo, we used two local server for Mobius server and
animalDetectionServer but mysql schema name is the same.
CREATE TABLE `mobiusdb`.`users` (
`idx` INT NOT NULL AUTO_INCREMENT,
`id` VARCHAR(45) NOT NULL,
`email` VARCHAR(45) NOT NULL,
`nick` VARCHAR(45) NOT NULL,
`password` VARCHAR(512) NOT NULL,
`salt` VARCHAR(512) NOT NULL,
`ae_name` VARCHAR(45) NOT NULL,
`photo_path` VARCHAR(100) NOT NULL,
`create_at` DATE NOT NULL,
PRIMARY KEY (`idx`)
);
D:\animalDetectionServer>npm install
- Run the Mobius platform . D:\animalDetectionServer>node server.js
- Power on the AE1,AE2,AE3
[Resource Tree ]
[Registration phase call flows ]
(DETECTION_AE1,DETECTION_AE2 and CAMERA_AE3)
AEs starts to request to Mobis server to create ae,cnt,sub and cin.
[Mobius server log]
DETECTION_AE1
(create ae)
POST : /Mobius?rcn=0
get_resource_from_url (gtMm-SkC2) - /Mobius?rcn=0: 0.433ms
security.check - SgVNM2PoQb: 0.115ms
insert_ae /Mobius/DETECTION_AE1: 2.837ms
###########################################
/Mobius [] express deprecated res.status("201"): use res.status(201) instead
mobius\responder.js:1699:22
{"rsc":"2001","dbg":"","ri":"POST-/Mobius-{\"rcn\":\"0\",\"fu\":2,\"rt\":3}"}
(create cnt)
POST : /Mobius/DETECTION_AE1?rcn=0
get_resource_from_url (Zmecy64kG1) - /Mobius/DETECTION_AE1?
rcn=0:1.799ms
security.check - s_bmKfPLG2: 0.009ms
insert_cnt /Mobius/DETECTION_AE1/update: 2.115ms
###########################################
/Mobius/DETECTION_AE1 []
{"rsc":"2001","dbg":"","ri":"POST-/Mobius/DETECTION_AE1-{\"rcn\":\"0\",\"fu\":2,
\"rt\":3}"}
POST : /Mobius/DETECTION_AE1?rcn=0
get_resource_from_url (wd9v1lchFN) - /Mobius/DETECTION_AE1?rcn=0:
0.329ms
security.check - Phy7TAImuH: 0.009ms
insert_cnt /Mobius/DETECTION_AE1/led: 3.853ms
###########################################
/Mobius/DETECTION_AE1 []
{"rsc":"2001","dbg":"","ri":"POST-/Mobius/DETECTION_AE1-{\"rcn\":\"0\",\"fu\":2,
\"rt\":3}"}
POST : /Mobius/DETECTION_AE1?rcn=0
get_resource_from_url (HcTJuhXNFL) - /Mobius/DETECTION_AE1?rcn=0:
0.266ms
security.check - eHSqcbfIX8: 0.012ms
insert_cnt /Mobius/DETECTION_AE1/temp: 1.626ms
###########################################
/Mobius/DETECTION_AE1 []
{"rsc":"2001","dbg":"","ri":"POST-/Mobius/DETECTION_AE1-{\"rcn\":\"0\",\"fu\":2,
\"rt\":3}"}
POST : /Mobius/DETECTION_AE1?rcn=0
get_resource_from_url (gynih3WcmD) - /Mobius/DETECTION_AE1?rcn=0:
0.346ms
security.check - kH-YLZSRA-: 0.013ms
insert_cnt /Mobius/DETECTION_AE1/buzzer: 1.37ms
###########################################
/Mobius/DETECTION_AE1 []
{"rsc":"2001","dbg":"","ri":"POST-/Mobius/DETECTION_AE1-{\"rcn\":\"0\",\"fu\":2,
\"rt\":3}"}
POST : /Mobius/DETECTION_AE1?rcn=0
get_resource_from_url (1ZMBLaZWmQ) - /Mobius/DETECTION_AE1?rcn=0:
0.275ms
security.check - n_RTRJfm7-: 0.008ms
insert_cnt /Mobius/DETECTION_AE1/uwb: 0.924ms
###########################################
/Mobius/DETECTION_AE1 []
{"rsc":"2001","dbg":"","ri":"POST-/Mobius/DETECTION_AE1-{\"rcn\":\"0\",\"fu\":2,
\"rt\":3}"}
(create sub)
POST : /Mobius/DETECTION_AE1/update?rcn=0
get_resource_from_url (2cvkfA2Yac) - /Mobius/DETECTION_AE1/update?rcn=0:
1.457ms
security.check - wpNHfv583pe: 0.54ms
insert_sub /Mobius/DETECTION_AE1/update/sub: 1.108ms
{"rsc":"2001","dbg":"","ri":"POST-/Mobius/DETECTION_AE1/update-{\"rcn\":\"0\",\"
fu\":2,\"rt\":3}"}
POST : /Mobius/DETECTION_AE1/led?rcn=0
get_resource_from_url (wRT8RloiAmq) - /Mobius/DETECTION_AE1/led?rcn=0:
2.03ms
security.check - 4TraysZiqBZ: 0.485ms
insert_sub /Mobius/DETECTION_AE1/led/sub: 1.255ms
{"rsc":"2001","dbg":"","ri":"POST-/Mobius/DETECTION_AE1/led-{\"rcn\":\"0\",\"fu\
":2,\"rt\":3}"}
POST : /Mobius/DETECTION_AE1/buzzer?rcn=0
get_resource_from_url (SHtCC-NIzPH) - /Mobius/DETECTION_AE1/buzzer?rcn=0:
1.431ms security.check - SPjW-AMCOX5: 0.44ms
insert_sub /Mobius/DETECTION_AE1/buzzer/sub: 1.066ms
{"rsc":"2001","dbg":"","ri":"POST-/Mobius/DETECTION_AE1/buzzer-{\"rcn\":\"0\",\"
fu\":2,\"rt\":3}"}
(create cin)
POST : /Mobius/DETECTION_AE1/uwb?rcn=0
get_resource_from_url (R1MWAAWjwpL) - /Mobius/DETECTION_AE1/uwb?rcn=0:
2.773ms
security.check - _ar81rohEuv: 0.751ms
insert_cin /Mobius/DETECTION_AE1/uwb/4-20230613040713960 -
M3h8BAVzSlM: 2.261ms
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ 1 0
0 3153600000
###########################################
/Mobius/DETECTION_AE1/uwb []
{"rsc":"2001","dbg":"","ri":"POST-/Mobius/DETECTION_AE1/uwb-{\"rcn\":\"0\",\"fu\
":2,\"rt\":3}"}
update_parent_by_insert /Mobius/DETECTION_AE1/uwb - pnJZLCU5JyC:
8.695ms
{ '/Mobius/DETECTION_AE1/uwb': { cni: 1, cbs: 1, st: 1 } }
POST : /Mobius/DETECTION_AE1/temp?rcn=0
get_resource_from_url (exJ59cn1o) - /Mobius/DETECTION_AE1/temp?rcn=0:
2.816ms security.check - jzWugT9wwd: 0.823ms
insert_cin /Mobius/DETECTION_AE1/temp/4-20230613040717467 - LMIj4aIiuP:
2.404ms
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
1 0 0 3153600000
###########################################
/Mobius/DETECTION_AE1/temp []
{"rsc":"2001","dbg":"","ri":"POST-/Mobius/DETECTION_AE1/temp-{\"rcn\":\"0\",\"fu
\":2,\"rt\":3}"}
update_parent_by_insert /Mobius/DETECTION_AE1/temp - 974T3EcndO:
6.942ms
{ '/Mobius/DETECTION_AE1/temp': { cni: 1, cbs: 16, st: 1 } }
==================================================================
DETECTION_AE2
(create ae)
POST : /Mobius?rcn=0
get_resource_from_url (i2_-UCEmo) - /Mobius?rcn=0: 0.282ms
security.check - lsQJy6X0MF: 0.011ms
insert_ae /Mobius/DETECTION_AE2: 1.661ms
########################################### /Mobius []
{"rsc":"2001","dbg":"","ri":"POST-/Mobius-{\"rcn\":\"0\",\"fu\":2,\"rt\":3}"}
POST : /Mobius/DETECTION_AE2?rcn=0
get_resource_from_url (bdltCvYsYd) - /Mobius/DETECTION_AE2?rcn=0: 2.014ms
security.check - QlQ0A6DmhX: 0.011ms
insert_cnt /Mobius/DETECTION_AE2/update: 1.721ms
###########################################
/Mobius/DETECTION_AE2 []
{"rsc":"2001","dbg":"","ri":"POST-/Mobius/DETECTION_AE2-{\"rcn\":\"0\",\"fu\":2,
\"rt\":3}"}
(create cnt)
POST : /Mobius/DETECTION_AE2?rcn=0
get_resource_from_url (MejmyasII) - /Mobius/DETECTION_AE2?rcn=0: 0.434ms
security.check - XzliEhI1YY: 0.01ms
insert_cnt /Mobius/DETECTION_AE2/led: 1.085ms
###########################################
/Mobius/DETECTION_AE2 []
{"rsc":"2001","dbg":"","ri":"POST-/Mobius/DETECTION_AE2-{\"rcn\":\"0\",\"fu\":2,
\"rt\":3}"}
POST : /Mobius/DETECTION_AE2?rcn=0
get_resource_from_url (vsqoK0hYAv) - /Mobius/DETECTION_AE2?rcn=0:
0.395ms security.check - aHGiMVx-rG: 0.009ms
insert_cnt /Mobius/DETECTION_AE2/temp: 1.26ms
###########################################
/Mobius/DETECTION_AE2 []
{"rsc":"2001","dbg":"","ri":"POST-/Mobius/DETECTION_AE2-{\"rcn\":\"0\",\"fu\":2,
\"rt\":3}"}
POST : /Mobius/DETECTION_AE2?rcn=0
get_resource_from_url (aGFsLvIP4y) - /Mobius/DETECTION_AE2?rcn=0:
0.937ms
security.check - MPEXFbwZNZ: 0.011ms
insert_cnt /Mobius/DETECTION_AE2/buzzer: 37.379ms
###########################################
/Mobius/DETECTION_AE2 []
{"rsc":"2001","dbg":"","ri":"POST-/Mobius/DETECTION_AE2-{\"rcn\":\"0\",\"fu\":2,
\"rt\":3}"}
POST : /Mobius/DETECTION_AE2?rcn=0
get_resource_from_url (ufLy47UqoH) - /Mobius/DETECTION_AE2?rcn=0:
0.425ms security.check - gEiyIFr4wq: 0.013ms
insert_cnt /Mobius/DETECTION_AE2/uwb: 1.292ms
###########################################
/Mobius/DETECTION_AE2 []
{"rsc":"2001","dbg":"","ri":"POST-/Mobius/DETECTION_AE2-{\"rcn\":\"0\",\"fu\":2,
\"rt\":3}"}
(create sub)
POST : /Mobius/DETECTION_AE2/update?rcn=0
get_resource_from_url (b0SbZhPl6b) - /Mobius/DETECTION_AE2/update?rcn=0:
1.562ms security.check - o3erA_sam9: 0.373ms
insert_sub /Mobius/DETECTION_AE2/update/sub: 1.323ms
{"rsc":"2001","dbg":"","ri":"POST-/Mobius/DETECTION_AE2/update-{\"rcn\":\"0\",\"
fu\":2,\"rt\":3}"}
POST : /Mobius/DETECTION_AE2/led?rcn=0
get_resource_from_url (E3DNpsl8dg) - /Mobius/DETECTION_AE2/led?rcn=0:
1.955ms security.check - lXvcQhPg2r: 0.534ms
insert_sub /Mobius/DETECTION_AE2/led/sub: 1.464ms
{"rsc":"2001","dbg":"","ri":"POST-/Mobius/DETECTION_AE2/led-{\"rcn\":\"0\",\"fu\
":2,\"rt\":3}"}
POST : /Mobius/DETECTION_AE2/buzzer?rcn=0
get_resource_from_url (DLoqae-iHo) - /Mobius/DETECTION_AE2/buzzer?rcn=0:
1.38ms security.check - 3xItDfUd1Vx: 0.333ms
insert_sub /Mobius/DETECTION_AE2/buzzer/sub: 0.725ms
{"rsc":"2001","dbg":"","ri":"POST-/Mobius/DETECTION_AE2/buzzer-{\"rcn\":\"0\",\"
fu\":2,\"rt\":3}"}
(create cin)
POST : /Mobius/DETECTION_AE2/uwb?rcn=0
get_resource_from_url (PA4-whJ2d8L) - /Mobius/DETECTION_AE2/uwb?rcn=0:
2.617ms security.check - TDiMflpru1u: 0.725ms
insert_cin /Mobius/DETECTION_AE2/uwb/4-20230613041443819 -
4dpSKb8bSmD: 1.569ms
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ 1 0 0
3153600000 ###########################################
/Mobius/DETECTION_AE2/uwb []
{"rsc":"2001","dbg":"","ri":"POST-/Mobius/DETECTION_AE2/uwb-{\"rcn\":\"0\",\"fu\
":2,\"rt\":3}"}
update_parent_by_insert /Mobius/DETECTION_AE2/uwb - iHXIOWJbxhO: 8.056ms
{ '/Mobius/DETECTION_AE2/uwb': { cni: 1, cbs: 1, st: 1 } }
POST : /Mobius/DETECTION_AE2/temp?rcn=0
get_resource_from_url (ZmDquvLlT44) - /Mobius/DETECTION_AE2/temp?rcn=0: 1.655ms
security.check - IWlTF2kU52P: 0.432ms
insert_cin /Mobius/DETECTION_AE2/temp/4-20230613041443998 - VoEVPUORJfp: 1.061ms
=====================================================================
CAMERA_AE3
(create ae)
POST : /Mobius?rcn=0
get_resource_from_url (LnLTRk0Vq) - /Mobius?rcn=0: 0.621ms
security.check - GNZdnTbPAV: 0.025ms
insert_ae /Mobius/CAMERA_AE3: 3.798ms
########################################### /Mobius []
{"rsc":"2001","dbg":"","ri":"POST-/Mobius-{\"rcn\":\"0\",\"fu\":2,\"rt\":3}"}
(create cnt)
POST : /Mobius/CAMERA_AE3?rcn=0
get_resource_from_url (2SjbytJzQw) - /Mobius/CAMERA_AE3?rcn=0: 3.456ms
security.check - Tw0B0Zbjq8: 0.018ms
insert_cnt /Mobius/CAMERA_AE3/update: 2.033ms
########################################### /Mobius/CAMERA_AE3 []
{"rsc":"2001","dbg":"","ri":"POST-/Mobius/CAMERA_AE3-{\"rcn\":\"0\",\"fu\":2,\"r
t\":3}"}
POST : /Mobius/CAMERA_AE3?rcn=0
get_resource_from_url (nETszie7X) - /Mobius/CAMERA_AE3?rcn=0: 0.965ms
security.check - DOLXxH-ZEL: 0.038ms
insert_cnt /Mobius/CAMERA_AE3/cam: 2.501ms
########################################### /Mobius/CAMERA_AE3 []
{"rsc":"2001","dbg":"","ri":"POST-/Mobius/CAMERA_AE3-{\"rcn\":\"0\",\"fu\":2,\"r
t\":3}"}
POST : /Mobius/CAMERA_AE3?rcn=0
get_resource_from_url (SL2nMUNUb1) - /Mobius/CAMERA_AE3?rcn=0: 0.648ms
security.check - 5eJ5qSFbxx: 0.016ms
insert_cnt /Mobius/CAMERA_AE3/motor: 1.897ms
########################################### /Mobius/CAMERA_AE3 []
{"rsc":"2001","dbg":"","ri":"POST-/Mobius/CAMERA_AE3-{\"rcn\":\"0\",\"fu\":2,\"r
t\":3}"}
(create sub)
POST : /Mobius/CAMERA_AE3/update?rcn=0
get_resource_from_url (K_Nkfc8u_s) - /Mobius/CAMERA_AE3/update?rcn=0: 3.209ms
security.check - 1VhJld31_a: 0.885ms
insert_sub /Mobius/CAMERA_AE3/update/sub: 2.317ms
{"rsc":"2001","dbg":"","ri":"POST-/Mobius/CAMERA_AE3/update-{\"rcn\":\"0\",\"fu\
":2,\"rt\":3}"}
POST : /Mobius/CAMERA_AE3/cam?rcn=0
get_resource_from_url (eK_MEIe-1) - /Mobius/CAMERA_AE3/cam?rcn=0: 5.132ms
security.check - 0c2mKH5wpO: 1.393ms
insert_sub /Mobius/CAMERA_AE3/cam/sub: 3.963ms
{"rsc":"2001","dbg":"","ri":"POST-/Mobius/CAMERA_AE3/cam-{\"rcn\":\"0\",\"fu\":2
,\"rt\":3}"}
POST : /Mobius/CAMERA_AE3/motor?rcn=0
get_resource_from_url (n8Ig3vtI5s) - /Mobius/CAMERA_AE3/motor?rcn=0: 4.528ms
security.check - efPZneEmJ3: 1.197ms
insert_sub /Mobius/CAMERA_AE3/motor/sub: 2.69ms
{"rsc":"2001","dbg":"","ri":"POST-/Mobius/CAMERA_AE3/motor-{\"rcn\":\"0\",\"fu\"
:2,\"rt\":3}"}
=======================================================================
[animalDetectionServer log] (ae_name :detection_server)
To receive uwb and temp contentInstance value of DTECTION_AE1 ,DETECTION_AE2 and cam contentInstance value of CAMERA_AE3, animalDetectionServer need to create ae and subscription.
To control buzzer and led in groups, animalDetectionServer need to create group(grled,grbuzzer)
D:\animalDetectionServer>node server
(create ae)
server is listening on port 3000
[REQUEST]
POST http://192.168.1.11:7579/Mobius
{
'm2m:ae': {
rn: 'detection_server',
api: 'app.company.com',
rr: 'true',
poa: [ 'http://192.168.1.15:3000' ]
}
}
[RESPONSE]
201
{
'm2m:ae': {
rn: 'detection_server',
ty: 2,
pi: '5-20230613040549198690',
ri: 'Sdetection_server',
ct: '20230613T045105',
lt: '20230613T045105',
et: '20250613T045105',
api: 'app.company.com',
rr: true,
poa: [ 'http://192.168.1.15:3000' ],
aei: 'Sdetection_server'
}
}
(create sub)
[REQUEST]
POST http://192.168.1.11:7579/Mobius/DETECTION_AE1/uwb
{
'm2m:sub': {
rn: 'sub',
nu: [ 'http://192.168.1.15:3000/Sdetection_server?ct=json' ],
nct: 2,
enc: { net: [Array] }
}
}
{
Accept: 'application/json',
'X-M2M-Origin': 'Sdetection_server',
'X-M2M-RI': 7300,
'Content-Type': 'application/json;ty=23'
}
[REQUEST]
POST http://192.168.1.11:7579/Mobius/DETECTION_AE1/temp
{
'm2m:sub': {
rn: 'sub',
nu: [ 'http://192.168.1.15:3000/Sdetection_server?ct=json' ],
nct: 2,
enc: { net: [Array] }
}
}
{
Accept: 'application/json',
'X-M2M-Origin': 'Sdetection_server',
'X-M2M-RI': 7906,
'Content-Type': 'application/json;ty=23'
}
[REQUEST]
POST http://192.168.1.11:7579/Mobius/DETECTION_AE2/uwb
{
'm2m:sub': {
rn: 'sub',
nu: [ 'http://192.168.1.15:3000/Sdetection_server?ct=json' ],
nct: 2,
enc: { net: [Array] }
}
}
{
Accept: 'application/json',
'X-M2M-Origin': 'Sdetection_server',
'X-M2M-RI': 9024,
'Content-Type': 'application/json;ty=23'
}
[REQUEST]
POST http://192.168.1.11:7579/Mobius/DETECTION_AE2/temp
{
'm2m:sub': {
rn: 'sub',
nu: [ 'http://192.168.1.15:3000/Sdetection_server?ct=json' ],
nct: 2,
enc: { net: [Array] }
}
}
{
Accept: 'application/json',
'X-M2M-Origin': 'Sdetection_server',
'X-M2M-RI': 3349,
'Content-Type': 'application/json;ty=23'
}
[REQUEST]
POST http://192.168.1.11:7579/Mobius/CAMERA_AE3/cam
{
'm2m:sub': {
rn: 'sub',
nu: [ 'http://192.168.1.15:3000/Sdetection_server?ct=json' ],
nct: 2,
enc: { net: [Array] }
}
}
{
Accept: 'application/json',
'X-M2M-Origin': 'Sdetection_server',
'X-M2M-RI': 7948,
'Content-Type': 'application/json;ty=23'
}
(create subscription)
[REQUEST]
POST http://192.168.1.11:7579/Mobius/DETECTION_AE1/uwb
{
'm2m:sub': {
rn: 'sub',
nu: [ 'http://192.168.1.15:3000/Sdetection_server?ct=json' ],
nct: 2,
enc: { net: [Array] }
}
}
{
Accept: 'application/json',
'X-M2M-Origin': 'Sdetection_server',
'X-M2M-RI': 6093,
'Content-Type': 'application/json;ty=23'
}
[REQUEST]
POST http://192.168.1.11:7579/Mobius/DETECTION_AE1/temp
{
'm2m:sub': {
rn: 'sub',
nu: [ 'http://192.168.1.15:3000/Sdetection_server?ct=json' ],
nct: 2,
enc: { net: [Array] }
}
}
{
Accept: 'application/json',
'X-M2M-Origin': 'Sdetection_server',
'X-M2M-RI': 944,
'Content-Type': 'application/json;ty=23'
}
[REQUEST]
POST http://192.168.1.11:7579/Mobius/DETECTION_AE2/uwb
{
'm2m:sub': {
rn: 'sub',
nu: [ 'http://192.168.1.15:3000/Sdetection_server?ct=json' ],
nct: 2,
enc: { net: [Array] }
}
}
{
Accept: 'application/json',
'X-M2M-Origin': 'Sdetection_server',
'X-M2M-RI': 8293,
'Content-Type': 'application/json;ty=23'
}
[REQUEST]
POST http://192.168.1.11:7579/Mobius/DETECTION_AE2/temp
{
'm2m:sub': {
rn: 'sub',
nu: [ 'http://192.168.1.15:3000/Sdetection_server?ct=json' ],
nct: 2,
enc: { net: [Array] }
}
}
{
Accept: 'application/json',
'X-M2M-Origin': 'Sdetection_server',
'X-M2M-RI': 3385,
'Content-Type': 'application/json;ty=23'
}
[REQUEST]
POST http://192.168.1.11:7579/Mobius/CAMERA_AE3/cam
{
'm2m:sub': {
rn: 'sub',
nu: [ 'http://192.168.1.15:3000/Sdetection_server?ct=json' ],
nct: 2,
enc: { net: [Array] }
}
}
{
Accept: 'application/json',
'X-M2M-Origin': 'Sdetection_server',
'X-M2M-RI': 7468,
'Content-Type': 'application/json;ty=23'
}
(create group)
[REQUEST]
POST http://192.168.1.11:7579/Mobius
{
'm2m:grp': {
rn: 'grbuzzer',
mid: [ 'Mobius/DETECTION_AE1/buzzer', 'Mobius/DETECTION_AE2/buzzer' ],
mnm: 10
}
}
[RESPONSE]
200
{"m2m:grp":{"pi":"5-20230613040549198690","ri":"9-20230613044711056709","ty":9,"ct":"20230613T044711","rn":"grled","lt":"20230613T044711","et":"20250613T044711","cr":"Sdetection_server","mt":0,"cnm":2,"mnm":10,"mid":["Mobius/DETECTION_AE1/led","Mobius/DETECTION_AE2/led"],"mtv":false,"csy":1}}
[REQUEST]
POST http://192.168.1.11:7579/Mobius
{
'm2m:grp': {
rn: 'grled',
mid: [ 'Mobius/DETECTION_AE1/led', 'Mobius/DETECTION_AE2/led' ],
mnm: 10
}
}
[RESPONSE]
201
{
'm2m:grp': {
rn: 'grbuzzer',
ty: 9,
pi: '5-20230613040549198690',
ri: '9-20230613045105418145',
ct: '20230613T045105',
lt: '20230613T045105',
et: '20250613T045105',
mid: [ 'Mobius/DETECTION_AE1/buzzer', 'Mobius/DETECTION_AE2/buzzer' ],
mnm: 10,
cr: 'Sdetection_server',
mt: 0,
csy: 1,
cnm: 2,
mtv: false
}
}
[RESPONSE]
201
{
'm2m:grp': {
rn: 'grled',
ty: 9,
pi: '5-20230613040549198690',
ri: '9-20230613045105419282',
ct: '20230613T045105',
lt: '20230613T045105',
et: '20250613T045105',
mid: [ 'Mobius/DETECTION_AE1/led', 'Mobius/DETECTION_AE2/led' ],
mnm: 10,
cr: 'Sdetection_server',
mt: 0,
csy: 1,
cnm: 2,
mtv: false
}
}
=============================================================
- Open your web broswer, input local server url (http://localhost:3000)
To test demo scenario, you need to sign up and sign in.
- To read sensor value(uwb status,object temperature) ,click Sensor Monitor
Whenever AE1, AE2 and AE3 sends sensor data of UWB ,temperature and
Camera to Mobius server, Mobius server sends them to
Animal Detection Server.
Every 3 seconds, you can see sensor data
[function to use]
In view/pages/header_.ejs, below function read sensor data.
function checkNotiFlag() {
$.ajax({
url: "http://192.168.1.15:3000/noti_data",
type: "get",
dataType:'json',
success: function(data){
const noti = JSON.stringify(data);
noti_flag1 = JSON.parse(noti).noti_flag1;
amb_temp1 = JSON.parse(noti).amb1;
obj_temp1 = JSON.parse(noti).obj1;
diff_temp1 = JSON.parse(noti).diff1;
noti_flag2 = JSON.parse(noti).noti_flag2;
amb_temp2 = JSON.parse(noti).amb2;
obj_temp2 = JSON.parse(noti).obj2;
diff_temp2 = JSON.parse(noti).diff2;
cam_state = JSON.parse(noti).noti_cam;
detect_flag = JSON.parse(noti).detect_flag;
//console.log(`cam_state :${cam_state}`);
//console.log(`noti_flag :${noti_flag1},${noti_flag2}`); //1 : no detect, 0 : detect
if((noti_flag1 == 0)& (noti_flag2 ==0)) detect_flag = 0;
console.log(err);
error: function(err) {
console.log(err);
}
});
}
- To control led, buzzer,camera click Sensor Control on the page
Whenever you press the control button,you can send control command to Mobius server by writing contentInstance ,then Mobius server publish the contentInstance to DETECTION_AE1,DETECTION_AE2,CAMERA_AE3.
[function to use]
In view/pages/header_.ejs, below function create contentInstance.
function WriteCin(aeId,cntName,value,mode) {
if(mode==0) {
//single control
url = "http://192.168.1.11:7579/Mobius/" + aeId +"/"+ cntNm + "?rcn=0";
resourceType = 4;
}
else if(mode==1) {
//group control
url = "http://192.168.1.11:7579/Mobius/" + "gr" + cntNm +"/" + "fopt";
resourceType = 4;
}
var representation = {};
if(cntName =="cam"){
representation = {
"m2m:cin":{
"con": val+'/'+ ip_addr +'/'+ user_id
}
};
} else {
representation = {
"m2m:cin":{
"con": val
}
};
}
var requestId = Math.floor(Math.random() * 10000);
fetch(url, {
method: "POST",
headers: {
"Accept": "application/json",
"X-M2M-Origin": aeId,
"X-M2M-RI": requestId,
"Content-Type": "application/json;ty="+resourceType,
},
body: JSON.stringify(representation)
}).then((response) => {
//console.log(response);
toggleImg(aeId,cntName,value);
});
}4. DEMO VIDEO
Comments
Please log in or sign up to comment.