Garage Door Monitor and Opener

Dependencies:   X_NUCLEO_COMMON ST_INTERFACES

Introduction

This system implements a simple garage door opener and environmental monitor. The hardware connects to the internet using Wi-Fi then on to the Pelion Device Management Platform which provides device monitoring and secure firmware updates over the air (FOTA). Pelion Device Management provides a flexible set of REST APIs which we will use to communicate to a web application running on an EC-2 instance in AWS. The web application will serve a web page where we can monitor and control our garage..

This project is intended to work on the DISCO-L475VG-IOT01A from ST Microelectronics It implements a simple actuator to drive a relay to simulate pushing the "open" button on older style garage doors which do not use a rolling code interface.

The system is designed to be mounted over the door so that the on board time of flight sensor can be used to detect if the door is open or closed.

The system also monitors temperature, humidity and barometric pressure.

https://os.mbed.com/media/uploads/JimCarver/garageopener.jpg

Hardware Requirements:

DISCO-L475G-IOT01A https://os.mbed.com/platforms/ST-Discovery-L475E-IOT01A/

Seeed Studio Grove Relay module https://www.seeedstudio.com/Grove-Relay.html

Seeed Studio Grove cable, I used this one: https://www.seeedstudio.com/Grove-4-pin-Male-Jumper-to-Grove-4-pin-Conversion-Cable-5-PCs-per-Pack.html

Connect to the PMOD connector like this:

https://os.mbed.com/media/uploads/JimCarver/opener.jpg

This shows how I installed so that the time of flight sensor can detect when the door is open

https://os.mbed.com/media/uploads/JimCarver/opener1.jpg https://os.mbed.com/media/uploads/JimCarver/opener2.jpg

To use the project:

You will also need a Pelion developers account.

I suggest you first use the Pelion quick state to become familiar with Pelion Device Management. https://os.mbed.com/guides/connect-device-to-pelion/1/?board=ST-Discovery-L475E-IOT01A

Web Interface

For my web interface I am running node-red under Ubuntu in an EC2 instance on AWS. This can run for 12 month within the constraints of their free tier. Here is a tutorial: https://nodered.org/docs/getting-started/aws

You will also need to install several node-red add ons:

sudo npm install -g node-red-dashboard

sudo npm install -g node-red-contrib-mbed-cloud

sudo npm istall -g node-red-contrib-moment

After starting node-red import the contents of GarageFlow.txt from the project, pin the flow into the page.

To enable your web app to access your Pelion account you need an API key.

First you will neet to use your Pelion account to create an API key.

https://os.mbed.com/media/uploads/JimCarver/api_portal.jpg

Now we need to apply that API key to your Node-Red flow.

https://os.mbed.com/media/uploads/JimCarver/api_node-red.jpg

Committer:
JimCarver
Date:
Thu Dec 05 19:03:48 2019 +0000
Revision:
37:ec1124e5ec1f
Parent:
28:0e774865873d
Bug fix

Who changed what in which revision?

UserRevisionLine numberNew contents of line
screamer 10:b27c962b3c3f 1 {
screamer 10:b27c962b3c3f 2 "macros": [
screamer 10:b27c962b3c3f 3 "MBEDTLS_USER_CONFIG_FILE=\"bootloader_mbedtls_user_config.h\"",
screamer 10:b27c962b3c3f 4 "SHOW_PROGRESS_BAR=0",
screamer 10:b27c962b3c3f 5 "MAX_COPY_RETRIES=1",
screamer 10:b27c962b3c3f 6 "MAX_BOOT_RETRIES=3",
screamer 10:b27c962b3c3f 7 "ARM_BOOTLOADER_USE_NVSTORE_ROT=1",
screamer 10:b27c962b3c3f 8 "ARM_UC_USE_PAL_CRYPTO=0",
screamer 10:b27c962b3c3f 9 "ARM_UC_USE_PAL_BLOCKDEVICE=1",
screamer 10:b27c962b3c3f 10 "ARM_UC_PAAL_TRACE_ENABLE=0",
screamer 10:b27c962b3c3f 11 "ARM_UC_PROFILE_MBED_CLOUD_CLIENT=1",
screamer 10:b27c962b3c3f 12 "ARM_UC_FEATURE_CRYPTO_PAL=0",
screamer 10:b27c962b3c3f 13 "ARM_UC_FEATURE_CRYPTO_MBEDTLS=1",
screamer 10:b27c962b3c3f 14 "MBED_CLOUD_CLIENT_UPDATE_STORAGE=ARM_UCP_FLASHIAP_BLOCKDEVICE",
screamer 28:0e774865873d 15 "DEFAULT_MAX_APPLICATION_SIZE=(MBED_CONF_APP_FLASH_START_ADDRESS + MBED_CONF_APP_FLASH_SIZE - MBED_CONF_APP_APPLICATION_START_ADDRESS - NVSTORE_AREA_1_SIZE - NVSTORE_AREA_2_SIZE)",
screamer 10:b27c962b3c3f 16 "DISABLE_ERROR_DESCRIPTION=1",
screamer 10:b27c962b3c3f 17 "Mutex=PlatformMutex"
screamer 10:b27c962b3c3f 18 ],
screamer 10:b27c962b3c3f 19 "config": {
screamer 10:b27c962b3c3f 20 "application-start-address": {
screamer 10:b27c962b3c3f 21 "help": "Address to the beginning of the active application firmware in flash",
screamer 10:b27c962b3c3f 22 "value": null
screamer 10:b27c962b3c3f 23 },
screamer 10:b27c962b3c3f 24 "application-jump-address": {
screamer 10:b27c962b3c3f 25 "help": "Jump address for running the active application firmware",
screamer 10:b27c962b3c3f 26 "value": null
screamer 10:b27c962b3c3f 27 },
screamer 10:b27c962b3c3f 28 "max-application-size": {
screamer 10:b27c962b3c3f 29 "help": "Maximum size of the active application",
screamer 10:b27c962b3c3f 30 "value": null
screamer 10:b27c962b3c3f 31 },
screamer 10:b27c962b3c3f 32 "flash-start-address": {
screamer 10:b27c962b3c3f 33 "help": "Start address of internal flash. Only used in this config to help the definition of other macros.",
screamer 10:b27c962b3c3f 34 "value": null
screamer 10:b27c962b3c3f 35 },
screamer 10:b27c962b3c3f 36 "flash-size": {
screamer 10:b27c962b3c3f 37 "help": "Total size of internal flash. Only used in this config to help the definition of other macros.",
screamer 10:b27c962b3c3f 38 "value": null
screamer 10:b27c962b3c3f 39 }
screamer 10:b27c962b3c3f 40 },
screamer 10:b27c962b3c3f 41 "target_overrides": {
screamer 10:b27c962b3c3f 42 "*": {
screamer 10:b27c962b3c3f 43 "target.features_remove" : ["LWIP"],
screamer 10:b27c962b3c3f 44 "target.features_add" : ["COMMON_PAL"],
screamer 28:0e774865873d 45 "target.extra_labels_remove" : ["PSA"],
screamer 28:0e774865873d 46 "target.components_remove" : ["FLASHIAP"],
screamer 10:b27c962b3c3f 47 "platform.stdio-baud-rate" : 115200,
screamer 28:0e774865873d 48 "platform.stdio-flush-at-exit" : false
screamer 10:b27c962b3c3f 49 },
screamer 10:b27c962b3c3f 50 "DISCO_L475VG_IOT01A": {
screamer 10:b27c962b3c3f 51 "target.components_add" : ["QSPIF"],
screamer 10:b27c962b3c3f 52 "flash-start-address" : "0x08000000",
screamer 10:b27c962b3c3f 53 "flash-size" : "(1024*1024)",
screamer 10:b27c962b3c3f 54 "nvstore.area_1_address" : "(MBED_CONF_APP_FLASH_START_ADDRESS + MBED_CONF_APP_FLASH_SIZE - 2*(2*1024))",
screamer 10:b27c962b3c3f 55 "nvstore.area_1_size" : "(2*1024)",
screamer 10:b27c962b3c3f 56 "nvstore.area_2_address" : "(MBED_CONF_APP_FLASH_START_ADDRESS + MBED_CONF_APP_FLASH_SIZE - 1*(2*1024))",
screamer 10:b27c962b3c3f 57 "nvstore.area_2_size" : "(2*1024)",
screamer 28:0e774865873d 58 "update-client.storage-address" : "(2*1024*1024)",
screamer 28:0e774865873d 59 "update-client.storage-size" : "(2*1024*1024)",
screamer 28:0e774865873d 60 "update-client.storage-locations" : 1,
screamer 28:0e774865873d 61 "update-client.firmware-header-version": "2",
screamer 10:b27c962b3c3f 62 "update-client.application-details": "(MBED_CONF_APP_FLASH_START_ADDRESS + 64*1024)",
screamer 10:b27c962b3c3f 63 "application-start-address" : "(MBED_CONF_APP_FLASH_START_ADDRESS + 65*1024)",
screamer 10:b27c962b3c3f 64 "max-application-size" : "DEFAULT_MAX_APPLICATION_SIZE"
screamer 10:b27c962b3c3f 65 }
screamer 10:b27c962b3c3f 66 }
screamer 10:b27c962b3c3f 67 }