To control (three AC Bulb) using an Arduino Uno, (Relay Module) & a (Bluetooth module)

 

 

code:

char Incoming_value = 0;

void setup()
{
Serial.begin(9600);
pinMode(8, OUTPUT);
Serial.begin(9600);
pinMode(9, OUTPUT);
Serial.begin(9600);
pinMode(10, OUTPUT);
}

 

// ██████  ███████ ██ ███████ ███████     ██████  ██████  ███    ███ 
//██  ████ ██      ██ ██      ██         ██      ██    ██ ████  ████ 
//██ ██ ██ ███████ ██ █████   █████      ██      ██    ██ ██ ████ ██ 
//████  ██      ██ ██ ██      ██         ██      ██    ██ ██  ██  ██ 
// ██████  ███████ ██ ███████ ██      ██  ██████  ██████  ██      ██ 
                                                                   

void loop()
{
if(Serial.available() > 0)
{
Incoming_value = Serial.read();
Serial.print(Incoming_value);
Serial.print(“\n”);
if(Incoming_value == ‘1’)
digitalWrite(8, HIGH);
else if(Incoming_value == ‘4’)
digitalWrite(8, LOW);
if(Incoming_value == ‘2’)
digitalWrite(9, HIGH);
else if(Incoming_value == ‘5’)
digitalWrite(9, LOW);
if(Incoming_value == ‘3’)
digitalWrite(10, HIGH);
else if(Incoming_value == ‘6’)
digitalWrite(10, LOW);
}
}

 

//  ▄▄▄▄▄▄▄▄▄   ▄▄▄▄▄▄▄▄▄▄▄  ▄▄▄▄▄▄▄▄▄▄▄  ▄▄▄▄▄▄▄▄▄▄▄  ▄▄▄▄▄▄▄▄▄▄▄  ▄▄▄▄▄▄▄▄▄▄▄  ▄▄▄▄▄▄▄▄▄▄▄  ▄▄       ▄▄ 
// ▐░░░░░░░░░▌ ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░▌     ▐░░▌
//▐░█░█▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀▀▀  ▀▀▀▀█░█▀▀▀▀ ▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀█░▌▐░▌░▌   ▐░▐░▌
//▐░▌▐░▌    ▐░▌▐░▌               ▐░▌     ▐░▌          ▐░▌          ▐░▌          ▐░▌       ▐░▌▐░▌▐░▌ ▐░▌▐░▌
//▐░▌ ▐░▌   ▐░▌▐░█▄▄▄▄▄▄▄▄▄      ▐░▌     ▐░█▄▄▄▄▄▄▄▄▄ ▐░█▄▄▄▄▄▄▄▄▄ ▐░▌          ▐░▌       ▐░▌▐░▌ ▐░▐░▌ ▐░▌
//▐░▌  ▐░▌  ▐░▌▐░░░░░░░░░░░▌     ▐░▌     ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░▌          ▐░▌       ▐░▌▐░▌  ▐░▌  ▐░▌
//▐░▌   ▐░▌ ▐░▌ ▀▀▀▀▀▀▀▀▀█░▌     ▐░▌     ▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀▀▀ ▐░▌          ▐░▌       ▐░▌▐░▌   ▀   ▐░▌
//▐░▌    ▐░▌▐░▌          ▐░▌     ▐░▌     ▐░▌          ▐░▌          ▐░▌          ▐░▌       ▐░▌▐░▌       ▐░▌
//▐░█▄▄▄▄▄█░█░▌ ▄▄▄▄▄▄▄▄▄█░▌ ▄▄▄▄█░█▄▄▄▄ ▐░█▄▄▄▄▄▄▄▄▄ ▐░▌ ▄        ▐░█▄▄▄▄▄▄▄▄▄ ▐░█▄▄▄▄▄▄▄█░▌▐░▌       ▐░▌
// ▐░░░░░░░░░▌ ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░▌▐░▌       ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░▌       ▐░▌
//  ▀▀▀▀▀▀▀▀▀   ▀▀▀▀▀▀▀▀▀▀▀  ▀▀▀▀▀▀▀▀▀▀▀  ▀▀▀▀▀▀▀▀▀▀▀  ▀  ▀         ▀▀▀▀▀▀▀▀▀▀▀  ▀▀▀▀▀▀▀▀▀▀▀  ▀         ▀
 
 

 

 

A Bluetooth module is a hardware component that enables wireless communication between electronic devices over short distances. Bluetooth technology uses radio waves to transmit data and connect devices, making it a common choice for wireless communication in various applications, such as smartphones, headphones, speakers, IoT (Internet of Things) devices, and more.

Here are some key aspects of Bluetooth modules:

  1. Wireless Communication: Bluetooth modules eliminate the need for physical cables by allowing devices to communicate wirelessly. They use the 2.4 GHz ISM (Industrial, Scientific, and Medical) band for communication.
  2. Range: The range of a Bluetooth connection typically varies from a few meters (for Class 2 devices) to around 100 meters (for Class 1 devices). The effective range depends on factors like the class of the module and any obstructions in the signal path.

  3. Versions: Bluetooth technology has gone through multiple versions, with each version improving on various aspects like data transfer speed, range, and power efficiency. Common versions include Bluetooth 2.0, 3.0, 4.0 (LE – Low Energy), 4.2, 5.0, and 5.1. Each version may have specific features and capabilities.
  4. Profiles: Bluetooth modules support various profiles or protocols that define how different types of devices can communicate with each other. For example, the Hands-Free Profile (HFP) is used for connecting Bluetooth headsets to smartphones, while the Advanced Audio Distribution Profile (A2DP) is used for streaming high-quality audio.
  5. Applications: Bluetooth modules are used in a wide range of applications, including wireless audio streaming, wireless data transfer, IoT devices, home automation, automotive systems (e.g., for connecting smartphones to car infotainment systems), and healthcare devices (e.g., fitness trackers and medical sensors).
  6. Development: Bluetooth modules come in different form factors, including integrated modules and standalone modules. Some popular manufacturers of Bluetooth modules include Nordic Semiconductor, Texas Instruments, and Cypress Semiconductor. Developers often use these modules to add Bluetooth connectivity to their electronic projects.
  7. Compatibility: To ensure devices can communicate effectively, they need to be compatible in terms of Bluetooth version and supported profiles. For example, a Bluetooth 5.0 module may not be compatible with a device that only supports Bluetooth 4.0.
  8. Power Consumption: Low-power Bluetooth modules, such as Bluetooth Low Energy (BLE) modules, are designed to minimize power consumption, making them suitable for battery-operated devices with long operational lifetimes.

When using Bluetooth modules, developers and engineers need to consider factors like power management, security, and data encryption to ensure that the wireless communication is reliable and secure. Additionally, selecting the appropriate Bluetooth module for a specific application is crucial to achieve the desired performance and functionality.

 

0sief