How to make Arduino Bluetooth RGB Mood Light Lamp

In this project I’ll show you how to build a simple and complex Arduino Bluetooth mood light projects you can control with your smartphone.

This is made simple with this smart application Remote XY.

It’s a website and phone app that can help you create wireless Arduino projects easily.

You can make your mood light, RC car, Quadcopter, Home Automation or any other projectusing this basic information to connect Arduino to your smartphone via Bluetooth connection.

All the projects can be made simple thanks to this genius application.

Picture of Hardware Components

Hardware required:

Arduino UNO Board

Amazon USAmazon UK , Amazon DEAmazon FR , Amazon ESAmazon IT ,

eBayBanggood , Aliexpress

HC-06 Bluetooh Module

Amazon USAmazon UK , Amazon DEAmazon FR , Amazon ESAmazon IT ,
eBayBanggood , Aliexpress

Red, Green and Blue LEDs

I connected the negative (shorter) leg of the three LEDs together for easy use.

Jumper wires

Picture of Hardware Components

Connection Ciruit

The connection is very simple.

You connect the Arduino Board to the Bluetooth Module via the hardware serial port(Pin #0 and Pin #1).

Arduino UNO <——> HC-06 Module

Vcc Vcc

GND GND

Tx Rx

Rx Tx

Connect LEDs as follows

Arduino UNO <——> LEDs

GND Common Short Legs

Pin # 9 Red LED +ve terminal (Longer Leg)

Pin # 10 Green LED +ve terminal (Longer Leg)

Pin # 11 Blue LED +ve terminal (Longer Leg)

Picture of Circuit Connection

Configuration

Picture of RemoteXY Editor

Editor

Open Remote XY Editor at RemoteXY.com and place controls. RGB control and Toggle switch. Here is where you can design the Smartphone interface.

Connection

Bluetooth

Device

Arduino UNO

Module

HC-06 Module

IDE

Arduino IDE

Module Interface

Select Hardware Serial

Speed(Baud Rate) 9600

View

You can configure controls appearance here.

You need to download the generated code from the editor. You also need to include the Remote XY library from the same page.

Then you need to edit the code in Arduino IDE.

That’s because the generated code only configures the controls. Then you need to code the actions between Arduino and those controls.

Download Remote XY App from Google Play or Apple Store.

Open it and connect to your device.

You can see the interface loads on your smartphone.

This is how the interface looks on the Smartphone.

Note:

You don’t need to be connected to the internet for using this interface between the phone and Bluetooth Module.

Run the application and power up the device.

Try the different modes of operation.

In the RGB mode, you can control the output color using the RGB circular control.

In the MOOD mode, the light fades in and fades out automatically.

In this project, I made a quick light diffuser using a piece of white paper.

Thank you for reading.

Check out my books on Amazon:

amazon.com/author/ahmedebeed

Code for Arduino mood light

/*
— BluetoothRGB —

This source code of graphical user interface
has been generated automatically by RemoteXY editor.
To compile this code using RemoteXY library 2.3.3 or later version
download by link http://remotexy.com/en/library/
To connect using RemoteXY mobile app by link http://remotexy.com/en/download/
– for ANDROID 4.1.1 or later version;
– for iOS 1.2.1 or later version;

This source code is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
*/

//////////////////////////////////////////////
// RemoteXY include library //
//////////////////////////////////////////////

// RemoteXY select connection mode and include library

define REMOTEXY_MODE__HARDSERIAL

include

// RemoteXY connection settings

define REMOTEXY_SERIAL Serial

define REMOTEXY_SERIAL_SPEED 9600

// RemoteXY configurate

pragma pack(push, 1)

uint8_t RemoteXY_CONF[] =
{ 255,4,0,0,0,30,0,8,13,0,
6,0,43,10,42,42,2,26,2,1,
12,23,22,11,2,26,31,31,77,111,
111,100,0,82,71,66,0 };

// this structure defines all the variables of your control interface
struct {

// input variable

uint8_t rgb_1_r; // =0..255 Red color value
uint8_t rgb_1_g; // =0..255 Green color value
uint8_t rgb_1_b; // =0..255 Blue color value
uint8_t switch_1; // =1 if switch ON and =0 if OFF

// other variable

uint8_t connect_flag; // =1 if wire connected, else =0

} RemoteXY;

pragma pack(pop)

/////////////////////////////////////////////
// END RemoteXY include //
/////////////////////////////////////////////

int brightness = 0; // how bright the LED is
int fadeAmount = 5; // how many points to fade the LED by

void setup()
{
RemoteXY_Init ();

// TODO you setup code

}

void loop()
{
RemoteXY_Handler ();

// TODO you loop code
// use the RemoteXY structure for data transfer

analogWrite( 9 , RemoteXY.rgb_1_r ); 
analogWrite(  10 , RemoteXY.rgb_1_g ); 
analogWrite(  11 , RemoteXY.rgb_1_b );

// This is for the Fading part. Provided that the switch is on the MOOD position

if(RemoteXY.switch_1==1)
{
analogWrite( 9 , brightness);

analogWrite(10 , brightness);

analogWrite(11 , brightness);

// change the brightness for next time through the loop:
brightness = brightness + fadeAmount;

// reverse the direction of the fading at the ends of the fade:
if (brightness <= 0 || brightness >= 255) {
delay(400);
fadeAmount = -fadeAmount;
}
// wait for 30 milliseconds to see the dimming effect
delay(30);

}

}

latest projects

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top