Author Topic: Is it possible to simplify slider switch wiring (Double knife four throw)  (Read 1006 times)

0 Members and 1 Guest are viewing this topic.

Offline Georgy.MoshkinTopic starter

  • Regular Contributor
  • *
  • Posts: 209
  • Country: hk
  • R&D Engineer
    • How to become a Tech Sponsor
Assume I want a device to be turned on and configured using a single slider switch with settings for OFF/Low/Medium/High. Many devices, such as air humidifiers and some older massagers, use such switches. I have used a "double knife, four throw" configuration switch, model K3-2410D-F1 (datasheet). I tried to find a way to use a simpler switch, but I am almost certain that it is impossible. The attached image shows the switch connection schematic. The left row of pins is used for configuring the speed, while the right row of pins has three pins shorted together to function as a simple on/off switch. Is there any way to use "single knife" switch?
Disappointed with crowdfunding projects? Make a lasting, meaningful impact by becoming a Tech Sponsor today. Visit TechSponsor.io to Start Your Journey!
 

Offline inse

  • Frequent Contributor
  • **
  • Posts: 961
  • Country: de
Re: Is it possible to simplify slider switch wiring (Double knife four throw)
« Reply #1 on: November 29, 2024, 03:33:01 pm »
I don’t think it’s possible the way the “logic“ is working now.
If you could “OR“ the speed select signals with diodes to generate an on signal, it would be possible to use a single pole switch.
« Last Edit: November 29, 2024, 03:55:44 pm by inse »
 
The following users thanked this post: Georgy.Moshkin

Online schmitt trigger

  • Super Contributor
  • ***
  • Posts: 2415
  • Country: mx
Re: Is it possible to simplify slider switch wiring (Double knife four throw)
« Reply #2 on: November 29, 2024, 04:15:30 pm »
Minor correction, it is not a knife switch but a slide switch.

If your circuit is DC, then a simple diode O’ring configuration would work. If it is AC, then it is also feasible but the solution would be far more complicated.
 
The following users thanked this post: Georgy.Moshkin

Offline inse

  • Frequent Contributor
  • **
  • Posts: 961
  • Country: de
Re: Is it possible to simplify slider switch wiring (Double knife four throw)
« Reply #3 on: November 29, 2024, 07:57:10 pm »
Not quite, one side is switching to GND, the other side supply voltage
 

Offline Georgy.MoshkinTopic starter

  • Regular Contributor
  • *
  • Posts: 209
  • Country: hk
  • R&D Engineer
    • How to become a Tech Sponsor
Re: Is it possible to simplify slider switch wiring (Double knife four throw)
« Reply #4 on: November 30, 2024, 08:06:45 am »
Thanks! I've tried the diode idea and changed GPIO outputs to positive ones but then realized that there is a huge voltage drop for a battery-powered device. I tried different ideas with resistive voltage dividers and N-channel MOSFET, and seems to find one possible solution.
I am using AO3400A with a Li-ion battery (3v to 4.7v).
With a resistor-only approach gate voltage becomes too close to a gate threshold voltage.
I added three diodes. Almost like it except the fact that now I have to use 3 GPIO inputs instead of 2 GPIOs.
Previously, I've used 2-bit state (00, 10, 11, 01) to encode 4 positions of slide switch.
But now I need three. 1 MOhm resistors just to show where GPIOs will be connected.
Does this circuit look good?

https://tinyurl.com/294amtnb
« Last Edit: November 30, 2024, 08:17:32 am by Georgy.Moshkin »
Disappointed with crowdfunding projects? Make a lasting, meaningful impact by becoming a Tech Sponsor today. Visit TechSponsor.io to Start Your Journey!
 

Offline inse

  • Frequent Contributor
  • **
  • Posts: 961
  • Country: de
Re: Is it possible to simplify slider switch wiring (Double knife four throw)
« Reply #5 on: November 30, 2024, 08:31:02 am »
Looks good, only need to select a MOSFET with low gate voltage.
Keep in mind that the gate threshold parameter is usually given for uA drain current, so you need to look at the curves.
Why did you go for 1M series resistor to the GPIO?
I would go for something lower and add a pull-down to each input, unless the GPIO can be configured for WPD.
« Last Edit: November 30, 2024, 08:36:00 am by inse »
 

Offline Georgy.MoshkinTopic starter

  • Regular Contributor
  • *
  • Posts: 209
  • Country: hk
  • R&D Engineer
    • How to become a Tech Sponsor
Re: Is it possible to simplify slider switch wiring (Double knife four throw)
« Reply #6 on: November 30, 2024, 09:07:12 am »
You are right! 1M is a bogus value. Here is an updated version. P-channel version has less resistors.
I think that 2 GPIOs are enough to read 3 states:

For N-channel:
Two GPIOs with MCU internal pull-downs.
In position 1 switch pulls-up GPIO1
In position 2 switch pulls-up GPIO2
In position 3 wire is not used, position 3 detected if GPIO1 and GPIO2 are still pulled down by MCU internal pull-downs.

For P-channel:
Two GPIOs with MCU internal pull-ups
In position 1 switch pulls-down GPIO1
In position 2 switch pulls-down GPIO2
In position 3 wire is not used, position 3 detected if GPIO1 and GPIO2 are in high position (MCU internal pull-ups)


N-channel version: https://tinyurl.com/26mm7v8c
P-channel version: https://tinyurl.com/22heebd5

Keep in mind that the gate threshold parameter is usually given for uA drain current, so you need to look at the curves.
hmm, this is indeed very important.

I have only looked into these curves:


These curves are for pretty high current, so gate voltages >2v will safely open both transistors.

Transistor datasheets:
https://www.aosmd.com/res/data_sheets/AO3400A.pdf
https://www.aosmd.com/pdfs/datasheet/AO3401A.pdf


« Last Edit: November 30, 2024, 09:27:45 am by Georgy.Moshkin »
Disappointed with crowdfunding projects? Make a lasting, meaningful impact by becoming a Tech Sponsor today. Visit TechSponsor.io to Start Your Journey!
 

Offline Georgy.MoshkinTopic starter

  • Regular Contributor
  • *
  • Posts: 209
  • Country: hk
  • R&D Engineer
    • How to become a Tech Sponsor
Re: Is it possible to simplify slider switch wiring (Double knife four throw)
« Reply #7 on: December 23, 2024, 03:58:01 am »
I think I've messed up with this one.
See that LOAD on the schematic? It's STM32 with bunch of other ICs like opamps, LDOs, step-ups.
The problem is that during the "off" state current somehow finds the way through STM32 GPIO outputs (ESD diodes, etc.) to the gate of N-Channel MOSFET. And it occurs only when battery is closer to discharged state, doesn't make sense to me why there is no leak when battery is fully charged though. It should be noted that the prototype PCB has an additional resistor to ground on the GATE pin (tried 1k, 10k, 100k), but it seems that the gate voltage remains the same(???) - leak looks like a voltage source  :-DD. Currently, in "off" state, I can measure some voltage around 1.2v on 3.3v lines. Device looks disconnected and LEDs are not blinking.



So, the only way is to switch to P-Channel high-side switch configuration?
I thought about adding diodes on GPIO lines, or maybe there is another solution.
« Last Edit: December 23, 2024, 04:12:54 am by Georgy.Moshkin »
Disappointed with crowdfunding projects? Make a lasting, meaningful impact by becoming a Tech Sponsor today. Visit TechSponsor.io to Start Your Journey!
 

Offline fourfathom

  • Super Contributor
  • ***
  • Posts: 2004
  • Country: us
Re: Is it possible to simplify slider switch wiring (Double knife four throw)
« Reply #8 on: December 23, 2024, 04:46:30 am »
Add a high-value pulldown resistor (to ground) at the MOSFET gate.  Otherwise the gate capacitance will stay charged when all switches are open, and the MOSFET won't turn off for a long time (if ever).
We'll search out every place a sick, twisted, solitary misfit might run to! -- I'll start with Radio Shack.
 
The following users thanked this post: Georgy.Moshkin

Offline inse

  • Frequent Contributor
  • **
  • Posts: 961
  • Country: de
Re: Is it possible to simplify slider switch wiring (Double knife four throw)
« Reply #9 on: December 23, 2024, 05:16:24 am »
Oops, forgot about the gate discharge resistor..
Make the 1k gate resistor 100Ohms and place 10k from gate to source.
Another issue you identified yourselves is the GND level issue as in off state the GND of the circuit will be above source potential of the MOSFET thus creating a path via the input protection diodes to charge the gate.
If you don’t mind a couple of uA quiescent current, place >100k in series with your GPIOs, so you will have a divider for the stray gate voltage in off state.
This will not allow the MOSFET to turn on and won’t affect the level detection in on state as the GPIOs are high impedance inputs.
Switching to PMOS would only create a mirror of the probem.
« Last Edit: December 23, 2024, 08:14:21 am by inse »
 
The following users thanked this post: Georgy.Moshkin

Offline Georgy.MoshkinTopic starter

  • Regular Contributor
  • *
  • Posts: 209
  • Country: hk
  • R&D Engineer
    • How to become a Tech Sponsor
Re: Is it possible to simplify slider switch wiring (Double knife four throw)
« Reply #10 on: December 25, 2024, 01:29:31 pm »
Thanks, that worked! N-Channel MOSFET is currently fully off: I measure 0v on both gate and source. Source is connected directly to the external ground, and the gate is pulled down by a ~10kOhm resistor to the same external ground. This was thanks to the 100kOhm resistor you've suggested in series with MCU's GPIO inputs.

In OFF state there is a 2.5 voltage drop across 100kOhm resistor in series with GPIO.
According to the formula I=2.5/100000 = 25 [uA], I guess it's the only way with my current design.

I have 0.67v across decoupling capacitors of MCU in off state.
I haven't measured all voltage drops, but 0.67+2.5 is around 3.17.
Battery voltage is 3.82v, so there is 0.68v is dropped somewhere.
Disappointed with crowdfunding projects? Make a lasting, meaningful impact by becoming a Tech Sponsor today. Visit TechSponsor.io to Start Your Journey!
 

Offline inse

  • Frequent Contributor
  • **
  • Posts: 961
  • Country: de
Re: Is it possible to simplify slider switch wiring (Double knife four throw)
« Reply #11 on: December 25, 2024, 01:59:18 pm »
In fact you have 3x25uA as there are three 100k resistors…
You could go higher, but I would stay below 1Mohm if quiescent current is an issue.
Just check at the uC pins whether there is a drop in the signal.
Also depends on input config like comparator or GPIO and WPU  enabled
« Last Edit: December 25, 2024, 02:06:40 pm by inse »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf