Thursday, November 21, 2024

Bluetooth Operated LED Desk Lamp

efy tested sani theoThis LED desk lamp can be switched on or off from a distance using Bluetooth. You can even regulate the lamp’s brightness through a slider on the screen of your Android smartphone.

The key hardware required for this little project is an Arduino Uno microcontroller board that enables you to control the lamp. Wiring diagram for the same is shown in Fig. 1.

Wiring diagram for the LED desk lamp
Fig. 1: Wiring diagram for the LED desk lamp

Working

Regulated 5V DC from the Arduino Uno’s onboard linear voltage regulator powers the HC-05 compatible Bluetooth module. The module communicates with the Arduino through its Tx and Rx lines that are connected to pins 2 and 3 of the Arduino board, respectively.

- Advertisement -

Pin 9 of the Arduino drives the white LED light source LED1 through the S8050 high-current transistor T1. The 1-kilo-ohm resistor R1 is the base resistor of driver transistor T1.

When the Arduino board is powered through its DC input jack (see Fig. 2), the DC voltage appears at its Vin pin through M7 (1N4007) silicon diode that is connected in series with the positive rail. This voltage is used to power the white LED light source. There is an inherent voltage drop of around 700mV, though.

- Advertisement -
Internal power supply circuit of Arduino
Fig. 2: Internal power supply circuit of Arduino

Likewise, the 700mA (IC max) small-signal transistor S8050 has a VCE(SAT) close to 500mV (IC=500mA, IB=50mA). Therefore, the white LED light source receives a slightly lower operating voltage than the input 12V DC. However, this is not a big issue because almost all 12V DC white LED modules work well with 9V DC onwards.

Software

The Arduino sketch (code) given below is based on RemoteXY Library. Its latest version can be downloaded from https://remotexy.com/en/library and installed in the Arduino IDE. The steps for installation can be found in the link https://remotexy.com/en/help/how-install-library/

/* Code
* Project: Bluetooth LED Desk Lamp v1
* Hardware: Arduino Uno & HC-05 Compatible
Bluetooth Module
* Android App: RemoteXY (http://remotexy.
com/en/download/)
* Arduino Library: RemoteXY 2.4.6
(https://remotexy.com/en/library/)
* Software Platform: Arduino IDE 1.8.13
(Win10x64) & Android 10
*/

#define REMOTEXY_MODE__SOFTSERIAL
#include
#include

#define REMOTEXY_SERIAL_RX 2
#define REMOTEXY_SERIAL_TX 3
#define REMOTEXY_SERIAL_SPEED 9600

#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =
{ 255,1,0,0,0,11,0,10,130,0,
4,128,13,20,80,22,108,16 };

struct {

int8_t slider_1;

uint8_t connect_flag;

} RemoteXY;
#pragma pack(pop)

#define PIN_SLIDER_1 9

void setup()
{
RemoteXY_Init ();
pinMode (PIN_SLIDER_1, OUTPUT);

}

void loop()
{
RemoteXY_Handler ();
analogWrite(PIN_SLIDER_1, RemoteXY.
slider_1*2.55);

}

Once the hardware setup is complete, the Android application RemoteXY can be downloaded and installed in the Android OS, which will manage the connection between the Arduino and the smartphone. RemoteXY is a bit different from similar Android applications for Arduino you may be familiar with.

You do not have to connect to the Internet to link your smartphone and Arduino setup with Bluetooth. The software has all the needed instructions and the user interface (slider). The Arduino setup smoothly sends the interface and configurations data to the RemoteXY app in your smartphone and then the smartphone app interprets the interface offline without the need to connect to the Internet!

Follow the steps below for proper operation of the lamp:

  1. Power the Arduino setup using a 12V DC adaptor.
  2. Start and run the smartphone RemoteXY application.
  3. Turn on Bluetooth connectivity.
  4. Press the new connection ‘+’ button in the top panel of the application as shown in Fig. 3.
  5. In the window that opens, select ‘Bluetooth’ connection.
  6. Select your HC-05 device.
  7. In the new window, enter password 1234 (or 0000) to establish the connection.
  8. Start controlling/regulating the brightness of the LED light source with the slider!
RemoteXY Android app
Fig. 3: RemoteXY Android app
Slider of RemoteXY app
Fig. 4: Slider of RemoteXY app

Fig. 4 shows the screenshot taken by the author during testing of the prototype with an Android smartphone (Nokia 5.3/Android 10).

If there is a connection problem, you might get error message: “The connection is established, but the device does not respond: Time out error: no response!” If you receive this message, recheck your Arduino setup (hardware and software) and/or the smartphone’s Bluetooth connectivity.

Bluetooth module with 12V white LEDFig. 1: Wiring diagram for the LED desk lamp
Fig. 5: Bluetooth module with 12V white LEDFig. 1: Wiring diagram for the LED desk lamp

The author built his quick prototype using an Arduino prototype shield (for his convenience). The white LED module is in fact a pair of 12V DC cool daylight-white LED plates (x3 lamps per plate) wired in parallel. Its total current consumption, as observed by the author, is 200mA at 12V DC.

To obtain HC-05 compatible Bluetooth module you may check this link.

For the 12V white LED module check this link.

Download Source Code


The author’s project works quite well but has not passed the prototype stage yet. Any additional ideas will be appreciated!

T.K. Hareendran is an electronics designer, hardware beta tester, technical author, and product reviewer

SHARE YOUR THOUGHTS & COMMENTS

EFY Prime

Unique DIY Projects

Electronics News

Truly Innovative Electronics

Latest DIY Videos

Electronics Components

Electronics Jobs

Calculators For Electronics