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
Your board can feel when it is tilted, shaken or dropped, know the real time and date even after it was switched off, and measure the air pressure to tell how high you have climbed. Meet three clever I2C sensors!
A tiny motion sensor: an accelerometer (feels gravity and pushes) plus a gyroscope (feels turning). Tick MPU6050 in Circuit Connections: import mpu6050.
Real-Time Clock module (DS3231 or DS1307) with its own small battery, so it keeps the time and date even when the board is off. import rtc.
An air-pressure sensor. It gives the pressure in hPa, the temperature and your altitude (height above the sea). import bmp280.
Hectopascal, the unit of air pressure. About 1013 hPa at sea level and less as you go higher.
Each I2C part on o7/o8 has a number. Two parts with the same address canโt be on one board: the RTC and the MPU6050 are both 0x68.
Drag the slider to tilt the front edge of the MPU6050 and see what tilt_x() and tilt_direction() give.
Switch between the sensors and see what each one measures.
# Add the libraries you need import oled_display import buzzer import mpu6050 # Give your pins easy-to-remember names o1 = set_name("siren") o2 = set_name("front_led") o3 = set_name("back_led") # ===== Toy fall alarm ===== # 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 siren = set_output(buzzer) front_led = set_output(led) back_led = set_output(led) # This code block executes forever loop: oled_write(1, left, small, regular, "Tilt X " + tilt_x()) # write "Tilt X " + tilt_x() on OLED line 1 (small, from the left) oled_write(2, left, small, regular, "Tilt Y " + tilt_y()) # write "Tilt Y " + tilt_y() on OLED line 2 (small, from the left) d = tilt_direction() # F, B, L, R or N (flat) if d == "F": # when d == "F" front_led = ON # turn front_led ON else: # otherwise front_led = OFF # turn front_led OFF if d == "B": # when d == "B" back_led = ON # turn back_led ON else: # otherwise back_led = OFF # turn back_led OFF if fall_detected() == 1: # when fall_detected() == 1 oled_write(3, center, medium, bold, "FALL!") # write "FALL!" on OLED line 3 (medium bold, centred) buzzer_play(siren, "alarm") # play the "alarm" tone on the buzzer (siren) โ the next line waits until it ends oled_clear_line(3) # clear line 3 of the OLED wait(200) # pause here for 200 milliseconds before continuing
A toy fall alarm: the OLED shows both tilts, two LEDs show front-down and back-down, and a fall makes the buzzer sound the alarm tone and shows FALL!
# Add the libraries you need import oled_display import mpu6050 # Give your pins easy-to-remember names i1 = set_name("reset_btn") # ===== Step counter and shake dice ===== # 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 reset_btn = set_input(push_button, active_low) reset_steps() # This code block executes forever loop: oled_write(1, left, small, regular, "Steps " + step_count()) # write "Steps " + step_count() on OLED line 1 (small, from the left) oled_write(2, left, small, regular, "Moving " + motion_level()) # write "Moving " + motion_level() on OLED line 2 (small, from the left) if reset_btn == ON: # when reset_btn is ON reset_steps() if shake_detected() == 1: # when shake_detected() == 1 dice = random(1, 6) # dice gets a surprise number from 1 to 6 oled_write(3, center, large, bold, dice) # write the value of dice on OLED line 3 (large bold, centred) wait(200) # pause here for 200 milliseconds before continuing
Carry the board while you walk: it counts your steps and shows how much it is moving. Shake it to roll a dice from 1 to 6 (random needs firmware 2.15 or newer).
# Add the libraries you need import oled_display import buzzer import rtc # Give your pins easy-to-remember names o1 = set_name("bell") # ===== RTC school bell ===== # 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 bell = set_output(buzzer, passive) rtc_set_time(8, 59, 50) # set it to the real time before you upload rtc_set_date(19, 10, 2026) # day, month, year rang = 0 # set rang to 0 # This code block executes forever loop: h = rtc_hour() # set h to rtc_hour() m = rtc_minute() # set m to rtc_minute() oled_write(1, center, medium, bold, h + ":" + m + ":" + rtc_second()) # write the value of h + ":" + m + ":" + rtc_second() on OLED line 1 (medium bold, centred) oled_write(3, center, small, regular, rtc_day() + "/" + rtc_month() + "/" + rtc_year()) # write the value of rtc_day() + "/" + rtc_month() + "/" + rtc_year() on OLED line 3 (small, centred) if rtc_weekday() <= 6 and h == 9 and m == 0 and rang == 0: # when rtc_weekday() <= 6 and h == 9 and m == 0 and rang == 0 buzzer_play(bell, "school_bell") # play the "school_bell" tone on the buzzer (bell) โ the next line waits until it ends rang = 1 # set rang to 1 if m != 0: # when m != 0 rang = 0 # set rang to 0 wait(500) # pause here for 500 milliseconds before continuing
A school bell with an RTC module: it shows the time and date and plays school_bell at 9:00 from Monday (1) to Saturday (6). Change rtc_set_time and rtc_set_date to the real time and date before you upload.
# Add the libraries you need import oled_display import bmp280 # Give your pins easy-to-remember names i1 = set_name("zero_btn") # ===== Stair-climb altimeter ===== # 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 zero_btn = set_input(push_button, active_low) start = altitude() # the height where we begin # This code block executes forever loop: oled_write(1, left, small, regular, "Pressure " + pressure() + " hPa") # write "Pressure " + pressure() + " hPa" on OLED line 1 (small, from the left) oled_write(2, left, small, regular, "Temp " + bmp_temperature() + " C") # write "Temp " + bmp_temperature() + " C" on OLED line 2 (small, from the left) climb = altitude() - start # set climb to altitude() - start oled_write(3, center, medium, bold, climb + " m") # write the value of climb + " m" on OLED line 3 (medium bold, centred) if zero_btn == ON: # when zero_btn is ON start = altitude() # count from here again wait(500) # pause here for 500 milliseconds before continuing
A stair-climb altimeter with a BMP280: it shows the pressure and temperature and how many metres higher you are than where you started. Press the button to start counting from here.
Shake the board and get a number from 1 to 6 โ perfect for board games when the real dice rolls under the sofa.
Take the BMP280 up a ghat road or a tall building: the pressure drops and altitude() goes up as you climb.
Who walks the most steps in a school day? Wear the step counter in your pocket and compare at home time.
Fix the MPU6050 and a buzzer inside a soft toy. When the toy falls, sound the alarm and count the falls with a counter shown on the OLED.
๐งฐ You need: TinkerPy board, MPU6050, buzzer, OLED, soft toy, power bankSet the RTC once and ring school_bell at the start of every period from Monday to Saturday. Use a flag so each bell rings only once.
๐งฐ You need: TinkerPy board, DS3231 RTC module, passive buzzer, OLED displayYour phone has the same kind of tiny accelerometer and gyroscope chip as the MPU6050 โ it is how the screen knows to turn when you rotate the phone.
5 quick questions to check yourself โ free with your TinkerPy account.
Log in