# How to automate appliances using Raspberry pi GPIO pins directly in openhab

**URL:** <https://community.openhab.org/t/how-to-automate-appliances-using-raspberry-pi-gpio-pins-directly-in-openhab/45295>\
**Category:** Home Automation\
**Created:** [May 22, 2018, 6:47am UTC](https://community.openhab.org/t/how-to-automate-appliances-using-raspberry-pi-gpio-pins-directly-in-openhab/45295 "2018-05-22T06:47:24Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Kees\_van\_Gelder](https://community.openhab.org/user_avatar/community.openhab.org/kees_van_gelder/32/17497_2.png) [@Kees\_van\_Gelder](https://community.openhab.org/u/Kees_van_Gelder)\
**Post date:** [May 22, 2018, 8:25am UTC](https://community.openhab.org/t/how-to-automate-appliances-using-raspberry-pi-gpio-pins-directly-in-openhab/45295/4 "2018-05-22T08:25:48Z")

</div>

Here you will find some examples to directly control the GPIO pins of the raspberry that you have openhab installed on. A simple search for “GPIO” on the forum that you could have done yourself, would have brought that up:

> [@Simple GPIO example](https://community.openhab.org/t/simple-gpio-example/36062):
>
> I have been mostly using openhab via MQTT commands to Arduino’s and ESP8266’s but ofcourse have been eying the mainly unused pins on my Raspberry Pi. In all honesty however, when I glanced over the various articles dealing with the use of GPIO pins, I got dizzy slight_smile But there is no way but forward, so i decided to just give it a try. It turned out to be much easier than I thought. First of all, install the GPIO binding in the PaperUI. After one has done that, there isnt really much e…

If you want to use the GPIO pins of a raspberry that your openhab is not installed on, have a look here:

> [@Controlling a RaspberryPi GPIO pin with MQTT](https://community.openhab.org/t/controlling-a-raspberrypi-gpio-pin-with-mqtt/40912):
>
> In a recent Tutorial, I [explained how to address the GPIO pins](https://community.openhab.org/t/simple-gpio-example/36062) on a Raspberry from within Openhab, but that was when Openhab is actually on the same RaspberryPi whose pins you wanted to address. So what if it is another raspberry, that is not the one that has OpenHAB installed on it? In that case MQTT is a good solution. I wrote a Python program ([download](https://drive.google.com/open?id=1lwpqZwVPpJIgoT7q71d4pfz7gk1oBy-0)) that will do exactly that. Python most likely will already be on your Raspberry Pi. Instaling the libraries You will need two libraries: …

Once you can control the pins, all you need to do is hang a relay on them and start making rules to switch the relays on and off.

---

_[View the full topic](https://community.openhab.org/t/how-to-automate-appliances-using-raspberry-pi-gpio-pins-directly-in-openhab/45295)._
