Go Down

Topic: Filtering out erroneous data (Read 399 times) previous topic - next topic

MaLi

Greetings,

I am fighting a very strange problem and I need a bit of help.

I made a controller for a reef tank with a Mega. Everything works very well with the exception of the metal halide lights. Whenever I command that relay on the ballast is messing up the reading on I2C from the DS1307 and makes it sending garbage time values. In hardware I have done all I knew to do (mechanical relay, snubber, etc.) Nothing worked with this ballast.

Now I am down to software. Is there a way of filtering out garbage time values ? They are popping up for a second and then dissapear for a few minutes. Everything is random.

If filtering is not an option, is there a way to start a counter based on Arduino time ?

Many thanks,
MaLi

marco_c

It depends on what you mean by 'garbage' values.

Time is a very linear thing, so one time value will aways be bigger than the previous time value. I would have thought that in the software you should be able to ignore values that differed from the previous one by more than a certain amount as being 'in error', and anything less than previous reading as being definitely wrong.

IMO
Arduino libraries http://arduinocode.codeplex.com
Parola for Arduino http://parola.codeplex.com

MaLi

Thanks Marco. Sometimes the time goes briefly to 00;00 sometimes to 45:XX or any combination. I have two ballasts. One is triggering the odd behaviour in a few seconds the other one every tweny , thirty minutes.

cheers,
MaLi

marco_c

The Arduino is not accurate as a clock over a long time. However, as you are in control of the lights, maybe when the lights come on you can just use the Arduino time to work out the current time. The sort of logic I am thinking of would be that is the lights are not energised, use the external clock (I2C) and if the lights are on, use the last reading and add on the time elapsed from the Arduino. When the lights are turned off the Arduino can resync to the external clock.

If it is RF interference, then maybe position the electronics further away from the lights? Or change the lights to something else :-).
Arduino libraries http://arduinocode.codeplex.com
Parola for Arduino http://parola.codeplex.com

Go Up