element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Personal Blogs
  • Community Hub
  • More
Personal Blogs
Legacy Personal Blogs Automating My Home
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: tonyboubady
  • Date Created: 13 May 2016 7:41 AM Date Created
  • Views 758 views
  • Likes 1 like
  • Comments 2 comments
  • arduiono
  • diy home automation
  • home automation
Related
Recommended

Automating My Home

tonyboubady
tonyboubady
13 May 2016

I have decided to do a little project for my home. There is a two light domes in front gate pillars of my home, we used to switch on the light at evening time as it will get too dark, and we are too lazy to ask each other to do so on regular basis...well, my brain start to think about "How to make it automated". I did a quick code in Arduino...

 

A LDR to read the light source, a potentiometer to calibrate the trigger point to switch on the light, a set button for manual calibration, a smart button to auto calibration. I am going to use the raw ADC value of LDR and as well potentiometer value. While setting manual calibration, the potentiometer value will be the trigger point of light source, the set button stores the value of the potentiometer in variable for trigger point. the smart button is just store the current LDR value as trigger point, it's very useful to set the exact atmosphere light source reading.

 

This is the code...

 

int sensorValue, 
    calibration,
    quickCalibration,
    triggerPoint,
    setButtonState = 0,
    smartButtonState = 0;


void setup() {
  pinMode(8, OUTPUT);
  pinMode(7, INPUT);
  pinMode(4, INPUT);
  Serial.begin(9600);
}


void loop() {
 sensorValue = analogRead(A0); // ADC value from LDR
 calibration = analogRead(A1); // ADC value from potentiometer
 setButtonState = digitalRead(7);
 smartButtonState = digitalRead(4);




 if (setButtonState == HIGH) {
     triggerPoint = calibration; // Manual calibration
 }


 if (smartButtonState == HIGH) {
     triggerPoint = sensorValue+25; // Smart calibration
 }

 if (sensorValue < triggerPoint){
     digitalWrite(8, HIGH); // Output to relay
  } else {
     digitalWrite(8, LOW); // Output to relay
  }
  
 Serial.println(sensorValue);
 Serial.println(calibration);
 delay(5); 
}

 

It's just on breadboard level I have to buy a relay to handle 220V switching and power supply for MCU My first thought was to use ATTiny13A but due to it's low memory of 1KB I have to go for ATmega8-16PU

 

I will continue to update this project when it's progress...

  • Sign in to reply

Top Comments

  • spannerspencer
    spannerspencer over 9 years ago +2
    Excellent idea. I've been considering similar at my house -- it's dark around the back, but it gets a lot of rain and bad weather, so PIR lamps just don't last. I'm seeing a lot of people putting variations…
  • tonyboubady
    tonyboubady over 9 years ago in reply to spannerspencer +1
    Thanks Spanner, well, i do have the ESP8266 -01 module quite a while, just haven't put that in real use... but your suggestion for this project make me so...I will update regularly on progress of this…
  • tonyboubady
    tonyboubady over 9 years ago in reply to spannerspencer

    Thanks Spanner, well, i do have the ESP8266 -01 module quite a while, just haven't put that in real use... but your suggestion for this project make me so...I will update regularly on progress of this project...

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • spannerspencer
    spannerspencer over 9 years ago

    Excellent idea. I've been considering similar at my house -- it's dark around the back, but it gets a lot of rain and bad weather, so PIR lamps just don't last.

     

    I'm seeing a lot of people putting variations of the ESP8266 to use for a simple option for sending sensor data and simple GPIO actions via Wi-Fi. Maybe you could hook it up so you've got smartphone and/or computer control of your lights too? This looks like quite a nice (and very affordable) breakout board for the ESP8266: GeekcreitTm Doit NodeMcu Lua ESP8266 ESP-12E WIFI Development Board Sale - Banggood.com

     

    Either way, keep us posted on your progress!

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube