Electronics > Projects, Designs, and Technical Stuff
Normally on electronic switch
ledtester:
Use a 3-pin DC jack such as this:
Pin 1 is the center pin which will be connected to the positive supply; pin 2 is connected to GND. With nothing plugged in pins 2 and 3 are connected, but with a plug inserted they are disconnected.
Connect pin 3 to the USB ID pin; also connect a 10K resistor in parallel (from the USB ID to GND).
When the external plug is not inserted the USB ID pin and GND will be shorted.
When the external plug is inserted the resistance between the USB ID pin and GND will be 10K.
Berni:
--- Quote from: gaminn on August 14, 2019, 08:41:40 am ---I found JFETs that have like 30 ohms rdson, which is more than what I expect from "connected to ground". And also the negative voltage means I have to solder another IC on the board. But yes, it is the best solution I have at the moment.
--- End quote ---
You can get power switching depletion MOSFETs that have a on resistance of under 1 Ohm, but since this is just a signal pretty sure 30 Ohm would be just fine too. The phone is likely not measuring the resistance on the ID pin with much current behind it, so it would make sense to have the threshold quite a bit higher than a few ohms since you wouldn't want a handful of milivoltes of voltage to trip it.
As for negative voltage you can build a charge pump with your existing MCU, so no extra IC is needed.
gaminn:
--- Quote from: ledtester on August 14, 2019, 09:01:22 am ---Use a 3-pin DC jack such as this:
--- End quote ---
Great idea. The only drawback I can see - when there is power outage or user leaves jack connected to the device without connecting adapter to AC power socket, the device will not work.
Benta:
Use a SPDT reed relay.
David Hess:
A JFET or depletion mode MOSFET would be my first choice.
Navigation
[0] Message Index
[*] Previous page
Go to full version