Posts

Showing posts from October, 2023

Install Visual Studio Code on Linux Mint 21.2 (over VirtualBox/Windows 11)

Image
 Install Visual Studio Code1.81 on Linux Mint 21.2, over VirtualBox/Windows 11. Visit: https://code.visualstudio.com/ Download .deb for x64 It's two ways listed to install VS Code in Linux (.deb) Method one: sudo apt install ./<file>.deb It's first suggested, but in my test on Linux Mint 21.2, it reports error of Permission denied: N: Download is performed unsandboxed as root as file '/home/eric/Downloads/code_1.83.1-1696982868_amd64.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied) Method two: sudo dpkg -i <file>.deb sudo apt-get install -f # Install dependencies For older Linux distribution, works for me with no error. next: ~  Install Espressif IDF Extension in VS Code to program ESP32-C3 Run on Linux Mint 21.2 (over Windows 11/VirtualBox) . ~  Create Hello World in VSCode/ESP-IDF Extension manually, run on ESP32-C6 to send text to Serial . ~  Install PlatformIO on Visua

my dev. board - YD-ESP32-C6-N16

Image
 YD-ESP32-C6-N16 by VCC-GND Studio - ESP32-C6-WROOM-1 with 16M Flash CircuitPython related: ~  Flash CircuitPython 9 (Alpha 5) on ESP32-C6, and control on-board RGB LED (NeoPixel) . ESP-IDF related: ~  Install Visual Studio Code on Linux Mint 21.2 (over VirtualBox/Windows 11) . ~  Install Espressif IDF Extension in VS Code to program ESP32-C3 Run on Linux Mint 21.2 . ~  Create Hello World in VSCode/ESP-IDF Extension manually, run on ESP32-C6 to send text to Serial . ~  Install PlatformIO on Visual Studio Code to program ESP32-C6 in ESP-IDF . esp-rs: ~  Install Embedded Rust for ESP32 on Linux Mint 21.3 over VirtualBox/Windows 11 (tested with ESP32-C3-DevKitM-1) ~  Rust on ESP (esp-rs), toggle GPIO to control LED on ESP32-C6 .

my dev. board - YD-ESP32-S3-EYE

Image
YD-ESP32-S3-EYE by VCC-GND Studio. The seller claim that it's compatible with Espressif  ESP32-S3-EYE . The seller claim that it provide the same as ESP32-S3-EYE. Related: ~  Install CircuitPython firmware on YD-ESP32-S3-EYE using esptool . ~  YD-ESP32-S3-EYE/CircuitPython 8, control LCD and Camera . ~  Turtle Graphics on ESP32-S3-EYE/CircuitPython

Python script with tkinter GUI to capture images from Raspberry Pi Camera Module 3, with Toggling AF mode function.

Image
This exercise work on last exercise " Python script with tkinter GUI to capture images from Raspberry Pi Camera Module 3 ", added function to toggle AfMode between Continuous and Manual. It works on Raspberry Pi 4B running 32-bit Raspberry Pi OS (Bookworm), with Camera Module 3 . cam_tkinter_capture.py (2023-10-15) from tkinter import * from tkinter import messagebox from picamera2 import Picamera2, Preview from libcamera import controls import time import sys import importlib.metadata picam2 = Picamera2() camera_config = picam2.create_preview_configuration() picam2.configure(camera_config) picam2.start_preview(Preview.QTGL) picam2.set_controls({"AfMode": controls.AfModeEnum.Continuous}) picam2.start() root = Tk() root.title(sys.argv[0]) root.geometry("550x450") # center on screen root.eval('tk::PlaceWindow . center') label_picam_ver = Label(root, text="picamera2 ver: " + importlib.metadata.ve

A simple way to take screenshot in Linux

Image
The easiest way to take screenshot in Linux is using the "PrtSc" key. But if your keyboard haven't the "PrtSc" key, it's another easy way, search and run screenshot in Start menu. At least it works on Linux Mint.

BLE communication between MicroPython aioble and ArduinoBLE

Image
Previous posts introduced " MicroPython bluetooth remote control LED between Raspberry Pi Pico W and ESP32-C3, using aioble library " and " BLE examples run on Nano 33 BLE (as Peripheral) and Uno R4 WiFi (as Central) using ArduinoBLE in Arduino Framework ". This video further test how BLE communication between that two approach.

MicroPython bluetooth remote control LED between Raspberry Pi Pico W and ESP32-C3, using aioble library.

Image
Last post introduced " MicroPython bluetooth example using aioble library, temp_client.py and temp_sensor.py ". This post modified it to remote control LED via bluetooth between Raspberry Pi Pico W and ESP32-C3-DevKitM-1 , achieve the same function as in " BLE examples run on Nano 33 BLE (as Peripheral) and Uno R4 WiFi (as Central), using ArduinoBLE in Arduino framework ". Basically, the bluetooth/aioble parts on both boards are same, but code in separated is caused by different configurare of onboard LED. Code: mpy_aioble_peripheral_led_esp32c3.py """ MicroPython v1.21 exercise run on Espressif ESP32-C3-DevKitM-1 using aioble lib. Play the role as BLE Peripheral of LED. As the role in ArduinoBLE examples>Peripheral>LED - Setup as BLE Peripheral of LED, wait connection from Central device. - Turn ON/OFF onboard LED according to received command: 0 - Turn OFF LED 1 - Turn ON LED """ import sys

MicroPython bluetooth example using aioble library, between Raspberry Pi Pico W and ESP32-C3. (Both run MicroPython 1.21.0)

Image
With recent update of MicroPython, bluetooth is supported in Raspberry Pi Pico W build. The official guide " Connecting to the Internet with Raspberry Pi Pico W book (2023-06-14) " updated with example using bluetooth. Read my previous post " Prepare MicroPython Bluetooth service example on Raspberry Pi Pico W ". Refer to MicroPython libraries document - bluetooth , higher-level aioble library is recommended. aioble provides an object-oriented, asyncio-based wrapper for MicroPython's bluetooth API. (* This module is still under development and its classes, functions, methods and constants are subject to change.) This video introduce the alternative using aioble library, run on Raspberry Pi Pico W and  Espressif ESP32-C3-DevKitM-1 , both run MicroPython v1.21.0. Notice that aioble is included in Raspberry Pi Pico W MicroPython v1.21.0, but not in v1.20.0. Fail in await connection.disconnected() using aioble library

Display on SSD1306/SSD1315 OLED with Uno R4 WiFi & Nano 33 BLE using Adafruit SSD1306 library

Image
Last post show how to display on SSD1306/SSD1315 OLED with Uno R4 WiFi & Nano 33 BLE using U8g2 library , this post show how to using Adafruit SSD1306 library. Install Adafruit SSD1306 library and dependencies, Adafruit BusIO and Adafruit GFX Library. Connnection, refer to last post . In last post, it's found that the I2C Address of SSD1306/SSD1315 OLED is 0x3C. Open File > Examples > Adafruit SSD1306 > ssd1306_128x64_i2c Change SCREEN_ADDRESS to 0x3C. #define SCREEN_ADDRESS 0x3C //0x3D Then it can run on Uno R4 WiFi & Nano 33 BLE to display on SSD1306/SSD1315 OLED.

Display on SSD1306/SSD1315 OLED with Uno R4 WiFi & Nano 33 BLE using U8g2 library

Image
This video show displaying on 0.96 inch 128x64 SSD1306/SSD1315 OLED with NoLogo Uno R4 WiFi & Nologo Nano 33 BLE nRF52840 using U8g2 library . Library: Install U8g2 Library in Arduino IDE's Library Manager. Connection: Connection between SSD1306/SSD1315 OLED and Uno R4 WiFi/Nano 33 BLE notice: Uno R4 WiFi operate on 5V Nano 33 BLE operate on 3.3V The operating voltage of my OLED board is 3.3~5V * Check operating voltage of your own OLED board! OLED Uno R4 WiFi Nano 33 BL ------------------------------ GND GND GND VCC +5V +3V3 SCL D19/SCL A5/P0.02 SDA D18/SDA A4/P0.31 Arduino Code: i2c_scanner.ino , scan connected I2C devices and print its I2C address. #include <Wire.h> void setup() { Wire.begin(); delay(1000); Serial.begin(115200); while (!Serial); delay(1000); Serial.println("\nI2C Scanner"); delay(2000); } void loop() { byte error, address; int nDevices; Serial.println(&qu

BLE examples run on Nano 33 BLE (as Peripheral) and Uno R4 WiFi (as Central) in Arduino framework using ArduinoBLE library.

Image
The video show ArduinoBLE examples run on Nano 33 BLE (Peripheral>LED example) and Uno R4 WiFi (Central>LedControl example). To remote control onboard LED via BLE. What I changed on code is in LedControl.ino: pinMode(buttonPin, INPUT); change to: pinMode(buttonPin, INPUT_PULLUP ); and int buttonState = digitalRead(buttonPin); change to: int buttonState = ! digitalRead(buttonPin); Such that you can connect pin 2 on Uno R4 WiFi to GND to simulate key press,to remote control Nano 33 BLE onboard LED via BLE. next: ~ This code communicate with MicroPython using aioble library -  BLE communication between MicroPython aioble and ArduinoBLE .

List pins of Nologo UNO R4 WiFi

Image
UnoR4WiFi_info.ino , list pre-defined pins of Uno R4 WiFi . /* Exercise run on Uno R4 WiFi to get pins info. */ void setup() { // set LED pin to output mode pinMode(LED_BUILTIN, OUTPUT); blinkLED(); blinkLED(); blinkLED(); Serial.begin(9600); delay(500); Serial.println(); Serial.println("-----------------------------"); Serial.println("\n- Uno R4 WiFi pins info -"); Serial.println("-----------------------------"); Serial.println("USB_NAME:\t" + String(USB_NAME)); Serial.println("USB_VID:\t" + String(USB_VID, HEX)); Serial.println("USB_PID:\t" + String(USB_PID, HEX)); Serial.println(); Serial.println("LED_BUILTIN:\t" + String(LED_BUILTIN)); Serial.println(); Serial.println("MOSI:\t" + String(MOSI)); Serial.println("MISO:\t" + String(MISO)); Serial.println("SCK:\t" + String(SCK)); Serial.println("SS:\t" + String(SS)); Seri

Check and update UNO R4 WiFi firmware

Image
unoR4WiFi_CheckWiFiFirmware.ino run on my dev.board - Nologo UNO R4 WiFi , to check the on board WiFi Firmware version. /* Simple code to check WiFi Firmware on Arduino Uno R4 WiFi Wi-Fi support is enabled via the built-in WiFiS3 library that is shipped with the Arduino UNO R4 Core. Installing the core automatically installs the WiFiS3 library. ref: UNO R4 WiFi Network Examples https://docs.arduino.cc/tutorials/uno-r4-wifi/wifi-examples */ #include <WiFiS3.h> void setup() { delay(500); //Initialize serial and wait for port to open: Serial.begin(9600); while (!Serial) { ; // wait for serial port to connect. Needed for native USB port only } delay(500); Serial.println("- Check Arduino Uno R4 WiFi firmware version -"); // check for the WiFi module: if (WiFi.status() == WL_NO_MODULE) { Serial.println("Communication with WiFi module failed!"); // don't continue while (true); } String fv = WiFi.fir