Product Documentation
Turn mode looks at the speed register to decide if the direction is forward or reverse. Then it applies a subtraction or addition of the
turn value on either motor.
so if the direction is forward
motor speed1 = speed - turn
motor speed2 = speed + turn
else the direction is reverse so
motor speed1 = speed + turn
motor speed2 = speed - turn
If the either motor is not able to achieve the required speed for the turn (beyond the maximum output), then the other motor is
automatically changed by the program to meet the required difference.
Encoder registers
Each motor has its encoder count stored in an array of four bytes, together the bytes form a signed 32 bit number, the encoder count
is captured on a read of the highest byte (registers 2, 6) and the subsequent lower bytes will be held until another read of the highest
byte takes place. The count is stored with the highest byte in the lowest numbered register. The registers can be zeroed at any time
by writing 32 (0x20) to the command register.
Battery volts
A reading of the voltage of the connected battery is available in this register. It reads as 10 times the voltage (121 for 12.1v).
Motor 1 and 2 current
A guide reading of the average current through the motor is available in this register. It reads approx ten times the number of Amps
(25 at 2.5A).
Software Revision number
This register contains the revision number of the software in the modules PIC16F873 controller - currently 1 at the time of writing.
Acceleration Rate
If you require a controlled acceleration period for the attached motors to reach there ultimate speed, the MD25 has a register to
provide this. It works by using a value into the acceleration register and incrementing the power by that value. Changing between
the current speed of the motors and the new speed (from speed 1 and 2 registers). So if the motors were traveling at full speed in the
forward direction (255) and were instructed to move at full speed in reverse (0), there would be 255 steps with an acceleration
register value of 1, but 128 for a value of 2. The default acceleration value is 5, meaning the speed is changed from full forward to
full reverse in 1.25 seconds. The register will accept values of 1 up to 10 which equates to a period of only 0.65 seconds to travel
from full speed in one direction to full speed in the opposite direction.
So to calculate the time (in seconds) for the acceleration to complete :
if new speed > current speed
steps = (new speed - current speed) / acceleration register
if new speed < current speed
steps = (current speed - new speed) / acceleration register
time = steps * 25ms
For example :
Acceleration
register
Time/step Current speed New speed Steps Acceleration time
1 25ms 0 255 255 6.375s
2 25ms 127 255 64 1.6s
3 25ms 80 0 27 0.675s
5 (default) 25ms 0 255 51 1.275s
10 25ms 255 0 26 0.65s
MD23 Technical Documentation http://www.robot-electronics.co.uk/htm/md25i2c.htm
2 of 3 2013-05-31 10:26