Noise causes reset in mega64

Go To Last Post
20 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi all

I have used a mega64a +ade7753 (energy meter IC) in a circuit 

the power supply which I use is a 220 to 12 volt converter module : http://www.javanelec.com/PDF/AC%...

then I use a lm2576 Ic to convert it to 5v .

I have used no additional filter .

the Reset Pin of the mega64 is pulled up by a 10k resistor and a 10uf tantalum capacitor is connected to it as well.

since the ground  of the circuit is connected to the ac line as shown in the attached picture (typical circuit of the datasheet) , the circuit has became very noisy .

not always , but many times when I connect a device such as a heater or vacuum cleaner , to my energy meter device-or an arc happens - the Atmega64 resets or hangs . I have used watchdog to prevent hangs , but for resets , I have no solution.

Can any one help me to prevent this issue?

 

Attachment(s): 

Last Edited: Tue. Nov 16, 2021 - 08:26 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

and a 10uf tantalum capacitor

What made you select this value? Have you read, among other things, AVR042: AVR Hardware Design Considerations?

 

And by the way welcome to the real world. wink
 

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

syavash_kasraeee wrote:
not always , but many times when I connect a device such as a heater or vacuum cleaner , to my energy meter device-or an arc happens - the Atmega64 resets or hangs .

 

I'll wager that if you investigate these incidents you will find spikes of tens of volts or more on AVR pins.

 

And what does the device data sheet say about Absolute Maximum Ratings?  Proper operation of the device is only guaranteed when Absolute Maximum Ratings is not violated.

 

 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

John pointed you to the AVR042 App Note.

 

I presume you have a By-Pass cap on every Vcc and on the AVcc pins on the uC?

I presume you have AVcc tied to Vcc?

I presume you are actually using the opto-isolator, and not directly connecting the chip to the uC?

 

A schematic of your exact circuit, and a photo of the setup would help.

 

Perhaps I'm missing something, but I don't see why the uC has to have a common ground with the Mains and the energy meter IC.

 

JC

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

theusch wrote:
Proper operation of the device is only guaranteed when Absolute Maximum Ratings is not violated.

Actually, proper operation is only guaranteed when you stick within the specified operating characteristics.

 

Atmel ATmega64A DATASHEET wrote:

Stresses beyond those listed under “Absolute Maximum Ratings” may cause permanent damage to the device.

This is a stress rating only and functional operation of the device at these or other conditions beyond those indicated in the operational sections of this specification is not implied.

Exposure to absolute maximum rating conditions for extended periods may affect device reliability.

 

http://www.atmel.com/images/atme...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

js wrote:

and a 10uf tantalum capacitor

What made you select this value? Have you read, among other things,?

 

this is what I always use in my circuit - and I don't know where I have found it first time !cheeky-

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

theusch wrote:
I'll wager that if you investigate these incidents you will find spikes of tens of volts or more on AVR pins.   And what does the device data sheet say about Absolute Maximum Ratings?  Proper operation of the device is only guaranteed when Absolute Maximum Ratings is not violated.

How can I prevent it? as you can see in the datasheet , the N line is connected directly to the ground . so how can i prevent the spikes ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

DocJC wrote:

 

A schematic of your exact circuit, and a photo of the setup would help.

 

Perhaps I'm missing something, but I don't see why the uC has to have a common ground with the Mains and the energy meter IC.

 

from the first attached picture which is from the datasheet , I thought that the N line must be connected to the gnd . Am I wrong ??

I have not used opto isolation between Ic and uc since i need the meter to be very small sized and i am not able to use another power supply to isolate them .

and the schematic is attached 

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Why is avcc not shown as connected on the mega64? What does the datasheet say about this?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why is PortE.4 tied to Ground?

 

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have not used opto isolation between Ic and uc

 

?

 

Would it not be better to start with the working example provided by the chip manufacturer before you start to modify their known good, working design?

 

JC 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi 

thank you for your advices 

considering the above items , I checked my circuit again . Searching in the internet for similar circuit based on ade Ics, I found EMI filters in the input of their circuits as well as ferrit bids . so I added them to my energy meter and have found a good result . neither my UC hang nor resets like before .

I started my tests on the circuit without any calibration and found very good results in rms voltage and current for ohmic (lamp)  consumers . (using voltage divider resistors for Voltage and a ct for current) the error in my measuring in comparison with a digital energy meter device was about 0.5 %.and the energy measurement was acceptable as well .

then I started testing fan , iron and vacuum cleaner . the result for the iron , fan and hair dryer was acceptable . But the vacuum cleaner error was about 30% to 40 % error in Irms . the IRMS register gave a much bigger value than the energy meter device . 

I thought that it might be due to harmonics that the vacuum cleaner makes due to its motor . it might have affected on the CT and so shows a greater value (maybe !) 

has any one have any suggestion for this issue ?

 

 

Last Edited: Thu. Apr 14, 2016 - 04:31 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

syavash_kasraeee wrote:
the schematic is attached 

That is not a schematic!  That is a bunch of isolated parts with net list names!!!!

A real schematic tells a story, just as a picture replaces a 1k words, so does the drawing, it should show how all the parts interrelate to each other, go back and spend some time drawing how each part is connected to the others with lines, arrange the parts so you can see the flow of how each works with the others!  Looking at your so called schematic, I can not read the story....

 

Jim

 

 

FF = PI > S.E.T

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


Just in this one snipit, I see you left unconnected AVCC and a GND pin??? Why?  All power pins MUST be connected, also each vcc/gnd pin pair needs a decoupling cap (100nf) placed as close to the pin pair as possible, these are required, you can not use only one for multiple power pins.  This is also a general practice for all digital and analog ICs...

Why is pin PE4 grounded? Grounding a port pin can cause an internal short should this pin be made an output and software attempts to set port pin high!!!

Jim

 

 

 

FF = PI > S.E.T

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


This circuit also concerns me, if the jumper is installed, then 220vac is applied to the VAP pin on the energy chip?!!! 

Also depending on the type of resistor r7 is, TH vs SMD, you may need to use more then one resistor in series to have enough clearance to prevent flash over!

i.e. three 330ks in series has 3x the gap clearance then a single resistor!  HV ac can kill, be VERY carefull!

 

Jim

 

 

FF = PI > S.E.T

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I'm a bit confused -- OP is still looking for amps five years later, with the same [non-]schematic?  With no posts since then?

 

Perhaps a moderator removed a spam but it bumped the thread?

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

theusch wrote:
Perhaps a moderator removed a spam but it bumped the thread?
Not me but that sure looks like what happened. 

 

(I often lock a thread that's been re-awoken by deleted spam but then I get an earful from the freedom of speech police so I guess you can't win!)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

theusch wrote:
Perhaps a moderator removed a spam but it bumped the thread?

I did report a spam message (sales link in sig), which is now gone.

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
I often lock a thread that's been re-awoken by deleted spam

Seems appropriate to me! yes

 

ISTR there was a discussion years ago, and that seemed to emerge as the preferred approach?

 

(plus there's the ongoing discussion about automatically locking inactive threads - which does happen on some (many?) other forums)

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Duh! Palm to forehead!  Sorry I forgot to check the date before posting, please lock the thread.....

 

FF = PI > S.E.T

 

Topic locked