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
Measure distance with a laser, let your robot see colours, switch a lamp with a wave of your hand and watch your own heartbeat blink on an LED. Four amazing I2C sensors, one line of code each!
A laser distance sensor. It times how long its tiny, invisible, eye-safe laser light takes to bounce back: 3 cm to about 2 m. import vl53l0x.
A colour sensor with its own white light. It names the colour in front of it and gives its red, green and blue amounts. import tcs34725.
A gesture sensor: it sees hand swipes (up, down, left, right), how near a hand is โ and colours too. import apds9960.
A MAX30100 or MAX30102 module that shines light into a fingertip to find the heart rate and SpOโ (oxygen in the blood). A learning project, not a medical device.
A number from 0 to 255 for how much red, green or blue the sensor sees. The strongest colour is always 255.
The sensor shows its R, G and B numbers. Tap the colour name you think color_name() gives.
Drag the object closer to the laser sensor and watch laser_distance() and the beeper.
# Add the libraries you need import oled_display import buzzer import vl53l0x # Give your pins easy-to-remember names o1 = set_name("beeper") # ===== Laser ruler ===== # 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 beeper = set_output(buzzer) oled_write(1, center, small, bold, "Laser ruler") # write "Laser ruler" on OLED line 1 (small bold, centred) # This code block executes forever loop: d = laser_distance() # cm, 999 = nothing in range if d == 999: # when d == 999 oled_write(2, center, large, bold, "--") # write "--" on OLED line 2 (large bold, centred) else: # otherwise oled_write(2, center, large, bold, d + " cm") # write the value of d + " cm" on OLED line 2 (large bold, centred) if d < 10: # when d < 10 beeper = ON # turn beeper ON else: # otherwise beeper = OFF # turn beeper OFF wait(200) # pause here for 200 milliseconds before continuing
A laser ruler on the OLED. It shows -- when nothing is in range (999) and beeps when something is closer than 10 cm.
# Add the libraries you need import oled_display import servo import tcs34725 # Give your pins easy-to-remember names o1 = set_name("arm") # ===== Colour-sorting arm ===== # 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 arm = set_output(servo, 90) # This code block executes forever loop: oled_write(1, left, small, regular, "R " + color_red()) # write "R " + color_red() on OLED line 1 (small, from the left) oled_write(2, left, small, regular, "G " + color_green()) # write "G " + color_green() on OLED line 2 (small, from the left) oled_write(3, left, small, regular, "B " + color_blue()) # write "B " + color_blue() on OLED line 3 (small, from the left) oled_write(4, left, small, regular, "Light " + color_brightness()) # write "Light " + color_brightness() on OLED line 4 (small, from the left) c = color_name() # the colour it sees, as a colour name if c == "red": # when c == "red" servo_write_angle(arm, 30) # point the arm at the red box elif c == "green": # otherwise, when c == "green" servo_write_angle(arm, 90) # the green box elif c == "blue": # otherwise, when c == "blue" servo_write_angle(arm, 150) # the blue box wait(300) # pause here for 300 milliseconds before continuing
A colour-sorting arm: the OLED shows R, G, B and brightness, and a servo points to the red, green or blue box. Test your own coloured cards first and change the angles to match your boxes.
# Add the libraries you need import buzzer import apds9960 # Give your pins easy-to-remember names o1 = set_name("lamp") o2 = set_name("beeper") # ===== Wave-to-switch lamp ===== # This code block executes only once setup: lamp = set_output(led) beeper = set_output(buzzer) o7 = set_function(SDA) # cannot be changed o8 = set_function(SCL) # cannot be changed level = 0 # set level to 0 # This code block executes forever loop: g = gesture() # up, down, left, right โ or None if g == "up": # when g == "up" level = 100 # set level to 100 elif g == "down": # otherwise, when g == "down" level = 0 # set level to 0 elif g == "right" and level <= 80: # otherwise, when g == "right" and level <= 80 level = level + 20 # set level to level + 20 elif g == "left" and level >= 20: # otherwise, when g == "left" and level >= 20 level = level - 20 # set level to level - 20 lamp = pwm(level) # set lamp to level if proximity() > 90: # when proximity() > 90 beeper = ON # a hand is very close else: # otherwise beeper = OFF # turn beeper OFF
Wave to switch a lamp: swipe up for full brightness, down for off, right and left for brighter and dimmer in steps of 20. A hand very close to the sensor sounds the beeper.
# Add the libraries you need import oled_display import pulse_oximeter # Give your pins easy-to-remember names o1 = set_name("heart_led") # ===== Heartbeat display (learning only) ===== # 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 heart_led = set_output(led) # This code block executes forever loop: if finger_detected() == 0: # when finger_detected() == 0 oled_write(1, center, small, bold, "Rest a finger") # write "Rest a finger" on OLED line 1 (small bold, centred) oled_clear_line(2) # clear line 2 of the OLED oled_clear_line(3) # clear line 3 of the OLED else: # otherwise oled_write(1, center, small, bold, "Keep still") # write "Keep still" on OLED line 1 (small bold, centred) oled_write(2, left, small, regular, "Heart " + heart_rate() + " per min") # write "Heart " + heart_rate() + " per min" on OLED line 2 (small, from the left) oled_write(3, left, small, regular, "SpO2 " + spo2() + " %") # write "SpO2 " + spo2() + " %" on OLED line 3 (small, from the left) if heart_beat() == 1: # when heart_beat() == 1 heart_led = ON # turn heart_led ON wait(100) # pause here for 100 milliseconds before continuing heart_led = OFF # turn heart_led OFF
A heartbeat display: it asks for a finger, then shows the heart rate and SpO2, and the LED blinks with every beat. A learning project only, not a medical device.
Feed coloured sweets or beads past the colour sensor and let a servo flick each colour into its own cup.
Wave your hand like a magician over the APDS-9960 and the lamp obeys โ no switch touched.
Measure your heart rate sitting quietly, then after 20 jumping jacks. Exercise makes the heart beat faster!
Put the colour sensor at the front of a robot car. It drives along, stops at a coloured card and turns left for red and right for blue. Show the colour on the OLED.
๐งฐ You need: robot car with TinkerPy board, TCS34725 colour sensor, OLED, coloured cardsUse the APDS-9960 to switch and dim an LED lamp with swipes. Add a beep for every swipe and show the brightness level on the OLED.
๐งฐ You need: TinkerPy board, APDS-9960, LED, buzzer, OLEDThe VL53L0X measures distance by timing light. Light travels about 30 cm in one billionth of a second, so the chip measures times far shorter than a blink of an eye.
5 quick questions to check yourself โ free with your TinkerPy account.
Log in