Wednesday, November 21, 2012

Water meter counter

The goal

Calculation of water used in your home.

Usability

Can be a part of "intelligent house" project.

Code


Hardware


Media

 Water meter counter

 CNY70 + ADC test

Description

My water meter has no pulse output, so I used a reflective optical sensor (CNY70), to fetch data from it. CNY70 can detect difference between colors, so I used it to detect color changes on meter shield.

On CNY70 + ADC test movie, you can see, that my when I put it to my finger, ADC returns 100, but piece of white paper can better reflect the light, so returns smaller values (from 8 to 25).

Water meter 


My meter has 2 moving shields. First one  (bigger) rotates with frequency one round per liter, the second one (much smaller) is like 10..15x faster. Of course I'd like to read from the smaller, but it was not possible. To see the move of the smaller one is difficult, and CNY70 has trouble to read it properly.


Difference between big and small shield.
Sorry I don't have a better picture.

As you can see, smaller shield can be seen only by part. And the difference between dark and bright is small. 

On the smaller one, difference was about 2-3 points (full range from white to black is about 247 points), so there was inaccuracies when it was moving. When you add possibility of displacement of CNY70, and other noise, it comes out that the bigger shield is a better option, it has a big black spot, witch is very recognizable.

CNY70 attached to water meter over bigger shield

At this point accuracy is 1 Liter, I'm not satisfied and I will be searching some other way to get impulses from the smaller shield, maybe smaller optical sensor or better algorithm.

I fix this when I will have some more time, because when I want to reprogram atmega8 I must bring whole device to my PC and it's a big waste of time.

Device

To process output from CNY70 i build a ADC and two (red/blue) 4-digit led displays on atmega8 which is measuring and analysing voltage from sensor.
Voltage is represented as 8-bit number by ADC, and then processed as ordinary number value from 0 to 255. All this processing is made by atmega8, program is written in C++.



No comments:

Post a Comment