Water level controller PCB not working

Good evening folks. My team and I are working on a mini project. This is the first time we’re doing something related to electronics. Our knowledge is not that great so I would appreciate if you could explain to me gently. We designed a PCB using eagle. After fabrication it’s not working. We’ve been trying to figure out what is wrong and are unable to do so, so far. I suspect our design is flawed. I would appreciate if someone could take a look at my schematic and board and tell me if there is something wrong. It’s a through hole design. We’re using PIC16f877a. We intend to measure water level using hc-sr04 ultrasonic sensor. We’re using songle srd-12vdc-sl-c relay to power up a 220V AC motor. I am unable to attach files therefore I’ve uploaded the .sch and .brd file on google drive:

https://drive.google.com/open?id=0B7IVjQMcdq9cVTJEWXpOSnlodEk

If there is any other information you would like to know please do tell me. Thank you.

Now that I’ve approved your post, you should be able to directly attach files.

What specifically isn’t working with your board? Do you suspect it’s the PCB or the firmware you’ve written?

The big issue I see is that you specified at 12V relay but have it connected to your Vcc net which I’m assuming is no more than 5V. The relay will not operate correctly at 5V. You may be able to repair this buy cutting the Vcc trace going to the relay and connecting it to your 12V input. Since that line also feeds other parts of your circuit, you will have to cut it again after the relay and reconnect that part to Vcc so the original parts still get the correct voltage.

From a safety issue, you should isolate the 220VAC section of your circuit better. You want to keep those traces as far away as possible from the low voltage DC side of your circuit. The trace coming from the common connection of the relay going to X5-2 should come out straight to keep it as far away from the coil terminals. The ground connection should not be routed so close to the X5 pads and ideally shouldn’t wrap around it at all.

I don’t know what the current draw is of your AC motor but I do know that the 30mil traces you used from the relay to the X5 connector cannot safely support the maximum current that the relay contact can. There are online trace width calculators you can use to determine the size trace you need for specific loads and acceptable trace temperature rises. You can mitigate this by soldering in appropriately sized wires between the relay pads and your X5 connector.

I hope that helps you get started!

-Bill

Thank you for the approval phalanx.

We tested our ultrasonic sensor with firmware on a breadboard but we did not test our motor.

Yes the relay is powered at 12V and yes our board is to be powered at 5V via the regulator. I’m unable to understand what do you mean by “It’s connected to your Vcc net.” Are you saying the current setup is providing 5V to the relay? If that is the case, would our motor work if I were to swap out the 12V relay with a 5V relay?

I have noted the safety issue you mentioned and will look into the trace width.

“Nets” are the connections between components in your schematic. On the output side (+5V) of your regulator, you have a symbol connected to it called Vcc. That sets the net name to Vcc. When you add other Vcc symbols in your schematic, everything connected to them will be considered the same electrical connection even though there is no physical line connecting them all together. This helps you make less cluttered schematics while still preserving all the connections otherwise you would end up with a rat’s nest of lines that are hard to follow and troubleshoot. When you get to the actual board layout, all these points will be physically connected together.

If you look at your schematic on the high side of the coil, you have a Vcc symbol connected to it which means you are delivering 5V to the relay. You can confirm this by looking at your board layout and if you follow the trace back you will see that it eventually ends up on the 5V side of your regulator. Had you used the “V+” net instead, the connection would have been to the 12V side of the regulator.

Everything being ideal, you could switch to a 5V relay and it will operate correctly. The real world problem that needs consideration is the current draw from the relay will cause your regulator to heat up. I’m assuming you’re using a 7805 linear regulator and when I looked at your relay earlier I believe the coil is listed at 0.36W at their rated voltage. The power equation is P=VI so the current at 5V is I=0.36W/5V = 72mA. Since your regulator has a 12V input and the output is 5V, there is a 7V drop across it while supplying 0.072A so the power being dissipated by it for only the relay is P=7V0.072A = 0.5W. With a TO-220 package, 0.5W will give you about a 10°C rise above ambient which can be easily handled with a heatsink in open air. If you are enclosing the board in a space with no ventilation, the regulator will heat the surrounding air which then in turn raises the temperature of the regulator. If your enclosure can’t dissipate the heat, there is the possibility that it could get hot enough to make the regulator shut off which obviously affects the operation of your circuit. It’s always up to the designer to run the math to make sure you won’t be violating the specs of any of your parts. Also keep in mind that my quick calculation was only for the power consumed by the relay and not the rest of your project board. Your PIC and MAX232 part should not add too much more but depending on how you interface with your ultrasonic transducers, you could be demanding more from your regulator than it can handle especially if long term stability is a concern.

If it were my board and I already had the 12V relay on hand, I would make the cut and jumps to bring 12V to the relay coil and 5V to the rest of circuit that would be affected by the change.

-Bill

Sorry for the late reply. It’s been quite busy. I fixed the relay issue by making the cuts and jumps. It works fine with the firmware and GUI. My most unfortunate issue currently is I am unable to make the ultrasonic sensor work. I edited my firmware to test it with a water sensor instead and it’ able to work perfectly fine. The pump stops water flow as it reaches the water sensor. It Looks similar to this:

http://www.emartee.com/Images/websites/ … Sensor.jpg

According to my friend the trouble with ultrasonic sensor is, it’s able to trigger a pulse but can’t seem to get any echo back and I’m unsure what’s the issue. I suspected the ultrasonic sensor has a fault, but it’s working fine with a different application. Just that for this PCB it’s not.

I’m glad that part of your board is up and running now and there’s no problem in looking into ultrasonic issue further. Post some more details about it, the code that runs it, and how you intend it to operate and we can go from there.

-Bill