Posts

Showing posts from October, 2024

ESP8266 NodeMCU interfacing with stepper motor 28BYJ-48 with ULN2003 driver board on Aduino IDE

Image
Powering stepper motor using ESP 8266 NodeMCU In this tutorial, we will learn about most widely used by beginners as low cost stepper motor 28BYJ-48 5VDC. Stepper motors are used in applications where rotation angle/step is critical for accomplishment of a task. As in a vending machine where the coil holding product must rotate for a fixed angle to dispense the product any less product wont be dispensed any thing more will dispense multiple products.  We will now learn about 28BYJ-48 stepper motor and ULN2003 driver board. This stepper motor has 5 wires and works both full step and half step. Read more here . ULN2003 driver board has DC 5-12V pins along with on/off short terminals, it has 4 input pins for connecting to a micro controller. In our case it would be esp 8266/NodeMCU. Hardware requirements 1. NodeMCU 2. Multi Voltage Output Power Module 3. ULN2003 stepper motor driver board 4. 28BYJ-48 5VDC stepper motor 5. Jumper wires Connections 1. Stepper motor in ULN2003 driver boa...

1 channel power relay module with adjustable timing cycle explained | HCW-M421

Image
Use of 1 channel power relay module with adjustable timing cycle - HCW M421 In this tutorial,  we will understand the usage of delay timer relays and different modes of operation.  Delay timer relays are used when a sequential flow of control over devices is needed, in triggering alarms, repeating tasks in loops, signalling etc. In fact your washing machines/dish washer uses it to handle cycles and to delay cycle start. I am going to use HCW-M421 module for this tutorial. It has majorly 4 modes of operation with few modes having sub modes as well.  Front view Back View It has a built in 5v mini usb power input which is very handy. It also has a 6-30V and GND for powering the relay in case mini usb is not being used. It has a trigger and GND_T to be connected from a micro controller or a trigger generator. In this example, i will be using 3.3v power module as trigger generator. It has 3 output terminals  (NO,COM,NC) similar to a 1 channel relay module as explained in ...

NodeMCU interfacing with 4 channel relay | ESP 8266

Image
Interfacing 4 channel Relay with NodeMCU Did you ever wonder, whats present inside a smart switch socket or a touch switch board. It has relays inside  ðŸ˜ƒ. Imagine controlling a device from any where over internet. Now that can be achieved using two major components as described below. In the last tutorial , we have learned about 2 channel relay and interfacing with ESP 01 and NodeMCU. In this tutorial, we will explore 4 channel relay with NodeMCU.  A 4 channel relay is similar to four 1 channel or two 2 channel relays kept side by side. It can control 4 high voltage devices with 4 input triggers from low voltage device like NodeMCU.   Hardware Requirements 1. NodeMCU 2. 4 Channel Relay 3. Jumper wires Go to Aurdino IDE, Select Tools -> Board -> ESP 8266 Boards -> NodeMCU 1.0 This will allow you to have D1, D2 etc in the code and wont result in a compile error. Connections NodeMCU Relay 3v Vcc GND GND D1 IN1 D2 IN2 D3 IN3 ...

2 Channel Relay interfacing with ESP 01 & NodeMCU | ESP 8266 | Control two high voltage devices.

Image
In this tutorial, we will explore two channel relay. If you missed 1-channel relay interfacing read this tutorial . This is an extension and will introduce ESP 01 and ESP 8266 together.  You can think of 2 channel relay as two 1-channel relays placed side by side. Relay needs 2 input triggers to operate each relay.  Hardware Requirements 1. NodeMCU 2. ESP 01 3. Jumper wires 4. 2 Channel Relay (Active LOW trigger) 5. Multi output voltage power module We will use the same code for both ESP 01 and ESP 8266. We will use GPIO pins 0 and 2. GPIO0 is D3  and GPIO2 is D4 on NodeMCU. void setup ( ) {   pinMode ( 0 , OUTPUT ) ;   pinMode ( 2 , OUTPUT ) ;   digitalWrite ( 0 , HIGH ) ;   digitalWrite ( 2 , HIGH ) ; } void loop ( ) {   digitalWrite ( 0 , LOW ) ;   digitalWrite ( 2 , HIGH ) ;   delay ( 3000 ) ;   digitalWrite ( 0 , HIGH ) ;   digitalWrite ( 2 , LOW ) ;   delay ( 3000 ) ; } Above code wil...

ESP 8266/NodeMCU interfacing with DS1307 RTC Module

Image
NodeMCU interfacing with DS1307 RTC module In this tutorial, we will know about Real Time Clock (RTC) module (DS1307 variant) and try to set and get time from the module. RTC modules are used to maintain clock on a device. It has a slot for battery which keep the clock ticking even if external power source is off. In the experiment i have placed CR2032 (3V) Lithium battery to keep clock running.  DS1307 module has several pins of these we will use Serial Clock Line (SCL) and  Serial Data Line(SDA) for i2c communication.  Vcc and GND are for powering the module. Hardware requirements 1. NodeMCU  2. DS1307 Module 3. 3V CR2032 Lithium Battery 4. 4 Jumper wires Connections NodeMCU DS1307 3V Vcc GND GND D1 SCL D2 SDA Install RTCLib library. Goto Sketch -> Include Library -> Manage Library. Search for RTClib Sketch #include < ESP8266WiFi . h > #include < ESP8266WebServer . h > #include < Wire . h > #include "RTClib.h" #i...

Using ESP in AP and STA mode using wifi manager | ESP| WIFI| Part-3

Image
Using ESP with Wifi manager In the last two tutorials, we have seen usage of AP mode and STA mode. In this tutorial we will see both AP and STA being used in conjunction. We have hard coded SSID and password in STA mode earlier, now we will see a way to select among multiple SSIDs and switch between them and have a wifi network setup in AP. We will use WifiManager to manager multiple SSIDs. Here how it will work. 1. Wifi Manager will attempt to connect with any know SSID and password combination. If it doesnt find a connection. 2. Wifi manager will setup an Access point and any device with a browser can connect to it at default 196.168.4.1 and then select SSID from scaned networks. 3. Once SSID is selected. ESP will be set to STA mode up on successful connection. This SSID will be stored for future connection attempts.  4. Up on restart if the stored SSID cannot be connected, ESP will be set to AP mode and process repeats. Wifi manager is useful to setup devices for the first tim...

Using ESP 01 Wifi in STAtion (STA) mode | ESP wifi tutorial | Part - 2

Image
ESP - 01 Fetch time from NTP server in STA mode In last tutorial , we use ESP 01 AP mode to control relay switch. In this tutorial we will use STAtion (STA) mode to fetch time from Network Time Protocol (NTP) server and display it on serial monitor. In this mode ESP - 01 will connect to existing wifi network just like any other mobile/device connecting to a home network. This mode allow ESP to connect to internet and send/receive information. Code #include "time.h" #include < ESP8266WiFi . h > const char * ssid = "Sensorism" ;  // To be changed const char * password = "ESP01STAModeExample" ; // To be changed const char * ntpServer = "pool.ntp.org" ; const long   indOffSet = 19800 ;    //Replace with your GMT offset (seconds), current is for INDIA void setup ( ) {   Serial . begin ( 115200 ) ;   WiFi . begin ( ssid , password ) ;   delay ( 2000 ) ;   while ( WiFi . status ( ) != WL_CONNECTED ) { ...

Using ESP 01 in Access Point (AP) mode to control ESP relay switch | ESP wifi tutorial | Part - 1

Image
Control ESP relay switch using wifi access point on ESP 01 In the last tutorial , we have seen how to control relay using ESP 01 as micro controller. In this tutorial, i will attempt to introduce ESP relay switch designed to work seamlessly with ESP 01.  we will also control the relay in built wifi capability of ESP 01. We will attempt to use Access Point (AP) Mode which allows devices like mobile, laptop and other esps to connect to wifi network created by esp. This mode can be used to create a local network to control and communicate between master and slave nodes. We will setup a web server on ESP 01, use it to change relay state on a android mobile. ESP Relay Switch This is a relay switch with inbuilt slot for ESP 01. It has 5v and GND terminal to power relay and ESP 01. It has NC, COM and NO terminal to collect output of the relay. ESP relay switch front and back view. Hardware requirements 1. ESP relay switch. 2. Multi output voltage converter power module 3. Led Strip connec...