Openhab MQTT PIR Motion Sensor

Published

Introduction: Openhab MQTT PIR Motion Sensor

About: I am a software engineering student. in the Netherlands with a intrest in Home automation with Openhab

Hello,

In this instructable I am going to show you how you can make your own Motion sensor for Openhab.

Step 1: Bill of Materials

for this project you are going to need:

  • HC-sr501
  • 1X3 female header
  • 1X3 male header
  • 3 colors of wire you can use servo extensions if you want
  • 1 10K resistor
  • Arduino uno or mega
  • 3d printed parts.

Step 2: PIR Assembly

1. Solder the header to the wire shown in the picture.

2. Add a 10K resistor between GND and the Signal.

3. Put the sensor in the case

4. Mout the back plate to the wall.

5. Add mount the housing on the back plate with a 3M bolt and screw.

Step 3: Connections to the Microcontroller.

1. Connect the 5V to the 5V on the microcontroller.

2. Connect the GND to the GND on the microcontroller.

3. Connect the signal wire to A0 on the microcontroller.

Step 4: Assembly of the Arduino

1. Put the ethernet shield on the arduino.

2. Connect the Ethernet-cable to the arduino.

3. Power the arduino.

Step 5: Code

1. Download and install the library's for the sketch.

1. MQTT PubSubClient

2. Put the library in the library folder of your Arduino-IDE.

3. Change the server IP to YOUR openhab server IP.

4. Change the topic to a topic that you want.

5. Upload the Code to the arduino.

Step 6: Trouble Shooting

  1. Case: The arduino won't connect to the server.
    1. Check that the ethernet cable is plugged in.
    2. Is the pin 13 led burning?
    3. check the server IP in the code.
  2. Case: The openhab server won't get messages.
    1. Is the Item config Correct?
    2. Is the mqtt topic correct in the code?
    3. Is there a mqtt server?
  3. Case: The status won't change.
    1. Is the sensor plugged into the right connector?
    2. Is there power going to the sensor?
    3. Is the sensor calibrated right?

Step 7: The End

This was my first instructables feel free to leave feedback on it.

If there are any questions feel free to ask them.

Share

    Recommendations

    • Casting Contest

      Casting Contest
    • Microcontroller Contest

      Microcontroller Contest
    • Woodworking Contest

      Woodworking Contest
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    Comments