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
Buttons, magnets, flames, rain, smoke, claps and footsteps โ your board can feel them all! Meet every input module in TinkerPyโs Circuit Connections, find out what ON means for each one, and learn which ones give a number instead.
A small board with a sensor or switch that you connect to a pin. You pick it on the pin in Circuit Connections.
What ON stands for on that module: PRESSED for a button, MOTION for a PIR, DRY for a soil sensor, DARK for a light sensor.
A module with two outputs โ a digital one (ON/OFF) and an analog one (0โ100). You choose which one to use: LDR, soil and gas modules are dual.
The point where ON changes to OFF. On many digital sensor modules you set it by turning a tiny screw (a preset) with a screwdriver.
Circuit Connections gives every new part a name like motion_sensor_1 or knob_1. You can change it to anything you like.
Tap the right group for each module: ON/OFF only, 0โ100 only, or both.
Tap each one: they all use light you canโt see, but they notice different things.
Input module ON means Usual mode Pins -------------------- ---------- ------------- ------------------------ Switch ON active_low any pin (or adc on i1-i4) Push button PRESSED active_low any pin Slide switch ON active_low any pin Limit switch HIT active_low any pin Touch TOUCHED active_high any pin Motion (PIR) MOTION active_high any pin IR obstacle OBJECT active_low any pin Sound / clap SOUND active_low any pin Flame FIRE active_low any pin Vibration SHAKING active_low any pin Reed (door) CLOSED active_low any pin Hall (magnet) MAGNET active_low any pin Tilt TILTED active_low any pin Rain RAIN active_low any pin Water leak WATER active_low any pin Line (IR) BLACK active_low any pin Light (LDR) * DARK active_low any pin (or adc on i1-i4) Soil moisture * DRY active_low any pin (or adc on i1-i4) LPG gas (MQ-2/6) * GAS active_low any pin (or adc on i1-i4) Alcohol (MQ-3) * ALCOHOL active_low any pin (or adc on i1-i4) Air quality * BAD AIR active_low any pin (or adc on i1-i4) Knob (pot) 0-100 adc i1-i4 only Water level 0-100 adc i1-i4 only Temperature 0-100 adc i1-i4 only Flex 0-100 adc i1-i4 only * = dual module: ON/OFF or a 0-100 level. Mini: input pins are i1-i2.
Every digital and analog input module in Circuit Connections, with what ON means, its usual mode and the pins it can use. โAny pinโ means i1โi4 or a free output pin used as an input. DHT11, joystick, TV remote, GPS and GSM have their own wiring โ they are in chapter 12.
# Give your pins easy-to-remember names i1 = set_name("motion") o1 = set_name("lamp") # ===== Corridor light ===== # This code block executes only once setup: motion = set_input(pir, active_high) lamp = set_output(led) # This code block executes forever loop: if motion == ON: # when motion is ON lamp = ON # turn lamp ON wait(5000) # stay on for 5 seconds else: # otherwise lamp = OFF # turn lamp OFF
A corridor light: the PIR on i1 (named motion, usual mode active_high) turns the lamp on for 5 seconds whenever someone walks past.
# Add the libraries you need import buzzer # Give your pins easy-to-remember names i1 = set_name("fire") i2 = set_name("gas") o1 = set_name("alarm") # ===== Kitchen safety alarm ===== # This code block executes only once setup: fire = set_input(flame, active_low) gas = set_input(lpg, active_low) alarm = set_output(buzzer) # This code block executes forever loop: if fire == ON or gas == ON: # when fire is ON or gas is ON alarm = ON # turn alarm ON else: # otherwise alarm = OFF # turn alarm OFF
A kitchen safety alarm: a flame sensor (fire) and an LPG gas sensor (gas), both active_low, sound the buzzer if either one is ON. Practise with a candle only with an adult โ never test with a real gas leak.
# Give your pins easy-to-remember names i1 = set_name("tank") o1 = set_name("full_light") # ===== Tank full alarm ===== # This code block executes only once setup: tank = set_input(water_level, adc) full_light = set_output(led) # This code block executes forever loop: level = analog_read(tank) # 0 (dry) to 100 (deep in water) if level > 80: # when level > 80 full_light = ON # turn full_light ON else: # otherwise full_light = OFF # turn full_light OFF wait(500) # pause here for 500 milliseconds before continuing
A tank-full light: the water level sensor on i1 is an analog module (adc), so analog_read(tank) gives 0 to 100. Above 80, the full_light comes on.
Many home alarms use a reed switch: a magnet on the door and a switch on the frame. Open the door, the magnet moves away โ alarm!
With a sound sensor you can switch a lamp with a clap. Two claps for ON and one for OFF is a fun coding puzzle.
Flex sensors on a glove can tell how much each finger bends โ inventors use them to turn hand signs into words.
On paper, plan a doorbell that rings when the button is pressed AND lights a porch LED when someone walks up (PIR). List each module, its pin, its name, what ON means and its mode โ then build it in Circuit Connections.
๐งฐ You need: push button, PIR sensor, buzzer, LED, TinkerPy board or SimulatorWalk around your home or school and list 10 places where one of this chapterโs sensors could help (rain on the terrace, water on the bathroom floorโฆ). For each, write the module name and whether it is digital or analog.
๐งฐ You need: notebook, pencilA PIR sensor doesnโt see light at all โ it feels the invisible infrared heat that every warm body gives off, so it can spot a person even in a dark room.
5 quick questions to check yourself โ free with your TinkerPy account.
Log in