0

I am designing a circuit for a PCB that will incorporate an ultra-sound sensor (HCSR04.)

The sensor needs 5V for supply and its input pin also requires 5 V. The MCU that I am using has pins that can only send 3.3 V.

I thought I could use a 3.3 V output pin and connect it to the sensor like the picture.

But now I am skeptical about it.

I think it will only send 3.3 V to the sensor pin. Should I switch the pin location so that the 3.3 V pin (PC7) is connected to the resistor instead, and place the 5V pin is where PC7 is? Or is there a better way?

enter image description here

JRE
  • 67,678
  • 8
  • 104
  • 179
mapapaya
  • 9
  • 3
  • Add a link to the sensor datasheet. – JRE Apr 28 '19 at 11:09
  • https://cdn.sparkfun.com/datasheets/Sensors/Proximity/HCSR04.pdf – mapapaya Apr 28 '19 at 11:13
  • If you only need to trigger the signal as HIGH usually 3.3V logic works good on 5V logic because the trig level voltage is way lower than 5V. – C. K. Apr 28 '19 at 11:19
  • 1
    @MariusGulbrandsen: Typical 5V CMOS is known to be unreliable with a 3.3V logic high input. See the data sheet for the [SN74HC00](http://www.ti.com/lit/ds/symlink/sn74hc00-q1.pdf), and extrapolate the input high voltage vs. supply voltage -- I get 3.5V at a 5V supply, which is more than 3.3V. 3.3V into a 5V-powered 74HC part may **sometimes** work, but it's not a **production** solution. Using a single-gate 74HCT buffer would work just fine. – TimWescott Apr 28 '19 at 15:39

2 Answers2

1

That's not how you'd do a level shifting for logical signals. You'd need something active if you want to actually increase the signal level.

Single transistor level up shifter has multiple recommendations on how to do that.

Personally, the single logic gate solution is probably by far the most robust one, and really easy, since you need no additional components.

Marcus Müller
  • 88,280
  • 5
  • 131
  • 237
0

Assuming that you're planning on using the MCU to signal input pins on the sensor rather than to power the thing, you're fine.

The various input signals to the device are rated as "TTL". This is shorthand to say that they recognize anything over 2.5V (or 2.4 -- I can never remember) as a logic-level high voltage. Your 3.3V MCU is CMOS, so it'll put out 3.3V no problem, and everything will just work.

TimWescott
  • 44,867
  • 1
  • 41
  • 104