Arduino UNO Smart Home Lighting Simulation w/LEDs, HC-05 Bluetooth Module + mBlock 3 [Tutorial]

Paul Marriott - CHANNEL of STUFF
28 Mar 201928:21

Summary

TLDRThis tutorial guides viewers on creating a smart home lighting system using Arduino components and an Android phone. It covers wiring the Arduino Uno board with LEDs, resistors, and an HC-05 Bluetooth module. The process involves connecting the setup to an Android device using the Arduino Bluetooth controller app, programming the system with Mblock software, and controlling the lights via Bluetooth commands. The video concludes with a demonstration of the system's functionality, showcasing how to turn lights on and off remotely.

Takeaways

  • 🔧 The tutorial is about creating a smart home lighting system using Arduino components and an Android phone.
  • 📱 An Android app called Arduino Bluetooth Controller is used to control the system, demonstrated with a Samsung phone.
  • 💡 The main components include an Arduino Uno R3 board, breadboard, 3 LEDs, resistors, jump wires, and an HC-05 Bluetooth module.
  • 🛠 The wiring involves connecting the Arduino to the breadboard, LEDs, resistors, and Bluetooth module as per the Fritzing diagram.
  • 🔌 The Bluetooth module HC-05 connects with the Arduino board using TXD and RXD pins for communication.
  • 📶 The Bluetooth module is powered up and tested by pairing it with an Android phone, using password 1234.
  • 💻 MBlock software (version 3) is used to program the Arduino and control the system. Custom extensions for Bluetooth programming are required.
  • 🔢 The system is programmed to respond to specific numeric inputs (e.g., 4 to turn on the living room light, 1 to turn it off).
  • 🛑 The RX pin must be disconnected while uploading the program to the Arduino board to avoid upload failure.
  • 🖱 Once programmed, the Android app can control the lights using buttons instead of typing commands, providing a user-friendly interface.

Q & A

  • What components are required to build the smart home lighting system using Arduino?

    -The required components include an Arduino Uno R3 board, a breadboard, three LED lights, three 220-ohm or 1k-ohm resistors, nine jumper wires, an HC-05 Bluetooth module, and an Android phone with the Arduino Bluetooth controller app.

  • How do you connect the Arduino Uno board to the breadboard?

    -You start by connecting the ground wire from the Arduino to the negative rail on the breadboard, and the 5V wire from the Arduino to the positive rail.

  • What is the role of the HC-05 Bluetooth module in the project?

    -The HC-05 Bluetooth module enables wireless communication between the Arduino setup and the Android phone, allowing the user to control the LEDs remotely via Bluetooth.

  • How do you ensure proper wiring of the Bluetooth module to the Arduino board?

    -You connect the TXD (transmit) pin on the Bluetooth module to the RX (receive) pin on the Arduino and the RXD pin on the Bluetooth module to the TX pin on the Arduino. Additionally, the module is powered by connecting GND to ground and VCC to the 5V rail.

  • What is the purpose of the resistors in the circuit?

    -The resistors, connected to the negative (short) legs of the LEDs, are used to limit the current flowing through the LEDs to prevent damage.

  • How are the LEDs controlled using the Arduino code?

    -The LEDs are connected to digital pins 5, 6, and 7 of the Arduino. By receiving specific commands (numbers) via Bluetooth, the Arduino code turns the LEDs on or off by setting the corresponding pins high or low.

  • What steps are involved in setting up the Arduino Bluetooth controller app on the Android phone?

    -First, download the Arduino Bluetooth controller app from the Play Store. Then, pair the phone with the HC-05 Bluetooth module by entering the default password (1234). Once paired, the app can send commands to the Arduino to control the LEDs.

  • How do you configure the buttons in the Arduino Bluetooth controller app?

    -Within the app, you assign different buttons to send specific numbers (commands) corresponding to each LED’s on/off state. For example, button 1 sends '4' to turn on the living room light, and button 2 sends '1' to turn it off.

  • What does the code do when the 'all lights on' command is received?

    -When the 'all lights on' command (number 9) is received via Bluetooth, the code sets all the LED pins (living room, bedroom, and dining room) to HIGH, turning on all the lights.

  • How do you upload the Arduino program to the board and ensure the Bluetooth module doesn't interfere?

    -Before uploading the program, the RX pin on the Bluetooth module must be disconnected from the Arduino board. After the upload is complete, the RX pin can be reconnected to allow Bluetooth communication.

Outlines

00:00

🔧 Setting Up the Smart Home Lighting System

In this introductory section, the host explains that the project is about creating a smart home lighting system using Arduino components and an Android phone. The app used for the project is the Arduino Bluetooth controller. A Fritzing diagram is introduced to guide the wiring setup. Components include an Arduino Uno R3 board, breadboard, LEDs, resistors, and a Bluetooth module (HC-05). Step-by-step instructions on how to connect these components are provided, including wiring the Arduino board to the breadboard and setting up the LEDs.

05:03

🔌 Connecting the Bluetooth Module

This paragraph focuses on wiring the HC-05 Bluetooth module to the Arduino. The HC-05 is used because it has six pins, differentiating it from the HC-06, which has four. Detailed instructions on wiring the module to the Arduino, including connecting the ground, VCC, TXD, and RXD pins, are given. A power test is demonstrated to confirm the Bluetooth module is functioning. Additionally, the host explains how to set up the Arduino to communicate with the module, ensuring correct connections between TX and RX pins.

10:05

📱 Pairing the Phone and the Bluetooth Module

The host moves on to pairing the Android phone with the HC-05 module. After downloading the app from the Play Store, they search for the Bluetooth device in the phone's settings, selecting HC-05 and entering the default password (1234) to pair. Once connected, attention shifts to writing the code for the Arduino, which will allow the system to control the lights. The host explains how to connect the Arduino to a computer and set up Mblock for coding, emphasizing that the correct port and board settings are crucial.

15:08

💻 Coding the Bluetooth-Controlled Lighting System

In this section, the host explains the process of writing the Arduino code. Using Mblock software, the code assigns specific pins (5, 6, 7) for each LED (living room, bedroom, dining room) and sets up a Bluetooth extension. The program uses conditional statements to turn on or off the lights based on Bluetooth signals received from the phone. The host details how to program each room’s light to respond to specific commands (e.g., typing '4' turns on the living room light).

20:11

💡 Controlling Multiple Lights Simultaneously

Here, the focus is on adding more functionality to the program. The host explains how to create commands that can turn on or off all the lights at once. The host also introduces feedback functionality, where the phone receives a message each time a light is turned on or off. This ensures the user is aware of the current status of the lights. The code is written to send a message to the phone when individual or all lights are toggled.

25:12

📲 Configuring the App for Button Controls

The host demonstrates how to configure the Arduino Bluetooth controller app, setting up buttons to control the lights through the phone. Each button is programmed to correspond with specific light commands (e.g., button 4 turns on the living room light, button 1 turns it off). The host goes through the process of customizing the button names and assigning the correct numbers to match the Arduino code. They test the app, ensuring it works as expected, allowing easy control of the lights using just the phone’s buttons instead of typing commands.

Mindmap

Keywords

💡Arduino Uno R3

The Arduino Uno R3 is a microcontroller board used to control electronic components. In the video, it is the core component of the smart home lighting system, responsible for processing inputs and controlling the LEDs and Bluetooth module.

💡Breadboard

A breadboard is a device used to prototype electronic circuits without soldering. In the video, the breadboard is used to connect the Arduino board, resistors, and LEDs, enabling the creation of the lighting system without permanent connections.

💡LED

LEDs (Light Emitting Diodes) are semiconductor devices that emit light when current flows through them. The tutorial uses three LEDs of different colors to simulate lights in a smart home setup, where each can be controlled via the Arduino and Android app.

💡HC-05 Bluetooth Module

The HC-05 is a Bluetooth module used to enable wireless communication between devices. In this video, it allows the Arduino board to receive signals from an Android phone, making the system controllable via Bluetooth.

💡Resistor

A resistor is an electronic component that limits the flow of electric current. In this project, resistors are used to protect the LEDs by controlling the amount of current passing through them, ensuring the components are not damaged.

💡Jump wires

Jump wires are insulated wires with connectors on each end, used to establish electrical connections between components on a breadboard or between a breadboard and external components. The tutorial mentions using nine jump wires to connect the various parts of the system.

💡Fritzing diagram

A Fritzing diagram is a visual representation of a circuit, showing how to connect various components. In the video, the presenter refers to a Fritzing diagram to guide the audience through the correct wiring of the smart lighting system.

💡Arduino Bluetooth Controller app

This is an Android app used to send Bluetooth commands to the Arduino via the HC-05 module. The video demonstrates how to download and use this app to control the smart home lighting system wirelessly using a smartphone.

💡MBlock

MBlock is a programming environment used for coding and controlling Arduino devices. In this tutorial, the presenter uses MBlock version 3 to write the code that makes the smart home lighting system function, allowing the phone to control the lights.

💡Digital input pins

Digital input pins on the Arduino are used to receive or send digital signals (on or off). In the project, the LEDs are connected to digital input pins 5, 6, and 7, which the Arduino controls to turn the lights on or off based on commands sent via Bluetooth.

Highlights

Introduction to creating a smart home lighting system using Arduino and Android components.

Components needed: Arduino Uno R3 board, breadboard, three LEDs, three resistors, jump wires, and an HC-05 Bluetooth module.

Explanation of the Fritzing diagram to help wire up the Arduino components for the lighting system.

Demonstrating how to connect the ground and 5V power from the Arduino to the breadboard.

Guidelines on how to properly position LEDs on the breadboard and distinguish between the positive (long) and negative (short) legs of the LEDs.

Instructions for wiring resistors between the LED negative legs and the ground rail to limit current and protect the LEDs.

How to wire the LEDs to digital pins 5, 6, and 7 on the Arduino, assigning each LED to a pin for control.

Introduction to the HC-05 Bluetooth module, including how to connect it to the Arduino for communication with the Android phone.

Explanation of the RX and TX pins on the HC-05 module, ensuring proper communication with the Arduino board.

Instructions to power the Bluetooth module using the VCC and ground connections from the Arduino board.

Steps to download and install the Arduino Bluetooth Controller app from the Android Play Store.

Pairing the Android phone with the HC-05 Bluetooth module, including using the default password '1234' for pairing.

Programming the Arduino in MBlock (version 3) to control the lighting system using Bluetooth commands sent from the Android phone.

Setting up variables to map each room (living room, bedroom, dining room) to specific Arduino pins controlling the LEDs.

Final testing of the Bluetooth app buttons, allowing the user to turn lights on and off remotely via the Android app.

Transcripts

play00:00

hey guys in this tutorial we are going

play00:03

to create a smart home lighting system

play00:06

using Arduino components as well as an

play00:10

Android phone so this is a Samsung phone

play00:12

and we need to use an app called the

play00:14

Arduino Bluetooth controller which we'll

play00:17

show you in just a moment now I want you

play00:20

to take a look at this Fritzing diagram

play00:22

this is how we are going to wire up the

play00:25

entire contraption right just for the

play00:28

Arduino components so now we're gonna

play00:31

start wiring this thing up now let's go

play00:35

through the components together so we

play00:37

have an Arduino Uno r3 board we've got a

play00:41

little breadboard three LED lights you

play00:45

can use any color you want I'm using red

play00:47

for this example you need three 220 ohm

play00:52

or 1k ohm resistors one resistor for

play00:56

each of the LEDs you will need nine jump

play01:01

wires these are for the Bluetooth module

play01:04

and this is going to be for powering up

play01:07

the five volt and the ground to the

play01:10

breadboard and these cables were going

play01:13

to use to plug the LEDs into the digital

play01:15

in ports now speaking of Bluetooth this

play01:21

is an hc-05 bluetooth module and we are

play01:26

going to use that to interface this with

play01:29

the sense Samsung Android phone or any

play01:32

Android phone for that matter okay let's

play01:36

get started so the first thing we're

play01:39

going to do is we're going to plug the

play01:43

Arduino board to the breadboard so I'm

play01:47

going to start with the ground wire so

play01:50

plug that into the negative and plug the

play01:55

five volt

play02:00

just right there put that into the

play02:04

positive rail just like that okay that's

play02:07

great okay so now once we've got that we

play02:13

can space it out a little bit that's

play02:14

fine

play02:15

so now what we want to do is get the

play02:18

LEDs plugged in so we want now keep in

play02:23

mind when you work with these the

play02:25

positive if we have a look the positive

play02:31

is the long leg and the negative is the

play02:33

short leg so we want it we want the

play02:36

positive leg to be facing left so let's

play02:40

say I'm gonna put this here and we'll do

play02:44

the same with all the others

play02:46

just follow basically what's on the

play02:48

Fritzing diagram and you should have no

play02:51

problems so let's get this done I think

play02:57

that's okay all right I've got three

play03:00

LEDs all plugged in and now let's go for

play03:03

these resistors so now for the resistors

play03:06

so we don't need more of these black

play03:09

wires for the negative we can simply

play03:11

just plug the resistor from the negative

play03:15

the short leg into the negative rail so

play03:19

all we have to do is just plug one there

play03:22

okay we need another one so negative

play03:28

rail short leg

play03:33

let's just get that in it'll be quite

play03:37

careful with this you might want to

play03:39

straighten this out a little bit so

play03:41

let's try that again so we'll plug that

play03:45

in okay I think that's good enough all

play03:50

right do the same for this one so plug

play03:52

that in and good all right so we have

play03:58

the resistors now what we want to do now

play04:03

we want to plug each of these LEDs into

play04:07

a respective digital input which is here

play04:11

so I could just fold this cable down a

play04:14

little bit so you can see it better okay

play04:17

so we are going to plug the yellow cable

play04:22

you can use any color cable you like but

play04:24

it's fine so we're gonna plug the yellow

play04:26

cable in to the long leg so we plug that

play04:32

into number five we plug the gray cable

play04:38

in the two number six and so we just put

play04:43

that in we're also going to put the blue

play04:47

cable into number seven so blue cable

play04:51

into number seven

play04:59

all right doesn't matter if he can't if

play05:02

these cables cover up the lights it

play05:04

doesn't matter too much just as long as

play05:05

the lights work and then it's fine now

play05:09

next thing is we want to hook up the

play05:12

Arduino Bluetooth module hc-05 and you

play05:16

know it's hc-05 because it has six pins

play05:19

and not four pins if it's four pins it's

play05:22

HC zero six now what we're going to do

play05:25

is we're going to insert this into here

play05:29

like that okay so it remains in place

play05:33

now you can see on your Bluetooth module

play05:37

you have txt and rxd txt means sending

play05:43

so if the Bluetooth module is going to

play05:45

send something to the Arduino board the

play05:48

t XD has to be plugged into the rx okay

play05:53

and the TX here when the Arduino board

play05:58

is sending something to the bluetooth

play05:59

module

play06:00

similarly the TX has to send and receive

play06:03

on the Rx or our XD TX d to Rx and the

play06:12

TX here to our XD so we have to make

play06:14

sure that the opposites are connected

play06:17

right now first we want to power this

play06:20

bluetooth module up so we connect the

play06:25

one to the ground so we can put it there

play06:28

and one to VCC VCC is positive so we

play06:35

plug that in to the positive sorry it's

play06:38

just that when I plug this in it's going

play06:40

to conceal the labels as long as you

play06:44

followed the diagram like I said you

play06:45

should have little problems all right

play06:48

now txd we're going to use the orange

play06:52

cable

play06:57

oh yeah if you're not sure whether this

play06:59

is actually powering up or not all you

play07:00

have to do is just turn it over now if I

play07:04

get a power USB cable and plug it in

play07:06

right see it actually lights up right so

play07:11

that is providing power from the it's

play07:14

getting power from the Arduino board

play07:16

let's pull it out just to make sure it's

play07:18

working okay now we want to plug the

play07:22

orange cable in to txd and we want the

play07:30

green cable into the rxd so the t XD has

play07:38

to be plugged into our X on the Arduino

play07:41

board so our X normally is 0 and the our

play07:50

XD has to plug in to TX

play07:58

just like that's a bit messy but it will

play08:02

work hopefully so let's just make sure

play08:05

we have all the cabling we seem to have

play08:07

everything so that seems to be

play08:09

everything plugged in so we've got all

play08:11

the cabling we've got the resistors the

play08:14

lights and we also have the Bluetooth

play08:16

module we turn it around okay that's

play08:20

what it looks like from one side and

play08:23

this is what it looks like from the

play08:26

other side so for the second part of the

play08:29

tutorial we are going to download the

play08:31

app for Android so that we can interface

play08:34

with the Bluetooth module okay so what

play08:39

we'll do is we're gonna power up the

play08:41

board so we use the USB cable you can

play08:45

use a battery as well but we're gonna

play08:46

use a USB cable right we know it is on

play08:50

because the light is actually flashing

play08:52

so if I turn this around just like that

play08:54

you should be able to see sorry this

play08:59

board's tilted somewhat but that's okay

play09:02

just make sure the cables not coming out

play09:04

okay that's I think that will do right

play09:08

so what we need to do is we need to get

play09:09

this phone on so if we just turn this on

play09:13

let's get out of this sorry I'm just

play09:14

gonna punch in my passcode all right so

play09:18

what we want to do is we want to go to

play09:22

the Play Store or you can if you want

play09:27

scan the QR code on I mean we do have a

play09:32

QR code for the app but otherwise simply

play09:37

go here and go to arduino bluetooth

play09:40

search for our teen arduino bluetooth

play09:42

you want the essay tech app also not

play09:47

this one there are loads of arduino

play09:49

bluetooth but we're gonna use the SI

play09:50

tech app so we're gonna install this

play09:54

remember this is only for Android this

play09:56

does not work on iPhone and the reason

play09:58

why is because iPhone is incompatible

play10:02

with this there's some security issues

play10:04

so you have to use Android

play10:07

right so we'll just wait for that okay

play10:09

once it's done you press open what we

play10:15

would like to be able to do is we'd like

play10:18

to be able to connect to this to the

play10:20

Bluetooth module all right and if you're

play10:26

not sure if it's connected what you do

play10:28

is you go to your Bluetooth and you I

play10:32

need to stir to search for this

play10:34

Bluetooth device

play10:43

right you might have to refresh the

play10:46

screen so you can see the Bluetooth

play10:49

device it should be called hc-05 if you

play10:53

can't find it you might have to switch

play10:55

off the Bluetooth switch it on and try

play10:57

to rescan but eventually you should be

play11:01

able to find it but if you oh yeah okay

play11:08

there you go there's hc-05 you might

play11:10

have to press the reset button there is

play11:12

a little button here I think you can

play11:13

press that so right

play11:15

it's hc-05 and it's gonna ask you for a

play11:19

password set the password is 1 1 2 3 4

play11:24

so 1 2 3 4 then press ok and once it

play11:33

says pair device you know you've done it

play11:35

correctly now the next thing we're going

play11:38

to do is we're going to write the code

play11:40

to make this whole system work now what

play11:44

we do is we want to make sure that the

play11:48

Arduino board is connected to the

play11:50

computer via USB cable so make sure that

play11:53

it is connected and that the end of the

play11:55

cable is plugged in to the computer and

play11:59

on M block you go to oh and by the way

play12:02

we are using M blocked version 3 this is

play12:05

on Mac OS so we're gonna connect the

play12:08

serial port because I'm using Mac OS the

play12:12

port comes out as USB modem if you're

play12:16

using a Windows computer it will be calm

play12:18

and then followed by a number as in c om

play12:22

so connect it you know it's connected

play12:26

when the light goes from red to green

play12:28

and it says ok but you also want to make

play12:32

sure that you choose the right board

play12:34

otherwise the program will not work so

play12:36

make sure you go to boards large we know

play12:39

who no and you get the Arduino blocks

play12:41

for your programmer and for your board

play12:45

we also need to download some extensions

play12:48

because if we want to program the

play12:50

Bluetooth module we need a special

play12:53

extension which I have written myself

play12:56

so what we do is we go to extensions

play12:59

manage extensions your computer might

play13:02

have this already but if not or if you

play13:04

just want to check go to manage

play13:06

extensions and type in P see M it will

play13:11

go online and it will find three modules

play13:13

that I have created myself all three

play13:15

extensions actually so I download the

play13:18

Bluetooth hc-05 extension okay it's

play13:23

right there now I can close that I know

play13:25

it's installed because now I have these

play13:28

blocks for doing Bluetooth okay without

play13:32

further ado we're gonna start coding I

play13:35

make this bigger so you can see it a

play13:37

little better

play13:38

so it's let's increase the size then a

play13:42

right click and upload once we are ready

play13:44

to get this program we're gonna press

play13:46

this upload button now if you remember

play13:51

from the Fritzing diagram we have

play13:53

connected three lights to digital pin

play13:55

five six and seven

play13:57

instead of saying five six and seven

play13:59

we're going to use bedroom names okay so

play14:03

we're gonna make a variable so let's say

play14:06

the first light could be living room so

play14:13

that's that now we need another variable

play14:16

it could be bedroom so let's spell that

play14:19

right this variable could be called

play14:22

bedroom and then we want another one

play14:24

called

play14:25

let's say dining room you can call it

play14:28

anything you want it really doesn't

play14:29

matter right now let's say the living

play14:35

room is going to be the light that's

play14:37

connected to pin five so we say set the

play14:40

living room to five bedroom could be six

play14:42

and dining room could be seven whatever

play14:44

you like just make sure you get the

play14:46

right pin numbers okay these names can

play14:48

be anything but you've got to get the

play14:50

right pin numbers okay now the next

play14:53

thing we want to check we want to set up

play14:58

the Bluetooth now you want to make sure

play15:02

that the port is correct

play15:04

so the TX port should be connected to

play15:08

zero it should actually be zero and rx

play15:12

should be connected to one leave the

play15:15

baud rate as it is it should be zero and

play15:17

one so you need to swap the numbers

play15:18

around go to control we need a forever

play15:23

loop because because we want to keep

play15:25

checking the Bluetooth module needs to

play15:26

keep checking so what we do now what we

play15:31

want to do is we want to say if we press

play15:36

let's say if we type the number four if

play15:39

we use the phone and we send the number

play15:41

four then we won't say I don't know the

play15:46

living room like to turn on or if we

play15:48

type the number one then the light will

play15:51

turn off okay that might sound a bit

play15:54

complicated but let's give it a try

play15:58

so we need an if we are using

play16:01

conditional statements here so we also

play16:03

need let's see what else do we need

play16:06

let's go to robots let's let's focus on

play16:09

living room first

play16:10

so if we say if the living if the living

play16:15

room okay wait right so if we get the

play16:26

number four and we want this light to

play16:29

turn on okay so if we receive the number

play16:35

four on the phone then or it actually

play16:42

yeah okay fine then we want to set the

play16:48

digital pin on the Arduino board and

play16:52

remember it's living room so go to data

play16:55

and blocks set the living room as hi-hi

play16:59

means turn at the light on the living

play17:01

room on we also need another block read

play17:07

data from hc-05

play17:12

so we need to check what numbers coming

play17:15

through the Bluetooth system and if it

play17:18

gets a number four then we make it high

play17:20

for the living room okay we're gonna

play17:25

copy this if we want to say okay if it's

play17:28

a number one then set the living room as

play17:34

low okay so you do exactly the same

play17:36

thing for the bedroom and the dining

play17:39

room now if it helps just all you have

play17:41

to do is just right click here and

play17:43

duplicate duplicate means copy right so

play17:46

what you have to do is just swap these

play17:48

out and do it for the dining room and

play17:50

for the living room but to remember you

play17:55

want to have a different number for each

play17:57

room so let's say I think we want four

play18:02

one five two let's make that smaller

play18:06

because we need to fit we need to fit

play18:07

all this on so four one five two and

play18:11

then we want so now we want to do the is

play18:15

it the bedroom I think so so let's do

play18:21

the bedroom

play18:25

all right so four four and one is four

play18:28

living room of five and two is four

play18:29

dining room so it should be six and

play18:31

three for the bedroom okay

play18:36

now we're also going to make it so that

play18:39

we can we want to make a button that we

play18:42

press that turns on all the lights and a

play18:45

button that turns off all the lights so

play18:49

we're gonna make let me see how do we do

play18:53

this okay so we need to copy this we'll

play18:56

just copy this one so we're gonna make

play18:58

it so that if we type the number nine if

play19:02

we receive the number nine then we want

play19:07

all the well we want all the lights

play19:09

actually it's not like this we want all

play19:12

the lights to be on sorry it should be

play19:18

bedroom a dining room living room okay

play19:22

we want all the lights to be on if it

play19:25

receives the number nine and if it

play19:28

receives the number zero then we want

play19:33

all the lights off so in other words all

play19:35

the lights set to low right

play19:44

and also what we'll also do as well is

play19:49

every time we turn a light off and turn

play19:52

a light on we're going to send a message

play19:54

to the phone to say if a certain light

play19:57

is on if a certain light is off just a

play20:00

double check so what we do is we say

play20:03

send so we use this every time we have a

play20:07

light on so let's say for the living

play20:11

room so I'll just quickly type this and

play20:15

so living room light on I have to do

play20:21

this quickly and if you don't want to do

play20:26

this part you don't need to but I

play20:27

it just helps it helps me a lot it takes

play20:34

a bit of time as well but I think it's

play20:36

worth it so dining room light on dining

play20:41

room light off and bedroom bedroom light

play20:49

on and the bedroom light off hangs so we

play20:55

get all those and then we want one for

play20:58

all lights on and all lights off will do

play21:00

this in capital letters so all lights

play21:05

off and all lights on make sure you put

play21:12

the right message with the right light

play21:15

and the right number so let's see living

play21:19

room light on it will also tell you what

play21:23

this is for as well it will remind you

play21:25

so it's very very useful living room

play21:27

light on dining room light on and this

play21:31

is where it gets really really long so

play21:33

just bear with me dining room light on

play21:35

bedroom light on bedroom light off it's

play21:40

getting quite long I know all lights on

play21:44

all lights off okay now I think we're

play21:50

ready to save so what I'll do is I'll

play21:52

just call it

play21:56

just all that lights PCM you can call it

play22:00

anything you like and now what we want

play22:03

to do is we want to upload this to our

play22:07

Arduino contraption so what we have to

play22:12

do I do have to say that if you want to

play22:14

upload a program to your Arduino board

play22:18

you have to make sure that this part is

play22:22

disconnected so the rx has to be taken

play22:25

out otherwise you can't upload so you

play22:27

must take this out and then after you

play22:31

put the program in then you can put this

play22:33

back you can try it but it will not

play22:36

upload you have to take this out so

play22:38

let's make sure it's connected right and

play22:41

let's upload

play22:50

and there we go and we can simply just

play22:55

put this back great so we have the

play23:01

contraption we have the program on the

play23:03

board and now we're ready for the next

play23:06

part which is to get the phone turning

play23:09

these lights on now for the final part

play23:13

we're going to get this phone connected

play23:16

with the buttons to these lights now if

play23:20

you remember we installed the Arduino

play23:21

Bluetooth controller and we have

play23:23

connected to the Bluetooth module if not

play23:26

you'll have to get it connected okay now

play23:30

so what we're gonna do just to make sure

play23:32

that it actually is working we have to

play23:35

go to terminal

play23:37

right now we said that if we type the

play23:40

number for the bedroom light or sorry

play23:44

the living room light is going to turn

play23:45

on so if we put in a number 4 yep this

play23:52

living room light will turn on I thought

play23:53

it was this light but now I've got it

play23:56

wrong but it's okay I mean that's fine

play23:58

all right and if we want to turn it off

play24:00

we put type the number 1 and it actually

play24:04

says on the screen living room light on

play24:08

living room light off

play24:09

so you know which light is turning on in

play24:12

which light is turning off so look

play24:13

living room light on living room light

play24:16

off now let's test the other lights

play24:18

let's try this is dining room light we

play24:22

can also turn on the other light this is

play24:24

the bedroom light and this is the living

play24:27

room light on okay and we can also test

play24:30

very useful to do testing okay living

play24:34

room light off dining room light off and

play24:40

bedroom light off what about all lights

play24:42

on and all lights off let's give that a

play24:44

try so if we type number nine it will

play24:47

say all lights on all three lights light

play24:49

up if we type zero all lights off

play24:54

perfect but of course we are not going

play24:58

to be using the terminal because it's

play25:00

very cumbersome to have to keep typing

play25:01

numbers you want to be able to just

play25:03

press

play25:04

buttons and have this thing work nobody

play25:07

wants to use terminal so what we have to

play25:09

do is we have to use the buttons we have

play25:12

to program some buttons on this app so

play25:15

that it corresponds with different

play25:16

numbers now let me show you so what we

play25:18

do is first we have to go back okay we

play25:23

go back to here the button part is see

play25:26

where it says on/off we have to click on

play25:29

this one and you've got all of these

play25:31

buttons okay now let's say for example I

play25:36

want to I'm sorry right so let's say

play25:43

we're going to what did we say for this

play25:46

one we said living room so you can

play25:50

change the name to living room so on is

play25:53

number four off is number one so that is

play25:57

correct if the name is wrong you can

play26:00

rename it you just hold down the button

play26:02

and you can you can change the name so

play26:04

right now it says bedroom 1 it says 6

play26:07

and 3 now for that one we want to say

play26:11

this is 4 bedroom no this is the bedroom

play26:14

actually so let's just we better type it

play26:16

again

play26:16

we'll just excuse me so we'll put

play26:19

bedroom one word and 6 is on and sixes

play26:25

off so that's good and for this one

play26:28

because this is not bedroom 2 we want to

play26:31

change that to dining room so we're

play26:32

going to type dining room so D I n I and

play26:37

excuse me not typing it properly so di

play26:40

ni ng R double O M all right check your

play26:46

code and just make sure yep dining room

play26:48

light on dining room light off 5 and 2

play26:51

respectively all right and here all on

play26:54

and all office in just a double check

play26:56

the names right all on is 9 of is 0 ok

play27:02

now the moment of truth let's see if

play27:04

this works so alright so let's say ok

play27:07

I'm in the living room I want the light

play27:09

on yep it's on great ok I'm in the

play27:13

living room and I want to turn on the

play27:15

light in the bedroom and I don't

play27:16

want to go to the bedroom so I'm going

play27:18

to get my phone and press bedroom yep it

play27:19

works I'm not gonna leave I'm gonna

play27:22

block it a turn it off I'm going to turn

play27:24

on the dining room well there we go good

play27:26

okay I can have different combinations

play27:28

right I could do this this this this

play27:31

this this and of course I could just do

play27:34

that and have all lights on or lights

play27:36

off and so forth

play27:41

brilliant so that is your smart home

play27:46

lighting system using Arduino Android

play27:51

phone brilliant so give it a try and see

play27:56

how far you get

play27:57

remember you need to download em block

play28:00

three it is free just google it and you

play28:03

can use my extensions online to do the

play28:06

Bluetooth module programming okay I'm

play28:09

gonna have to stop it there this video

play28:11

is long enough so thank you so much for

play28:14

watching and all the best good luck and

play28:16

see you soon take care and good bye

Rate This

5.0 / 5 (0 votes)

Étiquettes Connexes
ArduinoSmart HomeDIY ProjectLED ControlBluetooth ModuleAndroid AppHome AutomationTech TutorialCoding BasicsElectronics Guide
Besoin d'un résumé en anglais ?