Jump to content

Counting pulses via Analog In


JavaLaurence

Recommended Posts

I'd love to be able to track our water/gas/electricity usage via a mechanism similar to that developed by http://www.bwired.nl/How_rfxcom.asp

 

This chap hooked a plain, cheap sensor to a commercial pulse-counter. With my TF stack now living happily in our cellar, I'd like to try to hook up a Vishay CNY70 Optical Reflective Sensor to an Analog In bricklet and replicate the bwired design.

 

I've got no electronics experience, so am wondering whether this setup can work? Looking at the Analog In, I see that it has a single In line, and two 3.3/5V lines.. so I'm assuming I can just hook up the sensor with no additional electronics..? The rest would be down to the software.

 

Does anyone have experience of Analog In for pulse counting?

 

Thx!

Link zu diesem Kommentar
Share on other sites

Sure. I did this with a LDR and a few resistors on an arduino. With the TF hardware you could set a threshold value on the analogue bricklet and get the callback to increment a counter in your software. Should work the same way. Google the theory for setting up the resistors. You are essentially creating a light dependant potentiometer and then measuring the voltage changes.

 

It is of course better to use some electronics to create a voltage pulse that the digital i/o can process as this will be considerably cheaper

Link zu diesem Kommentar
Share on other sites

@CD108: I'm not very into electronics. So my questions:

When using the analogue in bricklet you should add a resistor in serial to the LDR as voltage divider? Is this correct or would it be enough to just use the LDR without any resistor?

 

Could you also elaborate what should be done when you want to use digital IO for such kind of sensors?

Thanks

Link zu diesem Kommentar
Share on other sites

I'm not looking at aggressively minimizing costs, my project is a one-off anyway. But I understand that using a IO-4 or IO-16 instead of numerous Analog In bricklets is a far superior approach, if only because it saves precious Bricklet connectors on the Masters (I've just got 3 unused connectors left on my 2-Master stack).

 

I'll have to get hold of the sensor, an IO-16 and an Analog In for good measure (pardon the pun)... and experiment.

 

Thx for the tips guys !

 

Link zu diesem Kommentar
Share on other sites

@Rafael

Here is a link to the basic theory

http://www.kpsec.freeuk.com/vdivider.htm

 

You are correct - it is a voltage divider that will move the voltage between the high & low voltages of the digital pin to create a pulse. I have also used this to detect the on/off status of various appliances using their power on LED.

Link zu diesem Kommentar
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gast
Reply to this topic...

×   Du hast formatierten Text eingefügt.   Formatierung jetzt entfernen

  Only 75 emoji are allowed.

×   Dein Link wurde automatisch eingebettet.   Einbetten rückgängig machen und als Link darstellen

×   Dein vorheriger Inhalt wurde wiederhergestellt.   Clear editor

×   Du kannst Bilder nicht direkt einfügen. Lade Bilder hoch oder lade sie von einer URL.

×
×
  • Neu erstellen...