Party Light System with Pinoo

Purpose of the Project: To create a DJ system with light sensor (LDR), led modules and servo motor using the Pinoo control card.

Duration: 2 lessons

Age Group: 9 years and older


• Learns to code Pinoo control card

• Learns to code the light sensor (LDR).

• Learns to encode the servo motor.

• Led module learns to code.

• Improves the skill of setting up algorithms.

• Improves coding skill.


Materials to be Used: Mblock 3 program, Pinoo control card, Light sensor (LDR), Servo motor and propeller, 2 green, 1 red led module, 5 connection cables.



Materials Required for Design: Colored cardboard, scissors, silicon gun, chenille




Project Preparation:



Draw a medium-sized circle on the cardboard and cut it.



Place a small hole for the light sensor near the middle of the circle.




We fix the light sensor in the hole we opened so that the Sensor is visible from above.




We fix the propeller of the servo motor in the middle of the circle..



We drill a small hole on the floor. We fix the motor to the floor so that the servo motor cable is under the floor.



We attach our circle to the servo motor with the help of its propeller.



We fix the LEDs at certain intervals to the left of the floor.




We cut 4 small rectangular pieces from the cardboard, stick them to the lower corners of the floor and provide the elevation on the main floor.



We decorate our DJ system as we wish.



Let's make our connections. We place the Pinoo control card in the gap between the main floor and the dj system floor and connect the corresponding input (purple) to the input number 1 on the servo motor, and our light sensor to the red input number 7 with a connection cable. We connect it to the purple inputs number 3,2 with a connection cable.



Connection and Coding:


We have completed our connections, now let's move on to the coding part. For this, we will use the mblock-3 application.


Let's connect our Pinoo control card to the computer with the help of a connection cable and enter the Mblock3 application. Then let's introduce our Pinoo control card to the computer. To do this, we first click on the serial port option from the Connect tab. Then we select COM3. (The number may differ depending on the computer and port.)


After making the serial port connection, let's select the card we will use from the cards tab. We are working with Arduino Nano model.


In order to add the Pinoo extension to our computer, we click on the ‘’manage extensions’’ option from the extensions tab. In the window that opens, we type "Pinoo" in the search engine and just click download to the result. It has been installed on our computer.


We come to the ‘’Extensions’’ tab again and click on the ‘’Pinoo’’ option. We will write our codes with the ‘’Pinoo’’ extension.


In the coding part; To start the application, we get the code when clicking the Green Flag from the Events menu.



We will get help from variables in order to learn the value read by the light sensor. In the ‘’Data & Block’’ tab, we create a variable named light.


We need to state that the light variable we created is equal to the value read by the light sensor. We take the "get light 0" block from the "Data block" tab and place the code block related to the light sensor in the "value (0)" section from the "Robots" tab.

*** Do not forget to change the pin number. We made the sensor connection to the Pinoo7 input.


In order to repeat the value reading process continuously, we take the ‘’code’’ block from the ‘’control’’ tab continuously and place our codes in it.


In the upper left corner, we can observe the values ​​of the light. You leave the light sensor with your hand in the light and dark place and observe the values ​​it receives and take notes.


When we move our hand closer to the DJ setup, let's set the threshold value of the sensor as 130 (You can change this threshold value as you wish according to your project) and create the ‘’necessary condition’’ conditions. We create our conditional statement.



In case the condition is fulfilled, that is, if we bring our hands closer to DJ setup, we want the servo motor to move at 0,90,45,0 degrees in order. We change it to 0.

Since we want this process to be constantly controlled, we place all blocks in the repeat block.


While DJ Setup is running (if the light is less than 130), we want the leds on the left to blink sequentially. Let's determine the flashing process of the LEDs by creating a specific algorithm. Our algorithm;

• Pinoo pin4 connected LED light up

• Let Pinoo pin4 connected led turn off

• Pinoo pin3 connected LED light up

• Let Pinoo pin3 connected led turn off

• Pinoo pin2 connected led light

• Let Pinoo pin2 connected led turn off


From the Robots tab, we get the led-related code block, update the pin number and LED status according to the algorithm, and place them under the code blocks for the servo motor.


If we are away from DJ Setup, we want the servo motor to always be at 0 degrees. For this, we take the code block related to the servo motor from the ‘’robots’’ tab and place it at the top of our condition statement.

After completing our codes, we check the operation of our project by clicking the green flag. We bring our hands closer to the DJ setup. The setup should make mixed movements from left to right and the leds should blink quickly in turn.


If there is no problem in the operation of our project, we need to load the codes we have written into our card in order to run it with a power source independent of the computer.

For this, click the green flag we used at the beginning and throw away the code and get the Pinoo Program code from the Robots menu.

Right click on the code and click on ‘’Upload to Arduino’’. (We work with Arduino as a board.)



If there is no problem, we unplug our power cable from the computer. We power our Pinoo control board with the help of a 9v battery and a battery cap. We also turn the ON/OFF button right next to the battery input to the ON position.




#include <Servo.h> // servo kütüphanesini ekledik
Servo servo; // servo nesnesine isim verdik
// ledleri pinlere atadık
int led1 = 3;
int led2 = 4;
int led3 = 7;

int ldr = A0; // ldr'yi A0 pinine atadık
int ldr_deger; // ldr_deger isminde değişken atadık

void setup() {
  servo.attach(2); // servo motoru 2. pine atadık
  // ledler çıkış pinidir
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
  pinMode(led3, OUTPUT);


void loop() {
  ldr_deger = analogRead(ldr); // ldrden deger okuttuk

  servo.write(0); // servo 0 konumunda

  if (ldr_deger < 130) { // ldr deger 130dan küçükse 
    // servo konumları
    //led durumları
    digitalWrite(led1, HIGH);
    digitalWrite(led1, LOW);
    digitalWrite(led2, HIGH);
    digitalWrite(led2, LOW);
    digitalWrite(led3, HIGH);
    digitalWrite(led3, LOW);