Every inventor began with one small project. Pick one and bring your idea to life today!
Great inventors and great teachers all started with one small step. Take yours today!
The same kits we use in 40+ school labs โ grab yours and build something youโre proud of.
Log in to continue
What if one pair of wires could talk to a screen, a clock, a motion sensor and a weather sensor โ all at the same time? Thatโs I2C! Every module waits for its own address, like houses on the same street waiting for the postman.
Say โI-squared-Cโ or โI-two-Cโ. A way for many modules to share just two wires with the board.
Serial Data โ the wire that carries the messages. On a TinkerPy board it is always o7.
Serial Clock โ the wire that keeps the timing, like a drum beat. It is always o8.
Each I2C moduleโs own number, like a house number: the OLED is 0x3C, the BMP280 is 0x76. The 0x means the number is written in hexadecimal.
Two modules with the same address on the same wires. The board canโt tell them apart, so Circuit Connections wonโt let you switch both on.
Watch the board call each address in turn on SDA and SCL. Tap a step to read what happens.
Check the addresses: can these I2C modules be switched on together, or do they clash?
I2C part Address Firmware What it gives ------------------------------- -------- --------- --------------------------------- OLED display 0x3C - 4 lines of text, animations LCD 16x2 0x27 - 2 lines x 16 letters (some 0x3F) MPU6050 tilt & motion 0x68 - tilt, shake, fall, steps, turn RTC clock (DS3231 / DS1307) 0x68 2.27+ time and date, battery backup Pulse oximeter (MAX30100/30102) 0x57 2.27+ heart rate, SpO2 (learning only) BMP280 pressure 0x76 2.27+ pressure, altitude, temperature VL53L0X laser distance 0x29 2.27+ 3 cm to about 2 m TCS34725 colour 0x29 2.27+ colour name, R G B APDS-9960 gesture 0x39 2.27+ swipes, near / far, colour All use o7 = SDA and o8 = SCL. Clashes: 0x68 (MPU6050 + RTC), 0x29 (VL53L0X + TCS34725).
Every I2C part in Circuit Connections โ Special components, with its address, the board firmware it needs and what it gives. The addresses tell you at a glance which two canโt be on together.
# Add the libraries you need import oled_display import bmp280 # ===== Pressure station ===== # This code block executes only once setup: oled_begin() # starts the OLED o7 = set_function(SDA) # cannot be changed o8 = set_function(SCL) # cannot be changed oled_write(1, left, small, regular, "Air pressure") # write "Air pressure" on OLED line 1 (small, from the left) # This code block executes forever loop: p = pressure() # air pressure in hPa oled_write(2, left, medium, bold, p) # write the value of p on OLED line 2 (medium bold, from the left) wait(1000) # pause here for 1000 milliseconds before continuing
A pressure station: the OLED (already on in a new project) and a BMP280 share o7 and o8. Switching on BMP280 pressure added import bmp280; the o7 / o8 lines were already there. Needs board firmware 2.27 or newer.
# Add the libraries you need import oled_display import rtc # ===== Real clock ===== # This code block executes only once setup: oled_begin() # starts the OLED o7 = set_function(SDA) # cannot be changed o8 = set_function(SCL) # cannot be changed # This code block executes forever loop: h = rtc_hour() # 0 to 23 m = rtc_minute() # 0 to 59 oled_write(1, left, small, regular, "Hour and minute") # write "Hour and minute" on OLED line 1 (small, from the left) oled_write(2, left, small, regular, h) # write the value of h on OLED line 2 (small, from the left) oled_write(3, left, small, regular, m) # write the value of m on OLED line 3 (small, from the left) wait(1000) # pause here for 1000 milliseconds before continuing
A real clock: the RTC module keeps the time even when the board is switched off, and the OLED shows the hour and minute. Two I2C parts, still only two pins. Needs board firmware 2.27 or newer.
# Add the libraries you need import mpu6050 import buzzer # Give your pins easy-to-remember names o1 = set_name("alarm") # ===== Shake alarm ===== # This code block executes only once setup: o7 = set_function(SDA) # cannot be changed o8 = set_function(SCL) # cannot be changed alarm = set_output(buzzer) # This code block executes forever loop: if shake_detected() == 1: # when shake_detected() == 1 alarm = ON # turn alarm ON wait(1000) # pause here for 1000 milliseconds before continuing alarm = OFF # turn alarm OFF
A shake alarm with the MPU6050 motion sensor: shake it and the buzzer sounds for a second. The OLED was switched off here, so only the MPU6050 is on o7 and o8.
Your phone knows when you turn it sideways because a tiny motion sensor inside measures tilt โ the same idea as the MPU6050.
Fitness watches shine a small light into your skin and watch how it changes with every heartbeat โ just like a pulse oximeter module.
When the air pressure falls quickly, rain is often on the way. Weather stations use pressure sensors like the BMP280 to help forecast.
Make one card for each I2C module: picture, name, address and what it measures. Play โclash or notโ: draw two cards and decide if they can be on together.
๐งฐ You need: 9 card pieces, pensPlan a station with an OLED, a BMP280 and an RTC: list each partโs address, check for clashes and write what each OLED line will show. Then switch them on in Circuit Connections and see which pins they take.
๐งฐ You need: notebook, TinkerPy board or SimulatorI2C was invented by the company Philips in the early 1980s so that the chips inside a television could talk to each other over just two wires โ today it is in phones, cars and your TinkerPy board.
5 quick questions to check yourself โ free with your TinkerPy account.
Log in