[EN] List the serial ports connected to the RPi with pySerial and PyQt5.

In the previous article, we have read the list of devices connected to the serial port of the Raspberry Pi board or RPi with the pySerial library in text mode as shown in Figure 1. This article combines the previous working principles with the use of a graphical user interface via the PyQt5 library, listed in the combobox for users to choose from. If no serial port connected to the board is found, the RPi disables the combobox from user selection. Therefore, this article discusses the implementation of pySerial with the QLabel and QComboBox libraries. PyQt5.

Read More

[EN] Binary Search Tree data structure programming with Python.

In the previous article, programming to implement queue-based data structures was introduced. In this article, we introduce programming to manage another type of data structure which has different storage and management methods called BST tree or Binary Search Tree, as shown in Figure 1, which is a structure that can be applied to data collection with attributes in which the data in the left branch is less than itself and the right branch is greater than itself or the opposite, i.e. the left branch has a greater value and the right branch is less. It enables searching for data in cases where the tree is balanced on the left and right in the BST structure, saving half the time or number of search times per round of available data, e.g. 100 data sets in the first round if it is not the information you are looking for will be left with a choice to find from the left or right branches which the selection causes the information of the other side is not considered or cut off approximately half. However, if the Binary Search Tree is out of balance, the search speed is not much different from the sequential search.

In this article, we use Python that works on either a Python 3 or MicroPython interpreter to store the data, adding information ,searching for information as an example of further development.

BST : Binary Search Tree
Figure 1 BST
Read More

[EN] List the serial ports connected to the RPi with pySerial.

This article discusses the use of Python language pySerial library on Raspberry Pi or RPi both 3rd and 4th generation to connect to the serial port. It can be done in 2 ways, the first is to use hardware like ET-CONV10/RS232 HAT that has been written in the book and with the use of a USB port connected to a converter to be a serial communication port (USB to Serial Port) as shown in Figure 1. This article uses the second method to run pySerial to check how many serial ports are connected and what are their names as an example in Figure 8.

Figure 1 Connect ET-USB/RS232 Mini to RPi’s USB
Read More

[EN] Control movement from a joystick via WiFi with MicroPython.

This article is based on the article programming a client/server for a weather station over a wireless network or WiFi to modify from reading data from sensors to joystick shield (Arduino Joystick Shield) so that it has become a wireless game controller using MicroPython and an ESP32 microcontroller as shown in Figure 1. It is possible to control the movement of objects in the display via a ST7735 TFT screen connected to another ESP32. It will be found that the Python implementation of MicroPython is applicable in this example. And with an easy-to-write language and code that can be modified without recompiling and uploading, it’s easy to write prototype code for further development at a higher speed.

Control movement from a joystick via WiFi
(Figure. 1 Our board)
Read More

[EN] The MaixPy’s image class Part 1. draw and find something.

This article discusses how to use image class with TFT-LCD display module of Sipeed M1W dock suit board via lcd class (MaixPy’s lcd class) as shown in Figure 1 provided with MaixPy to study the list of commands provided by image class and an example program using commands about creating a buffer object, clearing the value in the buffer, deleting the buffer, drawing straight lines, circles, squares, character display, saving data from the buffer to memory card (microSD Card), searching for straight lines in buffer (find_lines), finding circles in the buffer, find_circles and find squares (find_rects) in buffers with built-in functionality. It uses the Hough Transform principle to find the position and parameters of the searched object.

(Figure. 1 Sipeed M1W dock suit)
Read More

[TH] Calculate Regression with NumPy.

บทความนี้เป็นการแปลงการใช้งานโมเดลรีเกรสชันจากบทความของ ESP32-C3 มาเป็น NumPy บน Raspberry Pi และ PC พร้อมทั้งใช้การแสดงผลเป็น Matplotlib ดังภาพที่ 1 ซึ่งจะพบว่า จากบทความก่อนหน้านี้ได้นำค่าอุณหภูมิและความชื้นจากข้อมูล 1 วันมาหาพารามิเตอร์ a และ b ของสมการถดถอยหรือรีเกรสชัน (regression) และนำสมการหรือโมเดลที่ได้นี้มาหาค่าของอุณหภูมิที่เป็นไปได้ในช่วงเวลา 1 วัน

ภาพที่ 1 ผลลัพธ์ของตัวอย่างโปรแกรม
Read More

[EN] Improve st7735 blue-tab/red-tab 0.96 ” library

This article is an update of the st7735 library file for Micropython by Billy Cheung (accessed 2021-09-07) published on github. It is a library that has been updated by Guy Caver to support ST7735s. The required libraries include st7735.py and sysfont.py Guy Carver implements esp8266 and esp32 to provide better display speed through the principle of display buffering for pixel storage and additional instructions for sending data from buffer to TFT module via SPI bus.

(Figure. 1 dCore-miniML board with ST7735 0.96″ display module installed)
Read More

[EN] Collecting flags in a maze

This article is an example of writing a game. Move the character to walk in the maze to collect flags that are randomly positioned as shown in Figure 1, where the character will walk in the specified channel and can’t penetrate the wall. With a warning sound when trying to walk in an impossible location and when walking in any direction will change the image of the character to turn the face to that direction. In addition, pressing A will randomize the position of the new flag, pressing B will randomize the player’s position, and pressing D will exit the program. The board for use is still dCoreML4M as before, let’s get started.

(Figure. 1 The game in this article)
Read More

[EN] The dCore-espWST

This article recommends using the esp8266 to read temperature and humidity from the DHT11 sensor, the voltage from the LDR sensor, received from the switch, and display via OLED with MicroPython’s Python language, this feature is the dCore-espWST board we are using (Which in the previous article we used the dCore-esp32WST with the same design, but using esp32, but the program code can still be used with the model board) and is a board for use in teaching IoT subjects. The prototype structure of the board is as shown in Figure 1, which is normally used with a battery power supply unit with a solar panel charging circuit.

(Figure. 1 dCore-espWSTprototype)
Read More