TrigBoard Ultimate System

From Kevin Darrah Wiki
Revision as of 09:41, 4 September 2019 by Krdarrah (talk | contribs)
Jump to: navigation, search

...Back to Projects:

TrigBoardUltimate.png

  • trigBoards are used in a normal way monitoring doors/windows/etc... or even modified to detect flooding, motion, force, or whatever. It does this and maintains long battery life due to its extremely low standby current. See the trigBoard page for more details. With the Ultimate system described here, this is the difference:
    • Uses ESPNow, which is an efficient point to point communication protocol. This means that when the trigBoards are triggered, they do not connect to the local WiFi network, but rather send an encrypted message to a gateway. It only takes ~1second to complete the transmission, which further improves battery life.
  • No WiFi here, instead a trigBoard is configured as an ESPNow "receiver". All trigBoards used for sensors are configured to transmit to this trigBoard "gateway". This is nice because the system does not rely on a WiFi network being up running and reliably connected to the internet.
  • Cellular using a Particle Boron module which does many things for the system here. This gives a nice reliable way to get the messages out without the need for WiFi. Also, these modules can be powered from USB power and/or a lithium battery. That means this is a battery backed system as well! Now, if the power goes out, the messages can still get out.
  • The cellular module sends the messages out with the use of Particle's cloud and Webhook integrations. This keeps the data payloads light and things super easy to setup and modify if needed.
  • Push Safer is used send push notifications out to any mobile device - this is the same service as described on the trigBoard page.
  • IO Adafruit is used for the monitoring devices, so they can subscribe to a value there. Any time it changes, these monitoring devices are notified and can alarm/buzz. In this system, an MP3 player with audio amplifier is used to speak out various messages based on which trigBoard was triggered - "The front door has opened" or "The garage door is still open"

Parts Needed

Get the trigBoard from my Tindie store - note that you will have to reprogram them to support this system. May want to also pickup a USB-Serial programmer from the store as well (in case you don't already have one). Check the trigboard page for more details on the board and where to get batteries and other accessories.

Tindie-larges.png

Particle Cellular Modules - I went with the Boron LTE module, but the Electron should work as well. Just note they do have a monthly data charge. It's pretty inexpensive though.


Code Versions

Tested everything on:

Arduino 1.8.9  ESP8266 2.4.2  Adafruit MQTT 0.20.3
Note later versions will likely work, this is just what was tested with

trigBoard Side

TrigBoardV7diagram.png

Everything here is the same as described on the trigBoard page, just that the code running on it is setup for ESPNOW

CODE RELEASE 7/23/19

trigBoard Gateway Side

This is the trigBoard used to receive all messages from trigBoards in the system over the ESPNow protocol. It passes these messages off to the cellular module over a UART connection. It also gets its power from the 3.3V supply on the particle module. The wiring is simple:

The UART connection:

Espnowtoboron.png

Then 3.3V power:

Espnowpowerfromboron.png

CODE RELEASE 7/23/19


Cellular Side

This code runs on the Particle Cellular module - just copy and paste this over to the web IDE https://build.particle.io/

String str1,str2;

void setup() {
    Serial.begin(115200);//debug
    Serial1.begin(9600);//from trigBoard
    
}

void loop() {
  if (Serial1.available() > 0) {// new data came in
     Serial.println("New Data");
     str1 = Serial1.readStringUntil('$');//that's the separator
     str2 = Serial1.readStringUntil('\0');
     sendData();
  }
}

void sendData(){
     unsigned long startConnectTime = millis();
     char pushMessage[50], pushName[50];
     str1.toCharArray(pushName, str1.length() + 1);
     str2.toCharArray(pushMessage, str2.length() + 1);
     Serial.println(str1);
     Serial.println(str2);
     
     String adaFruitData = "[{\"key\":\"house\", \"value\":\"";//change house to whatver you used in IO adafruit
     adaFruitData.concat(str1);
     adaFruitData.concat("\"}]");
     Particle.publish("homeSecurityPost", adaFruitData, PRIVATE, NO_ACK);//first send off to adafruit so our monitors can beep and do their thing
     
     String pushSaferPacket = "[{\"key\":\"t\", \"value\":\"";
     pushSaferPacket.concat(str1);
     pushSaferPacket.concat("\"},");
     pushSaferPacket.concat("{\"key\":\"m\", \"value\":\"");
     pushSaferPacket.concat(str2);
     pushSaferPacket.concat("\"}]");
     Particle.publish("pushSafer", pushSaferPacket, PRIVATE);//then send to push safer so we get the notifications on our mobile devices

     Serial.print(millis() - startConnectTime);
     Serial.println("ms to connect");
}

trigBoard Monitor Side

The monitor board connects to io.adafruit.com and subscribes to the variable that is changed by the cellular module. This is especially useful for getting notifications when a mobile device is not available (do not disturb mode)

The setup includes a trigBoard, a buzzer, MP3 player, and audio amplifier with speaker.

Screen Shot 2019-07-26 at 8.54.39 PM.png

CODE RELEASE 7/23/19