You are on page 1of 23

Welcome!

Thank you for purchasing our AZ-Delivery D1 Board. On the following pages,
we will introduce you to how to use and set-up this handy device.

Have fun!
Table of Contents

Introduction....................................................................................................3
Specifications................................................................................................4
Features........................................................................................................5
D1 NodeMCU Wifi board...............................................................................6
Pinout............................................................................................................7
Input / Ouput pins description........................................................................8
Digital I/O pins...........................................................................................9
Analog input.............................................................................................10
PWM – Pulse-Width Modulation..............................................................11
Serial Communication..............................................................................12
USB to Serial communication..................................................................13
WiFi Communication................................................................................13
Other features..........................................................................................14
How to set-up Arduino IDE..........................................................................15
Additional setup.......................................................................................19
Sketch examples.....................................................................................21

-2-
Introduction

The D1 Board is a development board created around ESP8266 chip,


containing voltage regulator and USB programmer circuit for ESP8266 chip,
and a few other features.

For application development there is a choice between Arduino IDE or ESP-


IDF (Native platform). Mostly users choose the Arduino IDE because of its
simplicity and compatibility. The Atmega328p user community is very active
and supports platforms such as ESP8266.

The D1 Board module comes with a pre-installed firmware which allows to


work with the interpreted language, sending commands through the serial
port (CH340G chip). The SoC of the D1 Board is among the most used
platforms for Internet of Things (IoT) projects.

The D1 Board is specially designed similarly as Atmega328p board with a


similar pins layout.

It has a voltage regulator that allows it to feed directly from the USB port.
The input/output pins work at 3.3V. The CH340G chip is responsible for
USB to serial communication.

-3-
Specifications

Power supply voltage (microUSB) 5VDC


DC input voltage 7-12V
Input/Output voltage 3.3V
Operating current required min. 500mA
SoC ESP8266EX
CPU Tensilica L106 32-bit
Clock frequency range 80MHz (up to160MHz)
RAM 96kB
External flash memory 4MB
I/O pins 17
Analog input 1
ADC resolution 10bit
Digital input 11
Communication interfaces SPI, I2C, I2S, IR, UART, PWM
Wi-Fi protocols 802.11 b/g/n (802.11n up to 72.2Mbps)
Wi-Fi frequency 2.4 GHz - 2.5 GHz
Wireless antena PCB
USB to Serial chip CH340G
Dimensions 70x55x13mm(2.7x2.1x0.5in)

-4-
Features

• 802.11 b/g/n
• Integrated low power 32bit MCU
• Integrated 10bit ADC
• Integrated TCP/IP protocol stack
• Integrated TR switch, balun, LNA, power amplifier and matching network
• Integrated PLL, regulators, and power management units
• Wi-Fi 2.4GHz, support WPA/WPA2
• Support STA/AP/STA+AP operation modes
• Support Smart Link Function for both Android and iOS devices
• SDIO2.0, (H)SPI, UART, I2C, I2S, IRDA, PWM, GPIO
• STBC, 1x1 MIMO, 2x1 MIMO
• A-MPDU & A-MSDU aggregation and 0.4s guard interval
• Deep sleep power <10µA, Power down leakage current < 5µA
• Wake up and transmit packets in < 2ms
• Standby power consumption of < 1.0mW (DTIM3)
• +20dBm output power in 802.11b mode
• Operating temperature range -40C - 125C

-5-
D1 NodeMCU Wifi board

The ESP8266 series of Wi-Fi chips is produced by Espressif Systems. It is


affordable Wi-Fi module suited for DIY projects in the Internet of Things
(IoT) field. This module comes with many GPIOs and support for a variety of
protocols like SPI, I2C, I2S, UART, IR and more. The best part is that it
comes with wireless networking included, which makes it different to other
micro controllers like the Atmega328p. This means that it can easily control
and monitor devices remotely via Wi-Fi at an affordable price.

The D1 Board is a system-on-chip (SoC) integrating a 32-bit Tensilica


microcontroller, standard digital peripheral interfaces, antenna switches, RF
balun, power amplifier, low noise receive amplifier, filters and power
management modules into a small package. It provides 2.4GHz Wi-Fi
(802.11 b/g/n, supporting speeds up to 72.2MB/s), 11 I/O pins, I2C and I2S
interfaces, ADC (analog to digital conversion), DAC (digital to analog
conversion), SPI interface, UART on dedicated pins, Infrared remote control
interface and PWM (Pulse Width Modulation).

The ESP8266EX microcontroller integrates a Tensilica L106 32-bit RISC


processor, which achieves extra-low power consumption and reaches a
maximum clock speed of 160 MHz. It has a 64kB Instruction RAM, 96kB of
Data RAM, and 4MB of external flash memory which can be accessed
through SPI interface.

-6-
Pinout

The D1 Board has 25 functional pins. The pinout is shown on the following
image:

-7-
Input / Ouput pins description

Just like a normal Atmega328p board, the D1 Board has digital input/output
pins (GPIO pins - General Purpose Input/Output pins). These digital
input/outputs operate at 3.3V.

5V voltage must not be connected to any ESP8266 chip pins!

The pins are not 5V tolerant, applying more than 3.3V on any pin will
destroy the chip.

The maximum current that can be drawn from a single GPIO pin is 12mA.

ESP8266 has 17 GPIO pins, however, only 11 of them can be used,


because 6 pins (GPIO 6-11) are used to connect the flash memory chip.
This is the small IC right next to the ESP8266.

GPIO 1 and 3 are used as TX and RX of the hardware Serial port (UART),
so in most cases, these pins can not be used as normal I/O while
sending/receiving serial data.

-8-
Digital I/O pins

The function of the pin can be set by using:


pinMode(pin, mode)
where pin is the GPIO number, and mode can be either INPUT, which is
the default, OUTPUT, or INPUT_PULLUP to enable the built-in pull up
resistors for GPIO 0 - 15. To enable the pull-down resistor for GPIO16, use
INPUT_PULLDOWN_16.

To set an output pin HIGH (3.3V) or LOW (0V), use:


digitalWrite(pin, value)
where pin is the digital pin,
and value either 1 or 0 (or HIGH and LOW).

To read an input, use digitalRead(pin).

-9-
Analog input

The ESP8266 has a single analog input pin, with an input voltage range
from 0.0V to 1.0V. The D1 Board has an on-board resistive voltage divider,
to get an easier 0-3.3V range. The ADC (analog to digital converter) has a
resolution of 10bits. The ESP can also use the ADC to measure the supply
voltage (VCC). To do this, include:
ADC_MODE(ADC_VCC)
at the top of your sketch, and use:
ESP.getVcc()
to actually get the voltage. If it is used to read the supply voltage, nothing
else can be connected to the analog pin.

- 10 -
PWM – Pulse-Width Modulation

ESP8266 supports software PWM on all digital pins. The default PWM
resolution is 10-bits at 1kHz, but this can be changed. To enable PWM on a
certain pin, use:
analogWrite(pin, value)
where pin is the digital pin,
and value a number between 0 and 1023.

The range (bit depth) of the PWM output can be changed by using
analogWriteRange(range).

The frequency can be changed by using


analogWriteFreq(frequency)
Frequency should be between 100Hz and 1000Hz.

- 11 -
Serial Communication

The ESP8266 has two hardware UARTS (Serial ports):


- UART0 on pins 1 and 3 (TX0 and RX0 resp.), and
- UART1 on pins 2 and 8 (TX1 and RX1 resp.), however, GPIO8 is used to
connect the flash chip. This means that UART1 can only transmit data.

Additionally, UART0 has hardware flow control on pins 15 and 13 (RTS0


and CTS0 respectively). These two pins can also be used as alternative
TX0 and RX0 pins.

To use UART0 (TX = GPIO1, RX = GPIO3), the Serial object can be used,
just like on an Atmega328p: Serial.begin(baud)

To enable the alternative pins (TX = GPIO15, RX = GPIO13), use:


Serial.swap() after Serial.begin().

To enable UART1 (TX = GPIO2), use the Serial1 object.

- 12 -
USB to Serial communication

The D1 Board has a microUSB connection port. It is made around CH340G


chip made by Silicon Laboratories which allows USB to UART serial
comunication. The chip has the virtual COM port (VCP) feature that appears
as COM port in PC applications. The CH340G UART interface implements
all RS-232 signals, including control and handshaking signals, so existing
system firmware does not need to be modified. To be able to use the
ESP8266 the driver has to be installed.

WiFi Communication

The D1 Board has integrated Wi-Fi communication interface and can


operate in three different modes: Wi-Fi station, Wi-Fi access point, and both
at the same time. It supports the following features:

• 802.11 b and 802.11 g


• 802.11 n MCS0-7 in 20 MHz bandwidth
• 802.11 n 0.4 μs guard-interval
• up to 72.2 Mbps of data rate
• Receiving STBC 2 x 1
• Up to 20.5 dBm of transmitting power
• Adjustable transmitting power

- 13 -
Other features

One of features of D1 Board is its ability to work as Access Point, or hotspot


for the WiFi projects. Also, it can run as a web server. Another feature
enables uploading code to D1 Board via internet. This is called OTA (Over-
The-Air programming), and this is a process which allows devices to
upgrade the firmware or software wirelessly without any physical access
(over the Wi-Fi). These feature is not covered in this eBook.

- 14 -
How to set-up Arduino IDE

If the Arduino IDE is not installed, follow the link and download the
installation file for the operating system of choice. The Arduino IDE version
used for this eBook is 1.8.13.

For Windows users, double click on the downloaded .exe file and follow
the instructions in the installation window.

- 15 -
For Linux users, download a file with the extension .tar.xz, which has to
be extracted. When it is extracted, go to the extracted directory and open
the terminal in that directory. Two .sh scripts have to be executed, the first
called arduino-linux-setup.sh and the second called install.sh.

To run the first script in the terminal, open the terminal in the extracted
directory and run the following command:
sh arduino-linux-setup.sh user_name
user_name - is the name of a superuser in the Linux operating system. A
password for the superuser has to be entered when the command is
started. Wait for a few minutes for the script to complete everything.

The second script, called install.sh, has to be used after the installation
of the first script. Run the following command in the terminal (extracted
directory): sh install.sh

After the installation of these scripts, go to the All Apps, where the Arduino
IDE is installed.

- 16 -
Almost all operating systems come with a text editor preinstalled (for
example, Windows comes with Notepad, Linux Ubuntu comes with
Gedit, Linux Raspbian comes with Leafpad, etc.). All of these text
editors are perfectly fine for the purpose of the eBook.

Next thing is to check, if your PC can detect an Atmega328p board. Open


freshly installed Arduino IDE, and go to:
Tools > Board > {your board name here}
{your board name here} should be the Arduino/Genuino Uno, as it can
be seen on the following image:

The port to which the Atmega328p board is connected has to be selected.


Go to: Tools > Port > {port name goes here}
and when the Atmega328p board is connected to the USB port, the port
name can be seen in the drop-down menu on the previous image.

- 17 -
If the Arduino IDE is used on Windows, port names are as follows:

For Linux users, for example port name is /dev/ttyUSBx, where x


represents integer number between 0 and 9.

- 18 -
Additional setup

In order to use D1 Board with Arduino IDE, follow few easy steps. Before
setting-up the Arduino IDE, the driver for the USB to Serial communication
has to be installed. If the driver is not installed automatically, there is a
support page that contains the drivers for Windows/Mac or Linux and can
be chosen depending on which one is used. Drivers can be downloaded
from the following link.

Next, to install support for the ESP8266 platform, open Arduino IDE and go
to: File > Preferences, and find Additional URLs field.

Then copy the following URL:


https://arduino.esp8266.com/stable/package_esp8266com_index.json

- 19 -
Paste this link in the Additional URLs field. If one or more links are inside
this field, just add one comma after the last link, paste new link after comma
and click the OK button.

Close and open Arduino IDE again and go to:


Tools > Board > Boards Manager
When new window opens, type esp8266 in the search box and install the
library made by ESP8266 Community, as shown on the following image:

To select D1 Board board, go to:


Tools > Board > ESP8266 Boards > LOLIN(WeMos D1 R2 & mini
or Generic ESP8266 Module.

To upload the sketch code to the D1 Board, first select port on which you
connected the board. Go to: Tools > Port > {port name}

- 20 -
Sketch examples

Blinking LED

To test sketch examples no external components are needed. The


LED_BUILTIN function in the sketches is used only for the built-in LED on
D1 Board.

void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
}

- 21 -
PWM - Pulse Width Modulation

void setup() {
}

void loop() {
// increase the LED brightness
for (int dutyCycle = 0; dutyCycle < 1023; dutyCycle++) {
// changing the LED brightness with PWM
analogWrite(LED_BUILTIN, dutyCycle);
delay(1);
}

// decrease the LED brightness


for (int dutyCycle = 1023; dutyCycle > 0; dutyCycle--) {
// changing the LED brightness with PWM
analogWrite(LED_BUILTIN, dutyCycle);
delay(1);
}
}

- 22 -
Now it is the time to learn and make your own projects. You can do that with
the help of many example scripts and other tutorials, which can be found on
the Internet.

If you are looking for the high quality microelectronics and


accessories, AZ-Delivery Vertriebs GmbH is the right company to get
them from. You will be provided with numerous application examples,
full installation guides, eBooks, libraries and assistance from our
technical experts.

https://az-delivery.de
Have Fun!
Impressum
https://az-delivery.de/pages/about-us

- 23 -

You might also like