ronnyfrano
Posts: 6
Joined: Tue Aug 01, 2017 12:06 am

Raspi hat blocks all the gpio pins

Tue Aug 01, 2017 12:12 am

Hi,

I have recently started with a new project using raspi and dc motor and stepper hat. I want to add another ultrasonic sensor to that but the gpio pins are all blocked out by the hat and so I am not sure how to connect the additional sensor to the gpio pins. I can use a breakout board and then rewire the whole thing but is that a best practice or should I use some other easier technique?

User avatar
liudr
Posts: 685
Joined: Sat Jun 01, 2013 12:11 am
Location: Central MN, USA
Contact: Website

Re: Raspi hat blocks all the gpio pins

Tue Aug 01, 2017 3:15 am

Try interfacing the sonic ranger with an arduino. Get readings via USB serial port.
Arduino data loggers, user interface, printed circuit board designer since 2009, RPI 3B 2B 2B Zero Jessie, assembly/C/C++/java/python programmer since the 80's

User avatar
karrika
Posts: 1072
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: Raspi hat blocks all the gpio pins

Tue Aug 01, 2017 6:26 am

One way to add more than one card on top of the Pi is to use extended pins that allows you to stack the cards. There are many cards out there that already have long pins. Like http://www.audioinjector.net/rpi-hat

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

Re: Raspi hat blocks all the gpio pins

Tue Aug 01, 2017 7:22 am

ronnyfrano wrote:
Tue Aug 01, 2017 12:12 am
Hi,

I have recently started with a new project using raspi and dc motor and stepper hat. I want to add another ultrasonic sensor to that but the gpio pins are all blocked out by the hat and so I am not sure how to connect the additional sensor to the gpio pins. I can use a breakout board and then rewire the whole thing but is that a best practice or should I use some other easier technique?
The original hat specification /design was not intended to be stackable. I don't think this has changed.
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

DarrenHill
Posts: 234
Joined: Fri Oct 03, 2014 3:03 pm

Re: Raspi hat blocks all the gpio pins

Tue Aug 01, 2017 9:39 am

Pimoroni also offer various versions of their black hat hacker device, which can allow multiple hats to be connected at the same time.

That said of course the GPIO pins used by the boards need to be compatible (no pin aside from power/ground shared or at least designed to work with different addressing etc). Sites like pinout.xyz can assist there in finding out exactly which pins various pieces of hardware actually use.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12398
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Raspi hat blocks all the gpio pins

Tue Aug 01, 2017 2:12 pm

in fact HATS are NOT meant to be stacked at all, the name HAT implies it.

Image

All kinds of I/O conflicts can arise as you try to circumvent this rule, not in the least the fact that you can have only one HAT EEPROM on its I2C bus.

alphanumeric
Posts: 2138
Joined: Tue Jan 19, 2016 2:17 pm
Location: Sydney, Nova Scotia, Canada

Re: Raspi hat blocks all the gpio pins

Tue Aug 01, 2017 3:24 pm

Depending on what sensor(s) your adding stacking is Ok. I used this Proto Hat, https://www.adafruit.com/product/2310 with a tall stacking header, https://www.adafruit.com/product/1979 an put it between my Pi and Sens Hat. I have a DS3231 RTC mounted to it along with headers for a BMP180 and SI1145. Everything talks over I2C so no issues. I think multiple Hats each having an EPROM is the issue. On my Pi Zero's I use a Proto Bonnet. https://www.adafruit.com/product/3203 and substitute the header that comes with for the tall stacking header I linked to above.

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

Re: Raspi hat blocks all the gpio pins

Tue Aug 01, 2017 5:45 pm

As alphanumeric said, you can add a prototyping board with a stacking header between the Pi and the Hat.

Adafruit has such a prototyping board.

So does Mikronauts (working on uploading the product pages) basically a 40 pin gpio version of my EZasPi 26 pin boards :-)

Best Regards,

Bill
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

User avatar
bensimmo
Posts: 4187
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: Raspi hat blocks all the gpio pins

Tue Aug 01, 2017 7:18 pm

What HAT are you using?

Names/links, if it is just an Ultrasonic sensor you are attaching and it it can use unused GPIO pins then either just wire it up with a bit of solder, rear side, top, or if it's like the Sense-hat and you can pull the stacker pins out and use the (mentioned above) longer pins. Then you can use Dupont (?) pin wires to keep it easy to connect.
Just use free GPIO pins or if I2C and an unused address, then that should be ok.

Pictures of your setup might help (I'm assuming by blocked you mean cannot physically get to them)

User avatar
karrika
Posts: 1072
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: Raspi hat blocks all the gpio pins

Tue Aug 01, 2017 7:25 pm

The whole idea with the HAT eeprom has not turned to be so successful.

Almost every HAT board has its personal device tree blob in the raspbian distribution. This is a better and more user friendly distribution mechanism that the eeprom programming. Actually I have two HAT boards with eeprom's and for the next batch I plan to leave them unpopulated and go with the firmware-in-raspbian way as almost everyone else is doing already. The eeprom's cause conflicts as raspbian fixes old bugs. Typical things are swapping of audio channels in different Pi versions bug, UART pin's in RPi3.

Stacking cards is a wonderful thing. The pinout.xyz is a good resource for finding out which cards can be stacked on top of each other. The only thing is that you are not allowed to name the cards HAT's anymore after abandoning the eeprom's. But that is a small price to pay.

Here is a nice real-life example of stacking a sound mixer and a DMX controller on top of each other for getting real time control over volume and light. The result is pretty amazing.

Image

ronnyfrano
Posts: 6
Joined: Tue Aug 01, 2017 12:06 am

Re: Raspi hat blocks all the gpio pins

Wed Aug 02, 2017 1:57 am

bensimmo wrote:
Tue Aug 01, 2017 7:18 pm
What HAT are you using?

Names/links, if it is just an Ultrasonic sensor you are attaching and it it can use unused GPIO pins then either just wire it up with a bit of solder, rear side, top, or if it's like the Sense-hat and you can pull the stacker pins out and use the (mentioned above) longer pins. Then you can use Dupont (?) pin wires to keep it easy to connect.
Just use free GPIO pins or if I2C and an unused address, then that should be ok.

Pictures of your setup might help (I'm assuming by blocked you mean cannot physically get to them)
Its a DC stepper motor hat shown here : https://www.adafruit.com/product/2348 and yes i cannot physically reach them since i have placed the hat which occupies all the pins.

User avatar
OutoftheBOTS
Posts: 711
Joined: Tue Aug 01, 2017 10:06 am

Re: Raspi hat blocks all the gpio pins

Wed Aug 02, 2017 6:21 am

The motor hat designed by Adafruit is especially designed to be stacked. When you solder the 40 pin header on you just need to solder a straight through header for stacking. This hat is an I2C hat so only uses the 2 I2C pins but this doesn't stop you evn stacking more I2C devices as long as they have different addresses

User avatar
bensimmo
Posts: 4187
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: Raspi hat blocks all the gpio pins

Wed Aug 02, 2017 8:17 am

If you've not soldered the header pins in (or you don't mind changing it)
Then these are the long stacking headers
https://www.adafruit.com/product/1979 available elsewhere as well.

Other than that, just solder some jumper wires to the top or somewhere along it circuit.

Edit
Actually you have all sorts of holes on there and some are named GPIO pins (the long row nearest.)
Just solder some pins to them and attach the Ultrasonic sensor there ?
Maybe using this as a guide ?
https://www.modmypi.com/blog/hc-sr04-ul ... spberry-pi
Last edited by bensimmo on Wed Aug 02, 2017 8:27 am, edited 1 time in total.

User avatar
piglet
Posts: 911
Joined: Sat Aug 27, 2011 1:16 pm

Re: Raspi hat blocks all the gpio pins

Wed Aug 02, 2017 8:22 am

I'd like to see an official specification for hat-like boards that can be stacked - that specifies a way to get the best possible stacking where this is possible (probably more around using the different serial bus options than general GPIO): pin usages/I2C address selection/pullup-downs etc

alphanumeric
Posts: 2138
Joined: Tue Jan 19, 2016 2:17 pm
Location: Sydney, Nova Scotia, Canada

Re: Raspi hat blocks all the gpio pins

Wed Aug 02, 2017 9:06 am

I think you'll find that officially, Hats (boards that actually meet the specification) can not be stacked. A lot of boards are being called Hats that aren't really Hats. I do believe if it doesn't have an EPROM its not officially a Hat. And just to confuse it further on the Pi Zero side there are pHats and Bonnets. The term HAT is being generally used to describe any board that plugs into the GPIO.
If you go here, https://pinout.xyz/boards# you can see what pins are used by what board. The most common boards anyway. Then figure out what will work with what.

User avatar
rpdom
Posts: 15567
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Raspi hat blocks all the gpio pins

Wed Aug 02, 2017 9:24 am

Officially "A HAT is an add-on board for B+ that conforms to a specific set of rules" any other board should not be called a HAT. As previously mentioned, true HATs can not be stacked (it was considered in the early days, but the implementation was too complex to manage sanely).

PiGraham
Posts: 3670
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Raspi hat blocks all the gpio pins

Wed Aug 02, 2017 10:28 am

ronnyfrano wrote:
Wed Aug 02, 2017 1:57 am

Its a DC stepper motor hat shown here : https://www.adafruit.com/product/2348 and yes i cannot physically reach them since i have placed the hat which occupies all the pins.
Tha Adafruit board brings many GPIO signals to a separate row of holes that you can fit header pins to. The first two of which are the i2c pins SDA and SCL. There are also general purpose pins, UART and SPI. Connect your sensor to whichever pins suit the sensor and are not required exclusively for the stepper motor HAT, and in fact this board has NO exclusive pins, as they say here:
Only two pins (SDA & SCL) are required to drive the multiple motors, and since it's I2C you can also connect any other I2C devices or HATs to the same pins.
So you are free to use any of those GPIO on that row of holes adjacent to the header that connects to the Pi.

User avatar
OutoftheBOTS
Posts: 711
Joined: Tue Aug 01, 2017 10:06 am

Re: Raspi hat blocks all the gpio pins

Wed Aug 02, 2017 10:51 am

either way to help out with the problem of using GPIO pins for Ultrsonic sensor in combo using an Adafuit motor Hat (someone needs to tell Adafruit that r not allowed to called there device a hat). All you need to do is use a straight through 40 pin header this is standard practice for all experienced RPi users as any hardware that you attach on top of the GPIO header usually only uses a few of the pins and it is common to want to be able to use the rest of the pins for devices. Straight through headers allow you to physically stack devices on top of each other.

As for getting a complete list of what device uses what pins, this doesn't exist. What is standard practice is when you want to buy a piece of hardware then you get the datasheet from the seller and look up what it uses, then you know.

Hardware tends to have a very short production and sale life as it becomes out dated very quickly, also at the same time customers tend to be paying very low prices for this hardware. this tends to mean developers of new hardware don't tend to write detailed user instructions but rather release the data sheet that has all the tech detailsT

alphanumeric
Posts: 2138
Joined: Tue Jan 19, 2016 2:17 pm
Location: Sydney, Nova Scotia, Canada

Re: Raspi hat blocks all the gpio pins

Wed Aug 02, 2017 11:18 am

I soldered 90 degree male headers to my Proto Hat, then used female to female jumpers to connect them to my sensor breakout boards. They have male headers on them. My DS3231 breakout I just soldered right to the Proto Hat via the mail header that came with it. I just cut the excess off once I had it soldered in place. Then connected what GPIO I needed where with jumper wire on the Proto Hat. Lots of ways to get things done with a little ingenuity.

PiGraham
Posts: 3670
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Raspi hat blocks all the gpio pins

Wed Aug 02, 2017 11:34 am

OutoftheBOTS wrote:
Wed Aug 02, 2017 10:51 am
either way to help out with the problem of using GPIO pins for Ultrsonic sensor in combo using an Adafuit motor Hat (someone needs to tell Adafruit that r not allowed to called there device a hat).
I think they can call it a HAT so long as it conforms to the HAT spec. If they also allow for stacking in addition that's no problem. As long as one of these on it's own serves as a HAT, with EEPROM etc, than it's a HAT. AFAIK the spec doesn't make define how to stack, but doesn't prevent it.

Have you seen something about it that specifically doesn't conform to the spec?

PiGraham
Posts: 3670
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Raspi hat blocks all the gpio pins

Wed Aug 02, 2017 11:38 am

OutoftheBOTS wrote:
Wed Aug 02, 2017 10:51 am
As for getting a complete list of what device uses what pins, this doesn't exist. What is standard practice is when you want to buy a piece of hardware then you get the datasheet from the seller and look up what it uses, then you know.
Fortunately in this case Adafruit have specified exactly what I/o they are using and also made a selection of free gpio pins available for other purposes. With some devices things can be more difficult.

User avatar
OutoftheBOTS
Posts: 711
Joined: Tue Aug 01, 2017 10:06 am

Re: Raspi hat blocks all the gpio pins

Wed Aug 02, 2017 9:02 pm

Adafruit spend a lot time to write clear instructions and tutorials for there hardware this is the reason many people use Adafruit hardware.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12398
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Raspi hat blocks all the gpio pins

Wed Aug 02, 2017 11:02 pm

PiGraham wrote:
Wed Aug 02, 2017 11:34 am
I think they can call it a HAT so long as it conforms to the HAT spec. If they also allow for stacking in addition that's no problem. As long as one of these on it's own serves as a HAT, with EEPROM etc, than it's a HAT. AFAIK the spec doesn't make define how to stack, but doesn't prevent it.
the point is that the specification of a HAT is that no second HAT can be stacked on the FIRST HAT, as a conflict will occur with the two EEPROMS of both HAT's occupying the same address.

In theory you can stack something ELSE on top of a HAT, but NOT another HAT,
If you do so, (add other non HAT expansion devices) you are responsible to make sure no conflicts can arise.

PiGraham
Posts: 3670
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Raspi hat blocks all the gpio pins

Thu Aug 03, 2017 8:51 am

mahjongg wrote:
Wed Aug 02, 2017 11:02 pm
PiGraham wrote:
Wed Aug 02, 2017 11:34 am
I think they can call it a HAT so long as it conforms to the HAT spec. If they also allow for stacking in addition that's no problem. As long as one of these on it's own serves as a HAT, with EEPROM etc, than it's a HAT. AFAIK the spec doesn't make define how to stack, but doesn't prevent it.
the point is that the specification of a HAT is that no second HAT can be stacked on the FIRST HAT, as a conflict will occur with the two EEPROMS of both HAT's occupying the same address.

In theory you can stack something ELSE on top of a HAT, but NOT another HAT,
If you do so, (add other non HAT expansion devices) you are responsible to make sure no conflicts can arise.

So that Adafruit product can be called a HAT because it meets the spec when used as a single add-on board?
The fact that it can be stacked on 12c without conflicts doesn't disqualify it, does it?

User avatar
bensimmo
Posts: 4187
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: Raspi hat blocks all the gpio pins

Thu Aug 03, 2017 9:47 am

There are
'Add-on boards'
And there are
'HAT boards' conforming to the Pi B+ HAT spec.

(The terminology problem here is there are many HATs people call HAT w.r.t. the Pi)
You cannot stack HAT, you can stack Add-on at your own risk.

HAT have an EEPROM under the specs
https://github.com/raspberrypi/hats/blo ... /README.md
and these have a defined I2C address, so if two are attached they would conflict looking at the same address.
Hence cannot stack 'HAT'

I guess it is too difficult to scan I2C addresses for the EEPROMs, ask for the GPIO pins in use and bring up a warning before any GPIO's are set to any state.
Let alone make sure everyone is using a different I2C address.

The Stepper HAT is not a RaspberryPi 'HAT' but an add-on board, it has all the details anyone would ever need on the website on how to stack the add-on boards.
Even if they call it a HAT, I guess in reality there is nothing RPi can do about it.

But try stacking a SenseHAT and a VoiceHAT, I would assume it would complain ?

Anyway, I hope ronnyfrano now knows what's needed or has an idea what to do.

Return to “General discussion”