20 October, 2014

DC motor speed control from Mobile App

By Mauricio Hidalgo

In our projects is common to use DC motors in robotics, conveyor belts, in drones, among many other Arduino projects and we want to make a test of DC motor speed control from mobile App using an application created in AppInventor and will make a serial communication via a BlueTooth module HC-06 compatible with Arduino.

 

Steps and materials for DC Motor speed Control from mobile App

The materials for this simple circuit implementation are:

1. Small DC motor that works between 5v and 9v

2 A Bluetooth Module HC-05 or HC-06

3 A transistor BC549

4 Resistance of 100 ohms

5 Diode IN4007

6. Development board Arduino Mega or  Aruino UnoR3

7 Cell Phone with Android Operating System

8 Adapter for Arduino board

It is important to note that how you will control a DC motor, the power required may be greater than that provided by the USB port and therefore it is necessary to use an additional adapter for the Arduino board.

The connection of the motor circuit to Arduino is:

This circuit enables us to control the current passing through the motor using the PWM signal coming from Arduino board, and as the pulse width varies on 9 pin of Arduino board, the base current of the transistor varies too, so the current that flows from the emitter to the collector is directly controlled by the PWM, and this causes that the motor speed increases or decreases as the current flowing from the emitter to the collector of the transistor, in addition to some extent protect the Arduino board. This circuit is usually used to control motors, relays, lamps small, among others, the IN4007 diode protects the transistor from the inverse current.

Below are images from the design of the application, which was made in AppInventor and it is the same app that was used for our previous test “Servo Control via Mobile App“, located on youtube, but it is necessary to vary the maximum value of slider on the application and in my case assigned a value of 1023.

If you do not remember how to connect the Bluetooth module, here I leave the LINK where you can find a diagram of the connection.

The code to program the Arduino board can be found on download section at the following LINK, there basically what you do is a serial communication with the bluetooth module and the information coming from the slider that appears on the mobile app, this information is stored in a variable and the value of this variable takes the value of the PWM which is then sent via pin 9 of the Arduino Mega board to control the motor.

Finally I share the video where the operation of the application controlling the speed of DC motor is shown.

SCHEMATIC:

DC motor control app

If you liked this small test, please share it.