Wiring a DP3T switch for Foward-Brake-Reverse Function - Page 1
Forum section: electronics / beginners

author: TonyBarr
author_rank: Contributor
timestamp: November 19, 2019, 03:09:14 am
content: I would like to wire a DP3T switch that I have (NKK M2046SS1W01) to provide forward - brake - reverse functionality. I can't figure it out. I do understand how to use this switch to reverse the polarity for the forward and reverse positions, but I'm really struggling to figure out how to short the motor terminals for braking. Please help! Thanks.Tony

author: Nominal Animal
author_rank: Super Contributor
timestamp: November 19, 2019, 04:08:28 am
content: Your switch has 12 pins. Looking at the bottom, they are numbered12 9 6 311 8 5 210 7 4 1Up position connects 2-1, 5-4, 8-7, 11-10Center position connects 2-3, 5-4, 8-9, 11-10Down position connects 2-3, 5-6, 8-9, 11-12If you connect pins 3 and 5 with a link, and pins 9 and 11 with another link, then:Up position connects 2-1, 8-7Center position connects 2-4, 8-10Down position connects 2-6, 8-12So, let's say your motor is connected to pins 2 and 8.In the up position, the motor is connected to pins 1 and 7. So, you put + on pin 1, and - on pin 7.In the down position, the motor is connected to pins 6 and 12. So, you put - on pin 6, and + on pin 12.In the center position, the motor is connected to pins 4 and 10. So, you connect these together, to short the motor, but not the supply.What we do not know yet, is whether these connections can cause the supply to be shorted, momentarily, because we do not know if 8-7 breaks before 8-10 makes, and similarly for the three other pairs. The datasheet does not say. This means,I am not sure if this is safe.If this were safe, then the connections would be1: +2: Motor A3: Linked to pin 54: Linked to pin 105: Linked to pin 36: -7: -8: Motor B9: Linked to pin 1110: Linked to pin 411: Linked to pin 912: +

author: tooki
author_rank: Super Contributor
timestamp: November 19, 2019, 12:03:47 pm
content: I don’t think it’s common for toggle switches to be make-before-break, which would explain that not being mentioned on the datasheet.In any case, for this particular application, I think I figured out a way to make the wiring simpler using just half the switch (or allowing the use of the physically smaller SP3T version of the switch), based on the switch's behavior and a standard direction reverser setup:1: V- and link to 62: Motor A3: link to 44: V+ and link to 35: Motor B6: link to 1In the up position, this results in V- going from 1 to 2, so V- on motor A, and V+ from 4 to 5, so V+ on motor B.In the down position, this results in V- going from 1 to 6 to 5, so V- on motor B, and V+ from 4 to 3 to 2, so V+ on motor A.In the center position, this results in V- going nowhere (from 1 to 6, which is open) and V+ connecting to both motor A and B, shorting them out (4 to 5, and 4 to 3 to 2).Since this switch doesn’t have a multi-position slider, but is actually basically a bunch of single-pole ON-ON-OFF toggles, I think it’s safe to assume that each individual pole can’t make before breaking. When used as a true 3-way, you’re right that it’s behavior is undefined. But when used as above, I don’t think there’s any way for an unwanted short to happen, because each pole’s “preferred” position is the one that creates the braking short desired in the center position.

author: rstofer
author_rank: Super Contributor
timestamp: November 19, 2019, 04:45:33 pm
content: As to braking, sometimes a 'short' is too abrupt. You might want to consider a low value braking resistor. Calculating value and wattage is discussed here:https://www.cressall.com/dynamic-braking/calculating-resistor-sizes/

author: Nominal Animal
author_rank: Super Contributor
timestamp: November 20, 2019, 03:35:43 am
content: Quote from: tooki on November 19, 2019, 12:03:47 pmI honestly just don't know; I do have some cheap ones that are make-before-break. Many rotary switches vary and say which one they are in the datasheets, though. (Probably different construction than toggle/slide switches.)My intent was not to show an optimal configuration, but to show how one would work through it. (I've never had that problem in real life either, so I literally did it step-by-step like I explained.)Quote from: tooki on November 19, 2019, 12:03:47 pmYes! For any SP3T switch that is break-before-make, with the same pin configuration, that works.Here's how to check:In the center position, we have 2-3 and 5-4. So, the connections are-: 1,6+: 2,3,4,5 (A,B)I.e., both motor A and B are connected to +, thus shorted out. Good.In the up position, we have 2-1 and 5-4. So, the connections are-: 1,2,6 (A)+: 3,4,5 (B)I.e., A- and B+. Good.In the down position, we have 2-3 and 5-6. So, the connections are-: 1,5,6 (B)+: 2,3,4 (A)I.e., A+ and B-. Good.So, this would work, assuming shorting the motor leads isn't too hard on the motor.Quote from: rstofer on November 19, 2019, 04:45:33 pmGood point.In my original suggestion, the braking resistor would replace the link between 4 and 10.In Tooki's suggestion, the only place it could be put is between 3 and 4. However, we would then need to limit + to one of them, otherwise the braking resistor would be useless (bypassed by the link to +). Which one? In the up position, 4 is connected to 5 (B), and in the down position, 3 is connected to 2 (A). So, whichever we choose, in the other case the + would pass through the braking resistor. So, Tooki's suggestion does not really work if a braking resistor is also needed.I wrote a quick hack to brute-force search for the possible pin configurations with zero to two hard links, and it finds Tooki's suggestion as the only possible solution for SP3T switches with the aforementioned configuration, except for symmetries like swapping A and B, and + and -. It seems there are none for SP3T with a braking resistor, without having the motor current pass through the braking resistor in either up or down position.

author: Nominal Animal
author_rank: Super Contributor
timestamp: November 20, 2019, 08:01:27 am
content: My hack found several solutions using just the nine first pins of the DP3T switch, still assuming the switch is break-before-make; a make-before-break switch may short the power supply using these schemes.It finds 241 solutions (including many variants that differ only by which linked pin something is connected to) in about 0.2 seconds for the nine-pin switch case with a braking resistor, and is about 500 lines of C99. It slows down exponentially as the pin count or labeled pins increase, and is not properly documented or commented at all. At the core, it uses a disjoint set to describe each state, then tries all possible but sane configurations of the pin labels, to find the ones that work, if any. So, a brute force hack.The hardest thing was to describeallrules to the code; i.e., that the supply should not be shorted in any position, supply should not be shorted via the resistor or via the resistor and motor in the up or down position, and so on. It is intuitively easy for us humans to see a bad situation, but much harder to describe therulesthat define whether a situation is good or bad. In total, the hack has 28 cases (a total of 58 equality/inequality tests), for just 9 pins, three links, and 6 labels (P+ P- M+ M- Ra Rb), so it does get complicated rather fast.First example solution.Link pins 1 and 4.Link pins 2 and 9.Link pins 6 and 7.Connect motor positive (M+) to pin 5, and motor negative (M-) to pin 8.Connect power supply positive (P+) to pin 2 or 9, and power supply negative (P-) to pin 6 or 7.Connect the braking resistor (Ra) to pin 3, and (Rb) to pin 1 or 4.In the center position, there are three sets of connected pins:1,4,5: Ra M+2,3,8,9: Rb M- P+6,7: P-Power supply is disconnected from the motor, because negative supply connects to pins 6 and 7, but they are not connected to anything else. Motor negative is connected to positive power supply, but that is okay, because negative supply is not connected to the motor or the resistor. Motor positive and negative are connected via the braking resistor.In the up position, there are again three sets of connected pins:1,2,4,5,9: Ra M+ P+3: Rb6,7,8: M- P-Motor is connected to the power supply. One end of the braking resistor is not connected to anything, so it does not affect the supply or powering the motor.In the down position, there are again three sets of connected pins:1,4: Ra2,3,8,9: Rb M- P+5,6,7: M+ P-Motor is connected to the power supply with reverse polarity. One end of the braking resistor is not connected to anything, so it does not affect the supply or powering the motor.Second example solution, not a variant/reordering of the first.Link pins 1 and 4.Link pins 3 and 7.Link pins 6 and 9.Connect motor positive (M+) to pin 5, and motor negative (M-) to pin 3 or 7.Connect power supply positive (P+) to pin 2, and negative (P-) to pin 8.Connect the braking resistor (Ra) to pin 2, and (Rb) to pin 1 or 4.The three sets of connected pins in each state are:Center:1,4,5: Ra M+2,3,7: Rb M- P+6,8,9: P-Supply is disconnected on the negative side. Motor is shorted via the braking resistor.Up:1,2,4,5: Ra Rb M+ P+3,7,8: M- P-6,9: (none)Supply is connected to the motor. The braking resistor is connected to motor positive, so it does not affect the motor or the supply.Down:1,4: Ra2,3,7: Rb M- P+5,6,8,9: M+ P-Supply is connected to the motor with polarity reversed. The braking resistor is disconnected from one end, so it does not affect the motor or the supply.