user17339: 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?

user3917: 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.


17339: <p>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?</p>
 3917: <p>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  <a href="https://electronics.stackexchange.com/q/58498">3.3v input to Arduino digital pin</a> in electronics.stackexchange.</p>

<p>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 <a href="https://www.arduino.cc/en/Main/ArduinoBoardDue" rel="nofollow noreferrer">ArduinoBoardDue</a> article:</p>

<blockquote>
  <p>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.</p>
</blockquote>
