0

I am adding a distance sensor to existing project that uses Arduino due, do I connect the trigger pin and the echo pin of the HC-SR04 ultrasonic sensor directly to Arduino due which uses 3.3V while HC-SR04 ultrasonic sensor uses 5V or do I need to use a voltage divider?

Avamander
  • 624
  • 2
  • 11
  • 35

3 Answers3

1

As suggested in previous answers, you can directly use a Due output to drive the HC-SR04's Trig pin; according to the HC-SR04 spec sheet, that pin operates at TTL levels. It will see 0 V as a 0-input and will see 3.3 V as a 1-input since it exceeds 2.4 V. Also see 3.3v input to Arduino digital pin in electronics.stackexchange.

However, the Due's inputs are not 5 V tolerant, so you will need to use a voltage divider between the Echo pin and a Due input. See second paragraph of arduino.cc's ArduinoBoardDue article:

Warning: Unlike most Arduino boards, the Arduino Due board runs at 3.3V. The maximum voltage that the I/O pins can tolerate is 3.3V. Applying voltages higher than 3.3V to any I/O pin could damage the board.

James Waldby - jwpat7
  • 8,840
  • 3
  • 17
  • 32
0

Well, it depends on the sensor itself. Some sensors run on both 5V and 3.3V. There's a similar question here on StackExchange: How to connect 5V sensors to 3.3V digital input (Due)?

But, in short, if the sensor can't operate in 3.3V, you'll need a level converter /shifter.

Mero55
  • 201
  • 1
  • 6
0

The trigger pin is an input, so you can connect that directly to the Due.

The echo pin will however output 5v. You could use a voltage divider to bring that down to 3.3v or a bit lower.

Gerben
  • 11,286
  • 3
  • 20
  • 34