Problem
One night, my car was broken into. I lost a few thousand dollars in equipment and several hundred dollars replacing my alarm system. After doing some research, I realized how prevalent car theft is in the US. This made me think about people who were in less fortunate situations and needed a temporary alarm system that was inexpensive until they could afford a more permanent option.
Technology Implementation
As a form of expression, I decided to build an inexpensive sensor for $25 wholesale that would detect motion and send a user a text message if there was a disturbance.
Process
I relied on my electrical background to design and created a circuit that sounded an alarm and reported the distance of the detected movement. In addition, I coded a full-stack application for users to sign up to use the service. I wrote the Arduino program in C++ and from there made a request to a server using express/node. Once motion is detected this would trigger the route path and the user would receive a text message as a response. I built this project during the final week while attending a 16-week full-time immersive coding bootcamp.
Outcome
In two weeks, I was able to identify an issue, create a prototype, code in a programming language I had never worked with, and build a full-stack application in a language I started learning 3 months prior. I broke a problem into small steps and carefully solved the ones I was able to and utilized the Arduino and coding community to fill in the gaps. By leveraging communication and patience, I completed this project by relying on my strengths in problem-solving asking the needed questions to bring this passion project to life. This project was built for educational purposes only.
Tech Stack
- C++ Arduino
- HTML5
- CSS3
- JavaScript - Templating Engine
- PostgreSQL
- Node.js/Express
Planning & Process Build
The first day, I got accumulated to the basics of C++ as I had never worked with Arduino or C++ previously. The first step was to learn how to get an LED to blink. Once I solved this step, I knew I could tie in the rest of the circuit.
Super Sonic Sensor, LED, and Horns
Once I achieved the previous steps, I then supplied the appropriate voltage to each device needed in the circuit. Having a strong industrial electrical background, this part of the build process went relatively fast, taking about three hours to design.
8266 Wifi Chip
Since I was not familiar with the libraries and drivers needed for the chip to work, it took several hours to tie together. There were also many variations of the 8622 wifi chip, all with different voltage requirements and I/O control options. In the end, I was finally able to upload a simple blink program allowing me to move on to the next step.
Voltage Dividing
The next step involved researching some equations to create a small transformer. I needed to have the circuit output 5v and step down to 1v. I also needed to use a different sensor value to make my application's primary logic work. Once I could hook up the ADC pin on the wifi chip, the next step involved making some requests to the server.
GET/POST Code Sample
Writing the code on the C++ side was reasonably straight forward. The logic here evaluated if the wifi chip would connect to the wifi connection. After this, we were good to check if there were any detected motion in front of the sensor moving forward.
Twillio Code Sample
The last step was to use the Twilio API to send a message to the user via Node if the sensor detected an intruder. Once I got a valid response from the Twilio API, the sensor was finally complete and, from there, I created a small back end where users could sign up/in and register their device for use.