AVR resetting

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

I have been faced with this kind of if problem before and somehow fixed it -reset pin was left hanging.

My Atmega1284 resets when relays release/switch off AC motor. Sometimes the code hungs/stops or lcd throws unintended characters. Turning on the motor shows no problem.
The motor appears to be the only problem; removing it from the design restores everthing to norm.

I have the 0.1uf on the power rail of mcu, reset pin is pulled up, Brownout is default,optoisalators actuate the relays, common ground but relays operate on 12v.

Will Rc cross the motor help, I'm not sure about the values though. Motor is 14W 240VAC.

Crazy generation

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

The cause of the problem will come from hardware.
You can not receive specific advice unless you present a circuit diagram.

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

The optoisolators are useless if there is a common ground!

You need to be careful where you route the wiring for the motors. Show us a picture.

 

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

Schematic of Cct and routing

Attachment(s): 

Crazy generation

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

Please see the three thick red tracks around the two relays.

Crazy generation

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

That pcb design would be illegal in most western countries since you have violated creepage requirements. You've chosen the wrong relays as they do not allow adequate clearance between the low voltage wiring and the high voltage wiring.

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

Thanks for that observation. In future design I Will consider that.

This is a prototype any I'm after at least functionality.
What your take about fixing RC across the motor. The values if you could be knowing.
The motor came with a valueless ceramic cap.

Crazy generation

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

You could use a 100nF mainscap with a 100R 2W metal film resistor in series. The problem is still your pcb - clearance notwithstanding. You have loops to pick up the EMI and couple it into your circuit. There's also your transformer wiring to consider (you've not shown that). Unfortunately the pcb and schematic don't tell the whole story when it comes to these types of problems.

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

Okay let me try, Will also have to make another pcb if they RC don't help.
Thanks for quick response.

Crazy generation

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

I'd suggest you not even use the pcb as it is electrically dangerous and could kill.

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

I chose to Starr by connecting some movs across the motor and so far the problem has gone.

Not Very sure about consequences of this though.

Crazy generation

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

Since the problem is "AVR reset", it is important how the AVR power supply decoupling and reset pin processing are done.
Is Brownout the default meaning you are not using Brownout?

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

The Atmega1284 is somewhat more sensitive to noise when running from the low-power crystal oscillator.  If you haven't already, try changing fuses to use the full-swing crystal oscillator.

 

Do this >>in addition<< to following the other advice you've been given.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"Read a lot.  Write a lot."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

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

I'm using 16MHz

Crazy generation

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

I'm using external power supply from from a switching mode power supply 2.1A.

Brownout default means did not touch it/ inactive.

Crazy generation

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

Brownout is necessary if there is no external voltage drop detection.
Brownout is invalid and if it is reset it is suspected that the pull-up of the reset pin is weak or the decoupling of the power supply is insufficient.

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

I'm using 16MHz

You have misunderstood.  I'm not referring to the speed, but to the mode.  The Atmega1284 supports two modes for the crystal oscillator.  One is 'Low-power', the other is 'Full-swing'.  Which one are you using?

 

Brownout is necessary if there is no external voltage drop detection.

Brownout is >>always<< a good idea.  The only reason to avoid it is if you are running on batteries and can >>guarantee<< that there will be no power issues.  In your case, your problems are almost certainly power/noise related.  Do yourself a favour and enable BOD.

 

Again, neither of these will be sufficient to solve your problem.  Follow the other advice you've been given.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"Read a lot.  Write a lot."

"We see a lot of arses on handlebars around here." - [J Ekdahl]