Osile
Posts: 9
Joined: Fri Dec 28, 2012 12:11 am

Need additional GPIO Ports

Sat Nov 22, 2014 1:11 pm

Hey Guys,

Im not quite sure if i'm posting this in the right category so please move it if necessary. I've got an display from wetterott.com connected by GPIO not by I2C but for my current project I need some GPIO ports (controlling a timelapse setup). Is it possible to get some more GPIO ports over I2C or something ?. Or any other ideas ? Because buying a new display which connects to I2C wouldn't be my first choice :D

Cheers Marvin

User avatar
joan
Posts: 14473
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Need additional GPIO Ports

Sat Nov 22, 2014 1:14 pm

MCP23017 16-bit port expander, up to 8 (for 128 gpios) on each I2C bus.

Try to avoid using pins A7/B7 as inputs.

User avatar
mikronauts
Posts: 2732
Joined: Sat Jan 05, 2013 7:28 pm
Contact: Website

Re: Need additional GPIO Ports

Sat Nov 22, 2014 4:26 pm

I agree with joan, the MCP23017 is an excellent way of adding more I/O to the Pi. I actually designed a board with two of them (plus optional RTC) for the Pi to add 32 I/O's and some prototyping space:

Image

http://www.mikronauts.com/raspberry-pi/pi-rtc-dio/
Osile wrote:Hey Guys,

Im not quite sure if i'm posting this in the right category so please move it if necessary. I've got an display from wetterott.com connected by GPIO not by I2C but for my current project I need some GPIO ports (controlling a timelapse setup). Is it possible to get some more GPIO ports over I2C or something ?. Or any other ideas ? Because buying a new display which connects to I2C wouldn't be my first choice :D

Cheers Marvin
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

Osile
Posts: 9
Joined: Fri Dec 28, 2012 12:11 am

Re: Need additional GPIO Ports

Sat Nov 22, 2014 4:30 pm

Thank you guys very much !

Cheers Marvin

Osile
Posts: 9
Joined: Fri Dec 28, 2012 12:11 am

Re: Need additional GPIO Ports

Sun Nov 23, 2014 11:03 am

It appears that my display uses a I2C Connector on his own so it's also blocked :( am I right ?

Here the schematic of it : https://github.com/watterott/RPi-Displa ... f?raw=true

User avatar
PeterO
Posts: 5156
Joined: Sun Jul 22, 2012 4:14 pm

Re: Need additional GPIO Ports

Sun Nov 23, 2014 11:17 am

joan wrote: Try to avoid using pins A7/B7 as inputs.
Why ? I can't find anything in the data sheet to suggest the top bits are any different from the other 7 in each port.

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
joan
Posts: 14473
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Need additional GPIO Ports

Sun Nov 23, 2014 11:30 am

PeterO wrote:
joan wrote: Try to avoid using pins A7/B7 as inputs.
Why ? I can't find anything in the data sheet to suggest the top bits are any different from the other 7 in each port.

PeterO
Sort of interesting read here http://www.raspberrypi.org/forums/viewt ... 44&t=91209

User avatar
PeterO
Posts: 5156
Joined: Sun Jul 22, 2012 4:14 pm

Re: Need additional GPIO Ports

Sun Nov 23, 2014 11:43 am

joan wrote:
PeterO wrote:
joan wrote: Try to avoid using pins A7/B7 as inputs.
Why ? I can't find anything in the data sheet to suggest the top bits are any different from the other 7 in each port.

PeterO
Sort of interesting read here http://www.raspberrypi.org/forums/viewt ... 44&t=91209
Hmmmm odd there is no "silicon errata" covering this , and the chip has been around for nearly 10 years already (going by documentation dates). Next time I've got one connected to a PI I'll have to try these tests and see if mine are faulty as well.

PeterO

PS Has anyone done similar tests with PICs or Arduinos ?

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
joan
Posts: 14473
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Need additional GPIO Ports

Sun Nov 23, 2014 4:24 pm

PeterO wrote: ...
PS Has anyone done similar tests with PICs or Arduinos ?

PeterO
I've just tried on an MSP430 using the Energia suite (the Arduino environment for a TI Launchpad).

The following script hangs after printing a variable numbers of 0s and 128s.

P2_5 is connected to A7. The rest of the port is tied to ground.

Code: Select all

#include <Wire.h>

byte a=123;             // Variable to store the Byte in

void setup()
{
  Wire.begin();        // join i2c bus (address optional for master)
  Serial.begin(9600);  // start serial for output
  pinMode(P2_5, OUTPUT);
  analogWrite(P2_5, 128);
}

void loop()
{
   // Read the inputs of bank A
   Wire.beginTransmission(0x20); // Connect to chip
   Wire.write(0x12);             // Set Memory Pointer to Bank A
   Wire.endTransmission();       // Close connection
   Wire.requestFrom(0x20, 1);    // Request one Byte
   a = Wire.read();              // Put the Byte into variable 'a'
   Serial.print(a);              // print the character
   Serial.print(" ");
}
If I comment out the analogWrite(P2_5, 128); line the script continues until I kill it.

My assumption is that the error actually hangs the Wire.read() implementation.

User avatar
mikronauts
Posts: 2732
Joined: Sat Jan 05, 2013 7:28 pm
Contact: Website

Re: Need additional GPIO Ports

Sun Nov 23, 2014 4:36 pm

I2C is a shared bus, so unless the display is not using those pins for I2C they should co-exist with MCP23017's just fine.
Osile wrote:It appears that my display uses a I2C Connector on his own so it's also blocked :( am I right ?

Here the schematic of it : https://github.com/watterott/RPi-Displa ... f?raw=true
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

Osile
Posts: 9
Joined: Fri Dec 28, 2012 12:11 am

Re: Need additional GPIO Ports

Mon Nov 24, 2014 8:06 pm

damn, because according to it's shown schematic it's exactly what my display does, am I right ?
mikronauts wrote:I2C is a shared bus, so unless the display is not using those pins for I2C they should co-exist with MCP23017's just fine.
Osile wrote:It appears that my display uses a I2C Connector on his own so it's also blocked :( am I right ?

Here the schematic of it : https://github.com/watterott/RPi-Displa ... f?raw=true

awatterott
Posts: 8
Joined: Sat Aug 23, 2014 11:14 am
Contact: Website

Re: Need additional GPIO Ports

Mon Nov 24, 2014 9:54 pm

The display does not use I2C. There are only pads on the PCB to connect something to the I2C bus.

Return to “HATs and other add-ons”