Introduction: Controlling Actuators Via Smartphone by Interfacing With Arduino Using PictoBlox

About: STEMpedia is a place bringing project-making tools at one place- kits, online courses, coding platforms, controller app and tons of free learning resources.

Once you are there on the bed or sofa, you hate to get up to open the door. Well, this tutorial is the perfect solution. By the end of this tutorial, you will be able to open/close the door or any ON/OFF any motor by just typing a few words on your Smartphone. All of this is possible because of Dabble: a project-making app, that transforms your Smartphone into many virtual shields.

In this tutorial, we are going to interface a servo motor to Arduino Uno and control it wirelessly using Smartphone via Bluetooth Module. Also, the entire process just got easy as you are going to code the entire program in PictoBlox, a graphical programming software which eliminates the need to worry about syntax.

You can download Dabble from Play Store and PictoBlox from here.

Let’s begin!

Step 1: Components Required

Hardware

  • Arduino Uno (OR any Arduino Board of your choice)
  • HC05 Bluetooth Module
  • Micro Servo Motor with Accessories
  • Male-to-Male Jumper Cable
  • Male-to-Female Jumper Cable

Software

Step 2: Connecting Bluetooth Module and Servo Motor to Uno

Let’s connect the Bluetooth module(HC05) to Uno. It will help us pair our Smartphone with the board via Bluetooth.

  • Connect the VCC pin to Uno’s 5V pin
  • Connect the GND pin to Uno’s GND pin
  • Connect the Transmit pin (Tx) to Uno’s Digital pin 2
  • Connect the Receive pin to Uno’s PWM pin 3

Now, let’s connect the servo to Uno.

  • Connect the servo’s brown wire to Uno’s GND pin
  • Connect the red wire to Uno’s VIN pin
  • Connect the orange wire to Uno’s PWM pin 5

Step 3: ​Interfacing Arduino Uno to PictoBlox

To Interface Arduino to PictoBlox:

  • First, open PictoBlox.
  • Then, connect Uno to your computer via a USB cable.
  • Next, click on the Board button in the toolbar and select Arduino Uno from the drop-down menu.
  • Then, click on the Connect button and select the appropriate port.

Step 4: Controlling Servo Motor With a Smartphone Via Dabble

Here, we are going to use the terminal module of Dabble. Let's write the script in PictoBlox.

We are going to use the is data from terminal block to into the if condition to check whether the command given is close or open:

Use the set servo block and set the angle to zero degrees.

Now, to open the door, we must send the command ‘open’. Duplicate the entire set of blocks and stack the two. and write open in the white space of the second is data from terminal block and change the servo angle to 45 degrees.

Use the forever block to run the script forever. Add a set bluetooth baud rate to block to set Bluetooth's baudrate. And write drop the hat to execute the script.

Step 5: Pairing Dabble With UNO

  • Install Dabble from Play Store and open it in your Smartphone.
  • Next, click on the connect icon.
  • A dialogue box will appear on the screen asking for permission to turn on Bluetooth. Click on ‘Allow’.Once you do so, a list of nearby devices will appear. Select your device’s name.

    In case you don’t see it on the list, go to the Bluetooth settings of your Smartphone and search for it there.If your Smartphone asks for a password to pair it with the device, enter the default password. For HC-05 and HC-06, it is 0000 or 1234. For HM-10 it is 000000 or 123456.
  • A notification will appear in the drop-down menu of the phone once the connection is made.
  • Now, open the Terminal module and you’re ready to go!

Step 6: Final Output:

As soon as you type 'open' the servo angle will change to 45 degrees and when the command is close, set the servo angle to 0 degrees.

Step 7: Opening and Closing the Door Using Smartphone

Let’s try implementing this tutorial in the miniature house that we have made. Connect the Bluetooth module of the house to Dabble. Once done, open Terminal Module and type the command. Don’t even want to type the commands, voice commands are here to save your day!

Explore: You can try controlling the other appliances of the house too using a Smartphone.