Grove I2C Motor driver support

I’m not sure what error you’re showing, but it’s not associated with the Test 06 module I attached, above.

  1. The file name states “grove_i2c_motor.py” which is not the name the file would be if you imported the TEST 06 module.
  2. The line numbers (lines 293 and 298) in your error traceback do not correspond to what is in the TEST06 module.
  3. Your error references the variable self.channel_setup, which is not found anywhere in the TEST 06 module.

at last i have tested the 1_0_07.py with the 1.0 board and it runs perfect, after adjusting the fastest rate ml/min
i can dispense the amount i want

Great. Two working entities. Lets call that a success.

@kyle I dont think his log relates to the 06, but there was a lot of errors still. Should be fixed in 07. Maybe you can commit this version

TEST 07 had the ability to operate in reverse removed. TEST 08 has similar fixes to 07 but with direction preserved: grove_motor_driver_v1_0_08.py (16.1 KB)

Beautiful. Will test.

Doesn’t work. Wont accept manual on off buttons because no amount is send. Maybe add some check to see if amount != None before setting CW / CCW

Good point. I actually had it set direction to CW by default, but later changed it. Here’s Test 09 to try.

grove_motor_driver_v1_0_09.py (16.2 KB)

You forgot the None check

if amount != None:
    if amount < 0:
        direction = "CCW"
        direction_reg = self.reg_write_run_ccw

Darn! Thanks. Does it work well after that change?

As far as I can tell

1 Like

Is your Output module the same as the one you posted on the old forum, or have you made any updates to it? I ask because I’m going to include it in the built-in set soon. Below is the slightly modified version I made from the one you posted on the old forum. Could you test it with your v1.3 board?

Hello, the grove motordriver Vers.07 does everything i want to do.
I have one issue, i cannot change the i2c adress of the Grove motordriver 1.0
every board is set to 0x14 , is there a chance to change the i2c adress or do i have to buy some 1.3 boards to get 4 pumps running

If you have a ardunio its fairly easy to change the address on all the grove devices. There is a sketch in the example folder when you install the library. Othervise you can run a small piece of python code directly via putty. Or even create and trigger a custom output module.

You can even run four motors of one board as long as you dont run them at the same time and doesnt require them to run in reverse. It would require a another custom module though.

2 Likes

hi jacobguldberg,
i have some arduinos, i have installed the grove motordriver library in arduino ide,
in the examples folder i find two examples , dc -motor or stepper motor, but i dont know how to change the i2c, can you give me some more detailed instructions how to do this are maybe you have a link ?

Sure, ill send you something

great, because i am new to this stuff

Can you post it here? It can be added as a Custom Action on the Output settings to change the I2C address from the web UI.

Taken from the TB6612 library. Btw. default address is 0x14, its just the board I tested on that is 0x13.

#define GROVE_MOTOR_DRIVER_I2C_CMD_SET_ADDR         0x11

void MotorDriver::setI2cAddr(uint8_t new_addr) {
    if (new_addr == 0x00) {
        return;
    } else if (new_addr >= 0x80) {
        return;
    }
    I2Cdev::writeByte(old_addr, GROVE_MOTOR_DRIVER_I2C_CMD_SET_ADDR, new_addr);
    delay(100);
}
1 Like

mhh, sorry i am noob
what should i do with this piece of code, where should i put it in ?
The library contains a lot of files …which one is the right one ?

Thanks. I’ll port to Python and incorporate into the v1.0 built-in Output module.

1 Like