Hi everyone, in this instructable, I will show you how to make your home smarter.
Every night before go to bed, you always have to turn on the alarm system. So, in this project, I will use the light sensor to detect whether the light of your room has been turned off, means that you are going to sleep soon. Then, the Edison will turn on the relay and activate the alarm system. Now, let's get started!
Step 1: Parts you will need
You will need the Intel Edison Board and the Grove Starter Kits, specifically:
- Intel Edison
- Edison Arduino Expansion Board
- Grove Base Shield
- Grove LED Socket and a LED
- Grove Relay
- Grove Light Sensor
Step 2: Hardware Connection
- Make sure you connect the LED to the socket with right + and - pin.
- Use the bus cable in the Grove Starter Kit to connect the relay, LED, and light sensor to the Base Shield:
- Relay ---> D2
- LED ---> D3
- Light Sensor ---> A0
That's all you need! Let's move to next step!
Step 3: Some useful information about the Grove Starter Kit
We should take about 5 mins to gather some info about relay operation and the light sensor we are using.
- The Relay works the same way as a momentary switch, but with digital control. Specifically, when you set the input signal to 1 (pull up to VCC), it connects the two ports of the domino, the switch is on just like when you push a button, so the circuit is connected. Set 0, the switch is released, and the circuit is opened.
- There are 2 things to consider when using a relay: a max current coming through and the max voltage between 2 heads. The Grove relay is claimed to have 10A max current at 250V max voltage operation, but the PCB circuit as well as the domino cannot handle that much because they are too small. Thus, I only use it as prototype, and not wire it to home high-voltage alarm system.
- The light sensor is actually a thermoresistor - a resistor that changes its value based on light intensity.
Hope you will find some interesting information! Now let's start coding!
Step 4: Let's try the code
Here is how it works:
When you you move the finger into the sensor, the LED will dim according to the reduction of light intensity. When you move close enough, Edison will turn on the relay. Besides, you can open the Serial Monitor in Arduino Edison compiler to view the all the sensor and output status.
You can use this serial monitor to follow and adjust the light sensitivity.
First, you have to add Grove library, download it here: https://github.com/Seeed-Studio/Sketchbook_Starter...
I suggest you should read my earlier instructable to know how to add library as well as configure some basic things, here: http://www.instructables.com/id/Intel-Edison-IoT-C...
Now, import my project and enjoy the result!
If you have trouble, just comment here and i will help you solve it! Good luck, guys!