Energy Saver
Now that we have an energized city, the electricity bills are coming in. Let’s figure out a way to turn off the lights when we are not in the room.
Goal:
- Turn off the city lights if we don’t detect anybody for 5 minutes.
Challenges:
- Detect motion to turn on lights
- Turn off city lights after 5 minutes of inactivity
Components:
- Raspberry Pi (or any NodeJS host)
- Arduino (I used the Mega 2560 but any will do)
- HC-SR501 motion sensor
- 1.8v LED
- resistor
Schematic:
This is a pretty simple circuit. We just need to plug the motion sensor into a digital input pin and supply it 5v of power. We will then connect an LED and resistor to an output pin to indicate when motion has been detected.
Code:
Initialize the board, the LED and motion detector. Then we just define a sensor listener that will be activated by the motion detector. An LED is connected to an output pin so we could get instant feedback when motion has been detected.
Basic Flow
- Set initial energy delay timer for 5 minutes.
- Turn off devices if no motion detected.
- Listen for motion detection .
- Reset timer.
- Turn on LED for 2 seconds.
- Turn on lights (and other optional devices).
Filename
Now save and run your file.
npm init
npm install johnny-five --save
node energysave.js
Construction:
I basically just stuck the motion sensor to a vertical strut beam, using tacky tape. I then attached the LED to the top of an antenna and used a twist tie to lock it in place.
Probably not the most polished build, but it was quick and easy. The exposed electronics kind of makes sense on a radio tower.
Energy efficiency!
the original post is from http://www.internetoflego.com/energy-saver-motion-activation/
Leave a Reply
You must be logged in to post a comment.