-
• #2
Hi - yes, sorry - I need to update the documentation on that. Have a look here
As well as a great photoshop it gives some good information on using it with Espruino (just connect to 3.3v rather than 5v)...
-
• #3
Hi, Girdon
I have connected the tcrt5000 with espruino and use the pin c1 but the return value is just same.Var light = analogRead C1); SetInterval (function (){ console.log (light); }, 500);
Is this code correct?
-
• #4
You need to call analogRead each time, so:
var lightPin = C1; setInterval(function() { console.log (analogRead(lightPin)); }, 500);
Also, Espruino is case-sensitive, so you need to use capital and non-capital letters in the right places...
-
• #5
Take a look at Photomicrosensor (Transmissive) - Omron EE-SJ5 conversation.
The difference is 'reflect' vs. 'not interrupt'. the Photomicrosensor (Transmissive) - Omron EE-SJ5 has the receiving phototransistor opposite of the infrared emitting diode. Something (blocking) in between stops the phototransistor from 'conducting' / to switch off, where - in your case - something reflecting will make it to conduct / to switch on.
Using the analog read is a good idea to measure the amount of reflection... most phototransistors have though a more switching behavior than (linear) amplifying one. I used the analog read to figure out what is going on, because I had some strange behavior with a material I expected to block the infrared light. The material looked very blocking to my naked eye, but it was not blockin infrared. Weird... that's all what I can say, since did not do more research on that particular material.
As @Gordon mentioned - with the digital ready, you could eliminate the external resistor that I use in my circuitry:
pinMode(pin,"input_pulldown");
. Unfortunately, with the analog read, internal pull up/down is not possible. So you need an external resistor.To drive the infrared LED, you still need an external resistor to limit the current (and give the LED a life) - if the LED has not a built-in resistor.
-
• #6
Jack, on a hardware level, you need to ensure that you’ll be getting a fixed signal with no fluctuations in its analog values, you can do that by using an oscilloscope. Once you start writing your program, you can use ADC averaging or a moving average filter to get best possible results from your optical sensor. I’m planning to use this sensor in one of my circuits as well and I’m going to be waiting for your feedback.
-
• #7
Are you working with the bare component, or with one of the boards available?
There are boards available with a little pot on them and some other electronics - those contain a comparator. They seem to usually have 4 pins - power, ground, an analog out (probably raw output), and a digital out (output of the comparator, the trip point of which is set by the pot)
Hi, all
may I know how to use the Tcrt-5000 with espruino?
The link on the website is just intro the sensor?
Can anyone provide some idea and example.
Thanks.
http://www.espruino.com/InfraredProximity