Introduction: WiFi Controlled Box That Glows!

About: Student, maker

This is an ESP32 powered WiFi, Blynk controlled box that glows!

Supplies

  • ESP32
  • phone (for blynk app)
  • jumper wires
  • RGB LED
  • breadboard
  • usb-c cable

Step 1: Wiring

Wire everything as schematics shows.

Step 2: Code

Copy and paste this code. Use your WiFi's pass and ssid (you'll get auth while setting Blynk app).

download library from here and download analogWrite ESP32 from library manager.

#define BLYNK_PRINT Serial

#include <WiFi.h>

#include <WiFiClient.h>

#include <BlynkSimpleEsp32.h>

char auth[] = "---";

char ssid[] = "---";

char pass[] = "---";

int RED_LED = 23;

int GREEN_LED = 22;

int BLUE_LED = 21;

BLYNK_WRITE(V1) {

int pinData = param.asInt();

analogWrite(RED_LED,pinData);

}

BLYNK_WRITE(V2) {

int pinData1 = param.asInt();

analogWrite(GREEN_LED,pinData1);

} BLYNK_WRITE(V3) {

int pinData2 = param.asInt();

analogWrite(BLUE_LED,pinData2);

}

void setup() { // put your setup code here, to run once:

Blynk.begin(auth, ssid, pass); }

void loop() { // put your main code here, to run repeatedly:

Blynk.run();

}

Step 3: Setup Blynk

1.Download Blynk apps from Play Store or App Store.

2. After the download is done, open the apps and create an account. If you already create an account, you may log in.

3. After you successfully create an account, start by creating a new project.

4. Create a project name and choose a device by ESP32 Dev Board and choose connection type by WiFi.

5. After press the "Create" button, a window will pop up "Auth token was sent to....". You can open your email to check your authentication key.

6. Then, tap anywhere on the canvas to open the widget box. All the available widgets are located here. Now choose an RGB zebra.

7. Tap on the widget to change the setting. Select the RED pin to virtual 2, green - 1, blue - 3.

8. When you are done with the setting, press the PLAY button. This will switch you from EDIT mode to PLAY mode where you can interact with the hardware. While in PLAY mode, you won’t be able to drag or set up new widgets, press STOP and get back to EDIT mode. Make sure to copy the authentication code and paste it in your code: char auth[] = "paste it here";

Step 4: Prepare a Box

You can 3D print this box (from white colors), (I made it using TINKERCAD, which is a great tool). Settings:

  • infill: 100%
  • supports: not needed
  • layer height: lowest you have
  • material: I think PLA is the best, but you can try other ones

If you don't have a 3D printer, make a paper box (squares have to be 9,5 cm x 9,5cm

Step 5: Put Everything In

BEFORE closing the box, put electronics in (you may want to make a little hole for cable). Than use super glue or hot glue to stick the walls of box together.

Step 6: Done!

Enjoy your phone-controlled bedlight.

Box Challenge

Participated in the
Box Challenge