Powering 5V DC motor encoder via digital pins

I have two low power DC motors, and they both have encoders. One is magnetic rotary encoder and the other one is proprietary (i.e. I'm not sure what's the type, it controls the motor through its own board). They both require 5V VCC to operate.

I'm using Arduino Uno board with accompanying Motor Shield, both R3. They are powered by 9V power supply via DC jack. I have both motors connected to the main power outlets A and B. Now I'm thinking about powering up the encoders.

I plan to supply one encoder from the 5V/Gnd pins (located next to analog pins). For the other one I was thinking about setting a digital pin to 255. When I try this (without connecting the encoder) on, say, pin D5 I can measure 5V between D5 and digital Gnd pins. Would this cause any issues for the encoder or the boards?

Alternatively, I found a thread on this forum discussing that IOREF is also connected to 5V power source. I checked that too and multi-meter indeed shows 5V. Would this also work?

Or if you have any other proposal on what is the best way to supply both encoders, I'd appreciate the advice. Thanks.

krlesxe:
Alternatively, I found a thread on this forum discussing that IOREF is also connected to 5V power source. I checked that too and multi-meter indeed shows 5V. Would this also work?

IOREF and 5V are indeed connected internally on the board and are therefore the same point electrically. The big question is, how much current do the encoders draw? Hook up your meter and measure to be sure.

If I'm reading the data sheets of one of the encoders correctly, average operating current is 4mA, and permissible maximum 20mA. Do you perhaps know what is the limit for Arduino's connections?

The other encoder is fairly similar.

The rule-of-thumb value for an I/O pin is 20ma max. with 40ma absolute max. The total for the controller is 200ma through GND/Vcc pins.

A copy of the datasheet is a handy thing to have.

krlesxe:
I plan to supply one encoder from the 5V/Gnd pins (located next to analog pins). For the other one I was thinking about setting a digital pin to 255. When I try this (without connecting the encoder) on, say, pin D5 I can measure 5V between D5 and digital Gnd pins. Would this cause any issues for the encoder or the boards?

Possibly, best to power it from 5V directly. BTW digital pins are set to HIGH or LOW, not 255!

Yes, you are correct - my bad. Too many thought/type contractions. What I meant is to set the pin to HIGH and the PWM value to 255, then measure the voltage with meter before connecting the encoder.