Optical encoder not returning values

Our optical encoder is only returning 0.
We would like an example source code for getting the number of rotations.
Also the LEDs inside do not light up…should they be?
We have it connected to the Digital I/O of the digital side car.

Just for a test, I connected a USdigital quad encoder to the crio using the included example encoder code and it worked great. Does that help? OK some LEDs are infrared so you wouldn’t see anything but if you have connected 5V before and seen the led light… then of course the answer is yes. The USdigital encoder light is encased so I don’t see light from mine.

Steve

There is an example here:

C:\Program Files\National Instruments\LabVIEW 8.5\examples\FRC\Digital\Encoder Example

Make sure you have it wired correctly.

If you want to see if an IR LED is lighting up, look at it with a digital camera

Have you wired it correctly? There should be a +5, A, G, and B on the encoder.
PWM 1 - black to G, red to +5, white to A
PWM 2 - black to G, red to +5, white to B

The second PWM cable doesn’t really need the ground and power connected. Since you didn’t provide enough information, are you sure you connected both the A and B channels and selected the right ones in LabView? (are you using LabView or C++?)

If you dont see a red light stop altering your code, the sensor is wired incorrectly or it is broken, we have 5 on our robot so i know there is supposed to be a visible red light inside (with the top off of course)

Quick question for anyone. I just got back to the team and saw that they incorrectly hooked the encoders to the Analog I/O and not digital. I believe that the encoder were over-voltaged. They seem to have failed high, lights illuminates, but no pulse on the O-scope. Anyone have any luck with Overvoltage and still operational?

Both the Analog breakout and Digital Sidecar provide 5V on their power pins so connecting the encoder to the wrong board should not cause a problem.

I believe we do have it wired correctly, as it matches what you state above (we don’t use the ground and power on the second PWM cable). Originally we connected it to the analog i/o but then realized it needed to connect to the digital i/o.

We are using C++ and have test code like the following, just to verify the encoder is working correctly:

     Encoder encoder(1, 2, true); 
     while (1) {  
         count = encoder.Get();
         cout << count;
      }

We then rotate the middle of the encoder, but the count stays at 0. How should we be using the Encoder class to read values from the encoder?

While I’m not sure it’s completely necessary, when I last used them in C++, I called encoder.Start() before I started trying to read anything.

Wow, long day at work and robotics. Looks like I didn’t practice what I preach and read the manual. I saw the 10V stamp on the module and didn’t think about the bumper having it’s own power supply. Thanks for the catch, and that’s one de-merit for me…now I just need to find out what is actually wrong with it…

Wow, long day at work and robotics. Looks like I didn’t practice what I preach and read the manual. I saw the 10V stamp on the module and didn’t think about the bumper having it’s own power supply. Thanks for the catch, and that’s one de-merit for me…now I just need to find out what is actually wrong with it…

Just reminders you probably already know…
Make sure the encoded wheel is 1 un-scratched, and 2 installed to the proper height with the included placement wheel also it will not work without the cover on tightly.