multiplexer problem?  - Page 1
Forum section: electronics / projects

author: brettddglas
author_rank: Newbie
timestamp: October 11, 2010, 10:09:23 pm
content: I am trying to come up with the easiest way to do simple 24v dc switching over 7 channels using only 2-3 max for transmission wires. Would a multiplexer/demultiplexer do what I am asking? Is there a simple way of doing this?Thanks in advance for any help

author: JohnS_AZ
author_rank: Frequent Contributor
timestamp: October 11, 2010, 10:29:20 pm
content: Need more information.Do you need to apply the 24v to only one of the 7 channels at a time, or do multiple channels need to be on at the same time?

author: brettddglas
author_rank: Newbie
timestamp: October 11, 2010, 10:48:43 pm
content: would have to go to multiple channels.Thank you for your prompt reply

author: JohnS_AZ
author_rank: Frequent Contributor
timestamp: October 11, 2010, 11:06:18 pm
content: Well, mux/demux isn't going to work for you. To control 7 channels you'd need 4 wires for data, plus (I presume) 2 for power and ground. And even then you could only control one channel at a time, unless you put some sort of latch on each channel.Probably the simplest way to do this would be to get two Arduino or similar little computer boards. You could connect the serial transmit from one to the serial receive of the other, and just shoot commands at it. Presuming you had to send power on the wires, this would only take three leads. Plus, since you have a computer in there, you could do other fun stuff in your command set. For example, All On, All Off, Turn channel 5 on for 3 minutes, Turn them on one at a time in sequence, etc. If you added a 4th lead, connecting the other half of the serial link, the controller end could monitor for failures or other conditions at the far end of the line.At any rate you're going to have to get parallel control data, convert it to some sort of serial data, and then convert it back to parallel again. I imagine you COULD build up a circuit to accomplish this without a processor, but I think it would be a giant pain in the ass, and probably cost more than the Arduinos.If *I* were going to do it, I'd use DTMF! ( TouchTone )(bracing now for the shrieks about to get posted)

author: brettddglas
author_rank: Newbie
timestamp: October 11, 2010, 11:43:20 pm
content: DTMF? Huh. How would you go about using DTMF to solve this? And would it be simple?

author: DJPhil
author_rank: Frequent Contributor
timestamp: October 12, 2010, 12:58:38 am
content: Quote from: brettddglas on October 11, 2010, 11:43:20 pmI'd like to guess, even though I'm probably wrong.Use a portion of the 4x4 DTMF grid to encode a selection into two wires (analog and ground, or for added awesome use a differential driver for lower noise), run the wires wherever you like (good noise immunity), then use a DTMF decoder -> 1 of 16 data selector at the receive end. Was I close?Encoders and decoders for DTMF used to be available as MSI chips, but I'm not sure what it's like nowadays. I'm sure there's a bunch of ways to implement DTMF, it's probably cake with a micro.

author: JohnS_AZ
author_rank: Frequent Contributor
timestamp: October 12, 2010, 02:07:30 am
content: @DJPhil : You got it.I made up a quick diagram. I didn't pay much attention to the transmission line since there are a number of ways to do it.I think it would be elegant to just use a twisted pair to send power, and current modulate the DTMF onto the power (how a telephone works). But it would be simpler to use 3 conductors and just use one as the DTMF signal path.

author: NiHaoMike
author_rank: Super Contributor
timestamp: October 12, 2010, 03:25:00 am
content: Use a PIC to decode RS232. Or maybe just use a shift register.

author: scrat
author_rank: Frequent Contributor
timestamp: October 12, 2010, 01:06:41 pm
content: Quote from: JohnS_AZ on October 11, 2010, 11:06:18 pmI don't understand... isn't there the need for 7 lines to control 7 bits?However, I like the DTMF solution (smart, low-cost), although a UART-like could also be good.

author: TechGuy
author_rank: Regular Contributor
timestamp: October 12, 2010, 10:08:13 pm
content: Quote from: scrat on October 12, 2010, 01:06:41 pmThe minimum lines would be three connections: Pwr, Ground, Serial-IO. However if you need noise immunity for distance, than you will need four lines: Pwr, GND, and two signal lines for RS-485 Differential.For the three line system for short haul you need a PIC MCU preferable a 14 to 28 pin device, with SPI), Voltage convertor (ie 24V to 5V), and Seven Power switching devices (MOSFETs, relays, etc), You connect the seven switches to IO pins on the MCU. The MCU, will turn on or off the devices. SPI uses one signal wire (plus ground) to send or Receive. If you need to be able to send and receive you need to go with I2C or another 1-wire bidir. serial I/O (such as Dallas protocol). The problem with SPI and other 1-wire serial I/O is that they can be affected by noise, (ie flourescent lights, AC power lines, etc). RS-485 uses Differential signaling which has much, much better noise ammunity.Of course with any Serial I/O you will need a device on the other side to send signals to the remote controller. You can buy RS-485 Serial boards (PCI, PCI-X) from Startech for a reasonble costs. You can also go with RS-232, if you use a RS-232 convertor chip such as the MAX232 (RS-232 use +/- 15V for signalling) SPI uses +5V for signallingFWIW: Attached is a similar product using RS-485 to control 4 Relays (designed for switching AC ciruits, instead of 24Volts) for a 24Volt system, I would go with MOSFET switches instead. The circuit attached has more functionally since it includes voltage monitoring, and LED status lights so the user can see which relays are turned on and off.Note that using a 24VDC will limit the usable distance unless your current demand is very low, or you will need to run heavy gauge copper wiring (expensive). A better option would be to go with 48V and use a DC-DC convertor (Buck step-down regulator) to drop the voltage to 24VDC at the end point. 48VDC will go about 4 times the distance as 24VDCs using the same gauge wire. Notice in my schematic I am use a pair for LM2576 Buck regulators to step down the input voltage (designed to work from 18VDC to 55VDC) to 15VDC and 5VDC to provide operational voltages for the controller.

author: brettddglas
author_rank: Newbie
timestamp: October 12, 2010, 10:47:45 pm
content: The distance would not be that far, typically less than 100' and no more than say 200'. It would be 18ga solid wiring, and I have a max of 3 transmit wires (2 would be best if that is workable). What I need is as follows. I have 8 switched output channels that are either 24v or 0. I need to take these 8 IO pins and transmit their status across 2-3 wires as described above. This will be read and the ouput replicated on the other end. Keeping the cost down is important. The output side of this will be used to switch 24v relays.Hope this helps to clarify..Thanks!

author: scrat
author_rank: Frequent Contributor
timestamp: October 13, 2010, 11:33:07 am
content: I was wandering about the phrase of JohnS_AZ, since it was quite strange... I guess he was speaking about 3 lines for address and 1 line for state, because he mentioned the fact that this way it is possible to control one line at a time and you need some latching.Serial communication works best (especially differential), but requires some more hardware. As far as I know, there should be UART chips that made serial to parallel conversion (8250 or similar), allowing for that kind of control with only one chip (although I'm not completely sure they can work as standalone). But this is a less flexible solution than an MCU based one, and perhaps today that chips cost more than an MCU.

author: Frant
author_rank: Regular Contributor
timestamp: October 13, 2010, 01:50:28 pm
content: Quote from: brettddglas on October 12, 2010, 10:47:45 pmAn alternative approach to the ideas discussed so far is to use the DS2408 from MAXIM. It belongs to the 1-Wire (single wire) series of products and it has an 8-bit programmable I/O port. The chip communicates via the 1-Wire interface designed specifically to minimize the number of wires. In some cases, only 2 wires are necessary for proper operation (I/O and GND), since the chip derives "parasitic" power from the signal. However, in this application it would be necessary to add the third wire in order to supply the power to the remote unit (unless a separate power supply exists for the relays). Another IC to be considered is the DS2480B (Serial to 1-Wire driver) which can be used on the computer (controller) side. Another possibility is to use an I/O pin of a microcontroller, however that would require more programming and the generated signal might be inadequate for long distances. Apart from the complexity of the 1-Wire protocol, the solution based on it seems elegant.

author: david77
author_rank: Frequent Contributor
timestamp: October 13, 2010, 02:26:32 pm
content: As I see it you need two MCU's, a few zener diodes, resistors, a few transistors and relays. And a bit of codeto feed the MCU's with.On your sender side you feed the 24/0V signal into your controller using 5,1V zeners to clamp the +24V downto 5V.The controller reads the inputs and converts that into a serial form that can be transmitted over a serial line - whatever that might be.On the receiving side another controller reads the serial data and converts that back to parallel. The eightoutput ports each connect to a switching transistor and a relay.I think you might even be able to use a serial in / parallel out shift register at the receiving end, as relaysreact quite slowly you'd only have to update the shift register quick enough. Any thoughts on that?In theory quite simple. Now I know next to nothing about serial data protocols and such...Do you have to power the remote end of your setup from the sender or does it have it's own supply?David

author: DJPhil
author_rank: Frequent Contributor
timestamp: October 13, 2010, 02:34:28 pm
content: Quote from: JohnS_AZ on October 12, 2010, 02:07:30 amQuote from: scrat on October 13, 2010, 11:33:07 amI'm just guessing (again) but I think the 3 conductors part was in reference to the transmission lines. You'd have power (24V), ground, and DTMF signal, or with current modulation it'd just be power and ground. You are right about the last bit, DTMF would give you 16 states to work with and the receiving side in this case would allow you to latch 8 lines (3 bits) on and off. DTMF is kind of like analog 4bit serial communication.I just took a quick spin looking for DTMF chips. There are dozens of kinds out there in the world, but it seems like they haven't been manufactured in discreet chips in a long time. Those like me who salvage all the time really dig this sort of stuff for niche use, as it can have some real benefits. DTMF has been beaten and bent to all sorts of uses in the past (45 years or so?), and it's very robust. Odds are you'll wind up using a micro of some sort and a serial communication method, and it might be worth looking at some DTMF micro implementations to see if the benefits carry over.Hope that helps.

author: scrat
author_rank: Frequent Contributor
timestamp: October 13, 2010, 03:41:32 pm
content: Quote from: JohnS_AZ on October 11, 2010, 11:06:18 pmThis is the "sentence under test"From here I guess 4 data lines are 3 address + 1 state, then there are power and ground. But this isn' t the original "issue under test"... I agree on the fact that DTMF is a very good solution. You can see it as a kind of 2-channel 4-FSK.

author: JohnS_AZ
author_rank: Frequent Contributor
timestamp: October 13, 2010, 05:07:34 pm
content: @ DJPhil ... Cool, another DTMF fan.Provided you don't have any significant data rate requirements, it is STILL a bullet-proof transmission method. I've often said you can send it across any medium from copper to air (loudspeaker and microphone *grin*). And you were correct about the three wires: ground, power, and signal.After the revised description of this particular project, DTMF probably isn't the way to go however. RS-232/485 is probably a much better (albeit a lot more complicated and expensive) solution.

author: brettddglas
author_rank: Newbie
timestamp: October 13, 2010, 05:56:11 pm
content: Thanks for all the replies.The pin state changes would not take place very often, say once every minute or so. So the processing speed is really not an issue.I guess I was absolutely mistaken about using mux/demux for the answer. I thought it worked like the DS2408 chip in that you would feed it your inputs via the data pins, it would send the signal via the data line to the demux which demultiplexs' it and the output replicated by the data pins on the output of the demux. and would hold this state unless the input pins of the mux changed... OOPS...guess not. Nor is the DS2408 that simplistic it seems.What I am trying to do is we have some old machinery that was controlled via 3 wires. 1 is +24v, 1 common, and 1 control wire. The control board would switch the state of the 3rd wire. Now we have more things to control and rewiring these things would be a nightmare and sometimes not even possible. Sooooo.. Hence this project to save some old machinery and money. Some do external wiring but it is ugly and gets cut up, etc... so I was hoping for a better option.From what I read here the DS2408 is more what I need. I know basic electronics at best and am a fair programmer and this is looking to be over my head unfortunately. I have no way to engineer this project myself and if I pay someone it would be out of my pocket which unfortunately is not deep. Any ideas of how to proceed would be greatly appreciated.Thank you

author: JohnS_AZ
author_rank: Frequent Contributor
timestamp: October 13, 2010, 06:50:31 pm
content: Brett, is this a personal project, a one-off for work, or a future product? It makes a pretty big difference in the best approach.

author: brettddglas
author_rank: Newbie
timestamp: October 13, 2010, 07:44:59 pm
content: John,I am doing this on my own because I thought it would be doable and somewhat easy with all the chips, etc... available. And how they are doing it now is rediculous and costly (mostly in labor as wire itself is pretty cheap). If it works and is inexpensive enough and reliable enough, I will use it at work on customer's equipment that we are renovating.Hope this makes sense.Bdd

author: JohnS_AZ
author_rank: Frequent Contributor
timestamp: October 13, 2010, 09:00:17 pm
content: Okay ...So, to summarize, you have 8 24V outputs from some device, and you have to replicate those outputs some distance away over a 3-conductor cable.I think it's probably possible to design a circuit using logic chips to do this but off the top of my head it seams like it would be a nightmare. You'd basically be trying to build a kind of UART from scratch, and even *I* am not that crazy. Particularly when there are so many inexpensive and simple microcontroller options out there. You could use a Pic, an AVR, an Arduino, a BasicX, or others. You would have to decide where your comfort level is. Personally I've been playing a lot with Arduino lately so I'd go that way. Further the boards are only $28 (US) so that cost is pretty low.Whichever, you'll have two board, one set up for 8 inputs, and the other set up for 8 outputs. The 3-cond cable between them would carry ground, power, and the RS-232 signal. The program in the sender would just read the 8 inputs (as a byte), transmit it to the receiver, and repeat. Obviously the receiver would accept the byte, set the appropriate outputs, then wait for the next byte.The outputs of the receiver could drive some sort of transistor switch, but given your commercial/industrial environment I'd probably use something like a ULN2003 to drive physical relays.To get the inputs to the transmitter you could use just about any opto-coupler, but for commercial/industrial stuff I really REALLY prefer the HCPL-3700. It accepts anything from 5V to 240V AC -OR- DC, and for what it's worth, the chip, itself, is UL recognized.I'd want to use a pretty stout cable between the two, maybe something like balanced microphone cable with a really rugged rubber jacket. Keeping the baud rate as low as possible will help with noise immunity. Further, you could write the code so that the receiver has to receive the same byte 3 or 4 times in a row before it tries to set/clear any of the relays.All in all, the cost of this could be as low as $100 depending on how cheap you're willing to go. Add in a couple hundred feet of high quality cable, high quality relays, a couple of NEMA boxes, etc, and you could end up somewhere north of $500.

author: JohnS_AZ
author_rank: Frequent Contributor
timestamp: October 13, 2010, 09:01:20 pm
content: Forgot ...Here's the datasheet for theHCPL-3700.

author: JohnS_AZ
author_rank: Frequent Contributor
timestamp: October 13, 2010, 09:11:05 pm
content: One more thought ... (just how muddy can I get this water?)If your budget allows, you could eliminate the receiving microcontroller completely, and use an RS-232 relay board likethis.

author: TechGuy
author_rank: Regular Contributor
timestamp: October 13, 2010, 09:17:22 pm
content: Quote from: brettddglas on October 13, 2010, 07:44:59 pmThis chip might be of interest for you its a 7-Channel High side Mosfet Switch capable of handing 1.2per channel and up to 45V input. This takes care the the highside boostrap gate shift and has integrated power MOSFETs built into an SOIC-36 Pin Package.http://www.infineon.com/dgdl/Final_Datasheet_ISO1H816_V20.pdf?folderId=db3a30431b3e89eb011b8dbc543010a5&fileId=db3a304320d39d590120f700bb736a89The url is for the SPI version. There is also a parallel version of this chip too.

author: Frant
author_rank: Regular Contributor
timestamp: October 13, 2010, 09:35:14 pm
content: Quote from: brettddglas on October 13, 2010, 05:56:11 pmAs JohnS_AZ wrote, it depends on the circumstances. However, in my opinion, the hardware based on the DS2408 is as simple as it gets. It also enables bi-directional communication, thus adding more flexibility and robustness to the design. The software part may look difficult, but it can't be much simpler anyway. It would have to be done for the controller side only. If you manage to implement the 1-Wire protocol successfully, it would probably be useful for future projects as well, since there are 1-Wire chips for many different purposes.A colleague of mine has chosen not to use 1-Wire chips because they are expensive and sometimes unavailable from his preferred distributor. He uses Atmel ATTiny microcontrollers instead. He developed a protocol similar to those used in IR remote control units. Since the communication is in one direction only (simplex), it is well suited to low power galvanically isolated systems (only one optocoupler needed, <100 uA). Another possibility is to use some kind of digital current loop (simplex or half duplex). Yet another idea: at least in theory, a signal (voltage) can be superimposed on the existing 24V power, so you'd only need 2 wires!

author: TechGuy
author_rank: Regular Contributor
timestamp: October 13, 2010, 09:59:33 pm
content: Quote from: brettddglas on October 12, 2010, 10:47:45 pmWith RS-485 two signal wires would provide bi-directional communications. RS-485 to a MCU with a built in UART is extremely simple. If you look at the four channel relay board I posted earlier, it uses 4 connections Vin (Pwr), Gnd, and two signal lines for RS-485. I used a 8 pin connection so I could run an extra 4 lines, so I could have two separate runs daisy chained. The advantage of RS-485, is that you can daisy chain them so if you want connect more than one node to the same wire run. Perhaps you need to install two units, one at 200 feet and another at 300 feet. You just connect the units in serial. Soure -200 feet- Node A -- 100 feet -- Node B.. You can go on much futher with RS-485, up to about a mile, but you have to drop the baud rate to 2400 bps at long distance runs. The biggest issue, you'll have with long runs is the voltage drop across the power lines.This webpage:http://www.csgnetwork.com/voltagedropcalc.htmlwill estimate the voltage drop across a cable length. I put in 200 feet with 24V with 18 ga, with a 1 amp load and the voltage dropped to 20.4V. That may or may not be an issue depending on if your end use device can tolerate a 4 volt voltage drop.A better option would be to go with a 48VDC supply and using a point of use DC to DC convert like the LM2576HV to convert the input voltage to 24V at the end-point to ensure you have the correct output voltage. Plus with the higher voltage you can go with a smaller gauge wire. Perhaps even using Cat-5 cable using two or three pair in parallel to deliver power and the one pair for signalling.

author: TechGuy
author_rank: Regular Contributor
timestamp: October 13, 2010, 10:04:30 pm
content: Quote from: Frant on October 13, 2010, 09:35:14 pmThe problem with 1-wire is distance and noise. 1 wire serial I/O is affected by noise since it acts like an antenna picking up noise. A Differential serial signal is prefferable for long distance connections.

author: Frant
author_rank: Regular Contributor
timestamp: October 13, 2010, 10:57:18 pm
content: Quote from: TechGuy on October 13, 2010, 10:04:30 pmI agree. However, if I understood correctly, in this case only 3 wires are available and that includes the power. Therefore, I don't see any possibility of using differential signaling. Well, it might be possible to use the common mode of the differential signal instead of a dedicated power conductor (as in Power over Ethernet), but I don't think it would be practical since it would lead to a more complex design. Current loops have proven to be very robust because they use current signals instead of voltage signals. They are widely used in industrial environments and for long distance connections. The 2-wire 4 mA to 20 mA analog current loop is still the dominant industrial standard for field instruments.

author: brettddglas
author_rank: Newbie
timestamp: October 13, 2010, 11:41:05 pm
content: That would be correct, there are 3 wires total. The way it is structured now is that it only switches 1 device on and off. You have a +24v, 1 common (for powering the lighted panel) and 1 switched channel. The switched channel switches either a relay or contactor which is 24v. Now we are adding devices and need more wires. That is what this is about. I cant imagine the contactor or relay needing more than 1A. It has to be inexpensive as running new wire is "inexpensive" but ugly, ill-protected, and sometimes not doable because of where the machinery is located relative to where it is being controlled from. So what we are stuck with is 3-18ga solid cu wires that need to control up to 8 24v/1A loads. Upgrading to better 2 core mic wire or whatever would render this idea useless as we need to use the wire in place or I would just pull 18/8 wire and be done.

author: JohnS_AZ
author_rank: Frequent Contributor
timestamp: October 14, 2010, 04:03:10 am
content: Well the first thing you should do is go slap the snot out of whoever built the thing with bell wire in the first place.

author: brettddglas
author_rank: Newbie
timestamp: October 14, 2010, 05:00:33 pm
content: yeah, would love to but these are 30+ year old equipment and they figued that they will never need more than one control channel for this. Kiinda like we will never ever need more than 512k of ram or no one will ever fill a 10mb drive.Funny where technology takes us.

author: tycz
author_rank: Regular Contributor
timestamp: October 15, 2010, 12:29:11 am
content: Quote from: brettddglas on October 11, 2010, 10:09:23 pmCan't you buy a device like this? I've got one sitting on the shelf here, though it looks pretty old.8 inputs, 8 outputs, serial connection... The person who gave it to me called it a multiplexer.

author: brettddglas
author_rank: Newbie
timestamp: October 19, 2010, 06:16:13 pm
content: that is what I thought it was suppose to be. mux/demux would take the inputs, convert them into a signal then output them via serial where it would be picked up by the demux and then reversed. I would be surprised if this didnt exist in a simple chip of some sort. Seems there would be a lot of uses for this. well.. a lot of applications with one use I guess would be more correct.So am I wrong on the mux/demux thing? seems there should be an easy cheasy way of doing this. Is this what the DS2408 is all about?