Updated 24 September 2020

Kits and Gadgets Electronics Inc.
Farwaniya, Kuwait 80003
Kuwait

ph: +965 99571844

kits@kits-gadgets.com

  • Electronic Kits
  • Parts on Sale
  • Parts in StockClick to open the Parts in Stock menu
    • Resistor
    • Potentiometer
    • Capacitor
    • Trimmer Capacitor
    • Transistor
    • Crystal
    • Diode
    • LED
    • Diac
    • Thyristor
    • IC Socket
    • IC - Logic
    • IC - Linear
    • IC - Op-Amp
    • IC - VLSI
    • Relay
    • Motor
    • Lamp
    • Transducer
    • Gear
    • Switch
    • Heatsink
    • Parts Store Inventory
  • Brand New Items
  • Used Items
  • Power Supply
  • Raspberry Pi VaultClick to open the Raspberry Pi Vault menu
    • Demonstration Kit
    • Demonstration Kit - R3
    • The P1 Header Guide
    • BBC BASIC Tutorials
    • Activating the GPIO
    • LED Program
    • Motor Program
    • Solenoid Program
    • Stepper Motor
    • 8 Relay Program
    • GPIO as Input
    • Motors and Sensors Connection Diagram
    • Autonomous Program
    • Infrared Sensor
    • Ultrasonic Sensor
    • Camera Controller
    • PWM Program
    • Robotic Arm
    • STRYDER Robot
    • Demo Kit Program
  • Arduino VaultClick to open the Arduino Vault menu
    • Stepper Motor w/ LED
    • DCMotor
  • NodeMCU ProjectsClick to open the NodeMCU Projects menu
    • Running 8 LEDs
    • 8 LEDs and ULN2803
    • 8 LED Active Modes
    • ON-OFF Switch
    • Switch, Relay and LEDs
    • Motor Drive Interface
    • Connecting to Wi-Fi
    • IR Sensor
  • More GPIOsClick to open the More GPIOs menu
    • Accessing the P5 GPIOs
  • Prototypes
  • Computer Parts
  • Picture GalleryClick to open the Picture Gallery menu
    • Other Prototypes
    • Revived HP Laptop
    • Dismantled Helicopter
    • Dismantled Phone
    • ACER Laptop Repair
    • Revived Laptop
    • Inside of Electric Drill
    • Video Cam Automation
    • My Tours and Travels
  • My Original DesignClick to open the My Original Design menu
    • Handycam Automation
    • Autonomous Robot
  • What's New!Click to open the What's New! menu
    • Article-1
    • Article-2
    • Article-3
    • Article-4
    • Article-5
    • Article-6
    • Article-7
    • Article-8
    • Article-9
    • Article-10
    • Article-11
    • Article-12
    • Article-13
    • Article-14
    • Article-15
    • Article-16
    • Article-17
    • Article-18
    • Article-19
    • Article-20
    • Article-21
    • Article-22
    • Article-23
    • Article-24
    • Article-25
    • Article-26
    • Article-27
    • Article-28
    • Article-29
    • Article-30
    • Article-31
  • Forum
  • Video GalleryClick to open the Video Gallery menu
    • IR Proximity Sensor
    • Robot Vacuum Cleaner
    • Robotic Arm - RPi
    • Raspberry Pi Demo Kit
  • About Us
  • Contact Us

Motor Drive Interface

     The schematic diagram below is the simplest way of connecting a DC motor to NodeMCU. It is not possible to connect or drive directly the motor using the NodeMCU due to several reasons. Although some DC motors work even below 3.3 Volts, the variable current and the noise involve when driving a motor may damage the NodeMCU.

Also, since we want to operate the motor with reverse and forward motion or CW / CCW, it is not possible using only the ULN2803 driver IC. Thus, we need to use two relays or a motor driver IC to enable such functionality.

In the diagram, the motor supply terminals are either connected to POSITIVE  or GROUND polarity of the supply line depending on whether the relays are active or not. Two signals from NodeMCU are needed to achieve the needed function of the motor.

The program below can easily be modified to change the direction and the speed of the motor by just changing the state of GPIO and the delay value. 

 

 DIAGRAM

 

 

PHOTO-SHOT

 

 

 VIDEOS

 

1. Full Speed - CW / CCW

2. Speed 1 - CCW

3. Speed 2 - CCW

4. Speed 3 - CCW

5. Speed 4 - CCW


 

PROGRAM

 

/*  Experiment No.10

 

  By: Rolando Estomaguio

        Radar Specialist - Electronics Engineer

        http://www.kits-gadgets.com
 

        Objective: To learn the operation of NodeMCU and utilize its full functionality.  

        Title:  Motor Drive Interface   

        Description:  Drives the motor forward and reverse using two GPIOs. 

*/


// Using GPIO5 and GPIO4 to drive the motor through ULN2803 


void setup() {

    // initialize digital pin 5 and 4 as an output.  

pinMode(05, OUTPUT); 

pinMode(04, OUTPUT);   

}


// the loop function runs over and over again forever

void loop() {


   digitalWrite(05,HIGH);   // connect the motor positive terminal to B+

   digitalWrite(04,LOW);   // connect the motor negative teminal to GROUND 

   delay(2000);   // wait for two seconds

   digitalWrite(05,LOW);   // connect the motor positive terminal to GROUND

   digitalWrite(04,HIGH);   // connect the motor negative terminal to B+ 

   delay(2000);     // wait for two seconds

}

 

 

Copyright 2013 Kits and Gadgets Electronics Inc. All rights reserved.

Web Hosting by Yahoo

Kits and Gadgets Electronics Inc.
Farwaniya, Kuwait 80003
Kuwait

ph: +965 99571844

kits@kits-gadgets.com