I have been working on adding support for i2c to MyRobotLab during the spring and a bit of the summer.

So what is i2c ?

It's a very simple 2 wire addressable serial protocol. So you can, in theory, connect up to 126 different devices on the same 2 wires. You can find many different devices that use the i2c protocol. For example servodrivers, ad converters, gyro accelerometers, power measuring devices, LCD and OLED screens, temperature measuring devices, real time clocks and so on.

Each device has a predefined range of addresses that it can use. Some devices have many addresses that you can choose between. For example the Adafruit16CServoDriver can used any of 64 different addresses. Other devices are very limited, like the MPU6050 where you only can choose between two different addresses. To solve that problem there is a device called an i2c multiplexer, so that you can connect 8 different i2c buses ( sets of 2 wires ) to use more devices of the same type. However, you need to add two more wires per bus so the number of cables increases.  

Normal PC's and Mac don't have any i2c buses, so to use i2c from a PC or Mac, you need an Arduino. The Raspberry PI has i2c available on the GPOI pins. So if you use a PI, then you can use i2c directly or thru an Arduino. 

I made a small video where I explain about i2c. I will try to make more videos on how to use different i2c devices and some of the things that you may need to consider when connecting many i2c devices on the same bus. 

 

 

calamity

8 years 3 months ago

That's really awesome.

I really loves I2C device for their simplicity to connect them, and you made it possible to use many of them. 

And with your work it will be easy to implement new device.

That's great

Now the bits and pieces are starting to come together. To the right is th i2c multiplexer ( TCA9548A ) that will split the i2c commands comming from the Raspberry PI 3 in the head. I made 6 connectors. 2 are single bus connectors. One input from the main bus, and a connector to be able to connect more devices to it. Then four dual bus connectors, i.e. each connector has power, gnd, + 2 buses ( SCL and SDA ).

I will use one for each arm and one for each leg.

To the left is an Adafruit 16-channel Servo / PWM driver that I will use for all servos in the body and the shoulders. I'm not sure yet if I will connect the biceps to this unit or to the unit in the arm.

It looks a little empty, because I'm rebuilding so that the cables can go thru the shoulders and not on the outside. Same thing with the head. I'm reprinting parts of the head to have the cables run thru the neck.

So the electronics are a bit different from the default build.

So what I'm thinking about now is how to reconfigure the InMoov services to use my setup.

I will have four ServoControllers. One Arduino in the head, one Adafruit16CServoDriver in each arm and one in the back. So i will not be able to use many of the peers that are started automagically.  

I need to be able to select ServoController and pin for each servo. 

Arduino <=> Servo + pins for the servos in the head.

Raspi <=> Adafruit16CServoDriver (Body)<=> Servo + pins for the servos in the body.

RasPi <=> i2cMux <=> Adafruit16CServoDriver(Left) <=> Servo + pins for the left arm

RasPi <=> i2cMux <=> Adafruit16CServoDriver(Right) <=> Servo + pins for the right arm.

And then connect the different sensors. They are easier since they are not started as peers already.

RasPi <=> i2cMux <=> MPU6050 for the gyros in the arms

RasPi <=> i2cMux <=> Ads1115 for AD converters in the arms

RasPi <=> AdafruitIna219 for the power sensor(s)

I'm also a bit excited to see how well it works to have so many devices connected, and if I will get some serialization problems / collisions, 

 

GroG

8 years 3 months ago

Spellbinding Suspense !! ...
I can't wait to see the devices all worky ! .. talking on only 2 wires .. How is this possible .. its out of this world !!

Wish PCs came with SDA SCL Pins !