Grove i2c motor driver with GrovePi

The GrovePi motor driver should not be supplying the 5V to the Pi. You should have a separate power supply for the Pi and the motor driver.

I am not sure that you might have a defective unit with you. You should try out a few more things before deciding to get it replaced.

What kind of power supply are you using to power the whole setup.

-Karan

Thanks for getting back to me so quickly Karen.

I have 4 AA batteries going to the driver and the Raspberry pi is plugged into the wall socket.

I do admit I found these batteries in a drawer and I am not sure how much power is left in them

However when I put all the batteries in the driver lights up.

Could weak batteries be the issue?

I checked the schematics for the motor driver and the batteries are indeed supplying the power to the whole motor driver even for the comms. The regulator used is a 7508 and has a big dropout so you should use good batteries and at least 6 batteries.

The motor driver also uses an Atmega8 for interpreting the commands, so you can even rewrite the code on that if you want later if you feel like adding some features or making it easier to use.

-Karan

thanks karen, ill buy a 6 battery case today and new batteries and test it out, then let you know.

I will have to learn about the Atmega8, but I would be up for adding said features to my library

it seems there was a need for a python library for this driver. So hoping I can get this working and provide the community with the library i create/translate.

Do let us know how the driver work with a 6 battery pack.

Atmega8 is similar to the Atmega328 which is used with Arduino so you should be able to write the code for it in the Arduino IDE itself if you ever want to.

It would be great if you are able to get the driver for the motor controller working with the GrovePi. We would be glad to merge it with the GrovePi repository so that others can use it too.

-Karan

I added 2 aa batteries to the mix and the result is the same. I noticed now that the raspberry pi can be powered by the ic2 input alone. Is this normal/safe?

So my current setup is

8AAs(9v)–Motor Driver --Grove Pi I2C1 port – Raspberry Pi

entering i2cdetect shows my Grove at address 0x04 and my driver at 0x0f. After hitting the command again both addresses are gone. (showing --)

as well as running my code gives an input/output error when trying to read/write

Sorry to flood this thread,
just tried to remove the J4 jumper so no power would go to the raspberry

same result.
I am leaning towards the fact that the board I have is bad.

It would be better to power the GrovePi separately and not use the motor controller to back power it.

I am not sure what the problem is exactly. Can you try to measure the voltage on the 9V line and the 5V line to see what it says. Also, do you have and Arduino and a Grove Arduino shield to check if the board works with Arduino. That might be a better test to find if the Shield works or not.

-Karan

I have an Arduino,
plugged it directly to the Arduino and the driver worked.

Then I pluged the driver directly to the raspberry pi and it failed.

I had my friend bring over his raspberry pi to test and see if it was an error with my pi.

Same results with his raspberry pi. i/o error.

Also tested the connection with the meter. I see what you were talking about with the drop off, huge drop off of volts from the chip to the motors.

However the Arduino recieved volts coming in and volts to the motors, neither of the pis did.

any reason this driver would not function with the raspberry pi?

Hey Exadon and Karan, I’m coming late to the party here. Sorry about that. I have a few quick questions, and thoughts.

It sounds like the I2C is getting hung up on the driver. It seems like you ping it once, and the device freezes up.

First, since there’s an Atmega8 on the driver, I wonder if there’s a software error, or hardware error. Have we doubled back and seen if there are any comments on the Seeed site about this? I’m just curious.

Also, because we have multiple devices on the line, with multiple pullups, we might also be pulling the I2C lines high (or they’re getting stuck high). Exadon, do you feel adventurous enough to pull the pullup resistors off the sensor and see if affectss things? I’m leaning even more strongly to this because the behavior when you remove the sensor; it seems to work, and the line seems to be released.

Sorry for the late reply. I let my nephew have the board for his Arduino. I am feeling adventgerious enough though that I will give this a shot.

Also will check the comments to see if I missed anything (from seeeds site)

Hey Exadon,
No problems, you have laid a good foundation for someone else who comes looking for the code for the motor driver and this should be a good starting point for others in the future.

Do let us know if you get a chance in the future to test the driver more.

-Karan

Just got the board back.

I’m leaning even more strongly to this because the behavior when you remove the sensor; it seems to work, and the line seems to be released.

I am new to the hardware side of things.

enough to pull the pullup resistors off the sensor

Can you show me where this resistor is on the board? I believe this is the one I have (Link to the product page)

Hey Exadon,
I just checked the eagle design files for the Motor controller and it does not look like that it has pullups at all on the motor controller. This can or cannot be a problem and the only to way to check that would be with a logic analyzer. There are two things that you should try: 1) try connecting that motor controller to the GrovePi with the shortest cable that you have and 2) try connecting the motor shield directly to the raspberry pi on the I2C pins, VCCC and GND to see if that helps.

-Karan

Hi all,
I have same problem. Do you solve the problem?

Sadly I was never able to get it to work. Even when connecting the driver directly to the PI.

Has anyone ever gotten this to work?

I have exactly the same problem (IOErrors and I2C bus fail after i2cdetect command) with my setup (motor driver 1.3, GrovePi+, Pi B), with and without external power supply.

Hi @ErPi,

We haven’t tried the motor controller again and other users had problems, even when connecting it to the Pi. Can you try the example that we have here and tell us how it goes. Please do read the notes given in the comment section of the program. It is pretty sensitive to errors and commands sent to it, can get stuck.

-Shoban

Hi @Shoban,

Thanks for the quick response.

I have tested it with the example script and, after many failed attempts, managed to get it to work. It is indeed very sensitive and the only reasonably certain way to get my motor to spin is when I reboot the PI, run “avrdude -c gpio -p m328p” to reset the GrovePi and then reset the driver board by pressing its reset button. Make sure NOT to run any i2cdetect commands at any time. If you do, you will have to start all over again.
If you then run the example script it will probably fail with the dreaded IOError nr. 5. If you run it again after a few seconds, it will work correctly and your motor will start to spin. From then on it appears to continue to work fine. Well at least a dozen times or so. Haven’t done more extensive testing.
So it looks like the i2c bus needs a little while to initialize after a clean start or maybe it does so after a failed first attempt to address it.

Not an ideal situation but at least I can continue my project. :slight_smile:

Cheers,

Erwin

Hey @ErPi,
We had seen pretty similar behavior when we had tried it and were and there was not a lot we could do because the firmware on the motor driver was not available to hack around and test. It looks like Seeed has just released that firmware and the next time we are working on the motor driver, we see if there is a way to make it more stable. Not ETA on this though.