USB – Blog eTechPath https://blog.etechpath.com Tue, 03 Jan 2023 12:37:21 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.5 https://blog.etechpath.com/wp-content/uploads/2017/08/BrandLogo12-150x150.png USB – Blog eTechPath https://blog.etechpath.com 32 32 How to setup Arduino IDE board manager & library for ESP8266 module programming https://blog.etechpath.com/how-to-setup-arduino-ide-board-manager-library-for-esp8266-module-programming/ https://blog.etechpath.com/how-to-setup-arduino-ide-board-manager-library-for-esp8266-module-programming/#respond Fri, 19 Jan 2018 06:34:03 +0000 https://blog.etechpath.com/?p=489 About:

In this post i will explain you how to program your ESP8266 board using Arduino IDE software.

 

Things you will need:

  1. ESP8266 Node MCU or any Generic ESP8266
  2. USB to Serial TTL adapter. (CH340, CP2102, FTDI )
  3. 3.3v voltage source.
  4. A computer with Arduino IDE

 

Procedure:

Part 1 : Make your Arduino IDE ready for ESP boards

  1. Install Arduino IDE in your computer if you are using it for first time. (Arduino IDE)
  2. Open Arduino IDE, go to File – Preferences – find Additional board manager URL input box and copy paste below link to it and hit OK button.
    http://arduino.esp8266.com/stable/package_esp8266com_index.json esp8266-Arduino1
  3. Then go to Tools – Board – Board Manager and search for ESP8266, select latest version form the drop-down list and hit install button.
  4. You are done with setting Arduino IDE now, here is a simple video tutorial if you have any doubt with the above procedure..


Part 2 : Installing USB driver for your USB to Serial/TTL adapter

Depending on what adapter you are using for connecting ESP8266 serially with your computer, download and install respective drivers in your computer. Here i am linking some address of widely used programming adapters.

  1. CH340
  2. FTDI
  3. CP2102 

If you are unsure about the present driver ic on your ESP8266 or adapter board, then you can conform it visually form bellow picture.

Part 3 : Connection and uploading your first code to ESP8266

Connect esp8266 board to USB port of your computer and check its COM port (here’s how to) in device manager. Then select your ESP board type and COM port in Arduino IDE, that’s it you are ready to upload your first code.

 

 

 

 

]]>
https://blog.etechpath.com/how-to-setup-arduino-ide-board-manager-library-for-esp8266-module-programming/feed/ 0
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
USB ASP AVR Microcontroller Universal USB Programmer https://blog.etechpath.com/usb-asp-avr-microcontroller-universal-usb-programmer/ https://blog.etechpath.com/usb-asp-avr-microcontroller-universal-usb-programmer/#respond Fri, 08 Sep 2017 20:54:11 +0000 https://blog.etechpath.com/?p=270 About:

USB ASP is stand alone USB programmer for Atmel AVR microcontrollers, It mainly consist of atmega8 micro controller and some supportive components. Works with multiple platforms including linux, MacOS, & windows. This programmer is originally build by Thomas Fischl under GNU GPL 2 licence.

In this post, we will see how to make this programmer using atmega8. You can also use atmega88 or atmega48 instead of atmega8, firmware files for both is attached at download section at the bottom.

 

 

Components List: 

  •  IC :             Atmega8
  • C1, C2 :      18 pF
  • C3:              100 nF
  • Q2:             12MHz  cristal
  • R1 :             10K
  • R6, R2 :     68 Ω
  • R3:             270 Ω
  • R4, R5  :    390 Ω
  • R7 :             1.5 KΩ
  • J1, J2, J3 :       Jumper
  • D1 :                   3mm Red LED
  • D2 :                  3mm Green LED
  • K4 :                  USB male pcb mount

 

Circuit Diagram :

usb_asp_avr_programmer_circuit

usb_asp_isp_hidder_connection

 

Steps: 

  1. Download firmware rar file form download section and unrar the files in folder, it consist of three hex files for atmega8, atmega48 & atmega88. Select one hex file for your microcontroller and flash it in using another working programmer.
  2. You have to change the fuse bits for external crystal as bellow,
    atmega8  HFUSE=0xc9   LFUSE=0xef
    atmega48  HFUSE=0xdd  LFUSE=0xff
    atmega88  HFUSE=0xdd    LFUSE=0xff


    (Note: Put jumper J2 ON, at the time of programming firmware in ASP microcontroller  )


  3. once you are done with the flashing and fuse bit setting, install the USB drivers for your windows. (Drivers are attached at download section)
  4. For installing drivers, Connect USB ASP to your computer (Put jumper J2 OFF ). When windows ask for a driver, choose downloaded win-drivers folder. And it will install drivers to your computer automatically.
  5. Unplug USB asp and plug it again and windows will detect it. Now you can use ASP programmer to program AVR microcontrollers. AVRDUDE or eXtreme Burner GUI are easy to use software’s for USB ASP, Download it from the links given bellow.

 



Software

 

Downloads:

 

]]>
https://blog.etechpath.com/usb-asp-avr-microcontroller-universal-usb-programmer/feed/ 0
How to program XS3868 audio bluetooth module using USB TTL module https://blog.etechpath.com/how-to-program-xs3868-audio-bluetooth-module-using-usb-ttl-module/ https://blog.etechpath.com/how-to-program-xs3868-audio-bluetooth-module-using-usb-ttl-module/#comments Mon, 04 Sep 2017 22:48:48 +0000 https://blog.etechpath.com/?p=205 About :

XS3868 is based on OVC3860 RF transceiver. OCV3860 is low voltage single chip Bluetooth RF transceiver providing Bluetooth stereo solution. OVC3860 is a 2.4GHz transceiver with Bluetooth V2 baseband and can transfer 20bit high quality audio codec. OVC3860 is fetured with inbuilt power management and support advance lithium ion batteries with switch regulator.




In this project we are going to learn how to program XS3868 audio Bluetooth module using TTL USB module. Here you will learn how to change the costume Bluetooth device name and the security password of XS3868 device.

 

Requirments :

  1. XS3868 module
  2. USB TTL serial module
  3. 3.7v li-ion battery or any 3.6v-4.2v voltage source
  4. LED with 470 Ohm resistor (optional)
  5. Compute (to communicate with the device)

 

Circuit Diagram :

xs3868_bluetooth_UART

 

Steps:

    1. Connect xs3868 with battery then wire its reset terminal with 1.8v output terminal of xs3868.
    2. As shown in diagram connect TX of xs3868 to RX of UART module and RX of xs3868 to TX of UART  module.
    3. At last connect UART module GND terminal to common ground of xs3868.



  1. Download  “OVC3860 RevD Develop” tool from link given bellow at download section.
  2. Connect UART module to your computer USB port and check the COM port number for UART device, if it is other than COM-1 then change it to COM-1 first. [Here’s How To]
  3. Open OVC3860 RevD Develop tool with administrative rights, you will see the window similar as below,OVC3860_RevD_Develop_tool
  4. Now reset xs3868 module from reset pin and you will see the your device connected in tool window with green circle on the top.
  5. Now scroll down to item Local Name and Pincode, this is your Bluetooth name and password.
  6. Change it to desired Bluetooth name and password as you want.
  7. Click Write ALL button in tool and if everything went right, you will get Success message pop up on screen.

 

Download Section:

  1. OVC3860 RevD Development tool
  2. OCV3860 AT-Command Set



]]>
https://blog.etechpath.com/how-to-program-xs3868-audio-bluetooth-module-using-usb-ttl-module/feed/ 5