Thymio i2c I/O expansion

Getting the main idea from this article where the author Sivan Toledo describes how to build an I/O expansion for Lego Mindstorm NXT intelligent brick, and leveraging the already existent I2C connector of Thymio II, we would like to create an I/O expansion for Thymio.

We have to take care, as pointed out by retp2401 in a previous version of this page, that:
- The I2C bus of the thymio is clocked at 400KHz.
- The VIOH of the I2C bus of thymio is 3.3V.
For these reasons we cannot use exactly the same circuit of the article, but a different one using another IC.

In this case the core of this device must be changed with the Integrated Circuit PCA9538 that can be bought on internet for more or less 2 Euros.

PCA9538 is a gpio expander which has the following capabilities:

Interrupt Output Yes
Reset Input Yes
Technology Family I2C,SMBus
fSCLK (Max) (MHz) 0.1,0.4
VCC (Min) (V) 2.3
VCC (Max) (V) 5.5
Pin/Package 16SSOP, 16TSSOP, 16TVSOP, 16SOIC
Operating Temperature Range (C) -40 to 85
I2C Address 1110 0xx
# of I/Os 8
Low Power Yes
Configuration Registers Yes
5V Tolerant I/O Yes
Push–Pull I/O Type Yes

The pinout of this IC is the following:

IC2

Circuit

The circuit will be quite simple. For giving the right voltage to the IC in order to be compatible with the I2C bus of Thymio we will add an LDO like AP7331-33WG-7 already present in Thymio, directly powered by the battery of Thymio. It will decrease the +5V of the battery to 3.3 V, with 300mA of maximum output current.
According to retp2401 comments, pull up resistors on I2C bus are not required because already present in Thymio.
On the output pins we connect directly the leds with a resistor connected to the +5V of the battery.

schema1.png

Software

The firmware of Thymio must be modified in order to manage this device.
The first thing that the firmware will do at the power up will be to correctly set the I/O register of the PCA9538, in order to configure what are the input and what are the outputs.
We can assume that the pins from IO0 to IO3 will be input and the pins from IO4 to IO7 will be output. The address of this device is 1110 0xx, where xx is the binary number composed with address input A0 and A1. Refer to this Forum topic for further details.

Packaging

The final packaging may be that will be something with a connector, may be made by using LEGO Bricks.


Comments on this page

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License