Atmega 168pa MCU is not working properly sometimes

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

Hello forum experts,

I am having a problem where I'm trying to run a code that uses PWM and sensors to detect gas. It works perfectly, but mcu detects gas which means that make a beep signal(buzzer) and blinking led without anolog signal (whithout gas ). It repeats 2 or 3 times and after that mcu is silence.
The problem appears when mcu works long time, sometimes 2 weeks or 1 month. It doesn't depend on circuit board.
Does anyone know why this could be happening?

 

This topic has a solution.

sadf

Last Edited: Tue. Dec 4, 2018 - 02:10 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Could be many things - do you filter your analog signal both in hardware and software? With no filtering a static discharge event (ESD) can cause an invalid reading.  Hopefully this unit isn't a safety device.

 

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

I used LM324 op amp for analog signal(10kohm and 47uF). I used two 1000uF 25V 1000uf 10V for converting voltage. I am sure that hardware filter is OK. I didn't solder 0.01uF for MCU(vc,avc and gnd) for ripple because I used high filter.
In software, I used ADC 10 bit for reading anolog signal. How to filter analog signal in software? I used internal oscillator 16 MHz frequency.

sadf

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Casper_0770 wrote:
How to filter analog signal in software?

the simplest filter is taking a number of samples and averaging. 

Next up is digital filter using DSP techniques.

 

Casper_0770 wrote:
I didn't solder 0.01uF for MCU(vc,avc and gnd) for ripple because I used high filter.

 

You still need bypass caps for the AVR.

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

Casper_0770 wrote:

It doesn't depend on circuit board.

 

How do you know? Maybe all your boards are faulty. Show a picture of your board. And also a picture from your PCB CAD program showing the track layout.

#1 This forum helps those that help themselves

#2 All grounds are not created equal

#3 How have you proved that your chip is running at xxMHz?

#4 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand." - Heater's ex-boss

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

I considered before it averaging (sensors value/100).
Could you lead digital filter in software?

sadf

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

Brian Fairchild wrote:
How do you know? Maybe all your boards are faulty.

Funny how some ignore the obvious!

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

Need to also see a schematic of the circuit.

 

The LM324 is not a rail-to-rail op-amp, and if it is running on 5V/Gnd then it has a very narrow window of operation.

 

Need the sensor make and model, (or link), also.

 

When I have had a bug show up once every X hours or days, etc., it has usually been a software problem, where an interrupt just happened to fire at exactly the wrong time to screw things up...

 

JC