Académique Documents
Professionnel Documents
Culture Documents
com
1
www.keyestudio.com
Guide Content
Description:........................................................................................................................................................................3
Technical Details:.............................................................................................................................................................. 3
More Resources:............................................................................................................................................................. 33
2
www.keyestudio.com
Description:
This keyestudio ESP8266 WI-FI development board is based on the
ESP8266-12FWIFI module developed by Ai-Thinker.
The processor ESP8266 integrates the industry-leading Tensilica L106
ultra-low-power 32-bit micro MCU in a smaller package, with 16-bit Lite
mode. The main frequency supports 80MHz and 160 MHz.
It supports RTOS, integrated with Wi-Fi MAC/BB/RF/PA/LNA. Onboard
comes with curved antenna.
This development board is a standalone network controller, which can add
networking function to those existing devices.
It has 11 I/O ports (4 of which can be used as PWM output), and all I/O
ports operate at 3.3V. It also comes with an AD input interface, supporting
the voltage range of 0-3.3V.
The board can be powered via the USB port, or with an external power
supply (DC 7-12V), or powered by the female headers Vin/GND (DC
7-12V).
Technical Details:
Microcontroller: ESP8266-12F
Operating Voltage: 3V3
Input Voltage (recommended): DC 7-12V
Digital I/O Pins: 8
(GPIO2, GPIO4, GPIO5, GPIO12, GPIO13, GPIO14, GPIO15, GPIO16)
Analog Input Pins: 1 (A0)
IO output maximum current: 12 mA
Main frequency supports 80 MHz and 160 MHz
LED_BUILTIN: GPIO 14
Comes with an external power jack (DC 7-12V)
Dimensions: 54mm*56mm*15mm
3
www.keyestudio.com
4
www.keyestudio.com
5
www.keyestudio.com
When programming the control board, first you should install the Arduino
software and driver.
You can download the different versions for different systems from the link
below:
https://www.arduino.cc/en/Main/OldSoftwareReleases#1.5.x
NOTE: this control board is only compatible with Arduino 1.6.5 version or latest.
In the following, we will download the Arduino 1.6.5 version.
6
www.keyestudio.com
In this Windows system page, there are two options. One is Windows version, the
other is Windows Installer.
For Windows Installer, you can download the installation file, this way you need
to install the arduino IDE.
For simple Windows version, you can download the software directly, do not need
to install, just directly use the software after unzip the file.
7
www.keyestudio.com
Click JUST DOWNLOAD. When the ZIP file is downloaded well to your computer,
you can directly unzip the file. Open the Arduino-1.6.5-r5 folder, you should get it
as follows.
8
www.keyestudio.com
Click the icon of ARDUINO software to open it. This is your Arduino.
9
www.keyestudio.com
The USB to serial port chip of this control board is CH340G. So you need to install
the driver for the chip. You can click the driver file here usb_ch341_3.1.2009.06
to download it.
In different systems, the driver installation is similar. Here we start to install the
driver on the Win7 system.
Plug one end of your USB cable into the Keyestudio ESP8266 WI-FI board and the
other into a USB socket on your computer.
When you connect the ESP8266 WI-FI board to your computer at the first time,
right click your “Computer” —>for “Properties”—> click the “Device manager”,
under Other devices, you should see the “USB2.0-Serial”.
10
www.keyestudio.com
Then right-click on the USB2.0-Serial and select the top menu option (Update
Driver Software...) shown as the figure below.
11
www.keyestudio.com
After that, select the option to browse and navigate to the “drivers” folder of
usb-ch341 installation.
12
www.keyestudio.com
Once the software has been installed, you will get a confirmation message.
Installation completed, click “Close”.
Up to now, the driver is installed well. Then you can right click “Computer”
—>“Properties”—>“Device manager”, you should see the device as the figure
shown below.
13
www.keyestudio.com
Double-click the icon of Arduino software downloaded well, you will get the
interface shown below.
(Note: if the Arduino software loads in the wrong language, you can change it in
the preferences dialog. See the environment page for details.)
14
www.keyestudio.com
Arduino
Upload
the Arduino
Serial Monitor
15
www.keyestudio.com
First, plug one end of your USB cable into the Keyestudio ESP8266 WI-FI board
and the other into a USB socket on your computer.
Then open the Arduino IDE, click the “File” to select the “Preferences”.
16
www.keyestudio.com
After that, click “Tools”, for “Board”, enter the Boards Manager, it will
automatically download the relevant file. Shown below.
17
www.keyestudio.com
18
www.keyestudio.com
Done downloading the relevant file, it will pop up the window below. Then enter
the 8266 on the blank bar and click Install.
19
www.keyestudio.com
Installation completed, click Close, then click “Tools”, for “Board”, you should see
the Generic ESP8266 Module. Shown below.
20
www.keyestudio.com
Before upload the code to test your board, you should first add all the libraries
into the libraries folder of Arduino-1.6.5-r5. You can click the link to download all
the libraries needed.
https://drive.google.com/open?id=11mTs_DbCIx-PQHPjfZOAekBZ7IL8al3D
21
www.keyestudio.com
Open the Arduino IDE, you’ll need to click the “Tools”, then select the Board and
the Serial Port.
You can check the Serial Port on your computer’s Device Manager.
22
www.keyestudio.com
23
www.keyestudio.com
24
www.keyestudio.com
Add well all the libraries mentioned above, and select well the Board and Port, you
should upload the code to test your board.
Below is an example code, you can copy and paste it on Arduino IDE. pay
attention that if you fail to upload the code, you should firstly press the RESET
button, then long press down the FLASH button until the code upload
successfully, finally release the button.
NOTE: in the code, you should modify the WIFI name and password here:
const char* WIFI_SSID = "HUAWEI-3L9ML8";
const char* WIFI_PWD = "75785302";
********************************************************************
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <Ticker.h>
#include <JsonListener.h>
#include "SSD1306Wire.h"
#include "OLEDDisplayUi.h"
#include "Wire.h"
#include "WorldClockClient.h"
#include "icons.h"
#include "fonts.h"
#define SDA_PIN 5//oled_SDA
#define SCL_PIN 4//oled_SCL
/***************************
* Begin Settings
**************************/
// WIFI
25
www.keyestudio.com
const char* WIFI_SSID = "HUAWEI-3L9ML8";
const char* WIFI_PWD = "75785302";
// Setup
const int UPDATE_INTERVAL_SECS = 10 * 60; // Update every 10 minutes
// Display Settings
const int I2C_DISPLAY_ADDRESS = 0x3c;
// TimeClient settings
/***************************
* End Settings
**************************/
String timeZoneIds [] = {"America/New_York", "Europe/London", "Europe/Paris", "Australia/Sydney"};
WorldClockClient worldClockClient("de", "CH", "E, dd. MMMMM yyyy", 4, timeZoneIds);
Ticker ticker;
26
www.keyestudio.com
readyForUpdate = false;
delay(1000);
}
void drawClock(OLEDDisplay *display, int x, int y, int timeZoneIndex, String city, const char* icon) {
display->setTextAlignment(TEXT_ALIGN_LEFT);
display->setFont(ArialMT_Plain_10);
display->drawString(x + 60, y + 5, city);
display->setFont(Crushed_Plain_36);
display->drawXbm(x, y, 60, 60, icon);
display->drawString(x + 60, y + 15, worldClockClient.getHours(timeZoneIndex) + ":" +
worldClockClient.getMinutes(timeZoneIndex));
27
www.keyestudio.com
drawClock(display, x, y, 3, "Sydney", sydney_bits);
}
void setReadyForWeatherUpdate() {
Serial.println("Setting readyForUpdate to true");
readyForUpdate = true;
}
void setup() {
Serial.begin(115200);
Serial.println();
Serial.println();
// initialize dispaly
display.init();
display.clear();
display.display();
//display.flipScreenVertically();
display.setFont(ArialMT_Plain_10);
display.setTextAlignment(TEXT_ALIGN_CENTER);
display.setContrast(255);
WiFi.begin(WIFI_SSID, WIFI_PWD);
int counter = 0;
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
display.clear();
display.drawString(64, 10, "Connecting to WiFi");
28
www.keyestudio.com
display.drawXbm(46, 30, 8, 8, counter % 3 == 0 ? activeSymbol : inactiveSymbol);
display.drawXbm(60, 30, 8, 8, counter % 3 == 1 ? activeSymbol : inactiveSymbol);
display.drawXbm(74, 30, 8, 8, counter % 3 == 2 ? activeSymbol : inactiveSymbol);
display.display();
counter++;
}
ui.setTargetFPS(30);
// Add frames
ui.setFrames(frames, numberOfFrames);
Serial.println("");
updateData(&display);
ticker.attach(UPDATE_INTERVAL_SECS, setReadyForWeatherUpdate);
void loop() {
29
www.keyestudio.com
if (readyForUpdate && ui.getUiState()->frameState == FIXED) {
updateData(&display);
}
if (remainingTimeBudget > 0) {
// You can do some work here
// Don't do stuff if you are below your
// time budget.
delay(remainingTimeBudget);
}
}
********************************************************************
After copy and paste the code on IDE, click the compile button, if compiling
successfully, the message "Done compiling." will appear in the status bar. Shown
below.
30
www.keyestudio.com
Then click the “Upload” button, if the upload is successful, the message "Done
uploading." will appear in the status bar.
31
www.keyestudio.com
Done uploading, connect keyestudio OLED display module to the WIFI board
(separately GPIO5, GPIO4, GND, 3.3V), then supply the control board with DC
7-12V power via a black external DC jack.
Finally, the board will be connected to the WIFI you have set in the code, so you
should see the worldwide time display.
32
www.keyestudio.com
More Resources:
ARDUINO Software:
https://www.arduino.cc/en/Main/OldSoftwareReleases#1.5.x
33