Search

Dc Motor Position Control

About the project

Control DC motor position via local web page

Story

This instruction will show how to control motor position via Local web network. Now you can use smart phone or iPad   connected to network, then type address of local web server of motor       

Watch the video!

From here, we can control motor position   disk by rotating the disk on web page       when we touch the disk on webpage, it   will send position setting to web server of motor, then rotate motor disk to   reach that position setting on real time

Step 1: Hardware Needed

To make this project, we will need

1. nodeMCU  https://amzn.to/2PPo5e0

2. H-bridge L298  https://amzn.to/2QS2FeI

3. Motor with encoder  https://amzn.to/2RHsCRj

4. Motor base http://bit.ly/2DZJOZV

The heart of nodeMCU is ESP8266 which allow us connect to local wifi network. It also has GPIO and interrupt, PWM function like others Arduino microcontroller

The motor base is made from MDF wood 3mm thickness, cut by laser cnc machine.

Step 2: Circuit Design

Take a look at circuit design, motor encoder is connected to input pin 4, 5 in which pin 4 also acts as an interrupt pin to count rotation of motor

Pin 12, 13 acts as output pin to control motor moving forward or backward with helps of H-bridge L298

Pin 14 is used with PWM function to control motor speed, in this project, it just push out stable PWM to reduce speed of motor

Then, we made circuit into motor base like the picture.

Step 3: Arduino Code Works

Main part is HTML code which is used for local web screen

Full code can be download here http://bit.ly/2ZkMivK

Java script library is used to make circle disk, and pass value to nodeMCU. The Java lib needed to load to file system of nodeMCU

Step 4: Load the Code to NodeMCU

There are two part to load:

1. Java lib to file system of nodeMCU

The lib is save in folder next to project file, we have to install the tool called "data upload" tool into Arduino directory tool, then restart Arduino IDE.

To upload Java lib, choose following: Tools> ESP8266 Sketch Data Upload

Wait about 1 minute to upload the lib.

"Data upload" tool can be downloaded here http://bit.ly/2tMZWfF

2. Program to node MCU

Using upload function to upload the code as usual Arduino.

Step 5: Test It

That's it! From now, you can use mobile phone or iPad connected to wifi network to control motor position.

Credits

Leave your feedback...