1
\$\begingroup\$

I'm working on a thermal regulator for a greenhouse. My device will use ATtiny2313A as uC and DS18B20 as thermal sensor. I also use 1602 LCD display to monitor current temperature and set low and high limits for the heater system.

I want to be able to drive heater load for about 2kW (I'm from Russia so in my 230VAC line it will be about 10 amps). I use relay 507-1AH-F-C to commutate heater load. Actually I will break the Live line (which also have the fuse 10A @ 250VAC) while Neutral line will stay connected. As I understood from datasheet this relay can handle 12A @ 250VAC so things look pretty good to me. Coil voltage is 5VDC and I use KSP44 transistor in switch mode to handle such a heavy load (about 106 uA) by uC.

When I was in developing phase, I used breadboard to debug firmware for ATtiny2313A. During test phase, I was able to see some strange glitches such as random restarts of uC or even EEPROM corruption (see the discussion here). I've measured some voltages and discovered that display backlight and relay coil causes serious voltage drop on breadboard rails (about 0.2 volts).

Because of this I decided to make two power sources, which are built on LM7805CT linear regulators. One LM7805 is mounted on the heatsink and supplies power exclusively for relay coil and LCD backlight. The second LM7805 supplies power only to the DS18B20 and ATtiny2313A. Somewhere in the Internet I read that using two linear regulators in such manner is a bad idea.

So because this is my first full-cycle (schematics developing, PCB routing etc) project, I want to learn as much as possible and avoid potential pitfalls. Here I attached the schematics, routed PCB and 3D models of it. I would be very grateful if anyone from the community would tell me some useful advice or point to my errors. I'm only a beginner and want to dive into the world of electrical engineering.

There are main questions of the greatest importance to me:

  1. Is it bad practice to use two or more LM7805s in parallel? In my case they have common grounds. Generally I have solid ground planes on the both sides of PCB.

  2. I use transistor in switch mode. For my calculations I assumed that hFE = 20, Base-Emitter voltage drop is 0.8 volts and Vout for ATtiny2313A is 4.2 volts. I think that it will be OK that collector current is about 150 uA (although relay coil consumes 106 uA) so my math for base resistor is:

    (4.2 - 0.8) / 0.150 * 20 = 453 ohm

    I took 680 ohm for my R2 value. Is there any miscalculations in that scheme? Also I wonder if there will be any pitfalls because collector is powered from +5V line (the first LM7805) while base is driven by VCC line (the second LM7805)?

  3. How can I efficiently find and understand ground loops? I tried to separate logic and power parts of my scheme and use solid ground zones, but I am concerned if any loops still exist.

  4. Is my variant of snubber for relay good? Or are there improvements which could be introduced? I've read Application Note which stated that this variant should work well, but I want to know real user experiences.

Thank you!

Schematics

PCB

Front view of PCB

Back view of PCB

\$\endgroup\$
0
\$\begingroup\$

THe dirty current pulse of coil can interfere in both conducted ripple and radiated EMI.

So it should be filtered separately.

  • conducted noise using ultra low ESR Caps or series R and low ESR Caps.
  • Radiated noise filtered by CM rejection using a small Loop area so forward and return paths cancel out.

    Then LCD and uC can share 5V without interference.

  • Series R (depends on load but low ESR e-cap must have ESR*C< 10us and 0.1uF Ceramic or metal film must have lower ESR and much higher SRF (self-res. freq.)

  • if 100mA coil then 0.1V drop is ok with 1 Ohm R with 100uF and 0.1uF to coil with reverse diode clamp.

  • Low ESR e-cap is best otherwise 100uF cap is 2 Ohms vs 0.1 Ohms.

This attenuates noise by Rs (1 ohm) to ESR ratio of caps for step loads and ESR of 0.1uF for release current.

schematic

simulate this circuit – Schematic created using CircuitLab

  • If the power source sags that is a poor source.
  • if it drops 0.1V from 100mA coil and LDO maintains 5.0 for the other loads, then no conducted interference.
  • if loop area shown with arrows is large, then radiated interference can upset uC
  • Green arrow shows when relay is activated and Red Arrows when released.
\$\endgroup\$
  • \$\begingroup\$ Thank you for suggestion! Seems like my schematic almost the same as your - I already have 100uF and 100nF caps on LM7805 output. The one thing that I not have - 1 ohm resistor. Also I wonder why you are discharges coil via 1N4148 to the ground? According to the datasheet cited above it's not the best solution... In any case is using Zener + diode lacks something? \$\endgroup\$ – Drobot Viktor Apr 1 '18 at 23:41
  • \$\begingroup\$ Why? Is the current direction will change to the opposite on coil release, isn't it? I see the same scheme as on figure 6 here \$\endgroup\$ – Drobot Viktor Apr 2 '18 at 0:04
  • \$\begingroup\$ Yes of course the diode goes 5V not gnd as the current continues in the same direction andpath or trace to the coil , it was a dumb err \$\endgroup\$ – Sunnyskyguy EE75 Apr 2 '18 at 0:20
  • 1
    \$\begingroup\$ Great explanation! Things become clearer now with relay snubbering part. But in general If I still want to use separate voltage sources as on my schematics - will be there any pitfalls? \$\endgroup\$ – Drobot Viktor Apr 2 '18 at 1:06
  • \$\begingroup\$ Yes LCD and uC can share but not Relay \$\endgroup\$ – Sunnyskyguy EE75 Apr 2 '18 at 1:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.