esp-01 – Blog eTechPath https://blog.etechpath.com Tue, 03 Jan 2023 12:36:51 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.5 https://blog.etechpath.com/wp-content/uploads/2017/08/BrandLogo12-150x150.png esp-01 – Blog eTechPath https://blog.etechpath.com 32 32 How to control RGB LED wirelessly using ESP8266 WiFi web interface https://blog.etechpath.com/how-to-control-rgb-led-wirelessly-using-esp8266-wifi-web-interface/ https://blog.etechpath.com/how-to-control-rgb-led-wirelessly-using-esp8266-wifi-web-interface/#comments Tue, 21 Nov 2017 22:59:50 +0000 https://blog.etechpath.com/?p=476 About:

In this project we are going to control 1 watt RGB full color LED diode using WiFi module ESP8266-01. You can use any WiFi enabled device to access web interface to control this RGB LED. Watch video at the bottom of this page.




Things you will need: 

  • 1W RGB LED
  • ESP-01  WiFi module
  • 10Ω Resistance
  • ASM1117 3.3v  (or any 3.3v voltage source)
  • USB to TTL converter (for programming esp-01)
  • Momentary push button (optional)
  • Android / Apple / Windows  Phone or any WiFi enabled Laptop / Desktop (to control RGB LED)

Circuit Diagram for programming ESP-01 : 

esp-01_circuit

Steps :

    1. Connect the circuit on breadboard as shown in above circuit diagram for programming ESP-01 WiFi module. You must use only 3.3v logic setting in TTL device.
    2. In this tutorial we will used Arduino IDE to download code into ESP module. So, install Arduino IDE and add supporting board manager and ESP library into it. (Download links are given in download section)



  1. Download and save source code on your computer and open it up using Arduino IDE.
  2. Connect USB to TTL module to your computer.
  3. Open Arduino IDE – Select board ‘Generic ESP8266 Module’ – Select Port of your TTL device (Here’s How to)
  4. Open downloaded code.ino file into arduino and upload the code into ESP module by pressing upload button.
  5. After uploading, Disconnect the ESP module from USB-TTL module and connect it to RGB LED as shown in bellow diagram.

Circuit Diagram for connecting RGB LED:

Steps: 

    1. Connect the final circuit as shown in above diagram and power it up using 5v battery or wall adapter.
    2. ESP module will boot up and LED light will show fade effect in all three colors at startup.



  1. Then open your device WiFi in discovery mode and you will see a new WiFi access point, named as RGB in discovery list.
  2. Connect that WiFi access point, Open any web browser in that device and open ip address 192.168.1.1 , thats it, you will see a colorful RGB control screen to control your wireless RGB LED.
        Note: Do not feed more than 3.3v to ESP-01 module

Source Code : 

/* RGB web server with ESP8266-01 (ESP-01)
* There are only 2 GPIOs available in ESP-01: 0 and 2
* but RX and TX can also be used as: 3 and 1
* Wiring Circuit 
* 0=Red (GPIO0) D3
* 2=Green (GPIO2) D4
* 3=Blue (GPIO3) Rx
* www.etechpath.com
*/

#include <ESP8266WiFi.h>
#include <DNSServer.h>
#include <ESP8266WebServer.h>

const char *ssid = "RGB";
//Uncomment below line if you wish to set a password for ESP wifi network...
// const char *password = "87654321";  

const byte DNS_PORT = 53;
IPAddress apIP(192, 168, 1, 1);   //IP address of your ESP 
DNSServer dnsServer;
ESP8266WebServer webServer(80);

//Webpage html Code
String webpage = ""
"<!DOCTYPE html><html><head><title>RGB control eTechPath.com</title><meta name='mobile-web-app-capable' content='yes' />"
"<meta name='viewport' content='width=device-width' /></head><body style='margin: 0px; padding: 0px;'>"
"<canvas id='colorspace'></canvas>"
"</body>"
"<script type='text/javascript'>"
"(function () {"
" var canvas = document.getElementById('colorspace');"
" var ctx = canvas.getContext('2d');"
" function drawCanvas() {"
" var colours = ctx.createLinearGradient(0, 0, window.innerWidth, 0);"
" for(var i=0; i <= 360; i+=10) {"
" colours.addColorStop(i/360, 'hsl(' + i + ', 100%, 50%)');"
" }"
" ctx.fillStyle = colours;"
" ctx.fillRect(0, 0, window.innerWidth, window.innerHeight);"
" var luminance = ctx.createLinearGradient(0, 0, 0, ctx.canvas.height);"
" luminance.addColorStop(0, '#ffffff');"
" luminance.addColorStop(0.05, '#ffffff');"
" luminance.addColorStop(0.5, 'rgba(0,0,0,0)');"
" luminance.addColorStop(0.95, '#000000');"
" luminance.addColorStop(1, '#000000');"
" ctx.fillStyle = luminance;"
" ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);"
" }"
" var eventLocked = false;"
" function handleEvent(clientX, clientY) {"
" if(eventLocked) {"
" return;"
" }"
" function colourCorrect(v) {"
" return Math.round(1023-(v*v)/64);"
" }"
" var data = ctx.getImageData(clientX, clientY, 1, 1).data;"
" var params = ["
" 'r=' + colourCorrect(data[0]),"
" 'g=' + colourCorrect(data[1]),"
" 'b=' + colourCorrect(data[2])"
" ].join('&');"
" var req = new XMLHttpRequest();"
" req.open('POST', '?' + params, true);"
" req.send();"
" eventLocked = true;"
" req.onreadystatechange = function() {"
" if(req.readyState == 4) {"
" eventLocked = false;"
" }"
" }"
" }"
" canvas.addEventListener('click', function(event) {"
" handleEvent(event.clientX, event.clientY, true);"
" }, false);"
" canvas.addEventListener('touchmove', function(event){"
" handleEvent(event.touches[0].clientX, event.touches[0].clientY);"
"}, false);"
" function resizeCanvas() {"
" canvas.width = window.innerWidth;"
" canvas.height = window.innerHeight;"
" drawCanvas();"
" }"
" window.addEventListener('resize', resizeCanvas, false);"
" resizeCanvas();"
" drawCanvas();"
" document.ontouchmove = function(e) {e.preventDefault()};"
" })();"
"</script></html>";
void handleRoot() 
{
// Serial.println("handle root..");
String red = webServer.arg(0); // read RGB arguments
String green = webServer.arg(1);  // read RGB arguments
String blue = webServer.arg(2);  // read RGB arguments

//for common anode
analogWrite(0, red.toInt());
analogWrite(2, green.toInt());
analogWrite(3, blue.toInt());
//for common cathode
//analogWrite(0,1023 - red.toInt());
//analogWrite(2,1023 - green.toInt());
//analogWrite(3,1023 - blue.toInt());
webServer.send(200, "text/html", webpage);
}
void setup() 
{
pinMode(0, OUTPUT);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);

analogWrite(0, 1023);
analogWrite(2, 1023);
analogWrite(3, 1023);
delay(1000);
WiFi.mode(WIFI_AP);
WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0));
WiFi.softAP(ssid);
dnsServer.start(DNS_PORT, "rgb", apIP);
webServer.on("/", handleRoot);
webServer.begin();
testRGB();
}
void loop() 
{
dnsServer.processNextRequest();
webServer.handleClient();
}
void testRGB() 
{ 
// fade in and out of Red, Green, Blue
analogWrite(0, 1023); // Red off
analogWrite(2, 1023); // Green off
analogWrite(3, 1023); // Blue off

fade(0); // Red fade effect
fade(2); // Green fade effect
fade(3); // Blue fade effect
}
void fade(int pin) 
{
for (int u = 0; u < 1024; u++) 
{
analogWrite(pin, 1023 - u);
delay(1);
}
for (int u = 0; u < 1024; u++) 
{
analogWrite(pin, u);
delay(1);
}
}

 





Downloads:

  1. Code.ino
  2. Arduino IDE
  3. ESP8266 Board link for IDE board manager
  4. ESP8266 Arduino Library

 

]]>
https://blog.etechpath.com/how-to-control-rgb-led-wirelessly-using-esp8266-wifi-web-interface/feed/ 6
DIY pendrive size WiFi repeater using ESP-01 ESP8266 module. https://blog.etechpath.com/diy-pendrive-size-wifi-repeater-using-esp-01-esp8266-module/ https://blog.etechpath.com/diy-pendrive-size-wifi-repeater-using-esp-01-esp8266-module/#comments Thu, 07 Sep 2017 19:38:19 +0000 https://blog.etechpath.com/?p=214 About:

In this project i am going to explain you how to build your own WiFi repeater to extend your home WiFi signal strength. This device is very easy to make and very handy to use. You can use this device at school, college, office or Cafe to extend the WiFi signal without buying expensive WiFi modems from the market.




Components you will need:

  1. ESP-01 or NodeMCU
  2. ASM1117 3.3V voltage converter IC
  3. Male USB connector
  4. USB-UART adapter for programming ESP-01
  5. Android or iOS phone to configure settings.

Circuit Diagram for Programming ESP-01 : 

esp-01_circuit

 

 

Steps: 

    1. Connect ESP-01 to UART adapter as shown in above diagram.
    2. Download firmware files form the bottom of the page, We will flash these files to ESP-01 using ESP flash tools.
    3. Firmware files are in rar folder, So unrar firmware files first and then open ESP flash download tools.
    4. Browse downloaded firmware files into given location as shown in bellow picture and write down where do you want flash the particular file, i.e select 0x00000.bin file and then write location to flash @0x00000 after that select 0x10000.bin file and locate it to 0x10000. (refer bellow screenshot for example)esp8266_repeater_diy
    5. select COM port and hit START button. (If you dont know how to use flash tool, Check this link on Getting started with ESP8266 to flash ESP-01)
    6. After flashing firmware to esp-01, disconnect the circuit and connect USB male port to ESP-01 as given in bellow circuit diagram.ESP-01_Repeater
    7. Now you can power this circuit using any 5v USB wall adapter. So power up this circuit and follow the further steps for configuring WiFi AP settings.
    8. Download Telnet Client Terminal application in your phone. Download links are given in download section at the bottom of this page.



  1. Power up the circuit, default device will create open access point with name MyAP without any password and default IP will be 192.168.4.1, Open WiFi settings in your phone and connect this open access point.
  2. Open Telnet Client Terminal in your phone and add two fields as IP: 192.168.4.1 and Port: 7777, hit connect button.
  3. If everything is ok, terminal will show connected. write command show and hit enter. It will show the current name and password of device STA and AP as shown in bellow screenshot.
  4. Use these commands to update the username and password of your STA and AP.
  • set ssid XXXXXXXX    (your home router SSID)
  • set password XXXXXXXX   (your home router password)
  • set ap_ssid  XXXXXXXX   (new access point name)
  • set ap_password  XXXXXXXX   (new access point password)
  • save    (save configuration)
  • reset   (reset device)
  • show     (this will show updated setting of your device, i.e your routers and access point  username and password)
  • quit     (terminates current remote session)

You are now done with the repeater configuration, reset the ESP once and it will connect your home router with updated ssid and password at the same time it will create an access point with your new access point name and password.



Downloads:

Firmware

ESP Flash Download Tools v3.4.4

Telnet Client Terminal  (Android) (iOS)

 

]]>
https://blog.etechpath.com/diy-pendrive-size-wifi-repeater-using-esp-01-esp8266-module/feed/ 1
Getting Started with ESP8266 WiFi Module https://blog.etechpath.com/getting-started-with-esp8266-wifi-module/ https://blog.etechpath.com/getting-started-with-esp8266-wifi-module/#respond Thu, 31 Aug 2017 01:59:00 +0000 https://blog.etechpath.com/?p=100 ESP8266 :

ESP8266 is advance WiFi chip with complete and standalone networking capabilities. This can be use ether as a standalone or the slave to a host microcontroller. ESP8266 is integrated with advance Tensilica’s L106 diamond series 32 bit micro-processor and on-chip SRAM with CPU clock speed 80MHz. We can also interface external input devices with this chip though provided GPIO’s (general purpose input/output).

For detailed information you can download ESP8266 datasheet here.

 

ESP8266 Modules:

There are several esp8266 modules available in market but only some of them are famous and commonly used. The most commonly used esp modules are ESP-01, ESP-07ESP-12  & ESP-32. Nowadays  ESP-32 is most famous module amongs all of them because ESP-32 is the only version  of ESP which combines WiFi and Bluetooth in single module. You can download datasheets of these modules from attachments.

 

ESP-01 Basic Circuit:

 

ESP-01 Pinout

ESP-01 Pinout

 

How to flash ESP-01 using Flash tools:

  1. Gather all component shown in above circuit and wire your esp to serial module as shown.
  2. Download ESP flash download tool from  the link given at the bottom of the page. You will not need to install this tool in your system, this tool will run directly without installation.
  3. Extract the rar file which we have downloaded in last step and run application file in it and select ESP8266 form selection buttons.
    ESP-flash-tools
    ESP-flash-tools
  4. After selecting ESP8266 download tool button, Flash tool screen will appear like bellow picture.
    ESP-flash-tools2
    ESP-flash-tools
  5. Now go back to your circuit and put jumper JP1 on. For setting ESP-01 into programming mode, you have to short GPIO0 to ground terminal of connected source.
  6. Connect serial module to your computer USB port and check the COM port for this device in device manger. You will need the correct COM port number of the connected device which you want to flash.   ( learn how to check COM port )
  7. That’s it, You are ready to go. Now select the bin files you want to burn into your ESP, select com port at the bottom of the flash tool and hit START. Ongoing process and success message will show in download panel dialog box.
  8. For beginner level you can burn NodeMCU firmware in your ESP-01 for general use.

 

How to Flash NodeMCU firmware in ESP-01:

  1. Download ESP8266 Flasher form the link given bellow at the bottom of this page.
  2. Run the flasher application file. You will see the tool as shown in bellow picture,
    ESP_flasher
    ESP_flasher
  3. Now setup your ESP-01 in programming mode as i described in previous steps. and select the COM port of your serial module.
  4. Do not change any other settings in flasher, setting right port is enough.
  5. Now hit Flash button provided just beside com port and your ESP will start receiving data from flasher. At the same time  AP MAC and STA MAC will appears on flasher as shown in picture bellow,
    NodeMCU flasher
    Programming ESP….
  6.  After successfully completing flashing process green indication will appear at the bottom, This means your ESP is programmed successfully and ready to use.

 

 



Downloads:

  1. ESP Flash Download Tools
  2. ESP Flasher win32
  3. ESP Flasher win6

 

]]>
https://blog.etechpath.com/getting-started-with-esp8266-wifi-module/feed/ 0