A circuit works on a breadboard, but doesn't on the PCB I made. What's wrong? - Page 1
Forum section: electronics / beginners

author: vsevolopod
author_rank: Newbie
timestamp: February 03, 2019, 01:38:08 am
content: I'm trying to turn small 5 volt relays on and off from an arduino. I'm using a BC547 NPN transistor triggered by one of the digital pins. I've built the circuit based on this tutorial.https://www.electronics-tutorials.ws/blog/relay-switch-circuit.htmlI built the circuit on a breadboard, and it works. I made a PCB that has the Atmega 328 and the transistors on it. I know the microcontroller works, and that the extra digital pins on it will turn on the relay if I build the exact same circuit that is on the PCB on a breadboard. I don't understand why the exact same circuit on a breadboard turns the relay on, but it doesn't work on the PCB at all. I thought maybe it was because I have about a foot of cable between the transistor and the relay, but I put the same cable between the transistor circuit on the breadboard and the relay, and it worked. So at this point I've narrowed it down to a problem with my PCB design.When I measure the voltage between the collector of the transistor on the board and +5v, I get +5 volts switched on and off by my arduino sketch. When I connect the relay, I get like 2V or less (I forget the exact number). This only happens with my PCB, not the breadboard.What could I have done wrong with my PCB design?Might there be a way to fix this, at least for now and use the same board, then update the design when I iron out all of the possible issues?

author: sokoloff
author_rank: Super Contributor
timestamp: February 03, 2019, 01:41:42 am
content: Occam's Razor suggests that the most likely cause is something is actually different between the breadboard and the PCB you made.I'd spend a lot of time verifying or disproving that notion before thinking there's something different between the breadboard and PCB with the same circuit and components.

author: tsman
author_rank: Frequent Contributor
timestamp: February 03, 2019, 01:42:23 am
content: Show your PCB artwork?

author: vsevolopod
author_rank: Newbie
timestamp: February 03, 2019, 01:54:08 am
content: I went back and attached it to the original post, so It's easier for anyone to find.I have spent a lot of time making sure that there is no difference between the PCB and the breadboard. The components are the same, the diodes are in the right way, everything is put together correctly, I don't think it's a construction mistake. It being a PCB and not a breadboard is the main difference I can find, the traces leading from the microcontroller to the transistors are somewhat long, and there are jumpers on top of the board that connect them to skip over some other traces on the bottom.The digital outputs I wired to the breadboard are right next to the IC, this is the main difference I see, but maybe I'm missing something.

author: JDubU
author_rank: Frequent Contributor
timestamp: February 03, 2019, 02:21:23 am
content: Transistors backwards on the schematic.Emitter on an NPN transistor needs to be connected to ground. Collector goes to the bottom of the relay coil.Turn the transistors 180 degrees on the PCB (flat side toward the left side of the board).

author: vsevolopod
author_rank: Newbie
timestamp: February 03, 2019, 02:23:23 am
content: Wow yep that's it. I can't believe I didn't catch that. Thank you so much.I'll probably come here to have my schematics checked more in the future.I'd been staring at that so long I didn't notice that (honestly pretty obvious) mistake.EEVblog Forum is the best!