Knowledge points: What is a control board?
The control board is an open source intelligent hardware that popularizes STEAM maker education, artificial intelligence education, and robot programming education. It integrates ESP-32 high-performance dual-core chip, supports WiFi and Bluetooth dual-mode communication, and can be used as an IoT node to realize IoT applications. At the same time, the control board integrates OLED display, RGB lights, accelerometers, microphones, light sensors, buzzers, key switches, touch switches, and gold finger external expansion interfaces. It supports graphics and MicroPython code programming, which can realize intelligent robots, Smart control applications such as Maker Smart Works.
Control board hardware features:
ESP-32 main control
Processor: Tensilica LX6 dual-core processor (one core handles high-speed connection; one core independent application development)
main frequency: up to 240MHz clock frequency
SRAM: 520KB
Flash: 8MB
Wi-Fi standard: FCC/CE/TELEC/KCC
Wi-Fi protocol: 802.11 b/g/n/d/e/i/k/r (802.11n, speed up to 150 Mbps), A-MPDU and A-MSDU aggregation, support 0.4us Protection interval
Frequency range: 2.4~2.5 GHz
Bluetooth protocol: Compliant with Bluetooth v4.2 BR/EDR and BLE standards
Bluetooth audio: CVSD and SBC audio Low power consumption: 10uA
Power supply: Micro USB Power supply
Operating voltage: 3.3V
Maximum operating current: 200mA
maximum load current: 1000mA
Onboard
three-axis accelerometer MSA300, measuring range: ±2/4/8/16G
geomagnetic sensor MMC5983MA, measuring range: ±8 Gauss; accuracy 0.4mGz, electronic compass error ±0.5°
Light sensor
Microphone
3 full-color ws2812 lamp beads
1.3-inch OLED display, support 16*16 character display, resolution 128x64
passive buzzer
, support 2 physical buttons (A/B), 6 touch buttons,
support 1 alligator clip interface, Easy access to various resistive sensors
Expansion interface
20-channel digital I/O, (including 12-channel PWM, 6-channel touch input)
5-channel 12bit analog input ADC, P0~P4
1-channel external input alligator clip interface: EXT/GND
supports I2C, UART, SPI communication protocol
8. Line editing and input history
You can use the left and right arrow keys to move the cursor to edit the current input line; press the Home key or ctrl-A to move the cursor to the beginning of the line, press End or ctrl-E to move to the line at the end; the Delete key or the Backspace key is used to delete.
The REPL remembers a certain number of the first few lines of text you type (up to 8 on the ESP32). To recall the previous line, use the up and down arrow keys.
Tab key
Tab key can view the list of all members in the module. This is useful for finding out what functions and methods a module or object has. Assuming you imported machine in the above example then type . and press Tab to see a list of all members of the machine module:
>>> machine.
__class__ __name__ ADC DAC
DEEPSLEEP DEEPSLEEP_RESET EXT0_WAKE
EXT1_WAKE HARD_RESET I2C PIN_WAKE
PWM PWRON_RESET Pin RTC
SLEEP SOFT_RESET SPI Signal
TIMER_WAKE TOUCHPAD_WAKE Timer TouchPad
UART ULP_WAKE WDT WDT_RESET
deepsleep disable_irq enable_irq freq
idle mem16 mem32 mem8
reset reset_cause sleep time_pulse_us
unique_id wake_reason
>>> machine.
9. REPL paste mode and other control commands
Pressing ctrl-E will enter a special paste mode where you can copy and paste a large block of text into the REPL. If you press ctrl-E, you will see the paste mode prompt:
paste mode; Ctrl-C to cancel, Ctrl-D to finish
You can then paste (or type) your text. Note that none of the special keys or commands work in paste mode (such as Tab or Backspace), they are just accepted as-is. Press ctrl-D to finish entering text and execute.
There are four other control commands:
Ctrl-A on a blank line will enter raw REPL mode. This is similar to permanent paste mode, except characters are not echoed.
Ctrl-B on whitespace goes to normal REPL mode.
Ctrl-C cancels any input, or interrupts currently running code.
Ctrl-D on a blank line will perform a soft reboot.
10. The OLED screen displays Hello World
in 4 languages and is centered.
The control board is equipped with a 1.3-inch OLED display with a resolution of 128x64. Use Google Noto Sans CJK 16x16 font, font height 16 pixels, support Simplified Chinese, Traditional Chinese, Japanese and Korean languages. The experimental code is as follows:
from mpython import *
oled.fill(0)
oled.DispChar("世界你好", 40, 0, 1)
oled.DispChar("안녕하세요", 37, 16, 2)
oled.DispChar("Hello, world!", 26, 32, 3)
oled.DispChar("こんにちは世界", 22, 48, 4)
oled.show()
annotation
The DispChar(str,x,y) function can write the text whose upper left corner is the coordinate to FrameBuffer. str is to display the text content, supports Simplified Chinese, Traditional Chinese, English, Japanese and Korean languages. xy display starting xy coordinates for oled. oled.show() sends FrameBuffer to oled to refresh and display the screen.
Use Noto Sans CJK 16-pixel mono-height, unequal-width font. Different characters have different widths.
mPython X graphics programming (four modes)
Adjust the x value so that the displayed string "Hello World" is centered.
11. The mPython simulation function displays Hello World
- the program can be tested and run without a control board
The display effect on the computer is as shown in the figure
12. Understand OLED screens
The control board comes with a 1.3-inch OLED display. OLED (Organic Light-Emitting Diode), also known as organic electro-laser display, was discovered in the laboratory by Chinese-American professor Deng Qingyun in 1979. It is a very thin coating of organic materials that are self-luminous, in other words, when an electric current is passed through them, these organic materials emit light. Compared with traditional display screens, OLED can be said to be epoch-making in terms of technological advantages. OLED has a wide viewing angle and has the advantages of almost infinitely high contrast, low power consumption, very high response speed, full color and simple manufacturing process. OLED materials can be self-illuminating without adding a backlight source, which can greatly simplify the process and reduce the volume. Based on the above excellent characteristics, OLED is considered to be the new application technology of the next generation flat panel display.
The resolution of the OLED display on the control board is 128x64. Resolution refers to the number of pixels displayed on the screen. So what is a pixel? The resolution of the OLED display on the control board is 128x64. Resolution refers to the number of pixels displayed on the screen. So what is a pixel? You can see a picture on the screen, but in fact, if you stick it to the side of the screen, you will find that your screen is actually composed of countless small dots, because each dot is relatively small, so your eyes will Mistakenly thought it was a complete picture.
A pixel can be understood as a point on the screen. The screen is made up of multiple pixels. A resolution of 128x64 means that the horizontal direction contains 128 pixels and the vertical direction contains 64 pixels. There are a total of 128x64 pixels on the screen. Through the "draw point" command, we can see any pixel on the screen. The sample program and running results are shown in the figure below. You can see a picture on the screen, but in fact, if you stick it to the side of the screen, you will find that your screen is actually composed of countless small dots, because each dot is relatively small, so your eyes will Mistakenly thought it was a complete picture. A pixel can be understood as a point on the screen. The screen is made up of multiple pixels. A resolution of 128x64 means that the horizontal direction contains 128 pixels and the vertical direction contains 64 pixels. There are a total of 128x64 pixels on the screen. Through the "draw point" command, we can see any pixel on the screen.