3 in 3 out mappable relay - Page 1
Forum section: electronics / projects

author: sonicblaze
author_rank: Contributor
timestamp: October 18, 2020, 02:52:38 am
content: I have a project that has 3 IC pins (digital pots) that map to a 3-pin output plug. However depending on the mode needed, there's 3 different wiring mappings that could happen:Code:CW -- 2W -- 1CCW -- FloatCW -- 3W -- 1CCW -- 2CW -- 3W -- 2CCW -- 1I'd like to control the routing via my microcontroller, and there will be 4 of these circuits involved (each isolated to their own routing setup). The signal passing through will be 0V-5V, and under a few milliamps.I can currently spare 4 controller output pins (beyond that I'll have to toss in an output expander), and use either SPI or I2C if it's signal-controlled that way.Any suggestions or thoughts on the smallest-form way of doing this? I know I could use a crazy array of 4-pin SPST surface mount relay IC's with an output expander triggering to figure it out, but there's got to be a better way I'm missing hopefully.

author: Mr.B
author_rank: Unknown
timestamp: October 18, 2020, 04:30:19 am
content: One option is a bunch of quad bilateral switches and a GPIO expander.

author: Nominal Animal
author_rank: Super Contributor
timestamp: October 18, 2020, 07:25:21 am
content: You need four SPDT switches or relays, or three SPDT and one SPST.Here's one possibility:On the right, there is a table of the states. The grayed out states in the table show the safe transitions (without shorting the outputs together) between all three states. Assuming you add pull-down resistors to the four selector lines, it'll default to CW=3, W=2, CCW=float, but you can change the topology to suit your needs.

author: Zero999
author_rank: Super Contributor
timestamp: October 18, 2020, 10:21:12 am
content: I think the 74HC4053 would be a good choice.https://assets.nexperia.com/documents/data-sheet/74HC_HCT4053.pdf

author: Nominal Animal
author_rank: Super Contributor
timestamp: October 18, 2020, 12:43:04 pm
content: (Forgot to mention: the reason I used TI TS5A3160 instead of 74HC4053 was the low on resistance, only 1 ohm for TS5A3160. I assumed it mattered, as OP mentioned digital pots..) Also, I didn't notice OP needsfourof these circuits, and only has four pins available for all four.A better option (for four of such three-way muxes) would be three Maxim MAX14662 SPI/I2C-controlled 8-way SPST switches. Each pair of switches controls one input, so 24 independently controlled SPST switches are needed for four such circuits. In I2C mode, each chip has two address select pins, so the circuit would be very straightforward: just SCK and SDA from the microcontroller, to the three MAX14662 chips (in parallel). Plus, this way each signal has less than 1 Ohm resistance over the switch matrix.Should I sketch a schematic, or is the above understandable description? Me fail English often.

author: sonicblaze
author_rank: Contributor
timestamp: October 18, 2020, 02:57:57 pm
content: Man you guys are awesome! No idea how/why I couldnt find the right Mouser filters to come across these parts.It sounds like MAX14662 will be my choice from the so-far listed circuits/ideas.I think I understand what you're saying with regards to the MAX14662. I'd basically tie the 1/2/3 to multiple A (or B) pins, with the other side the specific options for the DigiPot pins per 1/2/3, and switch on exactly which one I need.Did I understand your suggestion correctly? If so I can design that circuit easily enough. I was always looking for relays (that seems to always be 1 or 2 per IC) and SP3T switches (so 1 switch did 3 states), didn't think about an array of SPST's like this to mimic a SP3T.

author: Nominal Animal
author_rank: Super Contributor
timestamp: October 18, 2020, 04:52:46 pm
content: Yeah, I think so:It'll be important to always disconnect before connecting, and the third MCU pin can be used (with a pull-down resistor, assuming the MCU pin is tristate at bootup) to ensure all switches are off during bootup.Also, both the SCL and SDA lines need pullup resistors that I did not include in the above, as a single pair suffices. TheMaxim MAX14662 datasheethas all the info.With this config, the I2C addresses are 0x4C for U1, 0x4D for U2, and 0x4E for U3 – or 0x98, 0x9A, and 0x9C if you treat the least significant bit of the address as the read(1)/write(0) bit. You might even be able to reuse the I2C for other peripherals. The register address is always zero, so to set the mux, you need to write three bytes per MAX14662 (I2C address in write mode, zero for the register address, and the eight bits corresponding to the switches). Again, the multiplexing sequence should first disable all switches, then enable the new ones, so it should be just 18 bytes transferred.You could also use the SPI in daisy-chain mode. All that changes is you'd pull SPI/I2C to VCC, and use CS/AD0 for the (active low) chip select for all three in parallel. The MCU MOSI would be connected to DIN/SDA on the first MAX14662, and its DOUT/AD1 to the DIN/SDA on the next. This way, after clocking 24 bits, pulling CS/AD0 high will change all 24 switch states at the same time. (You should still do it in two stages, disable all followed by enable all.) This does use all four MCU pins you have, but is even faster than the I2C, if it matters.In either case, the switch/mux configuration stays the same, and I guess that was the interesting bit.

author: sonicblaze
author_rank: Contributor
timestamp: October 18, 2020, 11:51:32 pm
content: I'm not overly worried about speed, as it's a config-menu set option. I'll probably end up going I2C just for wiring/PCB sake, and I'm thinking I'll actually use 4 chips and just use 1 per Pot to make wiring/programming/controlling easier.I don't think I've worked with an IC thats had both SPI and I2C, that's definitely unique for me and interesting to see. I do have both I2C and SPI in this circuit already, and the I2C addresses won't conflict, so that looks like a good path.Thank you so much for the detailed information and the reminders about pull-downs on bootup. I really appreciate the assistance and such detailed answers + actual schematics. I'll be able to convert that to a 4 IC wiring diagram pretty easy using the 1st one as the guide (while changing addresses properly!)