1
\$\begingroup\$

I have a use-case where I need to control 4+ sonar sensors with a pic 628A microcontroller. The pic is also responsible for controlling a GPS and LCD so pins are scarce. The sonar sensors each have a single signal pin. To operate them, you pulse this pin which produces an ultrasonic chirp and then wait for it to go high again which indicates that an echo was detected. The time between the initial pulse and the response pulse corresponds to the time of flight of the chirp.

I would like to be able to multiplex all of the sonar sensors onto a single bus, but am not sure how to accomplish this. I would like to use only basic components if possible (not specialized IC's) because my main purpose of this experiment is to get a better understanding of the basics. Since the signal channel must allow for both input and output, I do not think bipolar transistors will work. I have considered using FET's to multiplex each signal line, but I am very inexperience with this stuff and would appreciate some direction.

\$\endgroup\$
  • \$\begingroup\$ If you used a higher model of the PIC, you could have an I2C bus, that would let you add I/O port chips to the system. \$\endgroup\$ – Kaz Jun 13 '13 at 17:09
  • \$\begingroup\$ That's a good suggestion, but the reason I am doing this is to gain a better understanding of building circuits using discrete components. \$\endgroup\$ – Timothy Schoonover Jun 13 '13 at 17:54
2
\$\begingroup\$

What you want is an 8:1 multiplexer/demultiplexer. You can get them as an IC, but I don't know if that falls under your idea of a "specialized" IC or not. It's the kind of thing you would use in a freshman digital logic class.

If that's not basic enough for you, the block diagram still shows you what you need to build.mux/demux block diagram

The bottom half is your MOSFETs. The top half is called a decoder if you want to get that in a single IC. You can also get the inverters and 4-input AND gates as separate ICs, or you can build those from transistors if that tickles your fancy. Depends how hard you want to make it on yourself.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ PTL is a bit beyond my level of understanding. Let's say I have 3 pins to use for sensor selection (allowing me to address 8 separate sonar sensors) and 1 pin for data. Couldn't I just connect the PIC data pin to 8 separate FET's each going to a sonar sensor to achieve a bidirectional channel? Then, couldn't I use the 3 data select to somehow multiplex the FET gates? \$\endgroup\$ – Timothy Schoonover Jun 13 '13 at 17:48
  • \$\begingroup\$ @odysseus.section9 how are you going to connect 8 FETs to 3 pins? \$\endgroup\$ – Phil Frost Jun 13 '13 at 18:48
  • \$\begingroup\$ I thought maybe I could use the 3 pins as data select pins on a 1 to 8 multiplexer going to the the gates of 8 FETs. \$\endgroup\$ – Timothy Schoonover Jun 13 '13 at 20:11
0
\$\begingroup\$

The simplest approach may be to use something like a 74HC4051 along with some sort of counter chip to select among up to seven devices. One could probably use a single processor pin to do everything if the counter was operated by the rising edge on the data wire, though it would probably be a good idea to add a short delay (perhaps using a couple Schmidt-trigger inverters with an RC delay between them) between the data wire and the counter's clock input (to ensure that the data wire is all the way high before the counter advances). To avoid the need for a separate wire to reset or sense the counter state, wire one of the 74HC4051 inputs to a pull-down resistor which is strong enough to overpower the "normal" pull-up on the pin. Repeatedly asserting and releasing the pin would cause the counter to advance enough to select that input; the data wire would then sit low until the PIC actively drove it high.

| improve this answer | |
\$\endgroup\$

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