IoT Project: Use NodeMCU or D1 Mini to control DC Motor over WiFi with Relay
IoT Project: Use NodeMCU or D1 Mini to control DC Motor over WiFi with Relay
Using this Arduino code we can control a DC motor using ESP8266 NodeMCU or D1 Mini over WiFi either from Computer or tablet or mobile phone.
Your Ardino IDE (Arduino Program) must be ready for ESP8266 (NodeMCU or D1 Mini). Else this code will not work. The link to use in the "preferences" of Arduino IDE https://arduino.esp8266.com/stable/package_esp8266com_index.jsonTopics and Timing of section of video
- 00:50 Introduction
- 02:30 Wiring Explained
- 05:24 Preparing Arduino to work with ESP8266
- 07:45 HTML Page
- 08:45 Arduino Code Explained
- 16:46 Demonstration D1 Mini on Desktop
- 18:50 Demonstration NodeMCU on Desktop
- 19:49 Demonstration NodeMCU on Mobile
- 20:31 Small motor demo
HTML page to control motor using ESP8266
Resources for this sketch
- Preparing your Arduino IDE (Arduino Program) for ESP8266 NodeMCU or D1 Mini
- ESP32 Github repository
- ESP32 Datasheet (pdf)
- Robojax Arduino Course on Udemy
- Get Early Access to my videos via Patreon
Basic code to control direction of rotation of motor with 4 relay
/*
* Contol DC Motor over WiFi using ESP8266
* using 2 channel relay module.
*
* Watch Video instrution for this code:https://youtu.be/zyCdIlPsIXU
*
* Full explanation of this code and wiring diagram is available at
* my Arduino Course at Udemy.com here: http://robojax.com/L/?id=62
* Written by Ahmad Shamshiri on Marc 03, 2020
* in Ajax, Ontario, Canada. www.robojax.com
*
* Get this code and other Arduino codes from Robojax.com
Learn Arduino step by step in structured course with all material, wiring diagram and library
all in once place. Purchase My course on Udemy.com http://robojax.com/L/?id=62
If you found this tutorial helpful, please support me so I can continue creating
content like this. You can support me on Patreon http://robojax.com/L/?id=63
or make donation using PayPal http://robojax.com/L/?id=64
* * This code is "AS IS" without warranty or liability. Free to be used as long as you keep this note intact.*
* This code has been download from Robojax.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Copyright (c) 2015, Majenko Technologies
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
* * Neither the name of Majenko Technologies nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/