To remove the redundant HC-06 Bluetooth module and be able to utilize BLE (Bluetooth Low Energy), I decided to employ an Arduino Nano 33 BLE to build my new room lighting system. In addition to adjusting room lighting, I wanted this project to report weather and gas information, so I added an MQ-4 air quality sensor, an MQ-7 air quality sensor, and a DHT22 temperature and humidity sensor. Also, I added a buzzer to notify the user of a potential gas leak.

I decided to add a screen to display the BLE connection status and the collected weather and gas information. However, I realized a disturbing design flaw while using my previous lighting system: Looking directly at the LCD screen on the remote lamp induced eye fatigue and eyestrain, especially after sunset. Hence, I employed a Waveshare 2.9" e-Paper module instead of using an LCD or OLED screen as I did in my previous project.

Then, I developed a complementing Android application from scratch to adjust lighting settings, control integrated L9110 fan motors, and get informed of the collected weather and gas information over BLE. The Android application lets the user:

Due to my predilection for Star Wars, I based my entire project theme on Star Wars characters and airborne vehicles: Millennium Falcon, AT-AT, Yoda, Darth Vader, and Stormtrooper.

After completing wiring on a breadboard and testing the code for transmitting (writing) and receiving (reading) data packets over BLE, I designed a Millennium Falcon-inspired PCB for this remote lamp project.

Lastly, I also designed a complementary Star Wars-themed lighting system structure resembling an AT-AT (3D printable) to insert the Millennium Falcon PCB in order to create a robust and stylish apparatus emphasizing the Star Wars theme gloriously. Also, the lighting structure glows in the dark thanks to luminous PLA filaments (green and blue) :)

🎁🎨 Huge thanks to PCBWay for sponsoring this project.

Since Millennium Falcon has a captivating and memorable color scheme, I could not get the result I wanted with the regular solder mask options. Therefore, I decided to design my PCB with the grey solder mask option unique to PCBWay. They provide a fast, reliable, and budget-friendly service for exceptional PCB colors and requirements. You can inspect PCBWay solder mask and silkscreen options from here.

Also, if you are interested in developing an industrial-level product with budget-friendly prices, competitive delivery accuracy, and high product quality, you can check PCBWay's OEM service. The OEM service assists PCBWay customers in turning proof-of-concept projects into products ready for marketing with turnkey contract manufacturing options.

🎁🎨 Also, huge thanks to Creality for sending me a Creality CR-200B 3D Printer.

Step 1: Designing and soldering a Millennium Falcon-inspired PCB

Before prototyping my Millennium Falcon-inspired PCB design, I tested all connections and wiring with the Arduino Nano 33 BLE and checked the connection status between the Nano 33 BLE and the Android application.

Then, I designed the Millennium Falcon-inspired PCB by utilizing KiCad - reminiscent of the legendary interstellar adventures in a galaxy far, far away :) I attached the Gerber file of the PCB below. Therefore, if you want, you can order this PCB from PCBWay to build your BLE-enabled Star Wars-themed room lighting system controlled by a specialized Android application.

Click here to inspect and order this PCB directly on PCBWay.

First of all, by utilizing a soldering iron, I attached headers (female), resistors (20K), MQ-4 gas sensor, MQ-7 gas sensor, two bi-directional logic level converters, a buzzer, a 5mm common anode RGB LED, and a power jack to the PCB.

📌 Component list on the PCB:

A1 (Headers for Arduino Nano 33 BLE)

S1 (Headers for Waveshare 2.9'' E-Paper Module)

DHT22 (Headers for DHT22 Temperature and Humidity Sensor)

MQ4 (MQ-4 Gas Sensor)

MQ7 (MQ-7 Gas Sensor)

L1, L2 (Bi-Directional Logic Level Converter)

Relay1 (Headers for 2-Way Relay)

F1, F2 (Headers for L9110 Keyes Fan Motor)

BZ1 (Buzzer)

D1 (5mm Common Anode RGB LED)

R1, R2 (20K Resistor)

J1 (Power Jack)

J2 (Headers for External Battery)

Step 1.1: Making connections and adjustments

// Connections// Arduino Nano 33 BLE :  
//                                Waveshare 2.9'' E-Paper Module
// 3.3V -------------------------- VCC
// GND --------------------------- GND
// D11 --------------------------- DIN
// D13 --------------------------- CLK
// D10 --------------------------- CS
// D9  --------------------------- DC
// D8  --------------------------- RST
// D7  --------------------------- BUSY
//                                DHT22 Temperature and Humidity Sensor
// D2  --------------------------- DATA
// 3.3V -------------------------- VCC
// GND --------------------------- GND
//                                MQ-4 Air Quality Sensor
// A0  --------------------------- S
//                                MQ-7 Air Quality Sensor
// A1  --------------------------- S
//                                2-Way Relay
// A2  --------------------------- IN_1
// A3  --------------------------- IN_2
// 5V  --------------------------- 5V
// GND --------------------------- GND
//                                RGB LEB (RAGB)
// A4  --------------------------- R
// A5  --------------------------- G
// A6  --------------------------- B
//                                Keyes Fan Motor - L9110 (Left)
// GND --------------------------- GND
// 5V  --------------------------- VCC
// D3  --------------------------- INA
// D4  --------------------------- INB
//                                Keyes Fan Motor - L9110 (Right)
// GND --------------------------- GND
// 5V  --------------------------- VCC
// D5  --------------------------- INA
// D6  --------------------------- INB
//                                Buzzer
// D12 --------------------------- +

After completing soldering, I attached all remaining components to the Millennium Falcon PCB via headers - Arduino Nano 33 BLE, Waveshare e-Paper module, DHT22 sensor, 2-Way relay, and L9110 fan motors.

Since the Nano 33 BLE operates at 3.3V, it cannot power the 2-Way relay and L9110 fan motors sufficiently, which requires 5V logic level voltage. Therefore, I added two bi-directional logic level converters to the PCB to shift the voltage for the connections between the mentioned components and the Nano 33 BLE.

Step 2: Designing and printing a Star Wars-themed room lighting system

Since I focused on building a Star Wars-themed room lighting system, I decided to design a robust and compact lighting structure resembling an AT-AT walker. To be able to utilize different materials and avert loose wire connections, I designed the lighting structure in three parts: main case, lights, and plug. Then, to insert and attach the Millennium Falcon-inspired PCB to the main case effortlessly, I added a capacious slot. Also, I decided to fasten a Master Yoda bust to the structure and emboss well-known Star Wars icons on the plug part so as to adorn the lighting system gloriously :)

I designed the main case, lights, and plug parts of the lighting structure in Autodesk Fusion 360. You can download their STL files below.

For the Master Yoda bust (replica) affixed to the top of the plug part, I utilized this model from Thingiverse:

Then, I sliced all 3D models (STL files) in Ultimaker Cura.

Note: The pictures above are for demonstrating the sliced models: I needed to split some models to make them compatible with the CR-200B build size (200 x 200 x 200 mm).

Since I wanted to create a solid and perplexing appearance conforming with The Force for the lighting structure and emphasize the metaphysical aspect of Star Wars, I utilized these PLA filaments glowing in the dark:

Finally, I printed all parts (models) with my Creality CR-200B 3D Printer. It is my first fully-enclosed FDM 3D printer, and I must say that I got excellent prints effortlessly with the CR-200B :)

If you are a maker planning to print your 3D models to create more complex projects, I highly recommend the CR-200B. Since the CR-200B is fully-enclosed, you can print high-resolution 3D models with PLA and ABS filaments. Also, it has a smart filament runout sensor and the resume printing option for power failures.

According to my experience, there are only two downsides of the CR-200B: relatively small build size (200 x 200 x 200 mm) and manual leveling. Conversely, thanks to the large leveling nuts and assisted leveling, I was able to level the bed and start printing my first model in less than 30 minutes.

#️⃣ Before the first use, remove unnecessary cable ties and apply grease to the rails.

#️⃣ Test the nozzle and hot bed temperatures.

#️⃣ Go to Settings ➡ Leveling and adjust four predefined points by utilizing the leveling nuts.

#️⃣ Finally, attach the spool holder and feed the extruder with the filament.

#️⃣ Since the CR-200B is not officially supported by Cura, select the Ender-3 profile and change the build size to 200 x 200 x 200 mm. Also, to compensate for the nozzle placement, set the Nozzle offset X and Y values to -10 mm on the Extruder 1 tab.

Step 2.1: Assembling the lighting system and inserting the PCB

After printing all parts (main case, lights, and plug), I made wire connections and fastened all components to their corresponding slots on the lighting structure parts (main case, lights, and plug) via a hot glue gun. Then, I attached the lighting structure parts together by utilizing their built-in joints.

Finally, I placed and fastened the Millennium Falcon-inspired PCB via the specialized slot converted from its KiCad board outline layer (Edge.Cut) on the main case.

After assembling the lighting structure, I affixed the Master Yoda bust (replica) to the top of the plug part via the hot glue gun.

As mentioned earlier, I utilized luminous PLA filaments (green and blue) to capture the mysterious essence of The Force. Therefore, the lighting structure looks awesome and coruscates stunningly in the dark :)

Step 3: Developing a BLE-enabled Android application w/ the MIT APP Inventor

To be able to obtain the transmitted (advertised) information from the lighting system and pass commands to the lighting system over BLE, I decided to develop an Android application from scratch with the MIT APP Inventor.

MIT App Inventor is an intuitive, visual programming environment that allows developers to build fully functional Android applications. Its blocks-based tool (drag-and-drop) facilitates the creation of complex, high-impact apps in significantly less time than the traditional programming environments.

After developing my application, named BLE Remote Lamp, I published it on Google Play. So, you can install the BLE Remote Lamp app on any compatible Android device via Google Play.

📲 Install BLE Remote Lamp on Google Play (Soon)

Also, you can download the application's APK file directly below.

Nevertheless, if you want to replicate or modify the BLE Remote Lamp app on the MIT App Inventor, follow the steps below.

#️⃣ First of all, create an account on the MIT App Inventor.

#️⃣ Download the BLE Remote Lamp app's project file in the aia format (BLE_Remote_Lamp.aia) and import the aia file into the MIT App Inventor.

#️⃣ Since the MIT App Inventor does not support BLE connectivity by default, download the latest version of the BluetoothLE extension and import the BluetoothLE extension into the BLE Remote Lamp project.

In this tutorial, you can get more information regarding enabling BLE connectivity on the MIT App Inventor.

#️⃣ Inspect the BLE Remote Lamp project functions and source code in the Blocks editor.

After installing the BLE Remote Lamp app on a compatible Android device, the app starts displaying the transmitted (advertised) information from the lighting system over BLE immediately to inform the user of evaluated weather and gas data:

#️⃣ Also, the application lets the user transfer commands to the lighting system to control and adjust its various features:

Step 4: Setting up the Arduino Nano 33 BLE


Step 4.1: Displaying images on the Waveshare 2.9'' e-Paper module

To display images (black and white) on the Waveshare 2.9" e-Paper module successfully, I needed to create monochromatic bitmaps in the supported pixel format from PNG or JPG files and convert those bitmaps to data (.c) arrays.

#️⃣ First of all, download the Image2Lcd.

#️⃣ Then, upload an image to the program and select Horizontal as the Scan mode.

#️⃣ To generate the data array in the right format, activate the Reverse color option and select Mirror Left-Right.

#️⃣ Finally, convert the image (bitmap) and save the output (data array).

#️⃣ After exporting the data array (.c file), import the generated data array to the code and print it on the screen.

display.drawExampleBitmap(gImage_bluetooth, (display.width()/2)+l_offset-x_offset-e_offset+10, (display.height()/2)+y_offset, 29, 40, GxEPD_BLACK);

Step 5: Programming the Arduino Nano 33 BLE


Modes and Features

💡📲 The Android application (BLE Remote Lamp) allows the user to scan BLE devices and connect this lighting system via the Nano 33 BLE named BLE Remote Lamp.

💡📲 If the Scan button is pressed, the application scans for compatible BLE devices and shows them as a list.

💡📲 If the Stop button is pressed, the application desists from scanning devices.

💡📲 If the Connect button is pressed, the application attempts to connect to the selected BLE device (lighting system) over BLE.

💡📲 If the application connects to the Nano 33 BLE (peripheral device) as the central device successfully, the application waits for the advertised (transmitted) data packets from the lighting system.

💡📲 Every minute, the lighting system collects weather and gas information to display them on the Waveshare 2.9" e-Paper module with their complementing icons. If the central device (Android app) is connected to the Nano 33 BLE successfully, the lighting system advertises (transmits) the collected data over BLE to the application.

💡📲 Also, it changes the BLE connection status icon on the e-Paper module when the Nano 33 BLE is connected or disconnected to/from the central device via the Android application.

💡📲 Then, the application shows the recently collected data advertised (transmitted) by the lighting system.

💡📲 If the Send Commands button is pressed, the application transfers the given commands to the lighting system over BLE so as to adjust its features.

💡📲 The application lets the user control the movements of two integrated L9110 fan motors on the lighting system.

💡📲 The application allows the user to adjust the color of the built-in RGB LED on the Millennium Falcon PCB.

💡📲 The application lets the user turn on or off two LED light bulbs attached to the lighting structure.

💡📲 If the Nano 33 BLE throws an error while operating, the lighting system shows the error message on the Waveshare e-Paper module, turns the RGB LED to red, and prints the error details on the serial monitor.

💡📲 If the evaluated gas measurements exceed the given threshold, the lighting system shows the error message on the Waveshare e-Paper module, turns the RGB LED to red, and notifies the user via the buzzer.

💡📲 Also, the lighting system prints notifications and sensor measurements on the serial monitor for debugging.

💡📲 If the Disconnect button is pressed, the application disconnects from the Nano 33 BLE and clears all received information.

Videos and Conclusion