pimoroni-pico: Inventor 2040 W, some examples don't work correctly?

I have an Inventor 2040 W with two micro metal gear motors plus encoders. Both are connected to the motor connectors with the required 6 wire cables.

read_encodes.py runs fine, and shows the correct rotation as I turn the wheels by hand.

reactive_encoder.py fails. If I turn the wheel clockwise it immediately starts turning on its own and won’t stop. Going counter clockwise works until I go past detent 11. Then it starts spinning counterclockwise and won’t stop.

driving_sequence.py turns both motors on and they just continuously run at 2.1 with no change in speed or direction.

LEFT = -2.212428, RIGHT = -2.211421, 
LEFT = -2.203851, RIGHT = -2.210657, 
LEFT = -2.20833, RIGHT = -2.197961, 
LEFT = -2.220342, RIGHT = -2.190321, 

The LED’s continue to cycle colors until I click stop.

If you’d like me to run another example just let me know. Something is broken with my setup? I don’t know if its hardware or software, but something is messed up somewhere. I get the same results with Pimoroni v1.21.0 and v1.22.2.

About this issue

  • Original URL
  • State: closed
  • Created 3 months ago
  • Comments: 17 (9 by maintainers)

Most upvoted comments

For 50:1 motors I’m using 5.4. This matches the top speed I got out of the motors when running motor_profiler.py. In your case you can set your speed scale to 2.2. Or if you want your speed to be in RPM, then divide this by 60 to give 0.0366rpm.

board = Inventor2040W(motor_gear_ratio=GEAR_RATIO)

enc_A = board.encoders[MOTOR_A]
enc_B = board.encoders[MOTOR_B]
A = board.motors[MOTOR_A]
B = board.motors[MOTOR_B]
A.speed_scale(SPEED_SCALE)
B.speed_scale(SPEED_SCALE)
A.direction(REVERSED_DIR)
enc_A.direction(NORMAL_DIR)
B.direction(NORMAL_DIR)
enc_B.direction(REVERSED_DIR)

Appears to get the driving_sequence.py to work. The wheels are going the way I want and the readings match the direction and speed. Near as i can tell anyway. Thankyou for replying to this issue.