ESP32 with Blynk – Lighting an LED over wifi

Recently, my friend Gector lent me a new microcontroller called the ESP32. They are fairly new to the market and have super cool wifi, bluetooth, and networking capabilities! Since I’ve been in the area of networking projects for the past few days, I thought I’d play around with one.

To set it up, I followed Sparkfun’s tutorial.

First, make sure you have the Arduino IDE installed on your OS.

Next, make a directory in your filesystem where you want all the ESP32 stuff to go.
Then run all these lovely instructions from this github documentation:
sudo usermod -a -G dialout $USER && \
sudo apt-get install git && \
wget && \
sudo python && \
sudo pip install pyserial && \
mkdir -p ~/Arduino/hardware/espressif && \
cd ~/Arduino/hardware/espressif && \
git clone esp32 && \
cd esp32 && \
git submodule update --init --recursive && \
cd tools && \

Since I didn’t have installed in /Applications/ on my computer, I didn’t have to change some other aspects of my installation. But if you do have that setup, don’t forget to run this:
cd /Applications/Arduino_*/Contents/java/hardware/
mkdir -p espressif && \
cd espressif && \
git clone esp32 && \
cd esp32 && \
git submodule update --init --recursive && \
cd tools && \

Once done, cd /esp32/tools and run python

Now you can connect your ESP32 to your computer!
In the Arduino IDE, under Tools, select ESP32 Dev Module as your board. Make sure you have the right Port selected, too.
My setup looks like this:
Screenshot from 2017-12-03 16-42-47.png

Once finished, I installed the Blynk app on my iPhone. Sign up with an email and password, and create a New Project.

Give your project a name, choose the ESP32 as the device and WiFi as the connection type. Tap create project when you’re finished!
This will direct you to a black screen. Tap anywhere to add a “widget”, where you’ll select the Button option. It’ll add the button to your screen. Tap on it to edit the settings.

In settings, in the empty PIN field, put Digital GP21. Save/Exit the settings, and you’re almost finished.

Before we can see any action, we’ve got to download the Blynk Arduino Library.
On the Blynk Github Page, you can clone the repo into your Arduino folder, or you can download the ZIP file and extract it into the Arduino folder.

In the Arduino IDE, go to Sketch > Include Library > Blynk and the library should be imported.

After that, download the sample code found in this tutorial:

Then replace “Your auth token” with the authorization code sent to you in your email for the project in this code block:
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "Your Auth Code Here";

And again in this line farther down in the file:
Blynk.begin("Your Auth Code Here", ssid, pass);

Near the beginning of the file, add your Network WIFI name and password where it says:
char ssid[] = "Network name";
char pass[] = "Network password";

Save the file and load it into the Arduino IDE as a sketch, but don’t run it yet.

Make sure your ESP32 is plugged into the computer. Now stick it into a breadboard and find an LED. Plug the LED’s long (anode) led into Pin 21 of the ESP32, and the short (cathode) leg into pin GND. There are GPIO charts you can find on the interwebs if there aren’t any names on your board.

The moment of truth comes…upload the code onto the ESP32 and open the Serial Monitor (Tools > Serial Monitor). If all goes well, your board should connect to your wifi and say something that looks like this:

configsip: 0, SPIWP:0xee
mode:DIO, clock div:1
entry 0x40078ad0
Connecting to HOME-D7EF-2.4
..WiFi connected
[1075] Connecting to HOME-D7EF-2.4
[1075] Connected to WiFi
[1075] IP:
___ __ __
/ _ )/ /_ _____ / /__
/ _ / / // / _ \/ '_/
/____/_/\_, /_//_/_/\_\
/___/ v0.5.0-beta on ESP32

[5001] Connecting to
[5241] Ready (ping: 116ms).

If you run into trouble, don’t worry. If it can’t upload the code due to permissions issues, open a terminal and run:
sudo chmod 666 /path/to/port

If you get an error about an invalid auth code like I did, make sure all your devices are on the same network as the ESP32, generate a new auth code, and double check your setup.
If you’re still having issues, take a look at Sparkfun’s tutorial I mentioned at the beginning of this article. They have a few resources I may not have mentioned.

In the Blynk app press the Play triangle in the top right hand corner. It should tell you whether or not the WiFi LED is connected or not, and once it is, go ahead and press your button, and the LED will light up!

So much excitement for something so small and cute, but it’s sure fun to play with.


P.S. I have a discord server where we discuss and solve problems like this! If you’re having trouble setting up your config or want to share your success, we’d love to see it! Come join us and create a digital hackerspace community 🙂 Join here!


4x4x4 Rainbow LED Cube (hardware)


  • 64 LEDs – 3mm
  • Resistors (you can calculate the amount of resistance you need, I used 200ohm)
  • a through-hole generic PCB board
  • Wooden board (not huge, just big enough to stick the LEDs in to solder the layers)
  • Hookup wire
  • Male-to-male jumper wires
  • Craft wire (I used 0.8mm)
  • Jumper wires
  • Elegoo Uno (I bought the Elegoo knockoff of an Arduino since I didn’t have a ton of money, it works exactly the same!)
  • A LOT of solder


  • Soldering station
  • Drill (with 3mm OR 1/8in drill bit)
  • Wire cutters and strippers
  • Round nose pliers
  • crocodile clips (very, very useful)


Step 1: Measure out equidistant holes in your wooden board. It’s really important that they’re as equal as you can get it, or else your LEDs are going to stand all wonky, and it’ll be hard to solder them all together.

I measured the holes about 1/2in apart.

Step 2: Drill the holes!
It helps to have an LED right next to you to make sure it’ll fit nicely in each hole.

Step 3: Solder the LED strips.
Take all the LEDs and bend the cathode (the short, negative lead) in such a way that it doesn’t touch the anode (the longer lead), and make sure when you fit them into the holes on your wooden board that the cathodes overlap each other so you can solder them together, like so:

Once you solder all the strips, lay them out in each set of holes, (with all the cathodes pointing the same way), and….

Step 4: Cut some craft wire and solder it across the LED strips to make it a square!

At this point I recommend using a 9V battery with a resistor on the positive (red) lead, and with the black lead touching the craft wire, go through and test all the LEDs to see if any burnt out or aren’t working. Trust me, it’ll save a LOT of time if you have to replace one now rather than later.

Step 5: Solder the layers!
Line the layers up on top of each other (one at a time), and remember that you’re *only soldering the leads pointing up*.

If you’re having a bit of trouble keeping the cube upright or the layers stable, the crocodile clips come in handy to steady the design.

The above picture was actually a mistake, I accidentally flipped the layer around the wrong way and had to desolder it because all the cathodes weren’t pointing the right way. (The cathodes being the shorter leads that you bent earlier) I wanted to show an example of the crocodile clips, though.

Once that’s completed, you can turn the cube right side up!

You can trim all the excess craft wire off. As for the cathodes sticking out on the sides, I cut them in a stepping-stone fashion like this tutorial said, which will make things easier once we hook the LEDs up to a PCB.

Step 6: Get the right PCB

I bought this PCB kit for…about $11, I think. It was a really good deal, these PCBs seem to work very nicely. They weren’t as big as they needed to be, though, so I hot glued two of them together.

This was probably the trickiest part of the whole project: getting 16 LED leads into tiny holes all at the same time. Round nose pliers were my best friend when I did it. Once you get them all in, solder all the joints at the bottom so all your hard work will stay in place!

Step 7: Put the resistors in.

Round nose pliers were super handy for this step as well. I chopped the leads of the resistors to be tinier than usual, then with some pliers I stuck them in the holes and soldered them in.

With the leftover resistor leads I used them as mini hookup wire to connect the resistors to the LEDs on the bottom of the board.

Step 8: Cut up some more craft wire and solder it to the negative stepping-stone leads, and wire them down to the PCB. img_5069img_5070
Step 9: Get some hookup wire, strip the ends, and pull them all towards the oval pads to connect to the jumper wire GPIO thingies.

I would recommend starting with the smaller hookup wires, I found it hard to solder around the bigger ones already in place without almost melting the insulation stuff. img_5077

Step 10: Solder the jumper wires to the board!img_5078
As you can see, I color coded the wires based on which resistor it was connected to. That way, I’ll have an easier time connecting the jumper wires to the GPIO pins on the Uno.

I still have to get some small wire or just use solder to connect the hookup wire to the actual resistors and GPIOs, so the signals will actually flow through the circuit. But otherwise, the big job is finished.

And that’s it! I followed this tutorial the whole time:

Next time, I’ll put up a post on the Uno, loading the code, and getting it all to run.