Home> Blog> An MCU Development Board RTL8720DN: A Hidden Gem?

An MCU Development Board RTL8720DN: A Hidden Gem?

MCU development
PCBONLINE Team Tues, Apr 02, 2024
1212
RTL8720DN

Only a little is known about the RTL8720DN development board outside of its dedicated development community. Somehow, this development board supports both 2.4GHz and 5GHz Wi-Fi 802.11 a/b/g/n and Bluetooth 5.0 BLE managed to "fly under the proverbial radar" and remain almost entirely unnoticed.

Let's examine the RTL8720DN and explore its capabilities by looking at its hardware, compatible libraries, compatible code examples, and projects that utilize this board. You can also find an electronics manufacturer that provides one-stop PCB assembly services for devices developed based on RTL8720DN.

Hardware Aspects of RTL8720DN

RTL8720DN benefits from having the I2C and SPI ports, up to 4 MB of Flash, and up to 512 KB of RAM, depending on the version. It boasts a 32-bit Dual-Core CPU. One core of that CPU is the KM4 Arm Cortex-M4 running at 200 MHz, and another one is the KM0 Arm Cortex-M0 core running at 20 MHz.

RTL8720DN also employs the AES/DES/SHA hardware engine and Realtek Secure IoT Platform feature that includes Flash decryption and is used for secure boot and secure firmware update functionalities.

Unfortunately, it doesn't come with the built-in hardware random number generator.

The block diagram of the RTL8720DN is demonstrated in the picture below.

RTL8720DN hardware

Price Comparison Between RTL8720DN, ESP32, and ESP8266

The unavailability of the CoreMark score for the RTL8720DN microcontroller significantly hinders the ability to conduct a comprehensive cost breakdown. All that is available is to compare the starting retail price of the board with the other similar boards.

The cheapest RTL8720DN can be found on Aliexpress for $4.41. For comparison, the cheapest ESP32 costs roughly $2.5, and the cheapest ESP8266 costs roughly $1.7 on the same platform.

RTL8720DN price VS ESP32 ESP8266

Software Capabilities of RTL8720DN

The RTL8720DN can be programmed in Embedded C/C++ and MicroPython.

Since examining both programming languages and all supported IDEs would be time-consuming, let's only focus on the software aspects accessible for the RTL8720DN within the Arduino IDE using the Embedded C/C++ programming language.

The table presented below shows the compatibility of the RTL8720DN with several libraries.

All the libraries from the table are available on GitHub.

RTL8720DN libraries

As you can see in the table, the RTL8720DN can work with the ILI9341-controlled LCD, encrypt and decrypt data using the AES and Blowfish encryption algorithms, handle the Nintendo Wii Nunchuk, and benefit from utilizing the Arduino-crypto library, which enables the board to use the SHA-256 hash function and HMAC-SHA256 hash-based message authentication code.

Mitigating Some Flaws Of The RTL8720DN Using An Unorthodox Workaround

As you saw in the previous step, the library compatibility of the RTL8720DN isn't that great, especially when it comes to the input devices. Additionally, the lack of a functional random number generator is a significant drawback for cryptography-related applications.

It might seem to you that there's not much use for that board aside from its wireless capabilities, but hold the horses and remember that necessity is the mother of invention. So, I stumbled upon a viable solution for this issue:

Why not bind the RTL8720DN with the Arduino so that the Arduino can handle input from devices such as the PS/2 keyboard, Nintendo Wii Nunchuk, and Nintendo 64 controller, generate random numbers, and then simply pass that data to the RTL8720DN?

It worked, and as you can see in the table below, the RTL8720DN bound with Arduino supports more libraries than the stand-alone RTL8720DN.

RTL8720DN with Arduino libraries

Code Examples of RTL8720DN

Finally, let's get to the part where RTL8720DN runs something on it. But before you can flash the board, connect two jumper wires, as shown in the picture below. The jumper wires have to be connected because the serial port driver isn't connected to the MCU.

RTL8720DN jumper wires

Code Example 1

The first example contains code that enables the RTL8720DN to encrypt and decrypt data using the Blowfish encryption algorithm. Note that for this code to work, the "blowfish.cpp" and "blowfish.h" files from the "ddokkaebi/Blowfish" repository must be placed in the same directory with the .ino file containing the code presented below.

RTL8720DN code 1

#include "blowfish.h";
void setup() {
  Serial.begin(115200);
}

void loop() {
Blowfish blowfish;
unsigned char key[] = "RTL8720DN supports Blowfish cipher";
blowfish.SetKey(key, sizeof(key));
Serial.print("\nPlaintext: ");
unsigned char text[] = "https://www.pcbonline.com/about/";
for (int i = 0; i < sizeof(text); i++)
Serial.print(char(text[i]));
Serial.print("\nKey: ");
for (int i = 0; i < sizeof(key); i++)
Serial.print(char(key[i]));
blowfish.Encrypt(text, text, sizeof(text));
Serial.print("\nCiphertext: ");
for (int i = 0; i < sizeof(text); i++) {
if (text[i] < 16)
Serial.print("0");
Serial.print(text[i], HEX);
}
blowfish.Decrypt(text, text, sizeof(text));
Serial.print("\nDecrypted: ");
for (int i = 0; i < sizeof(text); i++)
Serial.print(char(text[i]));
Serial.println();
delay(3500);
}

Code Example 2

In the first example, you can find the connection table and the code that enables the STM32F407VET6 to handle the Nintendo Wii Nunchuk. Note that in order for this code to work, the NintendoExtensionCtrl library must be installed.

RTL8720DN
Nintendo Wii Nunchuk
3V3
VIN
GE2
SDA
GE0
SCL
GND
GND
RTL8720DN application2
RTL8720DN code 2

#include
Nunchuk wii_nunchuk;
bool pressed_c;
bool pressed_z;
bool held_left;
bool held_up;
bool held_right;
bool held_down;
byte threshold = 16;
void setup() {
  Serial.begin(115200);
  wii_nunchuk.begin();
  while (!wii_nunchuk.connect()) {
    Serial.println("Nunchuk not detected!");
    delay(1000);
  }
}
void loop() {
  boolean success = wii_nunchuk.update();  // Get new data from the controller
  if (!success) {                          // Ruh roh
    Serial.println("Controller disconnected!");
    delay(1000);
  } else {
    if (wii_nunchuk.buttonC() == true) {
      if (pressed_c == false) {
        Serial.println("C");
      }
      pressed_c = true;
    } else {
      pressed_c = false;
    }
    if (wii_nunchuk.buttonZ() == true) {
      if (pressed_z == false) {
        Serial.println("Z");
      }
      pressed_z = true;
    } else {
      pressed_z = false;
    }
    byte XAxis = wii_nunchuk.joyX();
    byte YAxis = wii_nunchuk.joyY();
    if (XAxis > (255 - threshold)) {
      if (held_right == false) {
        Serial.println("Right");
      }
      held_right = true;
    } else {
      held_right = false;
    }
    if (XAxis < threshold) {
      if (held_left == false) {
        Serial.println("Left");
      }
      held_left = true;
    } else {
      held_left = false;
    }
    if (YAxis > (255 - threshold)) {
      if (held_up == false) {
        Serial.println("Up");
      }
      held_up = true;
    } else {
      held_up = false;
    }
    if (YAxis < threshold) {
      if (held_down == false) {
        Serial.println("Down");
      }
      held_down = true;
    } else {
      held_down = false;
    }
  }
}

Code Example 3

Depending on the project you're working on, this might be the most useful code example for you. The code example N3 contains the connection table and the code that enables the RTL8720DN to receive the data from the Arduino over the I2C. The Arduino sends an 8-bit number to the RTL8720DN, increments that number, waits for 4 milliseconds, and then sends a new number.

RTL8720DN
Arduino
Vin
5V
GE2
A4
GE0
A5
1oz
at least 3.5/3.5mil

RTL8720DN application3
RTL8720DN code 3
Code for the Arduino:

#include

void setup() {
Serial.begin(115200);
Wire.begin();
}

byte x = 0;

void loop() {
Wire.beginTransmission(7);
Wire.write(x);
Wire.endTransmission();

    x++;
if (x == 256)
x = 0;
delay(4);
}


Code for the RTL8720DN:

#include

void setup() {
Wire.begin(7);
Wire.onReceive(receiveEvent);
Serial.begin(115200);
}

void loop() {
delay(100);
}
void receiveEvent(int howMany) {
howMany = howMany;
int x = Wire.read();
Serial.println(x);
}

Code Example 4

The fourth example contains the circuit diagram and the code that enables the RTL8720DN to display a centered line of text on the ILI9341-controlled LCD connected to the RTL8720DN via SPI.

RTL8720DN application 4

RTL8720DN LCD

#include "SPI.h"
#include "AmebaILI9341.h"

#define TFT_RESET       6
#define TFT_DC          2
#define TFT_CS          SPI_SS
#define SPI_BUS         SPI

AmebaILI9341 tft = AmebaILI9341(TFT_CS, TFT_DC, TFT_RESET, SPI_BUS);

#define ILI9341_SPI_FREQUENCY 20000000

void disp_centered_text(String text, int h) {
int text_width = text.length() * 12;
tft.setCursor((320 - text_width) / 2, h);
tft.print(text);
}

void setup() {
tft.begin();
SPI_BUS.setDefaultFrequency(ILI9341_SPI_FREQUENCY);
tft.fillScreen(0);
tft.setRotation(1);
tft.setFontSize(2);
disp_centered_text("pcbonline.com", 215);
}

void loop(){
}

Projects

While many projects don't utilize the RTL8720DN board, there are still some worthy examples. Let's explore a few of them.

Midbar (RTL8720DN + Arduino Uno Version)

Midbar RTL8720DN + Arduino

Midbar (RTL8720DN + Arduino Uno Version) is a hardware data vault that's developed to enhance data privacy by increasing the cost of unauthorized access to it. This vault can securely store up to 16 login credentials and up to 10 credit cards encrypted using the combination of the AES and Blowfish encryption algorithms in the RTL8720DN's built-in Flash. The RTL8720DN handles the cryptographic primitives, such as AES and HMAC-SHA256, while Arduino Uno handles the RFID card reader, random number generation, and input devices.

Dual Band Wi-Fi Analyzer

RTL8720DN dual band WiFi analyzer

As its name implies, the Dual Band Wi-Fi Analyzer is a device designed to analyze wireless networks operating on both the 2.4 GHz and 5 GHz frequency bands. It shows the network names, signal strength, and the channels on which these networks operate.

Wi-Fi Photo Frame

RTL8720DN Wi-Fi photo frame

The RTL8720DN board is equipped with a fairly fast CPU and has can decode JPEG images. On Instructables, the engineer Chen Liang demonstrated the board capabilities not just by showing the RTL8720DN functioning as a Dual-Band Wi-Fi analyzer but also by exhibiting the RTL8720DN-based Wi-Fi photo frame.

One-Stop PCB Assembly for Single-Board/MCU Development Devices

Single-board or MCU development devices based on RTL8720DN, ESP32, and ESP8266 can be many IoT appliances, such as smart projectors, smart mixers, sound-control LEDs, etc. You can design any IoT device that works in a Wi-Fi environment. To turn your MCU development design into real products, you can let PCBONLINE provide one-stop PCB assembly services until the final product is delivered to you.

MCU PCB assembly PCBONLINE

PCBONLINE has two large advanced PCB manufacturing bases, one EMS PCB assembly factory, and an R&D team with MUC development capabilities and rich technical experience.

Why choose PCBONLINE for PCB assembly for MCU development devices

Relying on its EMS PCBA factory, PCBONLINE can source RTL8720DN, ESP32, ESP8266, and many more ICs and MCU modules at lower prices.

The professional engineers at PCBONLINE have MCU development board R&D capabilities and mature solutions to provide for you.

As a source factory manufacturer, we provide affordable PCB fabrication, PCB assembly, component sourcing, value-added, and box-build assembly for your MCU development PCBA and devices.

We manufacture high-quality IoT and MCU development board PCBA and devices that are certified with IPC-A-610 Class 2/3, ISO 9001:2015, IATF 16949, RoHS, REACH, and UL.

One-on-one engineering support and considerate customer service throughout your project.

If you order bulk production for the MCU development board PCBA and IoT devices, PCBONLINE will refund the R&D and sample fees when your PCBA quantity reaches 5,000 and offer free functional testing. For MCU development PCBA and devices, please email PCBONLINE at info@pcbonline.com.

Conclusion

Even though the RTL8720DN is a relatively functional board that boasts an AES/DES/SHA hardware engine and supports both 2.4GHz and 5GHz Wi-Fi 802.11 a/b/g/n and Bluetooth 5.0 BLE, it's not exactly an economically viable one. You can buy five ESP8266s or three ESP32s for the price of the two RTL8720DN boards. Not to mention that the Espressif boards have more compatible libraries and can easily interact with the Google Firebase. PCBONLINE has strategic cooperation with Espressif, where you can buy ESP32, ESP8266, and more ESP ICs and modules at lower prices and enjoy one-stop electronics manufacturing.

© This article is an original work of the PCBONLINE team. Please indicate the author PCBONLINE if you reprint. If the article is reproduced without permission or indicating the author's source, PCBONLINE reserves the right to investigate the infringement.
View and save our product information
PCB assembly at PCBONLINE.pdf

GET A FREE QUOTE

File Upload