Introduction: 🤖 Coding Kit: Inputs and Outputs

About: Spreads the joy of science!

In this activity, you will learn the input and output modules of the Twin Science Kit and use them to control output modules. We will discuss some engineering problems and develop physical solutions.

Learning Outcomes

  • Decompose (break down) the steps needed to solve a problem into a precise sequence of instructions.
  • Develop a simple physical model to solve a given problem.
  • Understand how physical changes represented as numerical values
  • Understand how signals are received through electronic circuits
  • Choose appropriate inputs and outputs based on the needs


Step 1: 📡 What Are Input and Output Modules?

An input is data that a coding module receives. An output is data that a module sends.

Think of a games console

When you are playing a game you are using a controller where you push a button or push the control stick to move a character. These inputs are digitised and sent to the computer to be processed. The program processes the inputs and gives an output. In this case the character on screen moves as it has been programmed to.

Twin Science Kit has following input modules:

Button, Dimmer ,Proximity Sensor, Light Sensor, Sound Trigger, Motion Trigger, Remote Control, Ultrasonic Sensor (On programming board)

and the following output modules:

DC Motor, Servo Motor, LED, Buzzer, Counter, Bar graph, Fan, RGB LEDs (On programming board)

Modules are colour coded in Twin Science Kit. Yellow represents inputs, blue represents outputs, grey represents power and red represents connections.

Input modules send signals to the next module depending on the sensor located on them. Output modules work by generating sound, light and motion.

There are 2 types of signals: digital and analog. Digital signals can be either true or false which means there is a signal or there is no signal. This is usually represented as 1s and 0s. On the other hand, analog signals can have different voltage levels. Modules like Dimmer, Proximity sensor and light sensor gives analog signals.

Step 2: 📱 Open Twinner App

If you do not install the Twinner App on your phone yet, first get the mobile application:



Open the Twin app and go to Coding > New Project to create a new project. You can fınd the general explanation of the IDE above.

Save Button: Save button allows you to save your project.

Upload Button: Upload button allows you to upload your code to the programming module.

Blocks: Blocks are used to write code.

Step 3: Connect DC Motor Module

Connect DC motor module to d6, servo motor module to d9, and LED module to d10.

Afer that write and upload the code above to the programming module.

ANALYZE: This tutorial is aimed to teach using the output modules. Every code must start with a Start Block. After the start block, there is a DC motor block. You should observe that DC motor starts to turn after uploading the program. 2 seconds later servo motor starts to turn and after 2 more seconds, buzzer makes a noise. A pause block is used between the output blocks in order to understand the sequence. At the end of the sequence, all the outputs are turned off.

Play with the delay time value, speed value of DC Motor and angle of Servo Motor and observe what changes.

Step 4: Input Modules

Connect a button to d4, a dimmer to d8 and a proximity sensor to d12 and upload the code below to the programming module. Don’t forget to connect the signal conductor module to input side of button, dimmer and proximity sensor. Signal conductor is used to short circuit in order to let the experiment work. Experiment by pressing the button, using the dimmer and putting your hand in front of the proximity sensor.

ANALYZE: If module is used to connect the inputs to outputs in this example. 3 of the sensors gives out different colours when they are triggered.

Step 5: Signals and Flipbooks

A signal is an electrical or electromagnetic current that is used for carrying data at every time frame. It is like a flip-book. In a flipbook, you see a drawing in every time frame. When you receive all the data packages (drawings) you understand the data and understand the whole story.

Step 6: Did You Know: Electric Fish

An electric fish is any fish that can generate electric fields. A fish that can generate electric fields is said to be electrogenic while a fish that has the ability to detect electric fields is said to be electroreceptive. Most electrogenic fish are also electroreceptive.

Weakly electric fish generate a discharge that is typically less than one volt. These are too weak to stun prey and instead are used for navigation, object detection (electrolocation) and communication with other electric fish (electrocommunication). The process is called as feature detection.

Feature detection is a process by which the nervous system sorts or filters complex natural stimuli in order to extract behaviorally relevant cues that have a high probability of being associated with important objects or organisms in their environment, as opposed to irrelevant background or noise.

Feature detectors are individual neurons—or groups of neurons—in the brain which code for perceptually significant stimuli. Early in the sensory pathway feature detectors tend to have simple properties; later they become more and more complex as the features to which they respond become more and more specific.

Source: Wikipedia (Electric Fish, Feature Detection)