Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member683242
Participant

Introduction


Welcome to d-shop Bangalore, a maker space for developers. An opportunity for all the SAP employees to meet, collaborate and at the same time explore different technologies, attend workshops and innovate.

We at d-shop aim to bring hardware technologies closer to all SAP developers helping them to be leaders in the Internet of Things.

This is the era of 'smart homes'. Automation has completely taken over human actions. As a result of its impending explosion in the mainstream market we decided to give you a peek into all the hype surrounding it

In this blog series, we will discuss some basic techniques of home automation like lighting control using PIR sensor, Temperature sensor and Arduino board by virtually connecting, simulating and running the setup.

We are using Tinkercad to create all our circuits. If you are interested you can register on Tinkercad to create your own smart home.

Scenario : 


Turn on the lights when anyone walks into the room.

Components Involved :  



  • Arduino 

  • LED 

  • Resistor kOhm 

  • Breadboard 

  • Jumper Wires 

  • PIR Sensor 


Steps : 



  1. In the circuit section, click on create a new circuit. Search for Arduino board and drag and drop it onto the circuit area. In the same way position the other components(breadboard, PIR Sensor and LED) as shown in the diagram. Connect the 5V output power of the Arduino board with the plus point on the breadboard. Similarly connect the ground (GRND) to the negative terminal of the breadboard.

  2. Now, connect the PIR sensor power to the positive terminal of the breadboard. Also, take the ground of the sensor and connect it to the negative of the breadboard (connections shown in blue). 
     

  3. Connect the signal terminal of the PIR sensor to the 2nd pin of the Arduino board. This will send the signal back to the Arduino board. 

  4. Next, we will connect the LED to the Arduino board. The PIR sensor will send the signal to the Arduino board and then the Arduino board will send the signal to the LED that will light up the bulb. Pull the ground wire and connect it to the LED bulb. Connect the power output from the pin 4th of the Arduino board to the other end of the bulb.  

  5. To maintain the power voltage, use a resistor. Connect one terminal of the resistor to the LED bulb and the other end to the power output from the Arduino board as shown in the diagram.  

  6. Now, let’s move on to the code. It contains two functions. The setup() function does the basic initialization. It specifies what kind of pins would be used as Input or Output. The loop() function is a repetitive function that detects and performs the operation. 

  7. Now for the code: 
    void setup() 
    {
    pinMode(2,INPUT);
    pinMode(4,OUTPUT);
    }

    void loop()
    {
    // PIR with LED starts
    int pir = digitalRead(2);
    if(pir == HIGH)
    {
    digitalWrite(4,HIGH);
    delay(1000);
    }
    else if(pir == LOW)
    {
    digitalWrite(4,LOW);
    }
    }


  8. The circuit is now complete. This circuit detects the presence and turns on the LED light. 


 

This is it for our first scenario. Hope we were able to give you a sneak peek on how easily we can automate our homes. Hope you liked the blog post. Stay tuned for more sessions and blog posts to come. 🙂

Cheers !

Part 2:


SAP d-shop Bangalore Community | Home Automation Workshop 1: Part 2/2 -