This Grove - MIni I2C motor driver included two DRV8830, The DRV8830 provides an integrated motor driver solution for battery-powered toys, printers, and other low-voltage or battery-powered motion control applications. The module has two H-bridge drivers, and can drive two DC motors or two winding of stepper motors, as well as other loads like solenoids.It requires an onboard 5V voltage regulator which can power the I2C bus. All driver lines are diode protected from back EMF.I t features two LEDs for fault indicator and four LEDs to indicate which direction each motor is running. GROVE system plug and I2C interface enables you to daisy-chain the driver with many other devices.
Features
- Small driver board
- Two motor driver channels
- Working Voltage : 2.75v – 6.8v
- Changeable max limitation current for each channel
- Grove compatible
- I2C interface
Downloads
- Raspberry Pi Python Mini i2C Motor Driver
- Raspberry Pi Python Stepper Motor Driver for the Mini I2C Motor Driver
- Arduino Code
Specification
Item |
Min |
Typical |
Max |
Unit |
Working Voltage |
2.75 |
5 |
6.8 |
VDC |
Max Output Current per channel |
0.2(default) |
- |
1 |
A |
Input/output voltage on I2C bus |
3.3/5 |
V |
||
Communication protocol |
I2C |
/ |
||
Default I2C Address |
0xC0, 0xC4 |
/ |
Indicators
- CH1 fault indicator - Channel 1 fault indicator.
- CH2 fault indicator - Channel 2 fault indicator.
- Direction indicator - Motor direction indicator.
- CH1 Output Connector - Motor 1 connector.
- CH2 Output Connector - Motor 2 connector.
Change Default maximum drive current
The default maximum drive current of each channel is 200mA.
Each channel (CH1,CH2) has a control resistor, and each value of the control resistor (R5,R12) is 1 Ω, so the maximum drive current is 200mA according to the following equation:
Each channel also provides a reserved solderable pad (R6 for CH1, R13 for CH2), so you can solder a resistor onto the board to change the resistor value of each channel. Following is the new equation if adding resistor to the board:
Caution:
- The Maximum working current of each channel must be less than 1A. So the minimum value of resistor soldered to the reserved pad should not less than 0.2 Ω.
Default I2C Address
Arduino Code
The Grove - Mini I2C Motor Driver can control two motors and is based on the chip DRV8830. The DRV8830 is not just a dual motor driver, it is a dual H-bridge. An h-bridge is basically a specific setup of transistors that allow you to switch direction of current. You can use your Arduino to make them spin at any speed and in any direction. Because the module has 2 H-bridges, you can not only make a robot go forwards and backwards, but also turn around by having each wheel spin in a different direction.
This example code allows the Grove - Mini I2C Motor Driver to control two DC motors rotating in the positive or opposite direction.
You can find this software on the SparkFun MiniMoto board product page (which also uses a DRV8830).
/**************************************************************** Example code demonstrating the use of the Arduino Library for the Mini I2C Motor board, which uses the TI DRV8830 IC for I2C low-voltage DC motor control. ****************************************************************/ #include // Include the MiniMoto library // Create two MiniMoto instances, with different address settings. MiniMoto motor0(0xC4); // A1 = 1, A0 = clear MiniMoto motor1(0xC0); // A1 = 1, A0 = 1 (default) #define FAULTn 16 // Pin used for fault detection. // Nothing terribly special in the setup() function- prep the // serial port, print a little greeting, and set up our fault // pin as an input. void setup() { Serial.begin(9600); Serial.println("Hello, world!"); pinMode(FAULTn, INPUT); } // The loop() function just spins the motors one way, then the // other, while constantly monitoring for any fault conditions // to occur. If a fault does occur, it will be reported over // the serial port, and then operation continues. void loop() { Serial.println("Forward!"); motor0.drive(100); motor1.drive(100); delayUntil(1000); Serial.println("Stop!"); motor0.stop(); motor1.stop(); delay(1000); Serial.println("Reverse!"); motor0.drive(-100); motor1.drive(-100); delayUntil(1000); Serial.println("Brake!"); motor0.brake(); motor1.brake(); delay(1000); } // delayUntil() is a little function to run the motor either for // a designated time OR until a fault occurs. Note that this is // a very simple demonstration; ideally, an interrupt would be // used to service faults rather than blocking the application // during motion and polling for faults. void delayUntil(unsigned long elapsedTime) { // See the "BlinkWithoutDelay" example for more details on how // and why this loop works the way it does. unsigned long startTime = millis(); while (startTime + elapsedTime > millis()) { // If FAULTn goes low, a fault condition *may* exist. To be // sure, we'll need to check the FAULT bit. if (digitalRead(FAULTn) == LOW) { // We're going to check both motors; the logic is the same // for each... byte result = motor0.getFault(); // If result masked by FAULT is non-zero, we've got a fault // condition, and we should report it. if (result & FAULT) { Serial.print("Motor 0 fault: "); if (result & OCP) Serial.println("Chip overcurrent!"); if (result & ILIMIT) Serial.println("Load current limit!"); if (result & UVLO) Serial.println("Undervoltage!"); if (result & OTS) Serial.println("Over temp!"); break; // We want to break out of the motion immediately, // so we can stop motion in response to our fault. } result = motor1.getFault(); if (result & FAULT) { Serial.print("Motor 1 fault: "); if (result & OCP) Serial.println("Chip overcurrent!"); if (result & ILIMIT) Serial.println("Load current limit!"); if (result & UVLO) Serial.println("Undervoltage!"); if (result & OTS) Serial.println("Over temp!"); break; } } } }