Showing posts with label esp8266. Show all posts
Showing posts with label esp8266. Show all posts

Saturday, August 27, 2016

Fritzing parts of ESP8266 based WiFi module

Fritzing parts of ESP8266 based WiFi module


Just find a GitHub provide Fritzing part for an ESP8266-based WiFi module.


Get

Read more »

First look at the WeMos D1 Arduino compatible ESP8266 Wifi Board from Banggood com

First look at the WeMos D1 Arduino compatible ESP8266 Wifi Board from Banggood com


This video take a look at the WeMos D1: a Wi-Fi enabled Arduino compatible board based on the ESP8266 chip. The price of it is so tempting, less than 9$.


The board looks like an ordinary Arduino board. The dimensions and the pin layouts are exactly the same. So, this board is compatible with all the existing shields for Arduino. But don’t expect them to work at once, since the libraries available for the ESP8266 chip are few so far. The board, instead of an ATMEGA chip that standard Arduino boards use, use the impressive ESP8266 WiFi chip!

The ESP8266EX chip that the WeMos D1 board uses offers:
• A 32 bit RISC CPU running at 80MHz
• 64Kb of instruction RAM and 96Kb of data RAM
• 4MB flash memory! Yes that’s correct, 4MB!
• Wi-Fi
• 16 GPIO pins
• I2C,SPI
• I2S
• 1 ADC

--------------------
CODE OF THE PROJECT
--------------------
http://educ8s.tv/arduino-esp8266-tutorial-first-look-at-the-wemos-d1-arduino-compatible-esp8266-wifi-board/

Get

Read more »

Friday, August 26, 2016

ESP 05 mini ESP8266 WiFi module

ESP 05 mini ESP8266 WiFi module


ESP-05 is a mini size WiFi module of ESP8266 family. Almost half size of ESP-01, no on-board antenna, with five-pin in SIL, more breadboard friendly.





Its 5 pins on the board:
- RST
- GND
- URXD
- UTXD
- VCC3V3




First test AT Command and check firmware:

To test ESP-05 with AT Command, we connect ESP-05 to PC via FTDI USB-to-Serial adapter, as shown:

(The Fritzing part of ESP8266-05 can be found HERE)

- Run Arduino IDE
- Select connected port
- Open Tools > Serial Monitor
- Select Booth NL & CR, 115200 baud
- Power on ESP-05
- Then you can enter AT command as show in this video:


To check the firmware, enter the command AT+GMR:
AT+GMR

AT version:0.40.0.0(Aug 8 2015 14:45:58)
SDK version:1.3.0
Ai-Thinker Technology Co.,Ltd.
Build:1.3.0.2 Sep 11 2015 11:48:04
OK


Connect with Arduino Mega 2560 via Level Converter:


In this step, we are going to connect ESP-05 to Arduino Mega 2560, such that we can send command to ESP-05 by Mega. Because Mega is work on 5V, and ESP-05 work on 3.3V, so we need a Level Converter.

Connect as shown:


(Alternatively, you can simple use a voltage divider of 2 resistors to convert 5V Mega TX to 3.3V ESP-05 RX, ESP-05 TX can direct connect to Mega RX, to achieve the same job.)

Enter the code run on Mega. This program simple accept command from PC forward to ESP-05, receive response from ESP-05, forward to PC.

Mega_ESP05_test.ino
int LED = 13;
boolean LEDst = false;

void setup() {
Serial.begin(115200);
Serial3.begin(115200);
pinMode(LED, OUTPUT);
digitalWrite(LED, LEDst);
}

void loop() {
while (Serial.available() > 0) {
char a = Serial.read();
Serial3.write(a);
}

}

void serialEvent3() {
while (Serial3.available() > 0) {
char a = Serial3.read();
Serial.write(a);
ToggleLED();
}
}

void ToggleLED(){
digitalWrite(LED, LEDst = !LEDst);
}

Such that we can enter command as in "First test AT Command and check firmware" above. This step aim to make sure the connection between Mega and ESP-05 is correct.

Example:
- ESP-05(ESP8266) + Arduino Mega, act as simple web server

Get

Read more »

Friday, August 12, 2016

ESP8266 Witty Cloud Development Board with ESP 12F module

ESP8266 Witty Cloud Development Board with ESP 12F module







Get

Read more »

Tuesday, August 9, 2016

1ST ANNUAL ESP8266 DESIGN CONTEST

1ST ANNUAL ESP8266 DESIGN CONTEST


Cash price awarded for 1st 2nd and 3rd place, of $1000 $500 and $250 USD an extra $250 onto these prizes if its open hardware or open software.

Both hardware and software projects can be entered. Hardware must have ESP8266EX SoC onboard, and software projects must support the ESP8266 platforms.

- See more at: http://www.esp8266.com/viewtopic.php?f=47&t=7955#p42113

Get

Read more »

Saturday, August 6, 2016

ESP 05 ESP8266 Arduino Mega act as simple web server

ESP 05 ESP8266 Arduino Mega act as simple web server


Last post introduced ESP-05 (a mini ESP8266 board) with simple testing. This post show a very simple web server on Arduino Mega 2560 + ESP-05.

Basically, its same as the example of "Arduino + ESP8266 - Web Server (III) with firmware 00200.9.5(b1)", except the baud rate.


Mega_ESP05_Web.ino
/*
Arduino Mega 2560 + ESP-05(ESP8266)

ESP-05 running firmware:
AT version:0.40.0.0(Aug 8 2015 14:45:58)
SDK version:1.3.0
Ai-Thinker Technology Co.,Ltd.
Build:1.3.0.2 Sep 11 2015 11:48:04

Connection between Mega & ESP-05,
refer "Connect with Arduino Mega 2560 via Level Converter" in:
http://goo.gl/wtG89i

Mega + ESP_05 act as station, join WiFi AP of my phone.
Once server setup, you can visit the webpage in ESP-05
by visit the IP show in Serial Monitor, under the command:
AT+CIFSR
+CIFSR:STAIP,"192.168.43.15"

If always show "Module have no response.",
check your connection, or reset ESP-05 by power OFF and ON.

*/
#define ASCII_0 48
#define ESP8266 Serial3

//WiFi hotspot setting on my phone
String SSID = "ssid";
String PASSWORD = "password";

int LED = 13;

boolean FAIL_8266 = false;

String strHTML1 = "<!doctype html>
<html>
<head>
<title>arduino-er</title>
</head>
<body>
<H1>arduino-er.blogspot.com</H1>";

String strHTML2 = "</body>
</html>";

//String strHTML = "arduino-er.blogspot.com";

#define BUFFER_SIZE 128
char buffer[BUFFER_SIZE];

void setup() {
pinMode(LED, OUTPUT);

digitalWrite(LED, LOW);
delay(300);
digitalWrite(LED, HIGH);
delay(200);
digitalWrite(LED, LOW);
delay(300);
digitalWrite(LED, HIGH);
delay(200);
digitalWrite(LED, LOW);

do{
Serial.begin(115200);
ESP8266.begin(115200);

//Wait Serial Monitor to start
while(!Serial);
Serial.println("--- Start ---");

ESP8266.println("AT+RST");
delay(1000);
if(ESP8266.find("ready"))
{
Serial.println("Module is ready");

ESP8266.println("AT+GMR");
delay(1000);
clearESP8266SerialBuffer();

ESP8266.println("AT+CWMODE=1");
delay(2000);

//Quit existing AP, for demo
Serial.println("Quit AP");
ESP8266.println("AT+CWQAP");
delay(1000);

clearESP8266SerialBuffer();
if(cwJoinAP())
{
Serial.println("CWJAP Success");
FAIL_8266 = false;

delay(3000);
clearESP8266SerialBuffer();
//Get and display my IP
sendESP8266Cmdln("AT+CIFSR", 1000);
//Set multi connections
sendESP8266Cmdln("AT+CIPMUX=1", 1000);
//Setup web server on port 80
sendESP8266Cmdln("AT+CIPSERVER=1,80",1000);

Serial.println("Server setup finish");
}else{
Serial.println("CWJAP Fail");
delay(500);
FAIL_8266 = true;
}
}else{
Serial.println("Module have no response.");
delay(500);
FAIL_8266 = true;
}
}while(FAIL_8266);

digitalWrite(LED, HIGH);

//set timeout duration ESP8266.readBytesUntil
ESP8266.setTimeout(1000);
}

void loop(){
int connectionId;

if(ESP8266.readBytesUntil( , buffer, BUFFER_SIZE)>0)
{
Serial.println("Something received");
Serial.println(buffer);
if(strncmp(buffer, "+IPD,", 5)==0){
Serial.println("+IPD, found");
sscanf(buffer+5, "%d", &connectionId);
Serial.println("connectionId: " + String(connectionId));
delay(1000);
clearESP8266SerialBuffer();

sendHTTPResponse(connectionId, strHTML1);
sendHTTPResponse(connectionId, "<hr/>-END-<br/>");
sendHTTPResponse(connectionId, strHTML2);

//Close TCP/UDP
String cmdCIPCLOSE = "AT+CIPCLOSE=";
cmdCIPCLOSE += connectionId;
sendESP8266Cmdln(cmdCIPCLOSE, 1000);
}
}
}

void sendHTTPResponse(int id, String response)
{
String cmd = "AT+CIPSEND=";
cmd += id;
cmd += ",";
cmd += response.length();

Serial.println("--- AT+CIPSEND ---");
sendESP8266Cmdln(cmd, 1000);

Serial.println("--- data ---");
sendESP8266Data(response, 1000);
}

boolean waitOKfromESP8266(int timeout)
{
do{
Serial.println("wait OK...");
delay(1000);
if(ESP8266.find("OK"))
{
return true;
}

}while((timeout--)>0);
return false;
}

boolean cwJoinAP()
{
String cmd="AT+CWJAP="" + SSID + "","" + PASSWORD + """;
ESP8266.println(cmd);
return waitOKfromESP8266(10);
}

//Send command to ESP8266, assume OK, no error check
//wait some time and display respond
void sendESP8266Cmdln(String cmd, int waitTime)
{
ESP8266.println(cmd);
delay(waitTime);
clearESP8266SerialBuffer();
}

//Basically same as sendESP8266Cmdln()
//But call ESP8266.print() instead of call ESP8266.println()
void sendESP8266Data(String data, int waitTime)
{
//ESP8266.print(data);
ESP8266.print(data);
delay(waitTime);
clearESP8266SerialBuffer();
}

//Clear and display Serial Buffer for ESP8266
void clearESP8266SerialBuffer()
{
Serial.println("= clearESP8266SerialBuffer() =");
while (ESP8266.available() > 0) {
char a = ESP8266.read();
Serial.write(a);
}
Serial.println("==============================");
}





download filesDownload the file .

Get

Read more »

Thursday, August 4, 2016

esp8266 OLED esp8266 Arduino library for I2C OLED displays

esp8266 OLED esp8266 Arduino library for I2C OLED displays



esp8266-OLED is an esp8266-Arduino library for I2C-OLED displays. This post show how to download and install to Arduino IDE, and test with example.

- Its assumed you are programming NodeMCU on Arduino Software, with ESP8266 core for Arduino installed.

- Connect I2C OLED to NodeMCU.


OLED VCC - NodeMCU 3v3
OLED GND - NodeMCU GND
OLED SCL - NodeMCU D1
OLED SDA - NodeMCU D2

(reamrk: the Fritzing parts of can OLED_SSD1306_I2C_128x64 can be download HERE)


- Add esp8266-OLED library to Arduino Software:
visit https://github.com/klarsys/esp8266-OLED, follow the steps to install the library:
  • Click on the Download ZIP button in the top right corner.
  • Uncompress it.
  • Rename the uncompressed folder to OLED.
  • Check that the OLED folder contains OLED.cpp and OLED.h files.
  • Place the OLED folder in your <arduinosketchfolder>/libraries/ folder - you may need to create the libraries subfolder if it is your first library.
  • Restart the IDE.

Open the example,
File > Examples > ESP8266-OLED Display Library > example

In order to match with our connection, we have to modify it to correct SDA and SCL pins:
change the code:
OLED display(2, 14);

to
OLED display(4, 5);

where 4, 5 correspond to NodeMCU D2 and D1. Refer to the "The pin definition" in NodeMCU - ESP8266/CP2102.

// Example sketch for testing OLED display

// We need to include Wire.h for I2C communication
#include <Wire.h>
#include "OLED.h"

// Declare OLED display
// display(SDA, SCL);
// SDA and SCL are the GPIO pins of ESP8266 that are connected to respective pins of display.
OLED display(4, 5);

void setup() {
Serial.begin(9600);
Serial.println("OLED test!");

// Initialize display
display.begin();

// Test message
display.print("Hello World");
delay(3*1000);

// Test long message
display.print("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
delay(3*1000);

// Test display clear
display.clear();
delay(3*1000);

// Test message postioning
display.print("TOP-LEFT");
display.print("4th row", 4);
display.print("RIGHT-BOTTOM", 7, 4);
delay(3*1000);

// Test display OFF
display.off();
display.print("3rd row", 3, 8);
delay(3*1000);

// Test display ON
display.on();
delay(3*1000);
}

int r = 0, c = 0;

void loop() {
r = r % 8;
c = micros() % 6;

if (r == 0)
display.clear();

display.print("Hello World", r++, c++);

delay(500);
}

Result:




Related:
- Another library of I2C OLED for ESP8266 core for Arduino - Adafruit SSD1306 library
- esp8266-oled-ssd1306 library

Get

Read more »

Thursday, July 28, 2016

Blink NodeMCU on board LED using Arduino IDE with ESP8266 core for Arduino and more examples

Blink NodeMCU on board LED using Arduino IDE with ESP8266 core for Arduino and more examples



To program NodeMCU in Arduino IDE, we have to install esp8266 board (ESP8266 core for Arduino) to Arduino IDE.

Add Additional Board Manager URL for ESP8266 board:
> File > Preference

Add "http://arduino.esp8266.com/stable/package_esp8266com_index.json" in Additional Board Manager URLs.


Add ESP8266 board to Arduino IDE:
- Open Boards Manager in Arduino IDE
- Search "esp8266" or "NodeMCU", you will find "esp8266 by ESP8266 Community". Install it.


Test:
Once esp8266 board installed, you can find an example to blink the on-board LED.
File > Examples > ESP8266 > Blink

/*
ESP8266 Blink by Simon Peter
Blink the blue LED on the ESP-01 module
This example code is in the public domain

The blue LED on the ESP-01 module is connected to GPIO1
(which is also the TXD pin; so we cannot use Serial.print() at the same time)

Note that this sketch uses LED_BUILTIN to find the pin with the internal LED
*/

void setup() {
pinMode(LED_BUILTIN, OUTPUT); // Initialize the LED_BUILTIN pin as an output
}

// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, LOW); // Turn the LED on (Note that LOW is the voltage level
// but actually the LED is on; this is because
// it is acive low on the ESP-01)
delay(1000); // Wait for a second
digitalWrite(LED_BUILTIN, HIGH); // Turn the LED off by making the voltage HIGH
delay(2000); // Wait for two seconds (to demonstrate the active low LED)
}

You can upload it to NodeMCU, to toggle the on-board LED.


notice:
- Once the ModeMCU programmed, the original firmware will be erased. To restore the original firmware with Lua shell, you have to flash the firmware again.

Next:
- Read NodeMCU MAC address using Arduino IDE with esp8266 library
- Get my IP address
- Run diagnosis
- NodeMCU to read analog input, A0
- NodeMCU act as WiFi client to update dweet.io
- Display on 128x64 I2C OLED, using Adafruit SSD1306 and GFX libraries
- esp8266-OLED, another esp8266-Arduino library for I2C-OLED displays
- NodeMCU/ESP8266 act as AP (Access Point) and simplest Web Server
- NodeMCU/ESP8266 act as AP (Access Point) and web server to control GPIO
- NodeMCU/ESP8266 implement WebSocketsServer to control RGB LED
- NodeMCU/ESP8266 WebSocketsServer, load html from separate file in flash file system

Get

Read more »