Software apps and online services
Hand tools and fabrication machines
Ever wonder how to incorporate 21st century technology into the electrical system of a 1980's car? Thanks to Particle this is a possibility! Let's get going! A video below shows the final product, a security system that can be controlled from my phone!
A basic problem with classic cars is their security. Now you do not have to spend hundreds or thousands of dollars on a security system for your car. You just need a few basic components:
(X 2) Solar Panel Lights (=$20 dollars on Amazon.com)
- thank you to the sleep mode on the particle photon we are able to power each particle using 3.7V which can be outputted from the Solar Lights
Magnetic Switch (P/N 8601) (=$7 dollars on Amazon.com)
-depending on a person's specific code you might need a NA or NC (normally open or normally closed) reed switch
- for this specific application I purchased a magnetic switch with both and used the normally closed terminal for the door sensing
Cellular Device (Phone):
-IOS or Android device this IFTT app demonstration could vary
-I used a Android device
Relay: (=$10 dollars using Digikey)
-depending on your operating voltage/current your relay could vary
-I needed a 12V relay with a coil voltage of around 3V
First we take apart the solar lights and rewire the battery for a voltage output as pictured below in Figure 1.
I cut the wires from the PCB board to the LED light and also removed the light. I then rewired two wires, one from the ground from the battery and the other from the positive on the battery. These two leads will now become my Vin and GND on my photon. In Figure 2 you can see the finished solar panel reassembled.
The solar light lists specs for the battery of 1200mAh Lithium on the box. According to Professor MacAlpine, who uses these exact solar lights in his "You've Got Mail" project, the battery output should be sufficient to run each photon.
Next, I ordered my correct relay. I figured out that to shut my car off or to not let it start, I had to pull power from the ignition coil. I then figured out the current running through the wire, as well as the voltage. I decided a relay with a 10Amp capacity as well as 12Volt allowable passing voltage would work for this application. I then decided that if I could have a 3V coil voltage this would allow the photon to turn the relay open. I discussed my needed specifications with DigiKey and they were kind enough to lead me in the right direction. The top of the relay is shown in Figure 3.
I then cut the ignition coil wire in the vehicle and checked to make sure this would do the required task. I started the car, cut the wire, and the car stopped. I then rewired the connection and the car would start. This showed that the relay would work as anticipated that the idea will work. After receiving my relay I soldered the proper lead wires onto the terminals. I used the normally closed relay portion (terminal 1 and 4) so that with no power to the relay the car will run but once I tell the photon to output a high to pin D3 and D4 it will open the relay, causing the car to stop or not start. A picture of the wire I cut and added extra length to run to my breadboard is shown in Figure 4.
Then I wired up the relay. Unfortunately, I was not able to put this directly into a breadboard but I soldered the terminals to jumper wires that could go directly into the breadboard. A diagram of the wires is shown in Figure 5.
I then wired up my magnetic switch. I attached two lead wires to the D0 pin and GND pin of the photon and then attached the switch to the door like shown below in Figure 6. I used the sleep function on the photon. The photon wakes up once the door is opened (the circuit becomes disconnected, on a falling edge). The photon then reports RSSI, voltage, door trigger count, as well as, sends me a message, "Car Door Is Opened". As far as wiring, I then attached the one lead from the magnetic switch from NC (normally closed) to DO pin on the photon and the other COM to GND on the photon. I attached a picture of the two sensors as the door is closed in Figure 6.
Below are the schematics/pin outs for the two photons. Also attached are the Fritzing files if needed.
After finally getting all the hardware sorted I moved onto Thingspeak to track the RSSI, door trigger count, and voltage of the system.
I created two Webhooks, one for the photon that was working with the door opening switch named cardoor_open_ and the other working with the relay under the hood of the car named carrelay_open_, shown in Figure 8 and Figure 9. I then placed the form data from my code into the form on the integration so it knows what to graph since I have more than one variable being graphed.
I then logged into Thingspeak, and created a channel for each photon. I named the channel accordingly and then went to channel setting. I made sure to copy the "Write API Key" for each specific channel and pasted that key into the code for the specific photon that I want to write to that channel. Below, in Figure 10, is a random key I generated and in Figure 11 is the section of code I pasted it in.
After that I then tested the photon and had some slight issues. Make sure that the code is similar to the code below where the name "cardoor_open_" matches the "Event" on the Webhook. The "All" part comes from that, you want to publish all this information. Shown in Figure 12 is the code I am discussing.
After a few changes I was able to get both graphs to operate and monitor the RSSI, door trigger counts, as well as, the voltage for the battery. The two graphs are shown below in Figure 13 and Figure 14.
Car Door Channel- https://thingspeak.com/channels/255813
Car Relay Channel- https://thingspeak.com/channels/255813
Then onto the IFTTT notification and button. I created one applet so that if "kindicane" (name of door sensor photon) comes online it sends me a notification on my phone through IFTTT. Since the particle is asleep and offline all the time, except when it senses a falling edge when the door is opened, this will work out well.
To set this up I chose 'new applet' from the IFTTT menu. For the "if" I chose "particle" then I chose, "Monitor your device status". After that, I added the name of the photon as well as the "comes online" portion. Then I chose "Notifications" and typed in what I wanted the IFTTT to tell me when the door was opened. The applet, once finished, looks like Figure 15.
After this I created another applet that allowed me to control the car relay photon. I first created a new applet, chose the button widget so the button is visible on my phone, and then chose particle for the "that" part. I clicked on "publish an event" and then created an event name that matched my code. What this does is every time I hit the button it publishes an event that will output D2 and D3 on my photon with a "HIGH". This will then switch the relay to off and shut the car off or not let it start. In my code I put a delay of 15 minutes that the high values will remain on, and then the photon will return D2 and D3 to low and go to sleep. This gives me enough time to call the police or get someone to where the car is at if someone is trying to steal it. The IFTTT for the relay is shown in Figure 16.
Now let's say when I open the door, during my normal everyday process, IFTTT will send me a notification saying "Car Door Opened" but I will not respond to the IFTTT notification therefore the car will not remaining running.
The notification I receive from IFTTT is shown in Figure 17. As you can see it displays the approximate time the door was opened as well.