Go Down

Topic: 220V detector - again (Read 1 time) previous topic - next topic

guy_c

I don't really get the complex approach and the need for the middle. But if you want to put the uC to sleep then you, external filtering might be preferred to wake it up less frequency. Although it might still benefit from software filtering as well. And you don't need the middle and stuff. Just keeping time between a rising and a falling edge and counting them.
Sorry, I don't know what is it that you call 'middle'

septillion

Sorry, I don't know what is it that you call 'middle'
this:
So we need to wake up in sync with the middle [...]
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

guy_c

, check for x pulses in y time with minimum duration of z.

To check the minimum duration we need to sample in the middle. Eg 50% duty 10ms pulse we want to sample say at ms# 4, 5, 6. And find, say, >=2


septillion

Mm, not really. IF you think of it as sampling then you would at least need the Nyquist frequency. And you might say the second sample is the middle but that's as far as it has anything to do with the middle.

But you may assume the Arduino is orders of magnitude faster than mains. Aka, timing of the polling  or sampling isn't really an issue. And to make it accurate, just use the interrupt on state change. Now you just have two events for a puls, a rising event and a falling event. And you can just apply the usual time keeping practices (hint: millis() / micros()) to determine z and y.
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

guy_c

But we agreed that just meayrrng rising an falling will give false positive for noise synced to main

septillion

If you let THAT trigger the output directly, yes. Not if you put that into an algorithm which can detect a falls positive (or negative even!) and let that drive whatever-you-want.
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

guy_c

if you put that into an algorithm which can detect
yes, sure

Go Up