Grove - I2C Motor Driver - information and source code

First: Thanks for responding

Second: I wish this forum would show hyperlinks better. I didn’t see that you had one in your response and was going to ask where the firmware was!

On how to connect encoders: I hadn’t realized there weren’t enough inputs available. So that would be a real problem!

Hi all,

I’m also having trouble getting this board up and running. When I connect power all 4 direction and the power led go on. Doesn’t matter whether I2C is connected or not. Any ideas? How to check whether it’s a DOA?

Also, my board has v1.0 printed on the back. Does that mean it’s an outdated version?

And lastly, anyone got stepper motor code for it? That’s what I bought it for but the sample code is only for DC motors.

I’m trying to operate it from an Arduino Uno with several other devices on the I2C bus.

Thanks for any help, Dieter

Ok scrap the all-leds on issue… I was being stupid mixing up 5 and 3.3V VCC…

All help on the other questions still very welcome though!

Looks like an outdated board indeed, it doesn’t have the address dipswitch… Any know if other things have changed as well?

Apart from that, I was able to run the DC motor sample code successfully. I’m now trying to integrate it with my main application which involves other devices on the bus (ADXL345, MPR121). Now all power and direction led’s light again and the board doesn’t respond. Is this a signal for a certain error state that can help me debugging?

Still would like stepper motor action instead of DC, too.

I’ll just keep logging my progress here. Perhaps it’ll help someone at some point…

Turns out my older version board has address 0x28 instead of the current one’s 0x0f.

Looks like my board is the same as the one in the link posted earlier in this thread: salviusrobot.blogspot.nl/2012/03/grove-i2c-motor-driver-setup-and.html (forum doesn’t let me post links)

I found a basic stepper library for the Grove/Twig I2C driver here: github.com/mariolukas/TwigMotor-Library
Mind you, serial addresses are set for the older version boards. Change them for newer versions.
The code is also pre-arduino-1.0. I’ve patched 2 files in the repository for 1.0+ compatibility.

Actually the stepper mode is really not complicated, just badly documented in the wiki. What you need to do is set the ‘channel set’ / ‘direction set’ registry alternatingly for your motor’s 2/4/6/8 steps.

When I got TwigMotor working I started merging its I2C functionality with the AccelStepper library: open.com.au/mikem/arduino/Ac … index.html
It’s a great arduino stepper library with non-blocking code, acceleration/deceleration, etc.
I now have an alpha version of AccelStepper with an additional mode for I2C control of the Grove board (and potentially other I2C stepper drivers). I’ll publish it once it’s cleaned and tested.

  1. Maybe (this picture) will help you
  2. Usually stepper motor is driven by constant current, not voltage. But this board doesn’t allow you to measure the current.
  3. I think it would be better to implement all logic inside the board. I have posted the message about alternative open-source firmware. Please, consider implementing stepper-motor mode in this firmware.

Thanks for chiming in!

I’m not sure what the implications of #2 are. Can you elaborate? Is there going to be issues because of it?
The TwigStepper library sets PWM to 255 before doing the channel switching. Is that related?

As for #3, I don’t have a programmer to upload firmware to my board…

I have some experience in making driver for 12W stepper motors for CNC router.
The classical scheme is the following:

L298 is used with L297, which implements all logic, and controls the current. To control the drive current It compares voltage at SEN1/SEN2 with voltage at VREF.

My stepper motor works at 1.5A. It have resistance about 2 Ohms. So, if you want to run it at constant voltage, maximum voltage is 3V. It is unreal!
If you control the current, you can run it at any input voltage.

I don’t know anything about small stepper motors, maybe there are motors, which can be run at constant voltage 5V or 12V.

L298 have inputs to connect current-sense resistors, but I have never seen an I2C board with this resistors.

I have this motor: sparkfun.com/products/9238

I’ve ran it for a couple of hours and it seemed fine, though it got quite hot. I’m not sure if that’s ok as it’s my first time working with steppers.

Yes, I think you can run this motor without any current-sense.