Bluetooth Controlled Night Lamp with Pinoo
Purpose of the Project: To create a bluetooth controlled night light system with a bluetooth module and leds using the Pinoo Control Card.
Duration: 2 lessons
Age Group: 9 years and older
Pinoo Set: Maker set ve Full set
- Learns to code the Pinoo control card.
- Learns to code the Bluetooth module.
- Led module learns to code.
- Algorithm building skill develops.
- Coding skill improves.
Materials to be Used: A mobile phone with Android operating system, Mblock 3 program, Pinoo Control Card, Bluetooh Module, 3 LED modules in different colors, Connection Cables
Materials Required for Design: Three toilet paper rolls, green craft paper, color cardboard, scissors, utility knife, silicone gun
- We cover the outside of the rolls with craft paper.
- We cover the outside of the rolls with craft paper.
- We open tiny windows to all the rolls so that the light can look stronger from the roll. Here we created our windows using a model knife.
- We fix our rolls on the floor. The important thing here is that we need to glue the rolls to the right and left with a slight inclination.
- We connect our leds by passing the cables through the spaces between the floor and the rolls.
- We cover the rolls and decorate them.
Let's make our connections. For our leds, we make connections to the inputs numbered 1.2 and 3 (purple colored).
We can connect our bluetooth module directly to the appropriate input on our Pinoo card (in front of the number 1 input).
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 the 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 click download to the result. It has been installed on our computer.
We go back to the Extensions tab. Here we click on the Pinoo option. We will write our codes with the Pinoo extension.
- In the coding part; Since the bluetooth module can run its unique code blocks only if it is uploaded to the arduino card, we start our codes with the Pinoo program block in the robots tab.
We will ensure the communication between the bluetooth module and our phone with data 0 and 1. Therefore, we delete the numbers written opposite RX-Tx and write 0 for RX and 1 for TX.
- In order to control our LEDs, we need to check whether there is a bluetooth connection that can be used. For this, if we take the block from the control tab, and in the ‘’robots’’ tab, Pinoo BT connection has been established? We place the block.
- We will work on numerical data since we will perform communication over 0 and 1 data. In order to read this numeric data we receive or send, we take the Read Digital Data from Pinoo BT code block from the robots tab.
We need to know what data is coming to us in order to be able to perform operations according to the digital data (0-1) coming from Bluetooth. If the incoming numerical data is equal to 1, we take the if block from the control tab and the equality block from the operations tab to write the expression. Finally, we complete the code by taking the number data block from the ‘’robots’’ tab and writing 1 in front of it.
- If the incoming data is equal to 1, we want the LEDs on the 1,2 and 3rd pins to be lit. We get the code block related to the LED status from the ‘’Robots’’ tab. We update the pin number for three LEDs and bring the LED high status.
- We are doing the same, this time for number data = 0 statement.
- If the incoming data is equal to 0, we want the LEDs on the 1, 2 and 3 pins to go off this time. We get the code block related to the LED status from the Robots tab. We update the pin number for three LEDs and turn the LED low.
- Since we want all our operations to be done continuously, not once, we include all the other code blocks in the code block with continuous repetition in the control tab, except the block in which we have connection values.
We had to load our codes into Arduino to see if there was any problem in the operation of our project. To do this, right click the Pinoo program on the code block and click the Upload to Arduino option.
At this stage, we remove the bluetooth module from the card.
- We are waiting for the codes to be uploaded to the card. After the installation is complete, we close the window.
- We put our bluetooth module back on the Pinoo board. We download Arduino Bluetooth Controller application from Google Play Store to Android mobile phone.
We activate the bluetooth feature of the phone and open the application. We are pairing the phone with the unknown device in the Availables devices section. When the pairing process is completed, its name will appear in the Connect to a device section with the name HC-06/05. The light on the bluetooth module will start to flash less frequently.
We choose the switch mode from the screen that appears.
- From the screen that opens, we click on the settings icon in the upper right corner. We write 1 on the green mark and 0 on the red and click on the OK button. These are our numerical data.
- We return to the main screen by pressing the back button. We turn our night light on and off by pressing the ON/OFF button slowly.
- If there is no problem, we disconnect 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 switch located next to the battery input to the ON position.