PDA

View Full Version : Using +5V from analog input with 3rd party sensor



shobley
02-15-2007, 11:24 AM
Hi,

I bought some robotic wheel encoders that are not Phidgets. They are quad encoders and have Gnd, +5V, A and B connections.
http://www.roboticsconnection.com/pc-60-4-quadrature-encoder-combo.aspx

I'm hoping to "borrow" +5v from one of the analog inputs on the 8/8/8 board and then connect the ground and signal to the digital inputs/gnd on the other edge of the board.

My question is should I tie off the analog input to Gnd, or leave it unconnected?

Thanks,
Steve

(I appreciate that this invalidates a whole bunch of stuff, but I'd really like to know the right way to do this)

Dave
02-15-2007, 11:33 AM
Your idea makes sense, but the inputs on the 8/8/8 only sample 125 times per second, which isn't enough to handle the high frequencies your encoders will generate. You're going to need something like the High-Speed Encoder Phidget:

http://www.trossenrobotics.com/store/p/3236-Phidget-Encoder-High-Speed.aspx

This cranks up your sample rate from 125 Hz to 500 kHz, and it connects directly to the computer via USB.

edit: Although it isn't pictured, the encoder board comes with a connector with leads so you can easily hook up the four leads from your encoder.

shobley
02-15-2007, 01:09 PM
Hmmm....

That's really interesting - now can I use a A/B on the encoder for A on wheel one and A and wheel two...

If you see what I mean.

Since the computer controls the direction of the wheels I'm not really using the A/B on the sensor.

I really don't want to have to hook up 2 extra USB devices if I can help it.

Steve

Dave
02-15-2007, 02:26 PM
That would be nice, but the encoder board just sends one value back to the computer. There's no way to separate the channels.

shobley
02-15-2007, 02:51 PM
So just before I order these - how do they work?

I don't think that the USB interface can send back 500,000 signals a second, so I'm assuming that the encoders do all the fast work and send back a rotation speed value?

(or something like that)

Steve

Dave
02-15-2007, 03:05 PM
The Phidget keeps a running count and periodically sends the total to the computer.

[edit] Disclaimer: This is just what I've infered by using software that interacts with the encoder. I am not a programmer and I did not design this device.

shobley
02-16-2007, 08:02 AM
Hmmmm...

Now this has got me thinking - can you set board to send the count in an event to the host application? At a precise time?

It must be something like that - because at 500KHz there's no way windows messaging loop could get accurate results by polling the board.

(I bought them by the way! - but i think they must be stuck in the snow)

Dave
02-16-2007, 10:42 AM
Here's what the COM API Manual (http://www.phidgets.com/documentation/COM_API_Manual_Phidget21.pdf) has to say about the Phidget Encoder:


Property: EncoderPosition() as Long
Access: Get, Put By Value
Description: Returns / Sets the position of the encoder shaft. An incremental encoder will increment or decrement this property based on the direction of rotation.

Property: NumInputs as Long
Access: Get By Value
Description: The number of inputs on this particular I/O device. Please see the hardware descriptions for the details of device variations.

Property: NumEncoders() as Long
Access: Get By Value
Description: Returns the number of encoders supported by this device.

Property: InputState(Index as Long) as Boolean
Access: Get By Value
Description: Returns the state of the designated input. In the case of a switch or button which is
normally open, True would correspond to when the switch is pressed.

Event: OnPositionChange(Index as Long, Time as Long, EncoderDisplacement as Long)
Description: Occurs when the encoder shaft is rotated. EncoderDisplacement indicates the change since the last OnPositionChange event was fired, and may be positive (clockwise) or negative. Time is an estimate, in milliseconds, of the time since the last event was fired.
EncoderDisplacement and Time may be used to calculate a rough estimate of velocity.

Event: OnInputChange(Index as Long, NewState as Boolean)
Description: This event is triggered when the input's state is changed. The number of the particular input is returned, as well as the state of the input: True is On, False is Off. In the case of a switch (button) implementation, True would correspond to when the switch is pressed.
I'm primarily a hardware geek. High-level programming is largely a mystery to me, so I'll let the manual speak for itself.