Ultrasonic module (HC-SR04) with Basys3

Recommended Posts


I'm building a project with the basys3 for reading an ultrasonic rangefinder (HC-SR04) signal in and convert with that signal the distance in meters.

But now i'm almost done writing my code and I search the connectors of the board and there are pmod connectors so i'm wondering can I use those connectors as a normally gpio input and output?

Already friendly greetings!

Share this post

Link to post
Share on other sites


Looks like a fun component to work with!

My initial thought was that you should just be able to wire the HC-SR04 pins to a Basys3 pmod port and control it with GPIO.  Just to be sure, though, I double checked the HC-SR04 data sheet.  What I read suggested that the HC-SR04 wanted a 5V power supply, and a 5V input and output.  To connect this to the Basys3 board, you'll also need a level shifter and a 5V source.  For the 5V source, you might be able to tap the power rail underneath the power selection jumper.  That'd get you access to the 5V USB power source.  Alternatively, you could provide that 5V from somewhere else.  (The Basys3 wasn't really designed to provide 5V power, but rather 3.3V power)


Share this post

Link to post
Share on other sites


Thanks for the fast respond!

The sensor has 4 pins Vcc, Gnd, Echo, Trig. The Trig pin need a short pulse of 10µs for starting to send, I am going to send a pulse signal every 100ms. The Echo pin sends the pulse with to the board.

So I need the level shifter for the signal Trig? So that the sensor as an 5V input instead off 3,3v input?

Yeah it's fun to play with but more difficult with the fpga board (basys3) then an simple arduino board :)

Edited by Mell

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now