Pages: [1]   Go Down
Author Topic: Noise reading analog pulses  (Read 895 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I made an Arduino pulses counter that read led flashes with a fotoresistor.
The fotoresistor is connected to an analogue input that is continuously monitored:
when the reading reaches a certain level Arduino count a pulse.
This way I am monitoring 3 electrical power counters and logging the readings on a SD.
The 3 units needs 3 different threshold since the power counter that I am monitoring are different.
For one unit the threshold is 500 and the reading are always correct.
For another one threshold is 100 and the reading give 0,1% less reading.
For another one threshold is 60 and the reading give 1% less reading.
In theory I should reduce the levels to get missing readings but because of the noise on the analogue lines :
-if I reduce the threshold the reading are increased by 100-1000 times!
- if I increase the threshold I don’t read anything anymore!
So these levels have been adjusted to get the best performances.
I have tried to program some digital filtering with a moving average method , but since I want to read a narrow pulse those method are not appropriate.
I wonder if anybody found a solution to this problem : may be with some analogue filters.
Note: Probably the noise is generated by Arduino: I noticed that during communication the pulse reading run without led pulses.

Thank you for any help!

Paolo

Start new topic

I have tried to program some digital filtering with a mooving average method ,
 but since I want to read a narrow pulse those method are not appropriate.
I wonder if anybody found a solution to this problem : may be with some analog filters.
Note:
Logged

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 514
Posts: 31534
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I made an Arduino pulses counter that read led flashes with a fotoresistor.
Photo resistors are very slow and might not be fast enough to count the flashes on your LED, how fast is it flashing?

Are you sure your code is counting the pulses correctly and not continuing to increment the counter when ever the threshold is exceeded? That is when you exceed a threshold do you do nothing until the reading is then less than the threshold. Try making the up and down thresholds different, this is called hysteresis.

Quote
Probably the noise is generated by Arduino:
This is unlikely. What is your circuit?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you Mike:
the pulse are very short (few millisecond) but the frequency is low ( pulses per minutes <100).
The fotoresistor is glued over 3 Electrical Power Counters and connected by a cable of about 3-4 mt to the arduino where they are connected through a 10kresistor to the analogue port.
The 3 counters have the intensity of the light pulses  different and I have problem only for the dimmest led: I have tried to change the 10k resistor but the signal increase and the noise increase as well.

The code I am using now , after having test several other methods, count the number of sample above the threshold and if they are more than 3, increment the counter  . (I have found that 3 is the optimum)
Now it works continuously since august so I consider the method reliable but I would like to improve the reading of the dim leds.

Any suggestion?
Paolo
Logged

Montreal
Offline Offline
Edison Member
*
Karma: 23
Posts: 2487
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
The fotoresistor is glued over 3 Electrical Power Counters
How did you make it? You mean 3 photoresistors? And than connect them in series ?  ( you mention 1 resistor).
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry

I have not explained myself... smiley-confuse
3 counter leds, 3 photoresistors , 3 indipendent lines in series with 3 10K resistors connected to 3 analogue ports.
For each counter the hardware is like this:
5v---------3mt cable----------fotoresistor-----------3mt cable--------------10Kresistor-------analog port.

Paolo
Logged

Montreal
Offline Offline
Edison Member
*
Karma: 23
Posts: 2487
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
5v---------3mt cable----------fotoresistor-----------3mt cable--------------10Kresistor-------analog port.
It will never work this way. Do you mean:
5v---------3mt cable----------fotoresistor-----------3mt cable--------------10Kresistor-------ground.
                                                                                             |
                                                                                             |
                                                                                     analog port
?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Right! smiley

Paolo
Logged

Montreal
Offline Offline
Edison Member
*
Karma: 23
Posts: 2487
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Most likely you are missing pulses, if 3 meters are independent devices, there is no way to avoid collisions, when 3 pulses arrive simultaneously. And even if they are not colliding, you are taking measurements in the loop consequently, so there is big chance you not  reading right port when pulse arrived, or not reading at all.
I don't think analogRead function is right choice for this, and what ever you able to discriminate is only due slowness of LDR, which in turn also wrong sensor, as it pointed above.
 Summing up:
- use phototransistor/photodiodes;
- digital inputs, amplifiers if cable introduces big capacitance;
- interruptions;
There are some examples from i-net returned by google:
http://openenergymonitor.org/emon/node/79
http://sandeen.net/wordpress/?p=227
http://www.airsensor.co.uk/component/zoo/item/energy-monitor.html

Logged

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 514
Posts: 31534
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
the pulse are very short (few millisecond) but the frequency is low ( pulses per minutes <100).
This is your problem, a photo resistor (note how it is spelled) is very slow at responding to short pulses, the low frequency does not help. You should use a photo transistor not a photo resistor.
Also it is on the end of a long cable which is not helping at all.
Logged

Pages: [1]   Go Up
Jump to: