Switching circuit behaving differently on PCB and breadboard

I have the following circuit built on a breadboard, and manufactured into a PCB, to switch a load (J1) from an Argon. The circuit works fine on the breadboard, with the load switching when high and low are applied to the Argon’s A0, but on the PCB, even though everything is the same (and we have checked this multiple times), it fails. Whenever the transistor is turned on by driving A0 high, the particle reboots. I guess this is some overcurrent protection? I’m really at a loss how to debug this, anybody have any ideas? We’ve checked the PCB thoroughly, and the circuit works fine when switching a dummy (resistor) load.

(load A0 - particle A1 is an analog output from the load (a sensor))

What load do you have on A1?
How much current would it draw when engaged?
Could it be that you had your load connected to a different current source (e.g. VUSB, 3v3, Li+, …) on the breadboard?

The way your schematic shows there I don’t see the point in using a FET to switch the load that should be driven off A1 at all?
You could just use digitalWrite(A1, HIGH) and digitalWrite(A1, LOW) directly rather than driving A1 HIGH an then cutting the GND connection via the FET :confused:

Also, what is the value of R2?

apologies for the lack of info here. The load is a Gravity Sound Level sensor. A0 on the sensor - A1 on the particle is the analog output of the sensor, hence using the FET to switch it.

R2 is 1M.

The input current of that sensor is stated as 22mA@3.3V that is too much for A1.

Argon datasheet | Datasheets | Particle

but the sensor 3v3 input is coming from the Particle 3v3 output, which has ~100mA, no?

I see, I misread the schematic and “missed” the connection between the two instances of 3V3 :blush:
I thought A1 is driving the seonsor :man_facepalming:

Scrap my misguided comments :see_no_evil:

@adam.rob.carter, that transistor is total overkill for the application when a smaller 2N7002 would have been more than adequate. What were your reasons for this choice?

The 1Meg resistor R2 may have worked fine on the breadboard but may be too large depending on your PCB layout.

On that note, can you share your PCB layout so we can look at your design? Pure connection “logic” is not always the only thing affecting circuits on a PCB. So the circuit may “look” right but routing, adjacent signals, etc. can affect the circuit.

1 Like

I would ohm out the PCB board and make sure the connections are as you think they should be. You have a connector J1 with a GND pin that should not be connected to the ground plane of your board, which is an area where an error could creep in. It is best if you have an unpopulated board to test but you can probably figure it out on a fully populated board.

Another thing to try to is pulling the Argon if possible and adding a separate 3.3V supply temporarily. Then by touching the A0 pin on the board to 3.3V you can see what happens to the 3.3V current. I am going to guess that it will go way up to the limit of the 3.3V supply.


Yeah, the transistor is overkill for sure, it was just the only one we had plenty of lying around. Here’s the relevent part of the PCB.


Thanks for your help everyone!

@adam.rob.carter, I hate to ask the obvious but did you check the transistor orientation? Otherwise, I would suggest doing the test suggest by @bko.

1 Like

The board looks OK in the design but it could still be made wrong. I would check the transistor (orientation and type) and I would ohm out R2 (1Mohm). If R2 is 1ohm instead of 1Mohm you might reboot on A0 going high, for instance.

You say in your original post that you can switch a load to a dummy resistor, which is good. Could J1 be connected wrong? We can’t really tell from the schematic.

1 Like

Place a 0.1 uF capacitor between the 3.3 volt supply and GND, as close as possible to the sensor to decouple the power source from the Photon. I would also place a 0.1 uF decoupling capacitor very near the Photon’s 3.3 volt source and GND. I have found that it doesn’t hurt to also place a large electrolytic capacitor (say 10 uF) between Photon 3.3 volts and GND near the Photon (being careful to observe the capacitor polarity). The point of all of this is to prevent short spikes in current draw from the 3.3 volt supply (as the sensor is switched on an off) from “glitching” the logic (in this case, on the Photon).

Usually, the problem is the reverse of yours. Usually, a good PCB has a lot of ground plane which produces a distributed capacitance to help decouple the power supply (as well as to help prevent crosstalk between the circuit traces). The breadboards are usually crappy in this regard. However, your case may be the reverse. Which brings up one more thing to check - is the copper pour on your PCB actually connected to the Photon’s GND (BOTH Photon ground pins)? If the whole copper pour is not grounded, it will just bounce around with the sensor switching and produce glitches everywhere.

1 Like

Sorry - I meant Argon, not Photon, but the points are the same.

Thanks for your help everyone. It seems like the problem was that both the sensors at J1 were duds, and a fresh one is working fine. Duhhhhh!


This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.