A stepper motor, I2C bus and a Raspberry Pi

Thread Starter


Joined Nov 7, 2015
Our task is to make a robot that can move through a maze, and i am specifically in charge of the wheels and their code. The machine should be able to drive on its own, but we are ofcourse sending single commands to it from a terminal until we make it work. All 4 of us are IT students and electronics is neither our strongsuit, nor is it really within the scope of our assignment that this headache should befall us. But even so...

Me and one other guy was sitting one day fixing stuff, everything was finally working fine after we tried a different set of batteries, But then we descided to change to things:

1. I moved 4 commands in order, into a coding segment that would choose one of the 4 commands depending on what number-input was given from the terminal.
2. Since both wheels started turning after we swiched to different batteries, we descided to put the ones we had in the charger for what ended up being less than 4 minutes.

Trying to start the code yelded an "I/O Error" which certainly made sense since fire and brimstone spewed out of the batteries (okay just smoke, but a broken batterypack none the less) To our amazement, the battery socket had its negative pole melted CLEAN out!

We got a new socket and retried connecting everything, but we still had the same "I/O Error" problem. So we started testing.

The Raspberry Pi runs a program that connects to a certain address though the I2C-bus and thus communicates with the TMC222 Motor Controller to command a wheel to turn around, all of which worked fine before. It is worth noting that we have a 50 page datasheet for the TMC222 available.

Things we have tried to do for it all to work again:

1. The Raspberry Pi can run other segments of arbitrary code and shows no change aside from the "I/O Error" we keep getting with the motorcode.
2. The daughter board when mounted on the Raspberry Pi and with the voltage divider on top seems to output the correct voltage value when we measued the voltage across all the outer wires on each of the 6 bus outputs.
3. The voltage divider also gives off the same voltage value when measured directly
4. We measured the resistance through the white cables (of which we have 3) on each of the 4 wires, and found that one of them had a single wire that did not seem to give a proper value. We remade the cable from parts we could obtain, and now all 3 cables showed a minuscule resistance from one end to the other on all 4 wires.
5. We tried to make the Raspberry detect both of the TMC222 motor controllers, and also tried the same thing with a 3rd one from another team, neither of the 3 seemed to be detectable.
6. We made the cables for the batteries ourselves, and they give off a proper reading of 13.5v
7. We refit the motors themselves with cable extensions well before this error to solve a different problem, and we have successfully sent commands to either wheel, 1 at a time. Note: While the wheels might have suffered damage of which we have not identified yet (and we have no spare wheels to test), we are quite certain that the TMC222 should be detectable though the I2C-bus whether or not there are wheel attached to it.

It should be noted that we are not supposed to make the cables ourselves. All our job is, is to figure out how to connect these components and what code to write on the Raspberry Pi. Please be gentle with your eletronic language, we are IT students after all.