You are on page 1of 9

White Paper

How to choose
the right I2C
chips
Or the hidden software
problem of choosing
hardware modules

by IoT-devices, LLC - Kyiv - Ukraine


https://iot-devices.com.ua/en/
Preface
The I2C is supported by the vast majority of microelectronics manufacturers.
All popular controllers, IoT / Smart Home platforms, and related development
environments are compatible with the bus.
Most IoT devices support the I2C interface as basic. Moreover, the support of
the I2C bus is usually a decisive factor in the selection of chips in our projects. But
any system has not only advantages. There are also shortcomings and hidden
problems that we reveal in the publications.
Today we would like to talk about the software problem of choosing the right
hardware sensors with I2C bus support. We will not go into the theory, but rather
suggest a practical example using our devices.

© IoT-devices LLC - Kyiv - Ukraine


IoT-devices LLC constantly promotes the use of I2C bus as one of the best serial
digital interfaces.

The I2C bus offers all the necessary Sensors or actuators might be on an
functions: extension cord, or all the chips might
be concentrated on one module. Or all
● a simple physical interface: the chips can be focused on one module.
SDA data and SCL
synchronization signals require The master controller and slave
only two wires to connect to the devices can be powered
bus; independently. Or all devices on the
● the addressing of devices on the bus can be powered from a common
bus with unique 7-bit addresses; source.
● identification of devices on the
bus by their address or by unique The I2C is supported by the vast
identifiers (if provided by the chip majority of microelectronics
manufacturer); manufacturers. All popular controllers,
● hot device plugging / unplugging IoT / Smart Home platforms, and
like Plug & Play; related development environments are
● the unit is powered by the bus or compatible with the bus.
by each module’s own power
supply; Most IoT devices support the I2C
● the support for different supply interface as basic. Moreover, the
voltages of devices on the bus support of the I2C bus is usually a
(provided that the signals are decisive factor in the selection of chips
matched to the voltage level); in our projects. But any system has not
● an advanced infrastructure of only advantages. There are also
amplifiers, repeaters, splitters shortcomings and hidden problems
and multiplexers to build complex that we reveal in the publications.
topologies offered by chip
manufacturers; Today we would like to talk about the
software problem of choosing the right
All that allows about a hundred devices hardware sensors with I2C bus
to be connected to the controller on a support. We will not go into the theory,
single interface at the same time. The but rather suggest a practical example
I/O port budget of the main controller is using our devices.
minimal when the I2C bus is used to
connect the sensors.

© IoT-devices LLC - Kyiv - Ukraine


Let’s start with the popular radiation sensor module GGreg20.

module with the I2C interface and offer


such a product as an alternative to the
Example №1. GGreg20
product with a pulse output, which is
and I2C GGreg20 and I2C now GGreg20_V3.
From time to time we are asked if it
would be better to equip the GGreg20 In short, no. Let’s try to justify our
opinion in more detail.

Fig. IoT-devices GGreg20_V3 Ionizing Radiation Sensor module with pulse counting output

We really like the I2C bus. We, STM32, which must perform the
moreover, already have an I2C necessary pulse calculations and give
interface splitter module, I2CHUB, calculated values of the power and
which would be well suited to a dose of ionizing radiation to the main
hypothetical GGreg20 with I2C controller at a low level via I2C
interface. So we can take a budget interface.
microcontroller – a companion like
© IoT-devices LLC - Kyiv - Ukraine
But let’s ask ourselves how many The companion controller
common and very popular IoT occupies a certain area on the
platforms and microcontrollers will module board.
have driver support for such an I2C The I2C bus takes up twice as
sensor? The answer will be many controller ports as the pulse
disappointing since it is not an output.
industrial sensor with a huge sales All this significantly increases
market. the unit cost of the product.
While the Pulse interface takes
Certainly, our company needs up only one GPIO controller with an
everyone to be able to connect our interrupt handler and is much easier
sensors. It is our customers who must to program.
choose the type of controller or And if we talk about maximum
platform. We need to provide versatility simplification, the GGreg20 module
for Arduino, ESP32 / ESP8266, can work without a controller at all.
Raspberry Pi, or for NodeMCU, The user can measure radiation
Node-RED and ESPHome in Home (in circumstances that require it)
Assistant, and many other IoT only with a clock to record the
development environments that we measurement time in minutes.
might not have even heard of.
We will next consider another example
GGreg20 is now supported by any of two similar devices. They both have
controller, development environment, an I2C interface, but different
and IoT platform, precisely because it application perspectives.
has a versatile pulse output. If we
equipped the GGreg20 with an I2C
interface, we would have a completely Example №2. I2CUI3,
different result. I2CUI4 and I2C
We first developed I2CUI3 – a useful
and reliable product. It is a universal
Note. What if you make two
module of user interfaces with the I2C
interfaces on the GGreg20 module at
interface, which provides input of user
once – pulse output and I2C?
instructions with the help of five
It would be very convenient,
but in this case we believe that these
navigation buttons and output of data
costs at the expense of customers to the RGB LED and the buzzer about
would be unjustified. the status or events of the IoT device.

© IoT-devices LLC - Kyiv - Ukraine


It is based on the 8-bit NXP PCA9538 pre-programming at all, and therefore
port expander. For many years we can work even without the main
have been using this chip for various microcontroller.
tasks, including as the main And then it became clear that we need
component of the I2CUI3 module. not 8-bit, but 16-bit similar module for
certain tasks. So we created a new
The PCA9538 port expander is product with an I2C interface – I2CUI4
convenient, as it works module based on the MCP23017 port
semi-automatically after power supply expander chip.
and for some tasks does not require

Fig. IoT-devices I2CUI3_V1 User Interface module with I2C (PCA9538 8-bit)

© IoT-devices LLC - Kyiv - Ukraine


Fig. IoT-devices I2CUI4_V1 User Interface module with I2C (MCP23017 16-bit)

There are only a few libraries for


For the new I2CUI4, we could use PCA9539 on Github, but neither
NXP’s older expander in the line. They Adafruit nor Seeed Studio has drivers
have several 16-bit expander chips like for any NXP chip.
PCA6416, PCA9539, PCA9575,
PCA9673. But there are no official That is why the new product I2CUI4 is
libraries for any of the chips either on compatible with common platforms and
the arduino.cc site or on the has probably the most popular chip
esphome.io site. There are also no MCP23017 from Microchip Technology
drivers for the NodeMCU firmware. with I2C interface.

© IoT-devices LLC - Kyiv - Ukraine


Thanks to that, our MCP23017-based GGreg20 and I2CUI4, to minimize the
product can boast a wide range of risks and avoid the problems
support by Arduino, NodeMCU, mentioned above.
ESPHome / Home Assistant,
Node-RED, Blynk, MicroPython, We hope you find this material useful.
Raspberry Pi, STM32, and other
brands. GitHub has hundreds of Thank you for your attention.
repositories with drivers in C / C ++,
Python, JS, Lua, and other languages. To shop for GGreg20_V3 module
please follow the links:
Our Shop
Conclusion
Tindie
We gave two examples of identifying eBay
and solving the problem of driver Amazon
support for devices equipped with an
I2C interface from our own experience. To shop for I2CUI4_V1 module please
follow the links:
Unless you plan to provide on your Our Shop
own driver support for an I2C device Tindie
you are about to buy, please pay
attention to the hidden external risks xxx
described in this publication.
Original Story:
You should choose a device, module, https://iot-devices.com.ua/en/how-to-ch
or chip with an I2C interface, which, in oose-the-right-i2c-chips-en/
addition to other factors, will have the
Ukrainian article translation:
widest driver support among third-party
https://iot-devices.com.ua/how-to-choo
systems.
se-the-right-i2c-chips-ukr/
Special attention concerning Also read and listen at:
compatibility and support should be https://hackernoon.com/choosing-the-b
given to the target microcontrollers, est-i2c-chips-the-hidden-software-probl
platforms, development environments. em-of-choosing-hardware-modules
You have to be sure that all of these
systems will support your chip before Tags: I2C, DriverSupport, IoT,
using it in your designs. GGreg20_V3, I2CUI4_V1, MCP23017,
PCA9538, IO, IoT-devices
We have used these principles to
develop two excellent products,
© IoT-devices LLC - Kyiv - Ukraine
About IoT-devices, LLC laboratory work and experiments,
make their own smart devices in the
IoT-devices is a Ukrainian private best traditions of DIY.
company founded in 2020 in Kyiv,
which develops and manufactures its The IoT-devices project was born
own ecosystem of electronic modules thanks to customer support, as well as
for building smart devices in the sphere the team's experience and love for
of the Internet of things. Electronics. All IoT-devices products
are designed and manufactured with
The company's B2C business is freedom and wisdom in Ukraine.
focused on the needs of customers
who deal with the consumer and For more information please visit our
embedded electronics, home site: https://iot-devices.com.ua/en/
automation, smart home and the
connected home. The company's
products allow users to learn, conduct

See also

All My Links https://allmylinks.com/iot-devices

Tindie https://www.tindie.com/stores/iotdev/

Hackaday https://hackaday.io/iotdevicesdev

GitHub https://github.com/iotdevicesdev

Slideshare https://www.slideshare.net/IoTdevices

Reddit https://www.reddit.com/r/GGreg20_V3/

Twitter https://twitter.com/iotdevicescomua

Telegram https://t.me/s/iotdevices

Pinterest https://www.pinterest.com/iotdevicesua/

Facebook https://www.facebook.com/IoT-devices-114746816966582

Youtube https://www.youtube.com/channel/UCHpPOVVlbbdtYtvLUDt1NZw/v
ideos

© IoT-devices LLC - Kyiv - Ukraine

You might also like