+8801933-147547 razibahmmad7327@gmail.com
Select Page

Welcome to Arduino tricks

RGB Led Control using Bluetooth

Bluetooth Module HC05 :

HC-05 module is straightforward to use Bluetooth SPP (Serial Port Protocol) module, designed for clear wireless serial association setup. interface Bluetooth module is absolutely qualified Bluetooth V2.0+EDR (Enhanced information Rate) 3Mbps Modulation with complete two.4GHz radio transceiver and baseband. A Bluetooth transceiver, associated an Arduino. HC 05/06 works on serial communication. The automaton app is intended to send serial information to the Arduino Bluetooth module once a button is ironed on the app. you’ll open the serial monitor and watch the received information whereas connecting.

arduino tricks

Working Principle :

It uses CSR Bluecore 04-External single chip Bluetooth system with CMOS technology and with AFH(Adaptive Frequency Hopping Feature). it’s the footprint as tiny as twelve.7mmx27mm. The STATE pin on the HC-05 zs050 board is connected to the LED two pin on the tiny Bluetooth module and also the LED two pin is employed to point once there’s a full of life association. this implies the Arduino will hook up with the STATE pin and verify once we have an association.

Required Parts :

  • Arduino Uno Board      
  • Project Board & Connecting Cable               
  • Bluetooth Module ( HC05 )                           
  • RGB light                                                           
  • Resistor (330ohm)   

Pin Connection :

  • Connect VCC with 3.3V of Arduino, please do not connect it with 5V as that can cook the module.
  • Connect GND with any GND of Arduino.
  • Connect Rx pin with Tx of Arduino.
  • Connect Tx pin with Rx of Arduino.

Connection Diagram :

First, let’s examine the light-emitting diode strip input. it’s four wires. the primary one, sometimes white, is that the positive 5V input. the opposite three wires are the red, inexperienced and blue signal wires. so as to make a broad sort of colors, we must always offer a lot of or less brightness to every one of those three basic colors. to try and do that we must always apply a PWM signal to the current color pins. If the white pin is already connected to a positive 5V voltage, so as to shut the circuit, the RGB output pins ought to be modulated toward the bottom.

arduino tricks

The problem is that Arduino digital outputs cannot offer quite 200mA and this strip at full brightness might draw quite 1A. For that, we’ve got to place one thing between the Arduino PWM signal and also the light-emitting diode strip. to try and do this we’ve got 2 choices. Use associate NPN semiconductor unit electronic transistor semiconductor device semiconductor unit semiconductor with the electrode pin connected to ground for a PNP transistor with the electrode pin connected to the RGB output pins.



Arduino code:

// website : https://arduinotricks.com/rgb-led-control-using-bluetooth/
// app : https://goo.gl/EfKJAj

#include <SoftwareSerial.h>

SoftwareSerial BLU(0,1);

#define redPin 6
#define greenPin 3
#define bluePin 5

void setup()
{
//Serial setup
Serial.begin(9600);
Serial.println(“-= HC-05 Bluetooth RGB LED =-“);

BLU.begin(9600);
BLU.println(“-= HC-05 Bluetooth RGB LED =-“);

pinMode(4, OUTPUT);

digitalWrite(4,LOW);

 

pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);

setColor(255, 0, 0);
delay(500);
setColor(0, 255, 0);
delay(500);
setColor(0, 0, 255);
delay(500);
setColor(255, 255, 255);
}

void loop()
{
while (BLU.available() > 0)
{
int redInt = BLU.parseInt();
int greenInt = BLU.parseInt();
int blueInt = BLU.parseInt();

redInt = constrain(redInt, 0, 255);
greenInt = constrain(greenInt, 0, 255);
blueInt = constrain(blueInt, 0, 255);

if (BLU.available() > 0)
{
setColor(redInt, greenInt, blueInt);

Serial.print(“Red: “);
Serial.print(redInt);
Serial.print(” Green: “);
Serial.print(greenInt);
Serial.print(” Blue: “);
Serial.print(blueInt);
Serial.println();

BLU.flush();
}
}
}

void setColor(int red, int green, int blue)
{
analogWrite(redPin, red);
analogWrite(greenPin, green);
analogWrite(bluePin, blue);
}

Email

info@arduinotricks.com