During the employee shortage in the just recent global pandemic I experienced an issue with working in my building at work and being aware of trucks that pull into our loading dock to deliver supplies. When I am at the other end of the building it is impossible for me to be aware of when trucks are arriving. Before there was a shortage of workers during the pandemic we had enough staff that someone was always around that area. This problem had to be fixed. Because awhile most delivery drivers would walk to the front of the building some would just leave with a note that they will attempt delivery again.
The Sony spresense is an awesome multi core low power board. After this project I am definitely utilizing it in a future robot project!
It works by using a Electret Microphone with auto audio gain to normalize the audio between the morning and evenings when outdoor noises are different.
The Edge impulse AI model that is running determines if an window of audio that was just heard was similar to the audio that was uploaded during the ai models training. If it is then a gpio pin is raised and the signal is received by the wifi board.
I decided to utilize the ESP8266 (ESP-12E) version so I didn't have to worry about messing with the hassle of a FTDI adapter this one only requires a common micro USB cable. it uses this code to connect to wifi
// be sure to include the ESP8266.h from the github page
#include "ESP8266.h"
#define SSID ""
#define PASSWORD "12345678"
#define HOST_NAME "https://maker.ifttt.com/trigger/{Event_Truck_notifyer}//with/key/ << your key here>"
#define HOST_PORT (80)
ESP8266 wifi;
void setup() {
//signal pin
pinMode(11, INPUT);
Serial.begin(115200);
Serial.print("setup begin\r\n");
//Wifi
wifi.begin(Serial2, 115200);
if (wifi.joinAP(SSID, PASSWORD)) {
Serial.print("Join AP success\r\n");
Serial.print("IP:");
Serial.println( wifi.getLocalIP().c_str());
} else {
Serial.print("Join AP failure\r\n");
}
if (wifi.releaseTCP()) {
Serial.print("release tcp ok\r\n");
} else {
Serial.print("release tcp err\r\n");
}
while(1);
}
void loop() {
uint8_t buffer[1024] = {0};
if (wifi.createTCP(HOST_NAME, HOST_PORT)) {
Serial.print("create tcp ok\r\n");
} else {
Serial.print("create tcp err\r\n");
}
char *hello = "GET / HTTP/1.1\r\nHost: https://maker.ifttt.com/trigger/{Event_Truck_notifyer}//with/key/ << your key here>";
if (digitalRead(11) == HIGH)
{
wifi.send((const uint8_t*)hello, strlen(hello));
}
}
Instead of developing a android app or maintaining a web service I decided to use if this then that (IFTT) This free web service has applets that let you send a email when a json request is made with the same event name.
For example search for the email applet trigger and select "Receive a web request"
Then create an event name fill out the subject and body so you can recognize the email notfication.
To finish I have my IFFT account email address set as my phone number. if you don't know your carriers email extension just open your text messaging app and type your email into the recipient field normally for phone numbers after a few minutes you should see your text arrive in your inbox. if you dont check your spam/junk mail folder that is where I found mine. then copy the address and change your email in IFTT account.
Now when your spresense sends a get request to IFTT like this you will receive a more reliable sms message.
https://maker.ifttt.com/trigger/{Event_Truck_notifyer}//with/key/ << your key here>
Comments