Complete Guide GPIO Binding + OpenHAB 2

In this video I will show you and explain how to setup the GPIO Binding in OpenHAB 2. We will connect an LED, relay board, a button, and a door sensor to the GPIO pins. I will demonstrate how to control the GPIO pins from the basic UI and configure the binding in the paper ui as well as the items and sitemap files.
Order the Kits, PCBs or 3D Printed Parts to make the devices here:

Link To OpenHAB 2 and GPIO (Written Guide):

Link To OpenHAB 2 Configuration Files:

Link To OpenHAB 2 Web User Interfaces Explanation:

Link To Home Automation Server Guide:

Home Automation Server Videos:
Demo –
Hardware –
Software (Using Mac) –
Software (Using Windows) –
Final Installation –

Check out the official website:


This channel will show you the path to creating your very own Ultimate Smart House using Arduino, raspberry pi, esp8266, OpenHAB 2 and more to do home automation. Each video will be a different project and tutorial that you can follow to make your house more technologically advanced. Also, there is more information as well as detailed guides on

37 Replies to “Complete Guide GPIO Binding + OpenHAB 2”

  1. Wayne Rigley

    OK im a sub now ! thank for the video, im looking to deploy such a thing.. ok check this out this is our chicken coop that has door open/close led lights and water pump. im been thinking about having such an interface for follow up or control over a in crontab. normal day – door opens ( i peek outside to verify lol ) pump turns on and off every 15 min and end of day door closes ( yes i peek outside again ) i also have a DHT22 that is pushed to a html from davids site and i can verify from the temp that the door was closes lol NOW ive been looking at the OpenHab ( i dont think i can run it on my chicken coop Pi so i ordered a new 3B+ just for that, want to make a dashboard that has a few in house items Hue-switches etc, but also a chicken coop menu, where just like you have a way to control the 4 chan relay. i love the sensor and this will confirm my peeking outside daily.. i was going to try and figure out a way to hard wire a push button on the coop pi to run scripts if we are in there and need to open or close the door .. but not sure how to do that yet. also on the openhab would be nice to see the coop temp and humidity that the pi is pulling. any way thank you and hope to dig into your videos and see codes to help in our situation !

  2. Mr Rana

    Hi, i followed this video every step what you have done here but my case is not switching from openhab server, i can see all switches and present status on basic ui but doesn't control those gpio pin. Do you have any suggestion how can i fix this? please note i installed gpio bunding.


    Awsome !!!!! Nice and easy to follow as well !!! Please make a tutorial on using ESP8266 for openHAB.
    Actually is it possible to make it with esp8266? While the server is running on RPi3 ?

  4. sofian Moussaillon

    HI Matt can you help my syntax on my openhab item file please. mine is not working : I am using a sonoff SC and I would like to read the temperature for example.
    I'm getting nothing !
    //Temperature downstairs
    Number SonoffSC_DWS "Temperature Downstairs [%.1b C]" (BA,bTemperature) { mqtt="<[broker:tele/SonoffSC/SENSOR:state:JSONPATH($.Temperature)]" }

    Thanks Matt!

  5. Alto Roos

    Greetings Matt,

    I need help scheduling and I am sure others will appreciate it as well.

    In your Sprinkler tutorial you Hard code the schedule, I think a more user friendly scheduling system that can be modified on the fly would be super helpful. Such as using the "Google Calendar Scheduler" or "Google Calendar Presence Simulator" that is also described in the following link:

    Could you Please create a video on how this is setup and how it could be done? Perhaps a followup to your GPIO Binding Video of how to schedule the LED or Relays using a Google calendar? Perhaps you would like to expand on it slightly by Scheduling commands to the GPIO and perhaps send an MQTT command in as well? That way you cover several functions at once?

    Your Videos are AWESOME and a great help to us all.

    Thanks in Advance.

  6. Tomasz Jagusz

    Hi MK, great video. I'm just starting with OpenHab so Your video helped a lot 🙂 What if I'd like to add more relays? Could You show how to use IO Expander like SX1509 or MCP23017 to connect more relays (I'm planning to use 2×8 relay boards)

  7. Dirk Herber CDU

    Perfect! Thank you so much! I tried to figure this out and it took me about 2 days without any results. THAN i stumbled upon this video – it took me 5 more minutes and everything worked like a charm! THANK YOU SO MUCH!!! You made my day – even if just the evening is left now. THANK YOU!

  8. nom

    Thanks for the Video! I stumbled upon it trying to find a fix for my pi GPIO pins. From what I have read around the web is that there is a root issue that may not allow openhab access to the gpio's. Is there anything you have done to correct it?

  9. Anders Jackson

    Thanks, a great exampel on how it work. I will check this our myself.
    But should you not have a current reducing resistor on the LED, so it doesn't use to much current from the RPi. Guess 220 would be a good value.

  10. Djaber Kharoubi

    Hi MK, you are doing a very geat job, just keep going 🙂
    I need your help.
    I folowed all your steps, but I faced a problem with OpenHab2 android application, when I'm using the remot URL, an error msg is appears saying ""authentification failed. Please check Username/Password settings"", and I'm using the same username and password when using Browser on Windows OS, this problem apeared just when I apdated the Habdroid application.
    thnks a lot for your Great Videos 🙂

  11. Ben Mock

    I tried to do the same as you showed in this video however the relays don't work since they need 5v logic which the raspberry pi does not supply. So I was wondering how you got it to work since I noticed that you have 5v relays just like me.

Leave a Reply

Your email address will not be published. Required fields are marked *