Go Down

Topic: Pn2222 Transistor as Switch for my coffe machine ESP8266 (Read 122 times) previous topic - next topic



i want to use a Pn2222 Transistor to simulate a button. I have a old coffe machine and i want to add a esp8266 (controlling with my amazon echo). My electronic knowledge is not that good but i have a lot of free time while corona.

On the coffemachine there are a few buttons with 4 pins. I can messure 1,2V on upper left and bottom left to Ground. Upper right and bottom right i can messure 4,8V to Vcc

I conntected collector with bottom left and emitter with bottom right.

When i talke to my echo "coffe machine on" i hear a noice but the machine dont start.

Thanks for your time.


Before connecting a transistor, use a piece of wire to connect the pins, to simulate a button press on the machine.
When you find a working connection, then you can proceed with a transistor.

Or connect 4 wires to the pins, and measure their levels when a button is pressed and not pressed.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.


Hey thanks for your answer,

if i conntect green and orange(bottom right) or blue with orange(bottom right) -> machine turn off/on
Therefore it should be correct (first picture). I dont know whats wrong?


Ok now a test with 5V (not Gpio output)

green and blue to 1 - Collector
5V - 2 - Base
Orange and Orange to 3 - Emitter


i get the same result. When i connect 5V to Base i can hear a beeper but not more. Maybe my problem is time? Sometimes randomly the machine goes on/off but thats not my goal.


A transistor can be used as a switch in certain applications but it's NOT the same as a mechanical switch.  

However a regular electro-mechanical RELAY IS and electrically-operated and electrically-isolated switch.    A relay is almost always better if you want to replace a switch in an unknown circuit.

You still need a driver circuit because the Arduino can't directly supply enough current for a relay coil.   You can probably use the 2N2222 for that.   Or you can buy a "relay board" which has a relay and river built-in.


You also should be aware than many pieces of electronic equipment these days are double insulated,
meaning that any attempt to connect direct to the circuit might compromize safety - relays are isolated
however (choose a mains rated one), so should retain the double-insulated rating.

For instance its common in equipment with motors to have a floating motor drive circuit powered from
rectified mains directly.  Sometimes the whole circuit is at mains potential, but double insulated.
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]


thanks for sharing your knowledge. I understand now why i should use a relay instead of a transistore. Relayboards are not that expensive but need much space. Can you commend some smaller solutions?


An Opto FET is an option in these applications.

H11F1M    <200Ω  to > 300MΩ


There are small DIP relays too.

No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

Go Up