# What is the best way to access GPIO on Raspberry PI in ignition

**URL:** <https://forum.inductiveautomation.com/t/what-is-the-best-way-to-access-gpio-on-raspberry-pi-in-ignition/23995>\
**Category:** Ignition\
**Created:** [April 10, 2019, 1:34pm UTC](https://forum.inductiveautomation.com/t/what-is-the-best-way-to-access-gpio-on-raspberry-pi-in-ignition/23995 "2019-04-10T13:34:14Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [April 10, 2019, 1:34pm UTC](https://forum.inductiveautomation.com/t/what-is-the-best-way-to-access-gpio-on-raspberry-pi-in-ignition/23995/1 "2019-04-10T13:34:14Z")

</div>

Hi

what is the best way to access GPIO on Raspberry PI in ignition?  
Is it possible to access it by python script directly in ignition?

Thanks.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [April 10, 2019, 1:39pm UTC](https://forum.inductiveautomation.com/t/what-is-the-best-way-to-access-gpio-on-raspberry-pi-in-ignition/23995/2 "2019-04-10T13:39:19Z")

</div>

I think the GPIO are accessible at files under `/sys/class/gpio` but it’s been a while. You’ll need root access though.

The best way would be a custom module.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [April 10, 2019, 3:29pm UTC](https://forum.inductiveautomation.com/t/what-is-the-best-way-to-access-gpio-on-raspberry-pi-in-ignition/23995/3 "2019-04-10T15:29:58Z")

</div>

Another option to consider would be using [Codesys for Raspberry Pi](https://store.codesys.com/codesys-control-for-raspberry-pi-sl.html? ___store=en&___ from_store=default)

---

<div class="post-metadata">

**Author:** ![damean.thomas](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/damean.thomas/32/11367_2.png) [@damean.thomas](https://forum.inductiveautomation.com/u/damean.thomas)\
**Post date:** [April 10, 2019, 4:57pm UTC](https://forum.inductiveautomation.com/t/what-is-the-best-way-to-access-gpio-on-raspberry-pi-in-ignition/23995/4 "2019-04-10T16:57:52Z")

</div>

Currently i use node-red with a mqtt server node and a mqtt2opcua bridge

 ![Capture1](https://us1.discourse-cdn.com/inductiveautomation/original/2X/f/f054f7ddc9d31366ba19e1d85e4f323513016b20.png)

---

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [April 12, 2019, 11:26am UTC](https://forum.inductiveautomation.com/t/what-is-the-best-way-to-access-gpio-on-raspberry-pi-in-ignition/23995/5 "2019-04-12T11:26:23Z")

</div>

Codesys is costly for this.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [April 12, 2019, 1:13pm UTC](https://forum.inductiveautomation.com/t/what-is-the-best-way-to-access-gpio-on-raspberry-pi-in-ignition/23995/6 "2019-04-12T13:13:08Z")

</div>

One man’s costly is another man’s robust. I only give options. What you do with the information is completely up to you. 🙂

---

<div class="post-metadata">

**Author:** ![craigb](https://avatars.discourse-cdn.com/v4/letter/c/9f8e36/32.png) [@craigb](https://forum.inductiveautomation.com/u/craigb)\
**Post date:** [April 13, 2019, 6:32am UTC](https://forum.inductiveautomation.com/t/what-is-the-best-way-to-access-gpio-on-raspberry-pi-in-ignition/23995/7 "2019-04-13T06:32:49Z")

</div>

I also use node red and the MQTT modules. But as with codesys there will be a cost.

What are you doing with the IO pins, is it local? Would it be a safety issue? Another (depending on what you are switching) is the SQL modules in node red. You could write to a database and monitor it on both ends. As with any remote IO you will need some kind of life bit monitoring to make sure you have coms for safety reasons. But that could also be done through the data base. That would be a free solution.

---

<div class="post-metadata">

**Author:** ![craigb](https://avatars.discourse-cdn.com/v4/letter/c/9f8e36/32.png) [@craigb](https://forum.inductiveautomation.com/u/craigb)\
**Post date:** [April 13, 2019, 6:36am UTC](https://forum.inductiveautomation.com/t/what-is-the-best-way-to-access-gpio-on-raspberry-pi-in-ignition/23995/8 "2019-04-13T06:36:04Z")

</div>

Damean,

How have you done your MQTT flow setup to send all 4 values in one message ?

I use separate messages for each of my values as they appear as separate tags in the designer.

---

<div class="post-metadata">

**Author:** ![damean.thomas](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/damean.thomas/32/11367_2.png) [@damean.thomas](https://forum.inductiveautomation.com/u/damean.thomas)\
**Post date:** [April 13, 2019, 12:15pm UTC](https://forum.inductiveautomation.com/t/what-is-the-best-way-to-access-gpio-on-raspberry-pi-in-ignition/23995/9 "2019-04-13T12:15:03Z")

</div>

Here is a copy of my flow for the pi. On a lxc container i have my mqtt server and my mqtt2opc bridge by nz farmer. [GitHub - nzfarmer1/mqtt2opcua: MQTT to OPCUA protocol converter/gateway](https://github.com/nzfarmer1/mqtt2opcua)  
It took me a bit to work out best practices but i ended up defining a handler to handle a topic pi/#. after that any pi i need to read the topic begins with pi/oven or pi/ cooling tower. Honestly i was able to combine a pi, analog and digital widgetlord boards into a light weight mqtt plc. Its like franks red hot now " i put this \* on everything"  
[reactor\_flow.txt](https://us1.discourse-cdn.com/inductiveautomation/original/2X/5/52bf99d8ffce82bfb0b046f95492a6a02a1438c0.txt) (34.5 KB)
