Monday, November 30, 2020

Waveshare 1.44 inch LCD HAT

Waveshare 1.44 inch LCD HAT on Raspberry Pi Zero W running Raspberry Pi OS (32 bit)


This is an LCD display HAT for Raspberry Pi, 1.44inch diagonal, 128x128 pixels, with embedded controller, communicating via SPI interface.

Features

  • Standard Raspberry Pi 40PIN GPIO extension header, supports Raspberry Pi series boards
  • 1x joystick (5-position), 3x pushbuttons, handy and useful
  • Comes with development resources and manual (examples for Raspberry Pi)

Specifications

  • Driver: ST7735S
  • Interface: SPI
  • Display color: RGB, 65K color
  • Resolution: 128x128
  • Backlight: LED
  • Operating voltage: 3.3V

details refer to Waveshare product page:
https://www.waveshare.net/wiki/1.44inch_LCD_HAT (Chinese)
https://www.waveshare.com/wiki/1.44inch_LCD_HAT (English)


Monday, November 23, 2020

Install CircuitPython to nanoESP32-S2, on Raspberry Pi.

 


MuseLab nanoESP32-S2 is a dev. board with a ESP32-S2 module. This board has 2 USB-C connector, one for Serial (ch340) and one for Native USB (esp32), is supported running CircuitPython.

Currently, nanoESP32-S2 support 4 module:

  • ESP32-S2-WROOM: PCB Antenna, no PSRAM.
  • ESP32-S2-WROOM-I: IPEX Antenna, no PSRAM.
  • ESP32-S2-WROVER: PCB Antenna, with PSRAM.
  • ESP32-S2-WROVER-I: IPEX Antenna, with PSRAM.

My sample is ESP32-S2-WROVER-I.

This video show the steps to flash CircuitPython (latest unstable release CircuitPython 6.1.0-beta.1) on museLab nanoESP32-S2, using Raspberry Pi 4B/8G running Raspberry Pi OS (32 bit).


Install esptool:
$ sudo pip install esptool
Download CircuitPython:
Visit https://circuitpython.org/board/muselab_nanoesp32_s2/ to download CircuitPython (.BIN) for nanoESP32-S2.

The full path of the downloaded file in my case is:
/home/pi/Downloads/adafruit-circuitpython-muselab_nanoesp32_s2-en_US-6.1.0-beta.1.bin

Identify the COM port to attached to ESP32-S2 board, using dmesg:

Before connect to ESP32-S2 board:

Enter the command to clear dmesg buffer:
$ sudo dmesg -c

Connect ESP32-S2 USB marked "ch340".

Enter the command to check the latest attached port:
$ dmesg

found:
ch341-uart converter now attached to ttyUSB0

The COM port is: /dev/ttyUSB0

Erase and Flash ESP32-S2:

Erase:
$ esptool.py --chip auto --port <COM PORT> erase_flash
Flash with downloaded CircuitPython:
$ esptool.py --chip auto --port <COM PORT> -b 460800 --before=default_reset \
--after=hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 4MB 0x0000 \
<DOWNLOADED FILE>
Done!
After flashed with CircuitPython, you can now disconnect and reconnect the ESP32-S2 board to the another USB connector marked "esp32".

A new driver name "CIRCUITPY" is attached.


Install Mu:

Mu is a Python Editor, and is suggested to program CircuitPython.

To install Mu on Raspberry Pi OS:
Click the Menu >> Preferences >> Recommmended Software
>> Programing >> Mu

With Mu installed, you can try something with CircuitPython REPL. Refer to the video.


For more exercise related to CircuitPython/ESP32-S2, refer to my another blog posts Embedded things > Hello nanoESP32-S2/CircuitPython

Install esptool on Raspberry Pi OS

esptool.py is a Python-based, open source, platform independent, utility to communicate with the ROM bootloader in Espressif ESP8266 & ESP32 chips. ESP32-S2 is supported started from Version 3.0 (https://github.com/espressif/esptool/releases).

To install esptool on Raspberry Pi OS, enter the command in Terminal:

$ sudo pip install esptool
remark:

In my trial on Raspberry Pi OS, if I install without "sudo", I cannot run it without specify the full path.

Because the esptool.py executable is installed to the hidden directory ~/local/.bin directory. Have to set PATH to esptool, otherwise it cannot be run directly. So I install esptool with "sudo".

To check the version of installed esptool using pip:
$ pip show esptool



Next:
Install CircuitPython to nanoESP32-S2, on Raspberry Pi

Sunday, November 22, 2020

Remote access Raspberry Pi using xrdp/Microsoft Remote Desktop

How to remote control Raspberry Pi from Android/Windows 10 with xrdp installed.

Microsoft Remote Desktop Protocol (RDP) provides remote display and input capabilities over network connections for Windows-based applications running on a server. RDP is designed to support different types of network topologies and multiple LAN protocols.

xrdp is an open source RDP server, provides a graphical login to remote machines using Microsoft Remote Desktop Protocol (RDP). xrdp accepts connections from a variety of RDP clients: FreeRDP, rdesktop, NeutrinoRDP and Microsoft Remote Desktop Client (for Windows, Mac OS, iOS and Android).

Install xrdp:

In Raspberry Pi, install xrdp by entering the command in Terminal:

$ sudo apt install xrdp

Remote access Raspberry Pi from Android using Microsoft Remote Desktop App:

With Microsoft Remote Desktop app installed on Android devices, you can access remote Raspberry Pi running xrdp. There are two version available in Google Play Store: Remote Desktop and Remote Desktop 8. In my trial, Remote Desktop 8 is more stable, so I show how to for using it.




Remote access Raspberry Pi from Windows 10 using Remote Desktop Connection:

With xrdp installed, you can also remote access your Raspberry Pi from Windows 10 using Remote Desktop Connection. Just search and run "Remote Desktop Connection".


Check in the video:



Saturday, November 21, 2020

Record screen action on Raspberry Pi, SimpleScreenRecorder

SimpleScreenRecorder is a Linux program that I've created to record programs and games. To install it on Raspberry Pi OS:

MENU > Preferences > Add/Remove Software
Search and install simplescreenrecorder

Friday, November 20, 2020

Install Virtual Keyboard(matchbox-keyboard) on Raspberry Pi

 Matchbox-keyboard is an on screen 'virtual' or 'software' keyboard. To install on Raspberry Pi:

$ sudo apt-get install matchbox-keyboard

Tested on Raspberry Pi 4B/8G with 4" 800x480 HDMI IPS Touch Screen running Raspberry Pi OS (32 bit).

Wednesday, November 18, 2020

Setup 4 inch HDMI IPS Touch Display on Raspberry Pi 4B/8G (Raspberry Pi OS 32 bit)

This video show how to setup 4" HDMI Display-C (XPT2046 Touch Controller/800x480 Pixel) on Raspberry Pi 4B/8G (Raspberry Pi OS 32 bit).

Visit http://www.lcdwiki.com/4inch_HDMI_Display-C, follow the steps, enter the command in Terminal:

Install the Display/Touch driver:
$ sudo rm -rf LCD-show
$ git clone https://github.com/goodtft/LCD-show.git
$ chmod -R 755 LCD-show
$ cd LCD-show/
$ sudo ./MPI4008-show



Calibrate the touch screen of 4 inch 800x480 HDMI Display for Raspberry Pi 


Actually, the touch is calibrated very well after driver installed.

To calibrate the touch screen:
download How_to_calibrate_the_resistance_touch_screen-V1.2 below Download Resources,
follow the steps.

With driver installed,
Enter the commands in Terminal:
$ cd LCD-show/
$ sudo dpkg -i -B xinput-calibrator_0.7.5-1_armhf.deb

Execute the touch calibration command:
$ DISPLAY=:0.0 xinput_calibrator

Touch the four calibration points with the touch pen

New touch parameters will be displayed after calibration

Edit /etc/X11/xorg.conf.d/99-calibration.conf,
update with new touch parameters.
$ sudo nano /etc/X11/xorg.conf.d/99-calibration.conf

Save and exit:
- Ctrl-X
- Y
- Enter

$ sudo reboot



Next:
~ Install Virtual Keyboard(matchbox-keyboard) on Raspberry Pi

Remark@2021-07-15:
By default without installing driver, the screen will display in vertical (portrait). With Raspberry Pi OS Screen Configuration Orientation feature, I can change screen direction.

For sure, without installing driver, it cannot detect touch. Normally I use wireless keyboard with mouse pad, so no need touch function.


My board, Raspberry Pi 4B/8G v1.4

 Just received my new board, Raspberry Pi 4B/8G v1.4.








Setup 4 inch HDMI Display-C on Raspberry Pi 4B/8G (Raspberry Pi OS 32 bit)

Friday, November 13, 2020

Install 64 bit Arduino IDE on 64 bit Ubuntu for Raspberry Pi

Steps to download and install 64 bit Arduino IDE on 64 bit Ubuntu for Raspberry Pi, tested on Raspberry Pi 4B/4G.


download the option of Linux ARM 64 bits.

Extract the downloaded file, and run the install script in Terminal:
$ sudo ./install.sh


Remark:
If you fail when upload to board caused by Permission denied by USB port, enter the command in Terminal.
$ sudo usermod -a -G dialout <username>
$ sudo chmod a+rw <port>

where <username> is your user name in Ubuntu, <port> is the attached USB port.














Thursday, November 12, 2020

Program Arduino using VSCode/PlatformIO/Ubuntu for Raspberry Pi

With Visual Studio Code/PlatformIO IDE installed on Ubuntu for Raspberry Pi, this video show steps to program Arduino Uno using Visual Studio Code + PlatformIO IDE on 64 bit Ubuntu Desktop for Raspberry Pi, tested on Raspberry Pi 4B/4G).


Remark:
At 6:15 in the video, a+w is mis-entered, it work as expected. Anyway a+rw is suggested.

Wednesday, November 11, 2020

Install 64 bit Visual Studio Code/PlatformIO IDE on Ubuntu for Raspberry Pi

To install 64 bit Visual Studio Code on Ubuntu Desktop for Raspberry Pi, visit https://code.visualstudio.com/, download Linux .deb of ARM 64 build.

Open Terminal, run the command:

$ sudo apt install ./<file>.deb

After Visual Studio Code installed, you can search and run it in Activities, or enter "code" in Terminal.

Install Extension of PlatformIO IDE to Visual Studio Code:

Click Extension tab, search and install PlatformIO IDE.

Related:
Install official Visual Studio Code (ver 1.5) and PlatformIO IDE on Raspberry Pi OS (32 bit), basically the same steps, but 32 bit for current Raspberry Pi OS.

Next:
Program Arduino using VSCode/PlatformIO/Ubuntu for Raspberry Pi



Sunday, November 8, 2020

Run vcgencmd on Ubuntu for Raspberry Pi, fix "VCHI initialization failed"

vcgencmd is a command line utility that can get various pieces of information from the VideoCore GPU on the Raspberry Pi. Much of the information available is only of use to Raspberry Pi engineers, but there are a number of very useful options available to end users that will be described here.

In my trial on Ubuntu Desktop for Raspberry Pi, vcgencmd is installed by default. But fail with error of "VCHI initialization failed".

To fix it, add the video group to your user:

$ sudo usermod -aG video <username>


After log-out and log-in.



Thursday, November 5, 2020

psutil, process and system utilities for Python

psutil (process and system utilities) is a cross-platform library for retrieving information on running processes and system utilization (CPU, memory, disks, network, sensors) in Python. 

In my trial on Ubuntu Desktop for Raspberry Pi, it's installed by default.

Links:
- GitHub - giampaolo /psutil
- psutil documentation



Install Thonny on Ubuntu for Raspberry Pi

Thonny is a very great cross-platform Python IDE. 

To install Thonny on Ubuntu Desktop for Raspberry Pi, simple enter the command in Terminal:

$ sudo apt install thonny

After installed, you can enter "thonny" in Terminal, or search "thonny" in Activities.