4-pin-momentary button replacement with 2N2222A and mosfet

Thread Starter

TillFly

Joined Oct 26, 2016
57
Hello,

I want to control a 4 pin momentary button like this with an arduino.
The circuit with the button is powered with a 9V block. I don’t want to share the ground with the arduino.

In the circuit ( attached velleman k171) button pins 1 and 3 are connected to the ground plane and
the other one 2 and 4 are connected to the IC HT8950 to control TGU and TGD.

When the button is open the pins 1/2 plus 3/4 are steadily connected.
when its closed it changes to the pairs 1/3 plus 2/4 as also described in the link. What i´m missing in the explanation in the link is that when the button is closed pins 1/3 plus 2/4 are additionally connected to 1/2 and 3/4 right? If not where would be the ground then...?


What happens by hand when I connect pins 1, 2 and 4 for a moment it triggers TGD as I would like to control externally.
How could I do this automatically?
So FIRST I tried:

- connected pin pair 1/2 to the collector of a 2N2222, so that the collector leg is in the middle of the to pins
- connected pin 4 to the emitter
- connected a 1k resistor to the base and sent a slow PWM between 0 and 5V from the Arduino

—> what happened is that the pitch changed but NOT in the frequency of my arduino PWM. it changes about every 300ms.
why and how can that happen? where does that frequency come from?

I guess that a problem could be that the threshold of the 2N2222´s base is 10 V and I just had 5V?

NEXT
I tried it with a MOSFET IRF540N because if I read correctly in the datasheet it has a Gate-Treshold Voltage of 2V.

I have basically the same routing with the pins as in the first attempt except that I put a voltage divider in front of the MOSFET´s gate because the max. threshold level is 4V.

But nothing changed there is still that unknown frequency.

What am I missing?

Thanks in advancevellemann_k171.jpg
 

crutschow

Joined Mar 14, 2008
27,244
Sorry but I'm not good a word schematics. :rolleyes:
Please post a drawn schematic of what you are attempting.

Note that if want isolation between grounds you will need to have separate isolated power supplies and use opto couplers (or other isolated coupling scheme) between the Arduino and the controlled circuit.
 

Thread Starter

TillFly

Joined Oct 26, 2016
57
schematic_2n2222a.jpg
do I need any ground with the arduino if I just want to trigger the transistor?
the 1K resistor I put there because I read it somewhere in a forum but don't know why it should be there. maybe to reduce the current? can I trigger the transistor with 5V? in the datasheet of the 2N2222A I can't find something like a "Base Threshold". For what I have to look for?
 

Thread Starter

TillFly

Joined Oct 26, 2016
57
Sorry but I'm not good a word schematics. :rolleyes:
Please post a drawn schematic of what you are attempting.

Note that if want isolation between grounds you will need to have separate isolated power supplies and use opto couplers (or other isolated coupling scheme) between the Arduino and the controlled circuit.
I tried the same schematic as posted above with a MOSFET (irf540n) because I thought that a MOSFET is an isolated gate, thus it´s possible to have two different circuits. but didn't work either. what am I missing?
 

crutschow

Joined Mar 14, 2008
27,244
I thought that a MOSFET is an isolated gate, thus it´s possible to have two different circuits. but didn't work either. what am I missing?
That fact that the gate is high-impedance but that doesn't mean isolated.
Isolation and high impedance are two entirely different things.
The gate voltage must be referenced to the MOSFET source terminal, which thus must be common with the signal source common for the MOSFET to operate.
And the drain output of the MOSFET to the Arduino must also have the Arduino common referenced to the source common.

As I said if you truly need isolated grounds then you will need to use an opto isolator.
 

AnalogKid

Joined Aug 1, 2013
9,262
do I need any ground with the arduino if I just want to trigger the transistor?
the 1K resistor I put there because I read it somewhere in a forum but don't know why it should be there. maybe to reduce the current? can I trigger the transistor with 5V? in the datasheet of the 2N2222A I can't find something like a "Base Threshold". For what I have to look for?
1. Yes. The arduino ground, transistor collector, and HT8950 pin 6 all must be connected together for your circuit to work.
2. Yes, the 1K base resistor limits the base current. In this case, you are limiting it to something less than 4.5 mA. In your circuit the transistor's collector current is so low that the 1 K base resistor could be a large as 10 K.
3. It is called Vbe, short for forward voltage across the base-emitter junction.

If you want true galvanic isolation between the arduino and the HT8950 circuit, this can be done with optocouplers.

ak
 

Thread Starter

TillFly

Joined Oct 26, 2016
57
Hey,

thank you all for you answers!

Its working with the BJT now. The only thing is that I have a sizzling sound on the speaker. This I could probably avoid with an optocoupler right?
 

AnalogKid

Joined Aug 1, 2013
9,262
Without a complete schematic it is literally impossible to say, or even guess. Beyond a design issue, it could be a wiring problem, a ground loop, or, or, or ...

ak
 
Top