Instructions

6. Day
Controlling the LED with a sensor contact
Not only traffic lights, but also door openers, light switches and automatons are often controlled by sensor contacts that only need to be touched
nowadays. Buttons that actually need to be pushed are growing increasingly rare. The experiment of the 6th day controls an LED via a simple
sensor contact.
Components: 1 x plug board, 1 x LED red, 1 x 220-Ohm
resistor, 1 x 20 MOhm resistor, 2 x wire bridges (sensor
contact), 4 x connection cables
The two grey wire bridges are made of short pieces of blank circuit wire. The upper contact is plugged onto the ground line, the lower contact is
connected to the GPIO-pin 22. This wire will be needed more often in the next few days to build connection bridges on the plug board.
This is how sensor contacts work:
The GPIO-pin switched as input is connected to +3.3 V via an extremely high-Ohmic resistant (20 MOhm), so that a weak signal that is still clear-
ly defined as high is pending. A person who is not floating freely in the air is always grounded and supplies a low level through electrically
conductive skin. When this person touches a sensor contact, the weak high signal is overlaid by the much higher low level of the finger tip,
pulling the GPIO-Pin to low level.
The actual height of the resistance between hand and ground depends on many things, including shoes and floor. Barefoot in wet grass offers
the best ground connection, but stone floors usually work well, too. Wood floors insulate more strongly, and plastic floorings often even are
positively charged. For the circuit to work at all times, an additional ground contact is installed, similarly to sensor buttons at elevators and
doors. When it and the actual sensor are touched at the same time, the ground connection is made in any case.
The program
For the sensor contacts to work, the internal pull-up resistors at the GPIO-pins must be switched off first. The ScratchGPIO is always on by de-
fault. This is done by a GPIO command SetPinsNone at the beginning of the program.
In an endless loop, an if...else-query checks if the value of the sensor pin22 is equal to 0. Then the GPIO-pin is connected to the ground. The
sensor has been touched.
In this case, the LED at the GPIO-pin 12 is switched on; otherwise – if the sensor is not touched – it is switched off.
7. Day
Spoon as a sensor
A spoon or other metal object is well suitable as a sensor contact. The spoon is connected to a wire bridge on the plug board with an alligator
clamp cable.
Touching the spoon will cause the green LED to light up in the experiment of the 7th day. While it is not touched, the red LED is lit.
Components: 1 x plug board, 1 x LED red, 1 x LED green, 1 x 220-Ohm resistor, 1 x 20
MOhm resistor, 2 x wire bridges (sensor contact), 5 x connection cables, 1 x alligator
clamp cable










