Arduino interface with Bluetooth controller

Arduino interface with Bluetooth controller

In this article we will learn how to interface arduino nano with Bluetooth controller.
In the last post we will learn how to make password based door locking system using arduino UNO in proteus. You can visit our website,
I hope you appreciate my work, let’s discuss about today’s project.

Diagram of this project is below:

Arduino interface with Bluetooth controller
Arduino interface with Bluetooth controller

Components which we use in this project are listed below:

  1. Arduino nano
  2. Bluetooth module (HC-05)
  3. Four relay module
  4. Led’s ( red,green,white)
  5. Toggle switch
  6. 9V battery
  7. AC fan

Construction of arduino interfacing with Bluetooth controller:

  • Connect VCC point of Bluetooth module to 5V of arduino nano
  • Connect the GND point of Bluetooth module to GND point of arduino nano
  • Connect the pin TX1 of Bluetooth module to the pin RX1 of arduino nano
  • Connect the pin RX of Bluetooth module to the pin TX of arduino nano
  • Connect the neutral point of battery to GND point of arduino
  • Connect the +ve point of battery to VIN point of arduino through push button
  • Connect the VCC point of four relay module to VCC point of arduino
  • Connect the GND point of four relay module to GND point of arduino
  • Connect the IN1 point of four relay module to D9 point of arduino
  • Connect the IN2 point of four relay module to D10 point of arduino
  • Connect the IN3 point of four relay module to D11 point of arduino
  • Connect the IN4 point of four relay module to D12 point of arduino
  • Connect the neutral point of relay direct to appliances/LED’s
  • Connect NO point of relay 1 to light 1
  • Connect NO point of relay 2 to light 2
  • Connect NO point of relay 3 to light 3
  • Connect NO point or relay 4 to FAN

Real image of this project is below:

Arduino interface with Bluetooth controller
Arduino interface with Bluetooth controller

 Working of arduino interfacing with Bluetooth controller:

Interfacing an arduino with Bluetooth controller involves using a Bluetooth module to establish a wireless communication link between the arduino board and the controller (such as a Smartphone or computer). This allows you to send and receive data wirelessly, enabling remote control and communication with your arduino-based project.

Applications of arduino interfacing with Bluetooth controller:

  1. Home automation
  2. Robotics
  3. Smart wearable’s
  4. Smartphone-controlled vehicles
  5. Wireless sensor network

Advantages of arduino interfacing with Bluetooth controller:

  1. Wireless connectivity
  2. Remote control
  3. User-friendly interface
  4. Portability
  5. Real-time data exchange

Program code:

char val = ‘\0’; // Initialize to null character

bool relayStates[4] = {false, false, false, false}; // Initialize relay states

 

void setup() {

Serial.begin(9600);

pinMode(9, OUTPUT);

pinMode(10, OUTPUT);

pinMode(11, OUTPUT);

pinMode(12, OUTPUT);

 

digitalWrite(9, HIGH);

digitalWrite(10, HIGH);

digitalWrite(11, HIGH);

digitalWrite(12, HIGH);

}

 

void loop() {

if (Serial.available()) {

val = Serial.read();

Serial.println(val);

 

if (val == ‘1’) {

toggleRelay(0); // Toggle the state of relay 1

}

else if (val == ‘2’) {

toggleRelay(1); // Toggle the state of relay 2

}

else if (val == ‘3’) {

toggleRelay(2); // Toggle the state of relay 3

}

else if (val == ‘4’) {

toggleRelay(3); // Toggle the state of relay 4

}

else if (val == ‘5’) {

for (int i = 0; i < 4; i++) {

relayStates[i] = false; // Turn off all relays

digitalWrite(9 + i, HIGH);

}

}

}

}

 

void toggleRelay(int index) {

relayStates[index] = !relayStates[index]; // Toggle the state

digitalWrite(9 + index, relayStates[index] ? LOW : HIGH); // Set pin based on state

}