1. Introduction to onboard OLED screen driver
The onboard OLED screen uses the Adafruit_Python_SSD1306 driver, which is a very common OLED driver. The I2C peripheral address of the OLED is 0x3C, which stores all the methods and register information about the driver screen. The screen we use has a resolution of 128*32.
Path of package : [Jetbot-AI Car] --> [Annex] --> [Jetbot Dependency package]---> [Adafruit_Python_SSD1306]
2. Display IP address, system, memory usage information on the OLED screen
As shown in the above figure, the interface of the Jetbot robot car use information displayed by the OLED is displayed in the following order:
The first line of content: IP address information of the wired network
The second line of content: IP address information of WIFI wireless network
Third line content: running memory usage and percentage of used running memory
The fourth line: disk memory usage and percentage of used disk memory
How to drive the OLED display The method of real-time refreshing the display of the IP address, system, and memory usage information on the screen after the Jetbot robot car is powered on.
Before this, in order to avoid Jetbot's real-time refresh display, the stats.py program running by jetbot_stats.service and the program we are testing now use an I2C peripheral OLED screen at the same time and generate an exception conflict.
We need to stop refresh the operation of the OLED service at the Jetbot command console.
sudo systemctl stop jetbot_start
After executing the above command, we can observe that there is no value refresh display on the screen, then let's run the code we want to test:
First, we import the modules we need to use.
Then, we create the SSD1306 object instance we need to use, and create the variables that need to be used. When creating the OLED object instance, we will automatically call the driver initialization function to initialize the OLED screen. The code is shown below.
After running the above code, we can see that the display on the OLED screen is cleared, which means that our code is initialized to the OLED screen.
Then we run the following code to start collecting the data of the Jetbot robot car in real time every second, and refresh the display to the on board OLED display in real time.
After running the above code, the current usage information of Jetbot will be displayed on the OLED display.
The corresponding complete source code is located at:
/home/jetbot/Notebook/6.Using of Onboard OLED/Using of Onboard OLED.ipynb
- Yahboom JetBot AI Robot Car Tutorial
- Last Tutorial>> 4.4 Use of RGB programming light strips
- Next Tutorial>> 4.6 battery power inquiry