PiBorg Motor 12V 450RPM - 42mm

Forums:

Hello. I have bought 6 of "PiBorg Motor 12V 450RPM - 42mm". Can you tell me how i add encoders to this motors. What types? Links if possible?

Also is there any code writen for working with encoders for Thunderborg and/or Diablo?

Thank You

piborg's picture

There is a Python library available for reading encoder input on the GPIO pins: https://pypi.org/project/Encoder/
The read call should give you how many counts the motor has moved.

Positional control can be achieved by slowing the motor down as you get closer to the target count, stopping at the target value.

Speed control can be achieved by looking at the difference between count readings at a fixed time period, then adjusting the motor power up / down to aim towards your target.

If you are trying to measure wheel speed then you need an encoder that fits onto either:

  • The shaft of the motor - might be difficult with the shaft length as you still need to mount the hub / wheel as well
  • The hub connecting the wheel and shaft
  • The wheel itself

The options available will largely depend on how your robot is designed.

Quick side-note, the motors in question (P42UK12) are too powerful for the
ThunderBorg. They can draw up to 12A in some cases, ThunderBorg is designed for
5A or less.

Thank you for your quick reply. I have connected the motors to the Diablo.
Question: What do you mean with "Depends on how the robot is designed"???

Attached please find a foto of my current setup...

Any suggestions?

Thank You

Images: 
piborg's picture

What I mean is that there are a few ways to mount encoders, not all of which are possible for any given robot design.

The general options are:

  1. Fitting an encoder to the motor output shaft
    This would be ideal, but may be difficult to find one small enough to fit comfortably in the available space within the wheel.

  2. Fitting it to a motor shaft on the back of the motor
    Not possible with these motors.

  3. Connected to the outside of the wheel
    Not possible here without adding extra parts to extend the chassis past the wheels.

  4. Connected to a small roller / wheel that sits against the wheel to measure
    This could work well as the wheel positions are fixed.

  5. Markings on the wheel which are detected by sensors
    Could be done, but can be a pain to setup and get working correctly

  6. Magnets on the wheel picked up by sensors
    Requires more skill, the mounting of both the magnets and sensors can be tricky to get right.

Option 1 would be best, but I think you might struggle to find an encoder small enough to fit on the motor shaft at the same time as the hub connecting the wheel.

Option 4 could be a good way to go. This can be done cheaply by salvaging scroll wheels from old computer mice since the scroll wheel has its own encoder built in already. There is a post from il diavolo showing their DiddyBorg setup that uses this method: My DiddyBorg pictures

Subscribe to Comments for "PiBorg Motor 12V 450RPM - 42mm"