Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

RPi4b + RGB Matrix HAT + RTC + Ultrasonic Sensor HC-SR04
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

RPi4b + RGB Matrix HAT + RTC + Ultrasonic Sensor HC-SR04

by shanerooni on Mon Jun 29, 2020 8:51 am

Good morning, folks. I already have the adafruit hat mounted to my rp4b for a large matrix display. I'm wondering if there's a way I can connect the HC-SR04 ultrasonic sensor to the adafruit board, and where I would need to make the connections. The sensor requires 5V, and I see there are 5V holes to solder to. I also need ground, which is right next to the 5V. The other two connectors on the sensor are for Trig and Echo. I'm sure this is simple, but I'm clueless. If anyone knows if this will work, and where I need to connect Trig and Echo, I would very much appreciate it. Thanks!

shanerooni
 
Posts: 8
Joined: Sun Feb 23, 2020 10:47 pm

Re: RPi4b + RGB Matrix HAT + RTC + Ultrasonic Sensor HC-SR04

by adafruit_support_bill on Mon Jun 29, 2020 9:01 am

The pinouts page indicates which pins are available and not devoted to driving the matrix:
https://learn.adafruit.com/adafruit-rgb ... pi/pinouts
Unused GPIO pins include: RX, TX, 25, MOSI, MISO, SCLK, CE0, CE1, 19.

These are all labeled in the row of holes just below the RPi header:
Image

adafruit_support_bill
 
Posts: 78735
Joined: Sat Feb 07, 2009 10:11 am

Re: RPi4b + RGB Matrix HAT + RTC + Ultrasonic Sensor HC-SR04

by shanerooni on Mon Jun 29, 2020 9:10 am

adafruit_support_bill wrote:The pinouts page indicates which pins are available and not devoted to driving the matrix:
https://learn.adafruit.com/adafruit-rgb ... pi/pinouts
Unused GPIO pins include: RX, TX, 25, MOSI, MISO, SCLK, CE0, CE1, 19.

These are all labeled in the row of holes just below the RPi header:
Image


I appreciate the info and the quick response, but this is an area that I can humbly say I am lost. Even with the pins described, I don't know which would tie to Trig and which of those unused pins would tie to Echo, if any. I'm also only assuming that I can connect the 5V pin on the sensor to one of the 5 open 5V pins on the board, and the same with GND.

shanerooni
 
Posts: 8
Joined: Sun Feb 23, 2020 10:47 pm

Re: RPi4b + RGB Matrix HAT + RTC + Ultrasonic Sensor HC-SR04

by adafruit_support_bill on Mon Jun 29, 2020 9:21 am

That is up to your software. Any of the GPIO pins that are not otherwise being used can be use for trigger and echo.

This example uses pins 18 and 24: https://tutorials-raspberrypi.com/raspb ... r-hc-sr04/
You can use 19 and 25 instead since they are free. But you need to modify the code to reflect the actual pins you are using.

adafruit_support_bill
 
Posts: 78735
Joined: Sat Feb 07, 2009 10:11 am

Re: RPi4b + RGB Matrix HAT + RTC + Ultrasonic Sensor HC-SR04

by shanerooni on Mon Jun 29, 2020 9:27 am

Thanks so much for the info! One last question. Since the hat board doesn't have pins for me to use a female connector, what could I use for the "hole" as a temporary connector rather than soldering it on?

shanerooni
 
Posts: 8
Joined: Sun Feb 23, 2020 10:47 pm

Re: RPi4b + RGB Matrix HAT + RTC + Ultrasonic Sensor HC-SR04

by adafruit_support_bill on Mon Jun 29, 2020 9:37 am

If you want to use jumpers with female connections, you can solder some male header pins to the holes: https://www.adafruit.com/?q=header%200.1%22%20male

adafruit_support_bill
 
Posts: 78735
Joined: Sat Feb 07, 2009 10:11 am

Re: RPi4b + RGB Matrix HAT + RTC + Ultrasonic Sensor HC-SR04

by shanerooni on Mon Jun 29, 2020 9:41 am

Thanks again!

shanerooni
 
Posts: 8
Joined: Sun Feb 23, 2020 10:47 pm

Please be positive and constructive with your questions and comments.