JavaLaurence Posted February 24, 2013 at 06:23 PM Posted February 24, 2013 at 06:23 PM 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! Quote
CD108 Posted February 25, 2013 at 04:03 PM Posted February 25, 2013 at 04:03 PM 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 Quote
raphael_vogel Posted February 25, 2013 at 05:00 PM Posted February 25, 2013 at 05:00 PM @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 Quote
raphael_vogel Posted February 25, 2013 at 07:49 PM Posted February 25, 2013 at 07:49 PM I think I found something if you plan to use digital IO pins for measuring analog values (e.g. comming from an LDR). Some cheap AD converter. http://letsmakerobots.com/node/13843 Quote
JavaLaurence Posted February 25, 2013 at 09:13 PM Author Posted February 25, 2013 at 09:13 PM 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 ! Quote
CD108 Posted February 28, 2013 at 09:55 AM Posted February 28, 2013 at 09:55 AM @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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.