Using a Microcontroller Instead of a Switch

Thread Starter

popcalent

Joined Mar 17, 2018
138
Hi, all!

I have the top circuit, which is controlled by two manually operated switches. The circuit changes the resistance between points A and B depending on which switch is pressed. I want to replace the switches with a microcontroller, so I designed the bottom circuit. The outputs of the microcontroller are either a digital one, or a digital zero. The only voltage involved is 5 V.


Will this work? What value should I use for the base resistor?


This is just a DIY project — it’s not going to land a rocket on the moon — so I don’t need super precise values. Thanks a lot!

thing.png
 
The SW01 needs 5.7V into base at least to went into saturation.
Also some Ib current will be added to Ic current (output), so it will cause some output error.

I would use an optocouplers instead bjts and you are good.
 

sghioto

Joined Dec 31, 2017
8,633
Proposed suggestion using a CD4066 quad bilateral switch.
Switch A is normally ON as control A is high through R3 when both micro 1 and 2 are Low. Output = 50K
Micro 1 ON: turns ON switch D, Output = 0 ohms.
Micro 2 ON: turns ON switches B and C.
Switch C turns OFF switch A by pulling control A to ground.
Switch B ON and switch A OFF, Output = 100K
1760501898573.png
 
Top