Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Noise of Driving relay from avr

Status
Not open for further replies.
Much better!

Are you sure the PC817 can handle the relay coil current? I think transistor drivers would work better.

Personally I would make these changes:
1. move the track from F2 to the relays to a position more central between the relay pins and make it wider.
2. where C1 and C2 are linked, remove the track to ground and wire a new track from them directly to the MCU.
3. Flood fill the grounds wherever possible.

Brian.
 

Hi,

Yes, it´s better but there still are mistakes.

* Still no GND plane: We don´t need to talk about noise improvements without GND plane.
Homebrew PCB? Then GND_plane at the top side (for easier soldering), else GND_plane at the bottom side (to comply with SMDT).
--> RIPUP all your GND traces, use the POLYGON command to draw the outlines of the GND_plane, then use the NAME command to set the desired GND_signal_name.
RATSNEST calculates the polygon. Less than 1 minute to work.

* trace width is random?

* weird pushbutton placement. I don´t hink this is useful.

* still missing power supply capacitors at the ICs. (maybe wrong connection?)

* some JUNCTIONS are missing others are useless. Use the DRC to show errors.

* you are free to use 45° angles. They are not more expensive than 90° angles.

* maybe you need mounting holes?

* homebrew PCB? Then

SAFETY:
The relay is not rated for switching 220V AC! it`s just rated for 14V. Don´t use them, this is very dangerous!
You need to keep "safety distance" of at least 6mm between 220V areas and low voltage areas.
But you just need to keep "functional distance" of about 2..3mm between L and N (or switched nodes).

As already said: The optocouplers have no benefit as long as both sides are connected. This is no isolation it´s just a waste of money. Additionally I assume they are not able to switch the relay_coil_current.

Also check if the microcontroller can handle the LED_current + optocoupler_current.

Do these modifications by yourself. Maybe after that I can spend some time to optimize it. Let´s see.

Klaus
 

Much better!

Are you sure the PC817 can handle the relay coil current? I think transistor drivers would work better.
Personally I would make these changes:
Brian.

in pc817 datasheet the maximum collector current is 50mA, and the relay i used at 12 v draw current 3705mA, I think optocoupler is better for isolation,right.?

- - - Updated - - -

Much better!

Are you sure the PC817 can handle the relay coil current? I think transistor drivers would work better.

Personally I would make these changes:
2. where C1 and C2 are linked, remove the track to ground and wire a new track from them directly to the MCU.

Brian.

do you mean connect them directly to the ground of the AVR?

- - - Updated - - -

Much better!


3. Flood fill the grounds wherever possible.

Brian.
what do you mean by fill flood?
 

Hi,

Yes, it´s better but there still are mistakes.

* Still no GND plane: We don´t need to talk about noise improvements without GND plane.
Homebrew PCB? Then GND_plane at the top side (for easier soldering), else GND_plane at the bottom side (to comply with SMDT).
--> RIPUP all your GND traces, use the POLYGON command to draw the outlines of the GND_plane, then use the NAME command to set the desired GND_signal_name.
RATSNEST calculates the polygon. Less than 1 minute to work.
.

Klaus
i fulfilled as much as i can,GND plane is attached.
my relay is working on 220 Ac https://store.fut-electronics.com/collections/relays/products/5v-dc-songle-power-relay
you mentioned that optocoupler is useless as both sides are coneected, I there any other way that they aren't?
i used capacitors beside Ics such as c7,c3,c5.
 

Attachments

  • inc.pdf
    50.7 KB · Views: 57

Again, an improvement but far from ideal.

The relay coil requires ~38mA to operate which is more than I would pass through a PC817. They are intended to be used in feedback applications where the LED current can control conduction through the output transistor rather than as power switches. Besides, the relay itself can withstand up to 1.5KV so why use an additional isolator and power it from an un-isolated power source.

The flood fill means that all the unused areas, at least the ones around the MCU are filled with copper and connected to ground. Ideally, you use a double sided board and make the top side all copper, including holes to ground points on the bottom but isolate places where other wires pass through holes. For most PCB manufacturing processes, the board starts as a copper surface and the gaps between tracks are etched away so the more you leave, the less you have to dissolve away. The flood fill technique lets you minimize etching and make the ground better at the same time. Lower resistance grounds always work better.

Your new design still doesn't deal with the crystal issue. The clock circuit consists of the crystal and two loading capacitors, C1 and C2. If noise gets injected into the oscillator path it can cause unpredictable operation or a complete crash. Try to minimize the wiring length between those components and the MCU and connect the capacitor grounds directly back to the MCU without touching anything else. It may mean running two tracks to the same pin on the MCU but it keeps currents on them apart from each other.

Overall, you are improving the design but I would suggest doing it this way:

1. start with the outline of the PCB.
2. locate places where adjustable components are accessible. For example don't mount side adjustable potentiometers where another component blocks access to the slot. Fix the position of adjustables, make them easy to reach, you can work on getting the tracks to meet them later.
3. Decide which components have to be kept together (Crystal, C1, C2 for example) and which should be spaced apart. (relays, high voltages for example)
4. Leave space for decoupling capacitors close to the MCU supply pins.
5. Make sure current paths are sensible. Remember that even short tracks drop voltage along their length when current flows through them so try not to make any track share currents that might change during operation as it could result in varying voltages where you don't expect it.

There was a classic error of type 5 in the original PCB design where the relay currents passed along long tracks and the MCU supply was taken from along the track length. It meant the MCU supply voltage went up and down according to how many relays were operating. Usually, the best place to draw current from is the output pin of the voltage regulator or the capacitor across it's output.

Brian.
 

Hi,

i fulfilled as much as i can,GND plane is attached.
One side GND, other side signal routing

you mentioned that optocoupler is useless as both sides are coneected, I there any other way that they aren't?
The usual operation is that there is no connection between both sides. Optocouplers are especially designed for that.

i used capacitors beside Ics such as c7,c3,c5.
Close means millimeters.
And two GND pins of the same IC need to be connected with the shortest connection....in your case you build a loop of several centimeters which may act as a good antenna for frequencies like cellular phone, WLAN, Bluetooth...

Klaus
 

I have problem with the chip mega8, its pins locations aren't identical to the real chip, they are shifted
 

Hi,

give useful informations.
We can´t see what you see, thus post correct_pinning and wrong_pinning and tell us where the informations come from.

Klaus
 

I printed the pcb on a paper to see it correctly .i put the real chip on the paper , i found some pins are typical others on pcb are shifted from the real chip
 

again, new modifications, crystal and cap are close as possible to MCU with separated gnd. I made two tracks,IS that what you mean?. also supply of MCU doesn't share with any buss,it is taken directly from the regulator. I hope to be close to ideal
 

Attachments

  • 455.jpg
    455.jpg
    131.6 KB · Views: 60

I haven't checked for correct connectivity but the layout looks pretty good now. Compare it with your original to see how much better it is.

One thing to check: I assume the 'reverse', 'alarm off', 'set temp' and the other similar device are switches. The overlay shows upright types with the button pressed from the side. If you are using that type, make sure you can reach the button. If you are using horizontal mounted switches so you press from above, make sure there is enough courtyard to mount them as they have larger footprints.

Brian.
 

what about the relay circuit? will this affect the MCU board or cause noise, i take the relay coil supply before the regulator and i used transistors instead of pc8817.
 

Attachments

  • in.pdf
    19.3 KB · Views: 49
Last edited:

Hi,

will this affect the MCU board or cause noise
Yes.
There will be conductive noise and there will be radiation noise.

i take the relay coil supply before the regulator
I recommend a bulk capacitor at the relay board to stabilize the supply.

Your relay board design contains some errors that make the board - at least partly - useless. I wonder why you don´t simply press the DRC button..

Klaus
 

I pressed DRC button there were some overlaps and i corrected it nothing else. why do you think it is useless. Do you think it needs any thing except bulk capacitor?
why there will be conductive noise and radiation noise.? how to cancel it?

- - - Updated - - -

and How bulk is the capacitor?
 
Last edited:

H,

there are still overlaps. And clearance errors. Try DRC!
Did you draw the schematic in EAGLE?

Learn how to use a software tool ... then it will assist you. There are many tutorials around.

Klaus
 

Yes.it is eagle
And i tried drc,no overlaps and no errors
I want to focus on noise immunity
 

I desinged the new pcb with 1000uf on regulator input and 100 nf on its output, there is also 100nf connected the MCU VCC close to it. the circuit is working fine with dc motor and ac lamp but the problem appeared when i connected small ac motor(grill motor). it disturbed the MCU code and take random actions.
 

Hi,

From post#22
* Still no GND plane: We don´t need to talk about noise improvements without GND plane.
Homebrew PCB? Then GND_plane at the top side (for easier soldering), else GND_plane at the bottom side (to comply with SMDT).
from post#26:
One side GND, other side signal routing

You didn´t follow my recommendations, thus the problem isnt`t (fully) avoided.
Now decide what to do:
* designing a better PCB layout
* or try to reduce the motor noise (while still the PCB is prone against other noise)

Klaus
 

the GND plane was added since post #30. and i have only one side PCB. so i followed your recommendations.
 

Hi,

Me:
One side GND, other side signal routing

You:
and i have only one side PCB. so i followed your recommendations.

I think it makes no sense to go on this way.

Klaus
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top