Axelta Center of Excellence


DC Motor speed and direction control based on IoT using MQTT protocol

Today's industries are increasingly demanding process automation in all sectors. Automation results into better quality, increased production and reduced costs. The variable speed drives, which can control the speed of A.C/D.C motors, are indispensable controlling elements in automation systems. Depending on the applications, some of them are fixed speed and some of the variable speed drives. Direct current (DC) motors have been used in variable speed drives for a long time. The versatile characteristics of dc motors can provide high starting torques which is required for traction drives. Control over a wide speed range, both below and above the rated speed can be very easily achieved. The methods of DC Motor speed control are simpler and less expensive than those of alternating current motors.

In this project, speed control is attained using PWM (Pulse Width Modulation) technique and PWM generation is done using microcontroller. Pulse width modulation (PWM) is a method for binary signals generation, which has 2 signal periods (high and low). The width (W) of each pulse varies between 0 and the period (T). The main principle is control of power by varying the duty cycle. Here the conduction time to the load is controlled. Let for a time t1, the input voltage appears across the load i.e. ON state and for t2 time the voltage across the load is zero.

In this project we are using NodeMCU to generate PWM signal on its GPIO pins where motor is interfaced using motor driver. To make system IoT enable we are using MQTT - Message Queuing Telemetry Transport is an ISO standard (ISO/IEC PRF 20922) publish - subscribe - based lightweight messaging protocol for use on top of the TCP/IP protocol. We are connecting NodeMCU to MQTT broker over internet using WiFi network. To control speed and direction of motor we can publish user specific data from any other MQTT client from PC/Laptop/Mobile which is then subscribed by NodeMCU MQTT client to control speed of motor.

System Block Diagram

Technologies used

  1. PWM - Pulse width modulation
  2. MQTT - Message Queuing Telemetry Transport
  3. IoT - Internet of Things
  4. Wi-fi

Project area

Industrial IoT applications

Hardware used

  1. Small DC motor
  2. Motor Driver
  3. NodeMCU

Software used

  1. Arduino IDE - for Arduino and NodeMCU programming
  2. MQTT Lens
  3. OSMOSIS MQTT Broker
  4. AWS

Steps to follow to run