Go Down

Topic: MD22 I2C motor driver + arduino uno (Read 1 time) previous topic - next topic

emreg


emreg

ah yes, i saw the mode register section. thank you.
i want to help on another issue.
- In datasheet page, what does "I2C mode" and "Mode Switches" section mean? what is it used for?

Denbo


I mean the other speed steps. How can i obtain any speed (not a full speed) without giving just 0 or 255 .  Should i give a number between 0 and 255 to get that speed.


One of the pages you posted has the answer to this  http://www.robot-electronics.co.uk/htm/md22tech.htm
If you look at that page and scroll down to the  section called Mode Register there seems to be different modes you can set.

The default mode 0 says the following: 

(Default Setting) If a value of 0 is written to the mode register then the meaning of the speed registers is literal speeds in the range of:
0 (Full Reverse) 
128 (Stop)   
255 (Full Forward).

So in this mode, I assume that 191, the number between 255 and 128, would give you half speed in one direction.



emreg

Thank you very much.
It was so helpful instruction.
two bytes are required in order to command speed for motor, however i couldnt understand the accelerating mechanism for motor.
I mean the other speed steps. How can i obtain any speed (not a full speed) without giving just 0 or 255 .
Should i give a number between 0 and 255 to get that speed. Otherside, how can i be sure that i got the specified speed for example 200 rpm?

In pwm method, we send numerous duty cycles, but in I2C we are commanding only a cycle ( just a byte) in order to move the motor?




Denbo

#2
Feb 07, 2013, 11:29 pm Last Edit: Feb 07, 2013, 11:30 pm by Denbo Reason: 1
When an Arduino talks to an MD22 to drive a motor it doesn't send PWM and direction signals like most motor shields/controllers do.

The MD22 has a chip on it that is talking to the Arduino using I2C.  I2C is a two wire communication protocol.   In I2C, each device connected to the Arduino has an address which is what you need to communicate with it.  In this case, the I2C address for the MD22 is defined as  MD22ADDRESS(0x58).  

When you write to the driver to control the motors you send two bytes, the motor and the speed. It appears that setting a speed of 128 stops the motors, 255 makes it go the maximum speed in one direction, and 0 makes it go the maximum speed in the other direction.  

The two motors are defined as MOTOR1(0x01) and MOTOR2(0x02).

PWM does happen but it is happening between the motors and a chip on the MD22.  The Arduino just sends this chip commands to send the appropriate PWM signals to the motors.

Not sure this answered what you wanted.

Go Up