The Smart Way with Pinoo
Project Purpose: To make a smart road project by using Pinoo Control Card and Ldr and Led modules.
Duration: 2 lessons
Age Group: 7 years and older
Benefits:
• Learns to code Pinoo control card.
• Learns to use the Ldr module.
• Learns to use the LED module.
• Improves the skill of setting up algorithms.
• Improves coding skill.
Required Materials: Mblock 3 program, Pinoo control card, 2 ldr modules, 2 led modules
Materials Required for Design: Cover of shoe box, ice cream stick, acrylic paint and brush, scissors, utility knife, craft card in black, A4 paper cut into 4 small strips, silicone gun and silicone.
Project Preparation:
1. For our project, let's start by designing the road first.
We cover the lid of the shoe box with black craft paper.
We will design the road on the upper part.
We stick 4 strips of paper.
We drill holes with a utility knife to insert the Ldr modules.
We silicon the Ldr modules.
Placed Ldr modules.
We paint the ice cream sticks.
We silicon the ice cream sticks and place them in the design.
We silicon the LED modules to the ice cream sticks.
We attach the connection cable of the led modules and silicon some of it to the freezing stick.
(To keep the cables straight)
We install the connecting cables of the Ldr modules.
We attach the other ends of the connection cables of the sensors to the Pinoo control board.
We plug the USB cable into the pinoo control card and the computer. Now we can move on to the coding part.
2.Adding Pinoo extension:
From the Extensions tab, we click on the "Manage Extensions" option. In the window that opens, we type "Pinoo" into the search engine and simply say download to the result.
It was installed on our computer.
3.Connecting the Pinoo sensor board to the computer:
In Mblock 3, we click on the "Connect" tab on the upper left.
We click on the "Serial Port" section from the window that opens and select the "COM6" option from the page that opens. NOTE: Since the port entries of each computer are different, the numbers next to the COM text may change.
We click on the ‘’Cards’’ tab.
We select the "Arduino Nano" card option used by the Pinoo sensor card from the window that opens.
We click on the ‘’Extensions’’ tab.
In the window that opens, we select the extension "Pinoo" of the sensor card we use.
We click on the Connect tab.
We click on "Firmware Update" from the window that opens.
4. Coding part:
When we click on the green flag, we run it to see the light value on the screen.
You can also read the value for ldr attached to door number 8 here, but they will read values close to each other.
We delete our codes for reading values on the screen. If the value of ldr is less than 200, we turn the led off after 1 second. If not, the led stays off.
(Let's pay attention to the door numbers here. Looking at the design, let's turn on the right led for the right ldr)
We check the same for the other ldr module.
In order to upload our codes to the Pinoo sensor card, we make the "Pinoo Program" command at the beginning of the event.
* The aim here is to save money by turning on lights only when cars are passing.
We right click on the "Pinoo Program" command and select the "Upload to Arduino" option in the window that opens.
On the page that opens, we click the "Upload to Arduino" button selected in red.
Our codes are uploaded to our Pinoo sensor card.
We click on the "Close" button after the "Download Finished" text appears. After the loading is finished, the Pinoo card and sensors are placed in the hard hat.
5. Working Status of the Project:
After the installation is finished, we connect the 9V battery to the Pinoo control board.
Nothing happens until the car passes.
When the car is passing, the corresponding LED lights.
ARDUINO IDE KODLARI:
// ldrleri A0 ve A1 pinlerine atadık int ldr1 = A0; int ldr2 = A1; // ldr'lerden gelen deger okuması için iki değişken oluşturduk int ldr1_deger; int ldr2_deger; // ledleri 2 ve 3. pinlere atadık int led1 = 3; int led2 = 2; void setup() { // ledler çıkış pini pinMode(led1, OUTPUT); pinMode(led2, OUTPUT); } void loop() { // ldr analog okutma yaptık ldr1_deger = analogRead(ldr1); ldr2_deger = analogRead(ldr2); if (ldr1_deger < 200) { // ldr1 deger 200den küçükse led1 yandı digitalWrite(led1, HIGH); digitalWrite(led2, LOW); delay(1000); } else if (ldr1_deger > 200) { // ldr1 deger 200den büyükse led1 söndü digitalWrite(led1, LOW); digitalWrite(led2, LOW); delay(1000); } else if (ldr2_deger < 200) { // ldr2 deger 200den küçükse led1 yandı digitalWrite(led1, LOW); digitalWrite(led2, HIGH); delay(1000); } else if (ldr2_deger > 200) { // ldr2 deger 200den büyükse led1 söndü digitalWrite(led1, LOW); digitalWrite(led2, LOW); delay(1000); } }