1
\$\begingroup\$

I want to know how can i wire this toggle switch to obtain 3 positions :

  • Position 1 : Turn Off System
  • Position 2 : Turn On System
  • Position 3 : Write "High" On a microcontroller (ATtiny84)

This is the slide switch i am willing to use : Link

\$\endgroup\$
0
\$\begingroup\$

i don't know which pin of the switch is common pin, i think it might be pin no.1 or no.2

if pin no.2 was common, do this wiring :

enter image description here

if pin no.1 was common, do this one :

enter image description here

the diode is preventing Write HIGH on your ATtiny's digital input when you just want to turn it ON and not to do that in same time (Position 2) if you tell me which pin is common pin, i'll give you the exact answer

\$\endgroup\$
13
  • \$\begingroup\$ Thanks @Hamid 'Smith' Salehi for the response. In both cases the ground of the battery is not connected ? Thanks again and i am sorry i can not up your comment cause i do not have enough reuptation. \$\endgroup\$ – GellyHamb May 27 at 9:55
  • \$\begingroup\$ all you have to do is : connect the negative pole (-) of your battery >>> to GND pin of ATtiny, that's it \$\endgroup\$ – Hamid 'Smith' Salehi May 27 at 10:03
  • \$\begingroup\$ Sounds good thanks, i will keep looking to see which pin is the comman cause i can not find out through the datasheet of the switch. \$\endgroup\$ – GellyHamb May 27 at 10:07
  • \$\begingroup\$ you can use buzzer mode on a multimeter, the pin which connects to all other pins in every switch Positions, is common pin \$\endgroup\$ – Hamid 'Smith' Salehi May 27 at 10:16
  • 1
    \$\begingroup\$ Sounds good, Thanks for the hel^p \$\endgroup\$ – GellyHamb May 27 at 15:11
2
\$\begingroup\$

It would be better to use a DP3T switch. If you can stand the voltage drop of a Schottky diode, you can use @Hamid's scheme wired as so: (pin 1 has the gap to the next pin)

The divider loads against leakage in D1 up to 70°C at least, for very high temperatures you might have to reduce the values. A divider is used to prevent applying more than Vdd to the input pin.

schematic

simulate this circuit – Schematic created using CircuitLab

The lower schematic shows a circuit that does not suffer the leakage or voltage drop of the Schottky diode but has one extra component- eg. PEMH9,115 dual digital transistor (in dashed box). R8 prevents transient current through the MCU input while M1 turns on.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Thanks for the feedback, really appreciate the advices \$\endgroup\$ – GellyHamb May 27 at 14:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.