Difference between revisions of "TrigBoardV7"

From Kevin Darrah Wiki
Jump to: navigation, search
(Out of the Box Setup)
 
Line 1: Line 1:
 
...Back to [[Projects:]]
 
...Back to [[Projects:]]
  
 +
[[File:trigBoardv7.jpg|600px]]
 +
 +
The trigBoard is an IoT project that does one thing - it pushes you a notification triggered by a digital input.  Well, it's much more than that, but this is the inspiration.  I wanted to design a WiFi board that essentially sleeps most of its life, but when that door switch, flood sensor, motion sensor, etc.. gets triggered, I just want a notification immediately on my phone.  And that's about it... a perfect IoT device in the background doing its job.
 +
 +
= Release Version 7 =
 +
 +
[[File:trigBoardv7overhead.jpg|600px]]
 +
 +
<span style="color:red">Looking for Rev4?</span>  Go here [[TrigBoardV4]]
 +
 +
* Simple IoT development board that was designed to trigger "Push Notifications" on a smart phone/tablet based on a trigger event.
 +
* Unique low-power front-end to enable sub 1uA sleep current - uses a pulse to trigger wake-up, so even if door/window/etc is opened, the same ultra low currents can be maintained.  Compare to standard pull-up/down resistor based digital input designs with significantly higher leakage current. 
 +
* The board will wake itself up once an hour to check the battery voltage - if running low, a push notification is sent to warn the user.  This timer can be used to check other things as well - temperature changes, accelerometers, or other environmental sensors.
 +
* Based on ESP8266 WiFi Module (ESP-12S) - all source code is available for download and developed in the popular Arduino IDE. 
 +
* Battery Input can be any Lithium Polymer 3.7V - standard micro JST connector jack is used (please double check polarity),any of [https://www.adafruit.com/category/574 these] would work nicely.
 +
* Sensor input to trigger the "Wake Up" is a simple passive switch.  Typically a standard magnetic door/window switch is used and the board can be configured to wake on the "opening" (Normally Closed) or "closure" (Normally Open) of the contact.  Solder jumpers set this - Normally Closed is Default, so standard door/window switches wake the board up when opened. 
 +
* Auto-Reset circuitry built-in, so now with an FTDI USB-Serial Converter, just click "upload" and the board starts programming.  Note that this was designed to work with this [[The_USB_to_Serial_Converter:]]
 +
* Expansion pads broken out, so integration with custom projects is possible. 
 +
* Dimensions only 0.8" x 1.6 "  (20.32mm x 40.64mm)
 +
 +
'''trigBoard mentions'''
 +
 +
* [https://hackaday.com/2018/11/13/low-energy-esp8266-based-board-sleeps-like-a-log-until-triggered/ Hackaday]
 +
* [https://www.youtube.com/watch?v=usyaBK4z5CA Andreas Spiess]
 +
* [https://blog.hackster.io/the-trigboard-is-a-low-power-iot-platform-designed-around-the-esp8266-fffa6e267019 Hackster.io] [https://blog.hackster.io/esp8266-based-trigboard-pushes-notifications-when-digitally-triggered-39e8cc91be45  and again]
 +
* [https://blog.tindie.com/2018/09/trigboard-small-iot-platform/ The Tindie Blog]
 +
 +
 +
[[File:trigBoardV7diagram.png|800px]]
 +
 +
==  Projects ==
 +
 +
[https://www.youtube.com/watch?v=a2MiyFGWnU0&t=268s Andreas Spiess' Weather Forecaster]
 +
 +
[[TrigBoardWaterDetect]] Water Detector for leaks, floods, rain, etc...
 +
 +
[[WeatherBoard]] BME280 and LMT01 Weather Station
 +
 +
[[EPaperBoard]] E-Paper Display
 +
 +
[[CameraBoard]] Camera System with Arducam
 +
 +
[https://youtu.be/cD4gDeQ5jBI Clear Sky Indicator for Astronomy] Project to connect to https://openweathermap.org to get weather details, then indicate if sky is clear or not.
 +
 +
[[TrigBoardStillOn]] Simple Hack to see check if digital input is still open using the timer. Did you leave the door/lock or whatever open?
 +
 +
[[TrigBoardMotion]] Waking the trigBoard up with motion using a simple PIR sensor.
 +
 +
[[TrigBoardPressure]] Wake the trigBoard from a pressure pad (FSR sensor)
 +
 +
[[TrigBoardLightDetec]] Wake the trigBoard up from Light - simple light sensor circuit
 +
 +
== Purchase trigBoard ==
 +
[[File:tindie-larges.png|link=https://www.tindie.com/stores/kdcircuits]]
 +
 +
== Out of the Box Setup  ==
 
{{#evt:
 
{{#evt:
 
service=youtube
 
service=youtube
|id=https://youtu.be/CD-jmSkM3d4
+
|id=https://youtu.be/CdTLs8dbHYQ
 +
|dimensions=560x315
 +
}}
 +
 
 +
The setup for getting the trigBoard installed is very easy.  The base firmware that comes loaded on the board is ready to work with PushSafer.  This makes it so easy to get up and running with the trigBoard. I switched from Pushbullet on the V4 board due to reliability and compatibility issues.  Push Safer also has more attractive billing options.  Instead of a monthly fee, now you just pay for the amount of notifications you want... when they run out, you just buy more.  Best part is that they're super cheap. 
 +
 
 +
[[File:PushSafer.png|400px|link=https://www.pushsafer.com]]
 +
 
 +
'''Push Safer Setup'''
 +
 
 +
# Go here: https://www.pushsafer.com and register.
 +
# Download the mobile app for iOS or Android, and sign in.  You can also setup push notifications for your computers as well by installing the browser plugins. You may even like getting the desktop notifications better.
 +
# Go back to dashboard and copy your private key
 +
 
 +
[[File:pushSaferKey.png|600px]]
 +
 
 +
Notable Push Safer Features:
 +
* Ability to send test messages from the dashboard
 +
* Can "Mute" devices by toggling the Status switch in the dashboard
 +
* Guest Devices by just scanning a QR code, then can enable/disable them as needed.  Like for home security, you could give to a family member while you're out on vacation. 
 +
* Great support and a lot of exciting development! 
 +
* There are many more useful features in there as well... feel free to experiment!
 +
 
 +
'''trigBoard Setup'''
 +
 
 +
: '''Battery'''
 +
:: '''Battery Options''' - You will need a 3.7V Lithium Battery - fully charged will be 4.2V.  The battery connects to the trigBoard using a standard micro-JST PH 2mm connector.  Any of '''[https://www.adafruit.com/category/574 these from Adafruit]''' would work.  I typically use a ~1000mAh battery on all my doors/windows... that yields very long battery life.  I'm also experimenting with [https://www.ebay.com/itm/112677378893 these from eBay]  '''<span style="color:red">CHECK POLARITY!</span>''' This can damage the board, so check the drawing above and also the + and - symbols on the board match your battery.
 +
 
 +
Choosing the right battery for the job
 +
{{#evt:
 +
service=youtube
 +
|id=https://youtu.be/w_tNCdPDMmA
 
|dimensions=560x315
 
|dimensions=560x315
 
}}
 
}}
  
The trigBoard is an extremely low power platform for the ESP32 WiFi+Bluetooth Module.  This board is perfect for battery powered applications, due to it's single digit uA standby current draw '''~1.5uA''' with a 3V battery input.  To give an idea as to how low this current draw is, a cheap smoke detector pulls about 7uA. This board was initially designed to be the ideal IoT device - a WiFi connected battery powered monitoring solution for dry contacts (door/window sensors), where a push notification is immediately sent when the contact state has changed.  The ultra low standby current does not change regardless if the contact remains in the closed/opened state (this is part of the secret sauce in the trigBoard design).  But of course, the trigBoard is a playground of low power features, so it can easily be adapted to a unique monitoring application:
+
:: '''Charging''' - This version of the board does not have a charge port, so you might want to pick something like this up as well https://www.adafruit.com/product/1304
* Many battery options, with input voltage range from '''1.8-5V'''. Great for two AAA batteries or even a rechargeable Lithium cell at 4.2V.  Reverse polarity protection built in, so no issues if batteries are plugged in backwards. 
+
: '''Sensors'''
* Multiple wake sources all configurable through software '''(no solder jumpers)'''
+
:: '''Dry Contact Switch''' - magnetic door/window sensors like [https://www.amazon.com/dp/B00LYCUSBY/ref=sxbs_sxwds-stvp_1?pf_rd_m=ATVPDKIKX0DER&pf_rd_p=3341940462&pd_rd_wg=Nbhph&pf_rd_r=0DBSJ3Q6TNF9BDV32CXG&pf_rd_s=desktop-sx-bottom-slot&pf_rd_t=301&pd_rd_i=B00LYCUSBY&pd_rd_w=98468&pf_rd_i=magnetic+door+sensor&pd_rd_r=83aa0c34-3901-4f4f-bf19-1fc2ae849c87&ie=UTF8&qid=1512593794&sr=1 these]
* Dry contact trigger input supporting '''BOTH''' contact '''OPEN''' and contact '''CLOSE''', but configurable for either or both, so if for example a garage door was monitored, a push notification could go out for when the garage opens AND when the garage closes.   
+
::'''Connectors''' - They are "Micro JST" JST_2PIN-SMT-RA, I go with [https://www.amazon.com/gp/product/B0167X4D9M/ref=oh_aui_search_detailpage?ie=UTF8&psc=1 these].  It would be nice to find magnetic switches with the JST connectors already soldered on..Check [https://iotexpert.com/2018/01/18/jst-connector-crimping-insanity/ this] guide out on making your own cables.
* The board utilizes an actual '''RTC (Real Time Clock)'''.  This is a high quality RTC, so accurate wake times can be configuredThe timer wakes the board up at the configured time - for example once and hour, then checks the battery voltage and if low, will send out a push notification.  The timer can also be used to check the current status of the contact and send out a notification, so in the garage door example, the board can be configured to not only send out notifications when the door opens/closes, but also when the garage is left open for some period of time after the door was opened.
+
::'''Jumpers''' - By default, the board is configured to "Wake" when the contact opens.  This is the normally closed mode of operationIf it is desired to wake on a closure of the contact, then see the diagram above and desolder the NC solder jumpers and cut them open with a knife (on this board, I made the jumpers with tiny traces) and solder across the NO jumpers (make sure they are closed).  That default NC configuration was chosen because the magnetic door/window sensors are closed when the magnet is in proximity, so the trigBoard wakes up when the door/window is opened.  
* Wake button on board can also be used to send out a push notification.
+
:'''<span style="color:red"> IMPORTANT NOTE ABOUT TIMER</span>''' - The trigBoard performs a calibration on the built-in timer on power-up.  The sensor input must be closed when powered up, otherwise the 1hr timer will not be accurate.  You basically just need to have the door/window closed before the battery is plugged in. Sensor should be closed if using NC jumpers, Open if NO jumpers.  '''Change Timer Wakeup Interval''' By default, this is set to 1hour - see the diagram above for where the timer resistor is located on trigBoardYou can replace this resistor with any value you want to change the wakeup time - see the TPL5111 datasheet for resistor values: http://www.ti.com/lit/ds/symlink/tpl5111.pdf
* Unused pins from ESP32 broken out for future expansion and in-line to fit breadboards - developer friendly. 
+
 
* Base Firmware supports many Push Notification service options like '''Pushsafer''', '''Pushover''', and '''IFTTT'''And even develop a custom solution with '''MQTT''' and '''UDP''' messaging.  Any of these can be enabled, or even multiple. For example, the notifications can go out through Pushover, then a secondary backup notification can go through MQTTOr even a notification though Pushsafer, then turn the lights on in the house with IFTTT. The possibilities are endless with this.
+
'''Powering Up'''
* Configuration software gives full control over the board parameters and settings - in a nice clean easy to use '''GUI through Google Chrome''' and a Bluetooth connection to the ESP32. 
 
  
= Latest Release Version 8 =
+
Before mounting the trigBoard in it's final location, a simple bench test is helpful to make sure everything is setup.  With the battery and sensor plugged in, simply press the "Wake" button on the board.  You should see the LED turn on, then turn off.  This is normal, because the firmware checks to see if the WiFi settings are configured, and if not, it just goes back to sleep.  To enter in the WiFi settings, you have to press and hold the "Wake" button until you see the LED flash, then let go.  The LED should remain solid at this point.  You now have 2 minutes to configure the trigBoard.  From a computer (easier) or mobile device, go to your WiFi settings and search for available networks.  Connect to the "trigBoard" network.
 +
A captive portal window should automatically pop up:
  
[[File:v8Pinout.png|1000px]]
+
[[File:trigBoardcaptive.png|600px]]
  
For expansion - [https://randomnerdtutorials.com/esp32-pinout-reference-gpios/ randomnerdtutorials.com ] has a great guide on what pins do what. Just be careful with the pins marked above with the hazard symbolThese pins can be used, but just make sure that the mode they're configured for does not interfere with the normal operation of the board.  For example, the GPIO12 cannot be held high during boot up, or the ESP32 will never fully boot up and execute the codeAlso, on board is an RTC using the I2C port, so that same port can be used for other I2C devices, just as long as there's no address conflict.   
+
If you don't see a captive portal, you may need to open your browser and attempt to load a website.  Try to google something.  If you still don't see the portal, then you can try connecting directly to the board - in the browser, type in 192.168.4.1 in the address boxThat should connect you to the portal.  If you're still having problems, try disconnecting the battery from the board and allow the trigBoard SSID to fade away from the available networks on your computerThen plug the battery back in and try againSeems that on windows this may take more than one try.  I've also seen issues where the computer defaults to the ethernet connection when the WiFi network does not have an internet service.  If you think you're having this problem, just unplug the ethernet cable from your computer.   
  
'''trigBoard Pin Usage''At the core of the trigBoard, it's just a tricked out ESP32 development board with some incredible low power capabilityPower is actually removed from the ESP32 in order to accomplish the single digit uA standby current. This is important to note since the 3.3V rail is controlled by the wake circuitryIf needed, the base firmware can be completely overwritten by whatever custom application that fits the needs of the userThese are the pins used by the wake circuitry on the trigBoard, which can be used by the user for the custom application:
+
Click configure, and select the network that you trigBoard to use and enter in the password.  You'll now see where you want to enter in the private Push Safer key. Then you can give the board a name, and a trigger messageOnce that's entered in, click Save and you're all done! Once you click save, watch the LED on the trigBoardIt should start '''flashing''' quickly, indicating that the settings were saved and that it was able to connect to that networkThen, to test, just press the wake button for about a second, or use the sensor switch input.  If all was set up properly, you should get a notification!
  
::'''IO36''' AINPUT  Battery Pin for analog measurements of the battery voltage<br>
+
[[File:configWifimanager.png|600px]]
::'''IO0''' OUTPUT  LED pin - drive low to turn LED ON, but be careful with this pin, since also used by the auto reset circuitry.<br>
 
::'''IO16''' OUTPUT  Power Latch Pin - this pin can be driven high to keep power latched to the ESP32.  When the board wakes up, this pin is driven HIGH immediately to keep power applied while the wake source is determined and unlatched.  When the board is ready to go back to sleep, this pin can be written LOW. <br>
 
::'''IO17''' OUTPUT  Kill Power Pin or UnLatch Pin - The sensor input utilizes two latches for the normally open/closed inputs.  When the board wakes, these latch inputs can be read in, then unlatched with this pin by writing it HIGH. <br>
 
::'''IO18''' INPUT    Contact Opened Latch Pin - If low, the sensor input has got from closed to open.<br>
 
::'''IO19''' INPUT    Contact Closed Latch Pin - If low, the sensor input has got from open to closed.<br>
 
::'''IO23''' INPUT    Contact Status Pin - real time status of the contact - HIGH = Contact is OPEN, LOW = Contact is CLOSED<br>
 
::'''IO27''' INPUT    Wake Button Pin - LOW = Button was pressed<br>
 
::'''IO21 & IO22''' Used by the RTC at address 0x51<br>
 
  
== Purchase trigBoard ==
+
* If you don't see a flash, the board has failed to connect to your WiFi hotspot.  For testing purposes, try reconfiguring to another hotspot, like your phone.  That will at least help determine where the problem is. 
v8 to be ready soon...  
+
* If you get the blink, but then when waking the board, it goes to sleep after 5 seconds, with no notification, the board may be having a hard time connecting to your hotspot within 5seconds.  You can extend this timeout in the code.  Go to the provisioning tab and to this line:
 +
if (millis() - startedAt > 5000)// not there after 5 seconds, let's kill it
 +
 
 +
== Base Firmware ==
 +
 
 +
Note! the board is preloaded with the base firmware out-of-the-box, but if you want to develop/modify your own firmware, this section will go through the steps for getting the base code to compile.  Then you can develop your own code to run on the trigBoard!!
 +
 
 +
Base Firmware Downloads:
 +
[https://kevindarrah.com/micro/Pusher/trigBoardReleaseV7_12_16_18.zip Arduino Code 12/16/18]
 +
[https://kevindarrah.com/micro/Pusher/trigBoardReleaseV7_12_16_18.ino.adafruit.bin Bin File for OTA or Command Line programming]
 +
First Release
 +
Tested on Arduino v1.8.8, ESP core v2.4.2, WiFi Manager v0.14.0, Arduino JSON v5.13.4
 +
[https://kevindarrah.com/micro/Pusher/pushsafer-arduino-library-master.zip Archive of PushSafer Library I use]
 +
 
 +
[https://kevindarrah.com/micro/Pusher/trigBoardReleaseV7_1_11_20.zip Arduino Code 1/11/20]
 +
NOTE: All boards shipped with 12/16/18 code base, but if you want to compile and modify code, you should start with this 1/11/20 code.  There have been many changes to the ESP core and other libraries, so this can successfully compile and upload at these versions:
 +
Arduino v1.8.10, ESP Core v2.6.3, Wifi Manager v0.15.0, Arduino JSON v6.13.0 and latest Push Safer Lib, [https://kevindarrah.com/micro/Pusher/pushsafer-arduino-library-master-2.zip Archive HERE]
 +
 
 +
Base Firmware Developed on Arduino IDE - can download [https://www.arduino.cc/en/Main/Software Here] or [https://www.arduino.cc/en/Main/OldSoftwareReleases#previous Here for previous versions]
 +
 
 +
Then you'll find that the code does not compile and that's because you need several libraries and the board manager installed.  Here's what you need:
 +
 
 +
First, go to File>>Preferences and add this URL to to the "Additional Boards Manager URL". http://arduino.esp8266.com/stable/package_esp8266com_index.json
 +
 
 +
[[File:BoardsManagerURLnewCore.png|600px]]
 +
 
 +
Now, the ESP8266 boards will be available for installation.  Go to Tools>>Board>>Boards Manager...  Search for ESP8266, and go ahead and click install.
 +
 
 +
[[File:ESP8266Install.png|600px]]
 +
 
 +
After the boards are installed, you can select any of the ESP8266 boards out there from the Board Selection.  For the trigBoard, I have been using the Adafruit Huzzah,  here are my settings.  Note that I always upload as fast as possible:
 +
 
 +
[[File:trigHuzzahSettings.png|600px]]
 +
 
 +
NOTE!! The auto-reset circuitry may need a longer reset pulse, so try this if you're getting upload errors:
 +
 
 +
[[File:progSettings.png|600px]]
 +
 
 +
Next, you'll need to install the specific Arduino Libraries I'm using in the base code.  The first one is is the [https://github.com/tzapu/WiFiManager WiFi Manager by tzapu] - the easiest way to install the library is to go to Sketch>>Include Library>>Manage Libraries. Then type in WIFImanager.  Go ahead and install the library.
 +
 
 +
[[File:WiFiManager.png|600px]]
 +
 
 +
Do the same for the [http://arduinojson.org/ Arduino JSON library by Benoit Blanchon] - can just search for JSON.
 +
 
 +
[[File:ArduinoJSON.png|600px]]
 +
 
 +
We're also using the Push Safer library to keep things easy.  You can get that here: https://github.com/appzer/pushsafer-arduino-library
 +
 
 +
[[File:pushsaferGit.png|600px]]
 +
 
 +
Download that zip file, then head over to the Arduino IDE, and add zip library:
 +
 
 +
[[File:addZipLibrary.png|600px]]
 +
 
 +
Then that should be it - the other libraries are automatically installed with the ESP8266 board manager. 
 +
 
 +
See the "Testing and Programming" section below for information on loading the code over a wired USB-Serial connection.  The other option is to load code wirelessly "OTA - Over the Air". In the "trigBoard Operation" section this is shown.
 +
 
 +
== Programming ==
 +
 
 +
{{#evt:
 +
service=youtube
 +
|id=https://youtu.be/5uLtjMjbT08
 +
|dimensions=560x315
 +
}}
 +
Note that the USB-Serial Converter that I designed is known to work - other versions of it may not. Here is the wiki page for the USB-Serial Board: [[The_USB_to_Serial_Converter:]], and can be purchased here: https://www.tindie.com/products/13817/
 +
 
 +
The OTA link to upload the bin file: '''http://trigboard.local/update'''
 +
 
 +
[[File:trigBoardv7programmer.jpg|560px]]
 +
 
 +
Upload bin file via command line - [https://www.kdcircuits.com#contact contact me] if modified version is needed
 +
{{#evt:
 +
service=youtube
 +
|id=https://youtu.be/Lwpxrq9v1Yw
 +
|dimensions=560x315
 +
}}
 +
 
 +
== Schematic ==
 +
[[:File:trigBoardV7.pdf]]
 +
 
 +
[[File:trigV7SCH.png|1000px]]
 +
 
 +
== Tutorials/Walkthroughs ==
 +
 
 +
[https://youtu.be/HdHzxM6fEig V7 Hardware Auto Reset Circuit]
 +
 
 +
[https://youtu.be/TSbEN4bdt7I V4 Hardware explanation - low power trigger and timer circuit]
 +
 
 +
== Mechanical ==
 +
 
 +
Autodesk link to 3D viewer (you can download step file): https://a360.co/2EIjWEe
 +
 
 +
[[File:Screen Shot 2019-01-23 at 12.55.40 AM.png|200px]]
 +
 
 +
== Rev 4 Compatibility ==
 +
 
 +
Everything is pretty much the same as Rev 4, but if you have code running on the Rev 4 and want to program that on a Rev7, you will have to change how it measures the battery voltage.  I changed the voltage divider resistors:
 +
 
 +
[[File:rev7batMeas.png|400px]]
 +
  batteryVoltage = (4 - 3.5)/(712 - 621) ;
 +
  batteryVoltage = analogRead(A0) * batteryVoltage + (4 - batteryVoltage * 712);
  
[[File:tindie-larges.png|link=https://www.tindie.com/stores/kdcircuits]]
+
== Expansion ==
  
== Out of the Box Setup  ==
+
You can design your own "mini" boards to pair up with the trigBoard - soldering wires to the board works, or even pluggable type connectors like [https://www.digikey.com/product-detail/en/mill-max-manufacturing-corp/328-10-105-40-020001/ED10192CT-ND/9490853 these] and [https://www.digikey.com/product-detail/en/mill-max-manufacturing-corp/835-43-005-40-030001/ED10188CT-ND/9490849 these]. (Thanks Daniel B for the tip!)
  
The trigBoard v8 ships preloaded with base firmware, so it's very easy to get up and running.
+
[[File:expansionTrigBoard.jpg|300px]]
  
# '''Hardware Setup'''  All that's needed here is a battery and a dry contact used for triggeringBoth connectors on the board are standard JST PH 2.0mm
+
== Disclaimer ==
#* '''Battery Selection''' A good capacity for the trigBoard is 500-1000mAh, but this depends on how often the board will be triggered.  Any of these Lithium batteries would work from [https://www.adafruit.com/category/574 Adafruit]. Or two AA or AAA batteries would work, with a holder like [https://www.adafruit.com/product/4191 this]
+
I'm just a guy who designs boards, so I'll try my best to support you as much as I can and provide tutorials as I have time for.  Every board that is sold has been functionally tested, so that they can be programmed, the sleep current is right, they can be woken up, the battery voltage measurement is "close", and active current is consistent with a working boardAlso, these boards are for educational, hobbyists, DIYer, maker, and development use onlyIf you are interested in working this board into your product, please [http://www.kdcircuits.com/#contact contact me] for more information
#* '''Sensor''' These door sensors from [https://www.amazon.com/gp/product/B00LYD3Y6Y/ref=ppx_yo_dt_b_asin_title_o02_s01?ie=UTF8&psc=1 Amazon] work really nice, especially since they can be wired to directly.  This allows for any wire length that is needed.  The PH2.0 cable can also be found on Amazon like [https://www.amazon.com/gp/product/B07Q39Z7SS/ref=ppx_yo_dt_b_asin_title_o02_s00?ie=UTF8&psc=1 these] if it has to be a little longer.  Note that the polarity of the sensor input does not matter.
 
#'''Push Notification Service''' The trigBoard's base firmware supports various services, including [https://www.pushsafer.com/ Pushsafer], [https://pushover.net/ Pushover], [https://ifttt.com/ IFTTT], and can even send messages over MQTT and UDP.  Before doing anything with the TrigBoard, the service must be chosen and ready to go.  Here's what's needed for each of them:<br>
 
#:[[File:PushSafer.png|400px|link=https://www.pushsafer.com]]<br>
 
#*[[PushsaferSetup | PUSHSAFER SETUP INSTRUCTIONS]] - Pushsafer is a great service for getting push notifications to your mobile devicesThere are some nice features built in, like allowing for guest devices to be added/removed.  This works nicely for a vacation setup where a someone may need to temporarily monitor a property.  The notifications are purchased in bulk, but very inexpensive.<br>
 
#:[[File:pushoverlogo.png|400px|link=https://pushover.net/ Pushover]]<br>
 
#*[[PushoverSetup | PUSHOVER SETUP INSTRUCTIONS]] - Pushover is similar to Pushsafer in that it's a good reliable service for getting push notifications to your devices when there's an event at the trigBoards.  The app is a one time purchase per device with a monthly allowance of 7500 notifications.  That should be plenty for most applications.<br>
 
#:[[File:IFTTTlogo.png|400px|link=https://ifttt.com/ IFTTT]]<br>
 
#*[[IFTTTSetup | IFTTT SETUP INSTRUCTIONS]] - this one is pretty obvious, but go check out the IFTTT website to see what all can be accomplished with this service.  This alone can be used for the push notification, but it can tend to not be as fast as Pushsafer/Pushover.  This is great for secondary alerts like sending emails, text messages, voice calls, home automation (lights on/off), publish to a google sheet, etc... there's a lot here<br>
 
#*[[UDPSetup | UDP SETUP INSTRUCTIONS]] - more for the advanced user, but if you're looking to take this to the next level, UDP messaging allows for a tight and fast network for getting the notifications outBasically, a central gateway would be setup acting as a UDP server, where all of the trigBoards communicate back to.  This is great for building a secure standalone trigBoard network that's battery backed and could also allow for a cellular connection.<br>
 
#*[[MQTTSetup | MQTT SETUP INSTRUCTIONS]] - similar to UDP, but if you're using the raspberry pi or something to run your home automation system, and it's all based on MQTT messaging, then this will work great for that.  This was added in at the request of support for Home Assistant (not tested though)<br>
 
#'''The Configurator''' There is a lot to configure with the trigBoard, so what better name than "Configurator"?  '''THIS MUST BE RUN FROM GOOGLE CHROME ON Windows 10, Mac OS, Linux and must have BLUETOOTH equipped machine and it turned ON'''<br>
 
#:Latest version 1.0 [https://kevindarrah.com/configurator/trigBoardV8config_2_16_20/ HERE]<br>
 
#*There's so much going on in the Configurator, that only a video can explain it all:
 

Latest revision as of 11:23, 27 March 2020

...Back to Projects:

TrigBoardv7.jpg

The trigBoard is an IoT project that does one thing - it pushes you a notification triggered by a digital input. Well, it's much more than that, but this is the inspiration. I wanted to design a WiFi board that essentially sleeps most of its life, but when that door switch, flood sensor, motion sensor, etc.. gets triggered, I just want a notification immediately on my phone. And that's about it... a perfect IoT device in the background doing its job.

Release Version 7

TrigBoardv7overhead.jpg

Looking for Rev4? Go here TrigBoardV4

  • Simple IoT development board that was designed to trigger "Push Notifications" on a smart phone/tablet based on a trigger event.
  • Unique low-power front-end to enable sub 1uA sleep current - uses a pulse to trigger wake-up, so even if door/window/etc is opened, the same ultra low currents can be maintained. Compare to standard pull-up/down resistor based digital input designs with significantly higher leakage current.
  • The board will wake itself up once an hour to check the battery voltage - if running low, a push notification is sent to warn the user. This timer can be used to check other things as well - temperature changes, accelerometers, or other environmental sensors.
  • Based on ESP8266 WiFi Module (ESP-12S) - all source code is available for download and developed in the popular Arduino IDE.
  • Battery Input can be any Lithium Polymer 3.7V - standard micro JST connector jack is used (please double check polarity),any of these would work nicely.
  • Sensor input to trigger the "Wake Up" is a simple passive switch. Typically a standard magnetic door/window switch is used and the board can be configured to wake on the "opening" (Normally Closed) or "closure" (Normally Open) of the contact. Solder jumpers set this - Normally Closed is Default, so standard door/window switches wake the board up when opened.
  • Auto-Reset circuitry built-in, so now with an FTDI USB-Serial Converter, just click "upload" and the board starts programming. Note that this was designed to work with this The_USB_to_Serial_Converter:
  • Expansion pads broken out, so integration with custom projects is possible.
  • Dimensions only 0.8" x 1.6 " (20.32mm x 40.64mm)

trigBoard mentions


TrigBoardV7diagram.png

Projects

Andreas Spiess' Weather Forecaster

TrigBoardWaterDetect Water Detector for leaks, floods, rain, etc...

WeatherBoard BME280 and LMT01 Weather Station

EPaperBoard E-Paper Display

CameraBoard Camera System with Arducam

Clear Sky Indicator for Astronomy Project to connect to https://openweathermap.org to get weather details, then indicate if sky is clear or not.

TrigBoardStillOn Simple Hack to see check if digital input is still open using the timer. Did you leave the door/lock or whatever open?

TrigBoardMotion Waking the trigBoard up with motion using a simple PIR sensor.

TrigBoardPressure Wake the trigBoard from a pressure pad (FSR sensor)

TrigBoardLightDetec Wake the trigBoard up from Light - simple light sensor circuit

Purchase trigBoard

Tindie-larges.png

Out of the Box Setup

The setup for getting the trigBoard installed is very easy. The base firmware that comes loaded on the board is ready to work with PushSafer. This makes it so easy to get up and running with the trigBoard. I switched from Pushbullet on the V4 board due to reliability and compatibility issues. Push Safer also has more attractive billing options. Instead of a monthly fee, now you just pay for the amount of notifications you want... when they run out, you just buy more. Best part is that they're super cheap.

PushSafer.png

Push Safer Setup

  1. Go here: https://www.pushsafer.com and register.
  2. Download the mobile app for iOS or Android, and sign in. You can also setup push notifications for your computers as well by installing the browser plugins. You may even like getting the desktop notifications better.
  3. Go back to dashboard and copy your private key

PushSaferKey.png

Notable Push Safer Features:

  • Ability to send test messages from the dashboard
  • Can "Mute" devices by toggling the Status switch in the dashboard
  • Guest Devices by just scanning a QR code, then can enable/disable them as needed. Like for home security, you could give to a family member while you're out on vacation.
  • Great support and a lot of exciting development!
  • There are many more useful features in there as well... feel free to experiment!

trigBoard Setup

Battery
Battery Options - You will need a 3.7V Lithium Battery - fully charged will be 4.2V. The battery connects to the trigBoard using a standard micro-JST PH 2mm connector. Any of these from Adafruit would work. I typically use a ~1000mAh battery on all my doors/windows... that yields very long battery life. I'm also experimenting with these from eBay CHECK POLARITY! This can damage the board, so check the drawing above and also the + and - symbols on the board match your battery.

Choosing the right battery for the job

Charging - This version of the board does not have a charge port, so you might want to pick something like this up as well https://www.adafruit.com/product/1304
Sensors
Dry Contact Switch - magnetic door/window sensors like these
Connectors - They are "Micro JST" JST_2PIN-SMT-RA, I go with these. It would be nice to find magnetic switches with the JST connectors already soldered on... Check this guide out on making your own cables.
Jumpers - By default, the board is configured to "Wake" when the contact opens. This is the normally closed mode of operation. If it is desired to wake on a closure of the contact, then see the diagram above and desolder the NC solder jumpers and cut them open with a knife (on this board, I made the jumpers with tiny traces) and solder across the NO jumpers (make sure they are closed). That default NC configuration was chosen because the magnetic door/window sensors are closed when the magnet is in proximity, so the trigBoard wakes up when the door/window is opened.
IMPORTANT NOTE ABOUT TIMER - The trigBoard performs a calibration on the built-in timer on power-up. The sensor input must be closed when powered up, otherwise the 1hr timer will not be accurate. You basically just need to have the door/window closed before the battery is plugged in. Sensor should be closed if using NC jumpers, Open if NO jumpers. Change Timer Wakeup Interval By default, this is set to 1hour - see the diagram above for where the timer resistor is located on trigBoard. You can replace this resistor with any value you want to change the wakeup time - see the TPL5111 datasheet for resistor values: http://www.ti.com/lit/ds/symlink/tpl5111.pdf

Powering Up

Before mounting the trigBoard in it's final location, a simple bench test is helpful to make sure everything is setup. With the battery and sensor plugged in, simply press the "Wake" button on the board. You should see the LED turn on, then turn off. This is normal, because the firmware checks to see if the WiFi settings are configured, and if not, it just goes back to sleep. To enter in the WiFi settings, you have to press and hold the "Wake" button until you see the LED flash, then let go. The LED should remain solid at this point. You now have 2 minutes to configure the trigBoard. From a computer (easier) or mobile device, go to your WiFi settings and search for available networks. Connect to the "trigBoard" network. A captive portal window should automatically pop up:

TrigBoardcaptive.png

If you don't see a captive portal, you may need to open your browser and attempt to load a website. Try to google something. If you still don't see the portal, then you can try connecting directly to the board - in the browser, type in 192.168.4.1 in the address box. That should connect you to the portal. If you're still having problems, try disconnecting the battery from the board and allow the trigBoard SSID to fade away from the available networks on your computer. Then plug the battery back in and try again. Seems that on windows this may take more than one try. I've also seen issues where the computer defaults to the ethernet connection when the WiFi network does not have an internet service. If you think you're having this problem, just unplug the ethernet cable from your computer.

Click configure, and select the network that you trigBoard to use and enter in the password. You'll now see where you want to enter in the private Push Safer key. Then you can give the board a name, and a trigger message. Once that's entered in, click Save and you're all done! Once you click save, watch the LED on the trigBoard. It should start flashing quickly, indicating that the settings were saved and that it was able to connect to that network. Then, to test, just press the wake button for about a second, or use the sensor switch input. If all was set up properly, you should get a notification!

ConfigWifimanager.png

  • If you don't see a flash, the board has failed to connect to your WiFi hotspot. For testing purposes, try reconfiguring to another hotspot, like your phone. That will at least help determine where the problem is.
  • If you get the blink, but then when waking the board, it goes to sleep after 5 seconds, with no notification, the board may be having a hard time connecting to your hotspot within 5seconds. You can extend this timeout in the code. Go to the provisioning tab and to this line:
if (millis() - startedAt > 5000)// not there after 5 seconds, let's kill it

Base Firmware

Note! the board is preloaded with the base firmware out-of-the-box, but if you want to develop/modify your own firmware, this section will go through the steps for getting the base code to compile. Then you can develop your own code to run on the trigBoard!!

Base Firmware Downloads:

Arduino Code 12/16/18 
Bin File for OTA or Command Line programming 
First Release
Tested on Arduino v1.8.8, ESP core v2.4.2, WiFi Manager v0.14.0, Arduino JSON v5.13.4
Archive of PushSafer Library I use
Arduino Code 1/11/20
NOTE: All boards shipped with 12/16/18 code base, but if you want to compile and modify code, you should start with this 1/11/20 code.  There have been many changes to the ESP core and other libraries, so this can successfully compile and upload at these versions:
Arduino v1.8.10, ESP Core v2.6.3, Wifi Manager v0.15.0, Arduino JSON v6.13.0 and latest Push Safer Lib, Archive HERE

Base Firmware Developed on Arduino IDE - can download Here or Here for previous versions

Then you'll find that the code does not compile and that's because you need several libraries and the board manager installed. Here's what you need:

First, go to File>>Preferences and add this URL to to the "Additional Boards Manager URL". http://arduino.esp8266.com/stable/package_esp8266com_index.json

BoardsManagerURLnewCore.png

Now, the ESP8266 boards will be available for installation. Go to Tools>>Board>>Boards Manager... Search for ESP8266, and go ahead and click install.

ESP8266Install.png

After the boards are installed, you can select any of the ESP8266 boards out there from the Board Selection. For the trigBoard, I have been using the Adafruit Huzzah, here are my settings. Note that I always upload as fast as possible:

TrigHuzzahSettings.png

NOTE!! The auto-reset circuitry may need a longer reset pulse, so try this if you're getting upload errors:

ProgSettings.png

Next, you'll need to install the specific Arduino Libraries I'm using in the base code. The first one is is the WiFi Manager by tzapu - the easiest way to install the library is to go to Sketch>>Include Library>>Manage Libraries. Then type in WIFImanager. Go ahead and install the library.

WiFiManager.png

Do the same for the Arduino JSON library by Benoit Blanchon - can just search for JSON.

ArduinoJSON.png

We're also using the Push Safer library to keep things easy. You can get that here: https://github.com/appzer/pushsafer-arduino-library

PushsaferGit.png

Download that zip file, then head over to the Arduino IDE, and add zip library:

AddZipLibrary.png

Then that should be it - the other libraries are automatically installed with the ESP8266 board manager.

See the "Testing and Programming" section below for information on loading the code over a wired USB-Serial connection. The other option is to load code wirelessly "OTA - Over the Air". In the "trigBoard Operation" section this is shown.

Programming

Note that the USB-Serial Converter that I designed is known to work - other versions of it may not. Here is the wiki page for the USB-Serial Board: The_USB_to_Serial_Converter:, and can be purchased here: https://www.tindie.com/products/13817/

The OTA link to upload the bin file: http://trigboard.local/update

TrigBoardv7programmer.jpg

Upload bin file via command line - contact me if modified version is needed

Schematic

File:trigBoardV7.pdf

TrigV7SCH.png

Tutorials/Walkthroughs

V7 Hardware Auto Reset Circuit

V4 Hardware explanation - low power trigger and timer circuit

Mechanical

Autodesk link to 3D viewer (you can download step file): https://a360.co/2EIjWEe

Screen Shot 2019-01-23 at 12.55.40 AM.png

Rev 4 Compatibility

Everything is pretty much the same as Rev 4, but if you have code running on the Rev 4 and want to program that on a Rev7, you will have to change how it measures the battery voltage. I changed the voltage divider resistors:

Rev7batMeas.png

 batteryVoltage = (4 - 3.5)/(712 - 621) ;
 batteryVoltage = analogRead(A0) * batteryVoltage + (4 - batteryVoltage * 712);

Expansion

You can design your own "mini" boards to pair up with the trigBoard - soldering wires to the board works, or even pluggable type connectors like these and these. (Thanks Daniel B for the tip!)

ExpansionTrigBoard.jpg

Disclaimer

I'm just a guy who designs boards, so I'll try my best to support you as much as I can and provide tutorials as I have time for. Every board that is sold has been functionally tested, so that they can be programmed, the sleep current is right, they can be woken up, the battery voltage measurement is "close", and active current is consistent with a working board. Also, these boards are for educational, hobbyists, DIYer, maker, and development use only. If you are interested in working this board into your product, please contact me for more information