0
\$\begingroup\$

I want to use (probably) four ultrasonic sensors HC-SR04. These use a trigger pin and echo pin.

For the echo pins, I want to connect them to a timer with 'Combined Channels PWM Input on CH1', and the Input Trigger set to TI1FP1, so it is able to automatically time the high time of an echo.

However, since I don't want to use 4 timers, I want to interconnect all echo pins (and trigger the trigger pins of the sensors one by one).

Would this work, or is it not adviced to 'set' a signal to an echo pin when another echo pins becomes high?

Or should I use an IC with logical ORs? or is there a better/easier way?

schematic

simulate this circuit – Schematic created using CircuitLab

I got it by someone and he doesn't know the source, so I don't have a datasheet, this is something similar: Information

\$\endgroup\$
  • 1
    \$\begingroup\$ Why not use a multiplexer IC? \$\endgroup\$ – Marshall Eubanks Feb 14 '18 at 23:05
  • \$\begingroup\$ @MarshallEubanks I have to check what that does (limited electronic knowledge). \$\endgroup\$ – Michel Keijzers Feb 14 '18 at 23:08
  • 1
    \$\begingroup\$ Add the link to the datasheet so we're all using the same one and we don't all have to search for it. \$\endgroup\$ – Transistor Feb 14 '18 at 23:09
  • 1
    \$\begingroup\$ Depends how the echo pins are wired inside the sensor. \$\endgroup\$ – immibis Feb 14 '18 at 23:47
  • \$\begingroup\$ @Transistor I don't have a datasheet, updated my answer with some information (last paragraph). \$\endgroup\$ – Michel Keijzers Feb 15 '18 at 10:17
2
\$\begingroup\$

No, those sensors use a TTL level output signal for echo, so you'll have use an or gate or diodes plus a resistor to implement an or gate. You can drive all the triggers with a single output, although you won't be able to tell which sensor each echo comes from and multiple echo pulses that overlap will appear as a single long pulse.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
  • \$\begingroup\$ Sounds like an easy solution, depending on how many I want to use (4 in principle). \$\endgroup\$ – Michel Keijzers Feb 15 '18 at 10:18
  • \$\begingroup\$ Just in case, I check for multiplexers (probably CD4051BE will do), but this is an elegant sultino for if I don't want to use an IC. \$\endgroup\$ – Michel Keijzers Feb 15 '18 at 11:33
1
\$\begingroup\$

The Echo pin is a TTL output1, according to the datasheet for the HC-SR04. Don't wire the Echo outputs together directly. If one output is in a high state and another output is in a low state and they are connected together, then one of the outputs can burn.
Instead, combine the outputs using an OR gate IC.

1 If it were open-collector or an open-drain output, you could create a wired OR with a pull-up resistor.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.