Encoder Interface with Pololu VNH5019

I’m new at this, so sorry if this is a stupid question but I can’t get the encoder to print the right RPM. I’m using a Pololu Dual VNH5019 Motor Shield with a single 4.4:1 12V 37D Motor with an encoder.

The RPM only prints a nonzero value at the beginning and then never again. My code and a picture of the wiring is attached.

microgravity.ino (2.0 KB)

Any help/thoughts would be greatly appreciated!

Hello.

It looks like you are powering the encoders from the 3.3V pin on your Arduino. Please note that those encoders have a minimum operating voltage of 3.5V. Assuming your Arduino board is 5V-tolerant, can you try moving your blue wire to the neighboring 5V pin instead and see if that makes any difference?

I did not notice any obvious problems in your program, so if that does not work, you might try checking your solder joints. It is hard to tell from your pictures, but from the side-view picture, it looks like you might not have good wetting on all of the pads. For reference, you can find some good examples in Adafruit’s Guide to Excellent Soldering.

Brandon

Thanks so much for your response! I will power the encoder with the 5V pin and check all the soldering joints. Also I have a quick question: I know some of the pins on the Arduino are being used by the shield and there is a way to remap the connections so some pins can be used for other purposes. I was wondering, can you plug wires into the top pinholes and expected them to be read in the same way as if they were plugged directly into the corresponding pins on the Arduino? For example, I want to use two interrupt pins for each of the encoders/motors on the shield. These are pins 2 and 3, the only interrupt pins on the Arduino Uno. Can I plug in the encoder wire into pins 2 and 3 on the VNH5019 shield (if I reroute pin 2) and expect this information to be read by the Arduino?

Thanks so much!

Hello.

Yes, the headers can act as pass-through connections to the Arduino (as long as the shield isn’t using them for something else). However, instead of remapping pin 2, you could use pin change interrupts for your encoders so you can use any free pin on the Arduino UNO.

Brandon

Thanks for your reply! I looked into pin change interrupts and this seems to be exactly what I need. As for powering the encoder with the 5V from the Arduino, is there any way to power both encoders with 5V from the arduino with the shield mounted on top? I don’t see any more 5V ports on the headers.

You could make your own “Y” wire that splits the VDD pin on the shield (i.e. the 5V pin on the Arduino) into two for your encoders.

Alternatively, that VDD pin is also broken out on the other edge of the shield. So, you could connect one encoder to each VDD pin on the shield. You can see where the VDD pins are located from this picture from the Shield Connections section of the VNH5019 shield’s user’s guide.

Brandon