I took out a ceiling fan in a bedroom. I didn't pay much attention to how it was wired up because I've replaced 5 ceiling lights in the house previously and they've been without issue. My issue on this one is I have 3 black, whites, and grounds coming out. So I figured I'd hook them all together to the single black, white and ground in my ceiling light and they would work. So I do this, restore power at the breaker and go to the bedroom, flip the switch and blow the breaker. I've also noticed if I throw the switch to the ceiling fan in my master it will also blow the breaker. I've has no previous problems until removing this ceiling fan. Electrical is not my strong suite. I do have an ohm meter, but not exactly sure what to do with it...
This answer is brought to you by the term Switch Loop.
You're thinking "Oh, they must be color-coded". They can't be color coded because Every cable in every house in North America looks exactly like this. Black white bare. Bare is reserved for safety ground, so it doesn't even count!
A light has 3 wire functions: 1. Always-hot. 2. Switched-hot (hot when the lamp is desired to be on). 3. Neutral (the current return for all loads). You can't code 3 different wire functions when all your wire is the same 2 colors! (ground can never be used to carry power).
This is why I own 10 colors of electrical tape. So I can tape wires by function. Neutral must be white; I prefer black for always-hot and red for switched-hot.
I trust you have googled "switch loop". That's one of your 3 cables. The two wire functions are always-hot and switched-hot, and obviously, at least one of them has a misleading color! (white is allowed to be things other than neutral- sure be nice if someone had taped it like I do!)
The other two cables are supply; and power onward to other outlets. In both these cables, the wire functions are always-hot and neutral. Since neutral is present, it must be white.
Your next step is figure out which of the 3 cables coming into your box is the switch loop. Separate and cap them all, and turn power on.
- The black wire that lights up a voltage tester, that is your supply cable. One down.
Now if you notice, somewhere in your house something else has lost power. Go find it. Put a load of some kind on it so you can tell when it comes back.
Turn off the power, and pick either unidentified cable. Nut its black to the supply cable's black. Nut its white to the supply cable's white. TURN OFF THE SWITCH. (the third cable will be disconnected) Turn the power back on and see if the thing that had lost power has it back on again. If it does, that cable you just nutted is the onward power cable.
What remains is the switch loop. You can confirm this with an ohmmeter with the power off; near 0 ohms with switch on, infinity with switch off. Open up the switch. Get some RED electrical tape. Get access to the white wire at both ends, and wrap both ends with red tape to mark it as switched-hot. Do the same to the "hot" (non-white) wire on your fan or light.
Now thanks to the tape, you are color coded, and you can match "like color" to "like color" with wirenuts.