And I’m looking at setting it up. I understand it has to be close to the wheel but I’m having trouble making it work. In fact, the only way I can get the value to change from a 1 to a 0 is shining a flashlight into it.
So I’m just wondering.
Is there anything I can do to improve this sensors operation?
Can I just buy something else that would work better? I’m willing to pay overnight shipping at this point if it means getting something that would work.
I’m not looking to measure ball speed, but rather the shooting wheel speed. If we simply measure the ball speed then we can’t really proactively adjust the wheel speed.
So to answer your question, yes the sensor is within .2in of the flywheel.
How are you actually getting a reading out of this sensor? Do you have any resistors connected to it? Do you have power applied to it? Are you reading the analog voltage or just taking it as a digital input? Is it connecte directly to your robot controller or are you using some other way of telling when it gives you a 1 or a 0?
The way this sensor works is:
There is an emitter (E) side: an infrared (IR) LED that emits light when current is applied.
There is a receiver or sensor side (S): it is a photo-transistor. It will basically turn on and allow current to flow through it if it sees IR light, and turn off if not.
The idea es that the sensor sees the light that comes out of the emitter and reflects off a ‘reflecting’ surface (like a white piece of paper). And when there is nothing to reflect from, or a dark surface (like black tape on the piece of paper), then the sensor does not see it and turns off.
We’re using one of these and here is one way to hook it up:
Refering to the datasheet you linked, the leads are:
A: outer lead in the Emitter side
K: inner lead of the Emitter side
E: inner lead of the Sensor side
C: outer lead of the Sensor side.
Connect a 100 ohm resistor from lead A to a 5V supply (like the red wire in a pwm cable connected to a digital or analog input of the robot controller).
Connect lead K to ground (or the black wire in the pwm cable).
(this turns on the emitter)
Connect another 100 ohm resistor from lead E to ground.
Connect a 10 Kohm (10,000 ohm) resistor from lead C to a 5V supply.
The output signal from the sensor will be lead C. You can connect this to the white/yellow wire in a pwm cable.
The output signal shuld be ‘LOW’ when the sensor sees IR light reflected from a surface. And shuold be ‘HIGH’ when the sensor does not see light.
NOTE: This output from the sensor is ACTUALLY an analog output. It is possible, however, that the output levels of this analog signal are good enough that you can connect it to a digital input and get 1’s and 0’s. However, I would recommend that while testing, you connect it to an analog input and take a look at the values you are getting (if using MPLAB and the robot controller use printf to show the values on a terminal window). You should see the values get close to 0 when you bring a white sheet of paper close to the sensor (about .2in) and see the value go towards to 255 when you take the sheet of paper.
Let us know if this helps and if you have any other questions, feel free to post!