Rotary switch (power + position combo) - Page 1
Forum section: electronics / projects

author: okw
author_rank: Frequent Contributor
timestamp: September 24, 2024, 07:25:43 pm
content: I have a project where a rotary switch (SP6T) both powers my circuit, and acts as a position switch. Off in position 1, and on in pos 2-6.It works only partially. The MCU reads which position it's at. But when I turn it while powered, it briefly breaks contact with the battery between every position, so the MCU reboots.It seems to be worse at clockwise turns (increase the position), than counterclockwise. I've tried to put both 100uF and 470uF on the 3.3v rail with not noticeable improvement.If I turn if fairly firm, the dip from 3.7V to 2.25V lasts 700us, but if I turn it more slow it can be several tens of ms. (Not sure why my oscilloscope shows 3.7V, I'm measuring the 3.3V rail, maybe the oscilloscope is out of calibration).BAT+ is a li-ion battery, and BATTERY_SWITCHED feeds a 3.3v LDO and the MCU is a ESP32.I have several questions;-Is this possible to make this more or less "foolproof" (with firm/quick switching)?-Is it best to place these extra capacitors on the input or output of the 3.3V regulator? I would think close to the MCU?-Could a series diode prevent any back surges(?) if that is a thing?-How do I calculate which capacitor value(s) are needed (based on the oscilloscope readings, current consumption, voltage drop and duration of drop)?(PS. I've thought about a DP6T, but they are bigger than I can fit).

author: PCB.Wiz
author_rank: Super Contributor
timestamp: September 24, 2024, 07:40:14 pm
content: Quote from: okw on September 24, 2024, 07:25:43 pmThat's the nature of a break before make switch, it wil be very hard to cover very slow turns.Why not change it so only the off contact is used, with an active switching element, then you avoid the breaks entirely ?What is the voltage range and current load of the battery ?

author: okw
author_rank: Frequent Contributor
timestamp: September 24, 2024, 07:57:42 pm
content: I'm open to all suggestionsHow would that look like?One little detail, I have power distribution (battery + USB). The BATTERY_SWITCHED goes into a P-MOSFET (where a USB input triggers the gate, goes through a Schottky and supplies the 3.3v regulator if USB is connected).It seems to draw about 55mA, with a max of 80mA (need more testing if this is important), and voltage range is a li-ion battery (so little over 3v up to 4.2-4.3v).

author: PCB.Wiz
author_rank: Super Contributor
timestamp: September 24, 2024, 11:07:07 pm
content: Quote from: okw on September 24, 2024, 07:57:42 pmThat puts you in the mainstream market realm.You could use another PFET, or you could look at Power MUXES and load switches.Those are getting cheaper and smarter, as volumes grow.You can get reverse current flow protection and slew rate and current limiting.

author: okw
author_rank: Frequent Contributor
timestamp: September 25, 2024, 01:11:43 am
content: So you're thinking something like this?Am I right it will eat ~0.42mA while in off position?

author: inse
author_rank: Super Contributor
timestamp: September 25, 2024, 01:32:57 am
content: The resistor may have a higher value, 1M would work as well if the soft start behaviour (~1ms) is acceptable.