Remote-Controlled Motor

In this project, we create a simple remote controlled motor, using the Blynk Button widget and the SG90 Servo motor.

First, let's find the motor and assemble a rotating horn by just fitting one of the white horns provided onto the ribbed shaft. It should make a tight fit and stay on quite well without much more than a push.

Button Widget

Now let's add the simple Button Widget to the dashboard:

Once it is added, open its properties and:

You can leave the other properties as-is, and later you can choose to play with them to see how it affects your project.

Connecting the Button

List of Parts

For this project you will need the following electronics from your kit beside the ESP32:


First, get your breadboard ready:

It is upside-down on purpose. I want Row 1 to be on the bottom.

Now, you need to attach the ESP32 to the breadboard.

Be VERY CAREFUL not to damage the pins when you do this:

Next, use a Female-to-Male jumper wire to connect the 3v3 (top left pin) from the ESP32 to the '+' column of the breadboard on the right hand side.

Then, use a Male-to-Male wire to connect the GND (top right pin) from the ESP32 to the '-' column on the right hand side.

The '+' may be the outermost column or the one just next to it. Or there may be no markings. Just pick one of those 2 outermost columns as (+) and one as (-) and connect as shown.

The wire colors are not important.

Now, carefully connect the Servo's 3 pins such that the orange wire connects to G16 or row 8 on the breadboard. The red wire goes to '+' column. And the black wire goes to '-' or GND column. You will need Male-to-Male wires for that.

This completes our Smart Doorbell circuit.

Use the short USB wire to connect the ESP32 to your laptop to power it up.


Start with Blynk Blink code

Open the Arduino application.

See the basic code for Blynk Blink - that will the starting point we assume for this project.

The code for Remote Motor project needs to handle some Servo API, so put this at the top:

#include <Servo.h>

And somewhere below all the #include lines, you can add the Servo variable like this:

Servo servo;

We also need to set Pin 16 as Output, so we need to add the following line to the setup() function:

pinMode(16, OUTPUT);

Now for starters we can test the Servo motor in the setup function itself, by adding:

// Set Servo to position 30 degrees
// Wait 1 second
// Set Servo to position 180 degrees
// Wait 1 second again

That should cause the motor to move to two different positions for 1 second each...

Now compile and upload these changes.

Compile & Upload

See instructions here


After a successful upload you can test by just letting teh program run and you can reset the board to test it again.

All you should see is the motor moving to two different positions for 1 second each.

If it doesn't, you can ask for help.

Control Servo From Blynk

Now, we just need to add this extra function:


   if (param.asInt()) {
   else {


Compile, upload, and test again - see what happens when you click the button on and off. It shoudl cause the motor to hold one of two positions depending on the state of the button.

Challenges & Showcases

Show your teachers how you can control different aspects of a real world model with remote control using the Blynk app (a garage door opener from your phone, a remote way to open some malfunctioning carpark gantry, or a way to let the handyman into your home when you're away).

You should limit the values possible on the slider to the range available to the Servo (0-180). What can you do with a more find-tuned remote control? A balance game? Control a robot arm?