What is the best practice to increase number of RPi I/Os

Support for Air Player desktop on ARM devices, like the Raspberry Pi.

Moderators: russ, Ralph

Post Reply
Message
Author
User avatar
brodhaq
Posts: 152
Joined: Wed Jun 29, 2016 4:13 pm

What is the best practice to increase number of RPi I/Os

#1 Post by brodhaq »

Hello,
I am about to deploy my EFIS to a Raspbery Pi, but I need 39 I/O pins for that (I count 1 LED as 1 I/O, 1 button as 1 I/O, and 1 rotary encoder as 2 IOs).

RPi2 has 40 GPIO, but not all of them are actual I/O pins, so there is not enough of them to connect all my stuff (EFIS control panel, etc). What is the best way to connect more I/Os to the Rpi? Is there any way to use a shift register IC? I can't seem to find a wiki article on how would I access those I/Os. Or is there a way to connect Arduino Mega to Raspbery, to act as I/O interface?

Thank you.

Pavel
Pavel Brodský
Prague, Czech Republic

User avatar
brodhaq
Posts: 152
Joined: Wed Jun 29, 2016 4:13 pm

Re: What is the best practice to increase number of RPi I/Os

#2 Post by brodhaq »

I would actually prefer to use directly Rpi pins, not arduino, as the arduino seems quite complicated for what I need... Any chance to use multiplex with Rpi? Or some I/O board connected to Rpi? Maybe this? https://www.abelectronics.co.uk/p/54/IO-Pi-Plus

Pavel
Pavel Brodský
Prague, Czech Republic

alioth
Posts: 91
Joined: Tue Aug 16, 2016 9:03 pm

Re: What is the best practice to increase number of RPi I/Os

#3 Post by alioth »

First thought: just use two/three... arduino/rpi

About arduino: you could use the new message port feature to talk with arduino. In this way, with your own arduino sketch, you could add i2c or serial expanders..
But, you need to know how to program in the Arduino ide and how i2c expander works. And learn how to use the message port feature.
It depends on the experience you have, but it is not like using the arduino api in air manager. It needs more work and knowledge.

I think arduino API is perfect like it is. Simple... some buttons for the needs of the instruments.
If someone need something more complex, can be made with the message port library.

if you only need a lot of inputs for mapping switches in the cockpit... it is probably than some leobodnar cards can make the work.

User avatar
Ralph
Posts: 7933
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: What is the best practice to increase number of RPi I/Os

#4 Post by Ralph »

For multiplexing you need timers I would guess, and I don't think that can be trusted on the Pi. Corjan might know a better option, but I think that the Arduino is the safest solution.

User avatar
brodhaq
Posts: 152
Joined: Wed Jun 29, 2016 4:13 pm

Re: What is the best practice to increase number of RPi I/Os

#5 Post by brodhaq »

Ok, but is there a way to connect Arduino to RPi? That is what I am missing maybe :D I would be pretty hapy to use it without message port, just as I/O board to my RPi.

Pavel
Pavel Brodský
Prague, Czech Republic

User avatar
Ralph
Posts: 7933
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: What is the best practice to increase number of RPi I/Os

#6 Post by Ralph »

Yes you can, configure it on a desktop computer with the Arduino installer and then hook it up to the Pi (USB).

User avatar
Sling
Posts: 5244
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: What is the best practice to increase number of RPi I/Os

#7 Post by Sling »

You could also perhaps try to run the code for a matrix of buttons and/or LED multiplexing. I haven't tried myself yet but I'd be interested to see if the timing would be an issue or not.

There shouldn't be anything stopping you from expanding the I/0 with some simple 74 series chips or similar. You could even program an Arduino or some other micro to act as a basic multiplexer. You don't even need USB comms for this.

drnicolas
Posts: 115
Joined: Tue Aug 02, 2016 12:03 pm

Re: What is the best practice to increase number of RPi I/Os

#8 Post by drnicolas »

Just an idea:
Can we use additional libraries within lua-scripts which connects to the native raspberry Hardware?

I am thinking of using I2C as a GPIO Expander.
AFAIK there are ways to use I2c from LUA
Air Manager 3.6 Home Use - Rpi AirpLayer with 7" Touchscreen

User avatar
Sling
Posts: 5244
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: What is the best practice to increase number of RPi I/Os

#9 Post by Sling »

You could do I2C with an Arduino using your own Arduino sketch and the AM to Arduino message port. Some have started to use it this way. The Rpi does not have the message port functionality so only what's achievable with the AM API functions is possible.
Last edited by Sling on Sun Jan 07, 2018 12:24 am, edited 1 time in total.

alioth
Posts: 91
Joined: Tue Aug 16, 2016 9:03 pm

Re: What is the best practice to increase number of RPi I/Os

#10 Post by alioth »

Sling wrote: Thu Jan 04, 2018 9:02 am You could do I2C with an Arduino using you own Arduino sketch and the AM to Arduino message port. Some have started to use it this way. The Rpi does not have the message port functionality so only what's achievable with the AM API functions is possible.
I think is the better way too.

With Arduino, I2C and 8 x mcp23017 we have 128 inputs/outputs only with the i2c lines.

I have 6 mcp23017 working now with one of my arduinos, and works perfect.

Post Reply