For my ESE 680 project I chose to build an internet connected door lock. The idea was to be able to automatically unlock the door to my apartment using my cell phone for authentication. The original goal was to use a servo to open the lock and a ping sensor to detect when a user was walking up to the door to notify me. Sadly, I was not able to get the ping sensor to work. In the end I replaced the ping sensor with a photo resistor which would tell the user if they left the lights on at home. They would need another IoT device to turn those lights off though.
My Boot-loader works by first checking my seas web hosting for a new Cyclic Redundancy Check (CRC) signature. If there is a new CRC signature online, it will download the new application code on to the external flash of the board and then reset. After the rest, the bootloader will copy the new application code into the on chip nvm where the application is run from. After the application is copied over it creates a signature for the code that is copied into local memory. If the CRC of the code in local memory, and the CRC from online do not match, the boot-loader will copy over a golden image of the code which it saves the first time the device is manually programmed.
NVM Memory Map
Flash Chip Memory Map
For cloud connectivity I used IBM Bluemix to host my back end and Cloud MQTT for my MQTT broker. My backend was simply a node red flow which had two main components. The first was a switch to control the door lock. The second was a text box that updates based on whether or not the lights in the room are left on. The last component is a time stamp that tells the user when the IoT device was last seen online.
Node Red Backend
I ran into a few surprises during this project starting with my PCB. When I ordered my PCB I had accidentally ordered a 3 layer board, and ended up getting a 2 layer board. Thankfully PCB:NG was nice enough to remake my board for free. My next issue was with the pin-out of my servo. I had accidentally changed the order of the pins, but this was an easy enough thing to fix my soldering new wires to the servo. My last major issue was the level shifting for my ping sensor. I made the pull up resistor too small meaning that my ping sensor did not have the power to pull down the line in order to send a signal back to my micro controller. In the end I solved this by replacing my ping sensor with a photo resistor.