|
MD22 - Dual 24Volt 5Amp H Bridge Motor Drive
For this project, the excellent Devantech MD22 Motor Controller was used. This Controller is very versatile as it allows various control methods: via I2C bus, analogue (0...2.5...5V) and via R/C receiver or pulses lasting 1...1.5...2 ms. This last function allows 4 types of customization, illustrated in the following table.
RC Servo + Turn mode allows you to use one channel for forward/backwards and the other channel for left/right. The Timeout On mode is a safety mode, if the MD22 does not receive signals from the receiver for 200 ms it automatically turns off the motors, until it receives a new valid command on channel 1. You can experiment with the various modes up to to find the one best suited to your application. Attention: switching the switches must be done with the power supply deactivated. To supply the 5V to the MD22 module and the receiver, a simple regulator circuit can be built using a 7805 integrated circuit and some 10uf and 100uf electrolytic capacitors between input and ground and output and ground respectively, respecting the polarities. Or a switching regulator Art. 220 005 can be used. This regulator, in addition to being much more efficient, and therefore consuming less, has capacitors already integrated; Furthermore, it does not heat up and supports a higher current, so it can be used to provide regulated 5V energy to other services on the Robot.
Overview The MD22 is a robust low/medium power motor driver, designed to supply power for two motors. The main features are: MD22 Connections
The motor ground and the logic ground are internally connected to the module. Be sure to use cable rated for at least 10A for the battery, fuse and motor leads. Motor Noise Suppression Please note that using motors with the MD22 as with any other electronic device requires suppression of noise. This is easily achieved by the addition of a 10n snubbing capacitor across the motors. The capacitor should also be capable of handling a voltage of twice the drive voltage of the motor. Mode Switches The 4 mode switches set the operating mode of the MD22. They are read once only when the module is powered up. You cannot switch modes while the unit is on.
New modes from version 3(Dec 2004)
New modes from version 9(Mar 2006)
Analogue mode - 0v-2.5v-5v In this mode, the motors are controlled independently by two 0v to 5v analogue signals on the SCL (Motor1) and SDA (Motor2) lines. Analogue mode - 0v-2.5v-5v with differential drive Both motor's speed is now controlled by the analogue voltage level on the SCL line. The SDA line is now responsible for offsetting the two speeds and thus controlling the degree of turn. RC servo mode This mode allows direct connection to standard model radio control receivers. Most receivers work from a 4.8v-6v battery pack and can be powered by a 5v supply that powers the MD22 logic. The control pulses (Yellow) from the receiver should be connected to the SCL (Motor1) and SDA (Motor2) terminals. Connect the receiver supply (Red) to the +5v logic supply and the receiver 0v ground (Black) to the MD22 logic ground. The output from an RC receiver is a high pulse 1.5mS wide when the joystick is central. The MD22 provides full control in the range of 1mS to 2mS with 1.5mS being the centre-off position. There is a 7uS dead zone centred on 1.5mS for the off position. The Radio Transmitter centring control should be adjusted so that the motor is off when the joystick is released. RC servo mode with differential drive Again uses a standard radio control receiver module output to determine speed with the addition of the extremely useful steering function. The receiver's forward and reverse channels should be wired to the SCL connection and the steering (turn) through the SDA channel. Again fine adjustment to the transmitters offset may possibly be needed. RC modes with timeout feature (from version 3) An extra couple of modes have been added and operate in much the same way as the normal servo control. The difference is the addition of a new timeout feature. If the RC pulse is not detected on channel 1 (SCL) for a period over 200ms, then both of the motors will stop being driven until a valid RC signal is received on channel 1. I2C mode I2C mode allows the MD22 to be connected to popular controllers such as the PICAXE, OOPic and BS2p, and a wide range of micro-controllers like PIC's, AVR's, 8051's etc.
The mode register defaults to 0, as does the acceleration register (fastest acceleration). No motor will move until directly after speed or speed2/turn registers are changed. Mode Register The mode register selects which mode of operation and I2C data input type the user requires. The options are: 4, (new from version 9) Alternate method of turning (type 2), the turn value being able to introduce power to the system. 5, (New from version 9) Alternate method of turning (type 2), the turn value being able to introduce power to the system. Speed register Depending on what mode you are in, this register can affect the speed of one motor or both motors. If you are in mode 0 or 1 it will Set the speed of the motor 1. The larger the number written to this register, the more power is applied to the motor. If the mode is set to a turn mode it controls the speed and direction of both motors (subject to the effect of turn register). Speed2/Turn register Again when in mode 0 or 1 this register operates the same as speed but controls the operation of motor 2. When a turn mode is selected Speed2 becomes a turn register, and any value in speed 1 is combined with the contents of this register to steer the device. Turn mode (up to version 7) In software versions up to 7, the turn modes look at the speed channel or register to decide if the direction is forward or reverse. They then apply a subtraction or addition of the turn value on either motor. so if the direction is forward Turn mode ( version 8+ ) In turn mode 1 the power supplied to the motors is always with reference to the speed. Turn values are only applied with respect to the speed. The turn factor is determined by the equation below, where speed_max is a program constant equating to the maximum possible motor speed. And now the power to the motors can be calculated, remembering that a turn in either direction in a forward direction is the inverse in the reverse direction so: if we are moving forward and require a turn then If 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. Turn mode 2 ( version 9+ ) In turn mode 2 there is no link between the turn factor and the speed, this means when the speed is at zero you can still turn. With this method, the backward turns are inverted (left is right). The turn factor is now just : turn factor = turn And the power to the motor is now : motor speed1 = speed - turn factor If 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. Acceleration register (indirect motor control) If you require a controlled acceleration period for the attached motors to reach their ultimate speed, the MD22 has a register to provide this. It works by inputting a value into the acceleration register which acts as a delay in the power stepping. The amount of steps is the difference between the current speed of the motors and the new speed (from speed 1 and 2 registers). So if the motors were travelling at full speed in the forward direction (255) and were instructed to move at full speed in reverse (0), there would be 255 steps.
This register contains the revision number of the software in the module's PIC controller. Using the MD22 with popular controllers One of the easiest ways of connecting the MD22 to a standard controller, such as the BS2 Stamp, is to use RC Servo mode. Select normal (independent) or differential mode on the switches before powering the module. Now you can use the PULSOUT command to simulate the servo pulse and control the motors. The pulse needs to vary between 1mS (full reverse) to 2mS (full forwards) with 1.5mS being the centre-off position. Unlike servos, which require the pulse to be repeated every 20mS or so, the MD22 need only be sent a new pulse when you want to change speed. With no pulses being sent it simply continues at the current speed. The timing parameter will vary depending on the controller. Here are some popular examples - all tested by us.
* BS2p resolution is 0.8uS - rather than 0.75uS or 1.18uS as specified in earlier BS2p documentation. Parallax have confirmed this to us. Dec 2004 (from software version 3) Pulse time in RC mode is now verified to ensure it is within a specified time period of 800us to 2.2ms. Pulses outside of this timing will act to stop the motor. There is also the addition of an extra two RC servo modes which will stop the motors if a valid pulse is not received on channel 1 for a period of 200ms. Mar 2006 (from software version 9) The MD22 now includes two ways to implement the turn, the first uses the forward and backwards channels to control the power with channel two offsetting the power levels to turn. The second method allows channel two to introduce turns without any forward or backwards movement. MD22 schematics are md22sch1 and md22sch2
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
We offer the best and economical solutions, backed by 27+ years of experience and international standards knowledge, echnological changes, and industrial systems.