Showing posts with label ESP32. Show all posts
Showing posts with label ESP32. Show all posts

Saturday, April 8, 2023

Has anyone integrated ai models in to micropython?

 Integrating AI models into MicroPython can be challenging due to the limited resources available on microcontrollers, which usually have constraints on memory, processing power, and energy consumption. However, there are examples of AI models being integrated into MicroPython, particularly for TinyML applications.

One approach is to use TensorFlow Lite for Microcontrollers, a version of TensorFlow Lite designed specifically for microcontrollers and embedded devices. TensorFlow Lite for Microcontrollers supports a subset of operations available in the full TensorFlow Lite, making it suitable for running on resource-constrained devices.

While TensorFlow Lite for Microcontrollers does not have direct support for MicroPython, you can use the C++ API to integrate the AI models into your MicroPython application. Some microcontrollers, like the ESP32, support both MicroPython and the TensorFlow Lite for Microcontrollers C++ API. In such cases, you can use the C++ API to run the AI model and then interact with it through MicroPython.

An example of this approach can be found in the following GitHub repository: https://github.com/mocleiri/tensorflow-micropython-examples

It demonstrates how to use TensorFlow Lite for Microcontrollers with MicroPython on an ESP32 microcontroller. The repository includes examples for running speech recognition and image classification models.

Keep in mind that running AI models on microcontrollers can be challenging due to the limited resources available. You may need to optimize the model, use quantization, or apply other techniques to make the AI model suitable for deployment on such devices.

Sunday, March 7, 2021

ampy - Utility to interact with a MicroPython board over a serial connection.

 

This can be really useful to control the I/O hardware if your control board is running on MicroPython like the Micro:Bit. 


I found ampy was being used by the Hadabot Project used for teaching ROS2. that consisted of an ESP32 Wifi board running ampy, and a simple DC motor controller on a magic chassis , turtle bot robot that is just two motors, a motor driver , and encoders, and a few sensors.  Everything was being over Wifi to be controlled by ROS via the ampy python library which is a cinch to in then map ROS messages in to micropython function calls.  


https://github.com/scientifichackers/ampy

ampy

MicroPython Tool (ampy) - Utility to interact with a CircuitPython or MicroPython board over a serial connection.

Ampy is meant to be a simple command line tool to manipulate files and run code on a CircuitPython or MicroPython board over its serial connection. With ampy you can send files from your computer to the board's file system, download files from a board to your computer, and even send a Python script to a board to be executed.

Note that ampy by design is meant to be simple and does not support advanced interaction like a shell or terminal to send input to a board. Check out other MicroPython tools like rshell or mpfshell for more advanced interaction with boards.

Tuesday, December 15, 2020

$5 Wi-Fi IP Surveillance Camera (Very little DIY needed)



https://github.com/espressif/arduino-esp32






ESP32-CAM-MB CH340G ESP8266 ESP32-S Wireless WiFi Bluetooth Expansion Board OV2640 2MP Camera SMD IPEX Antenna for Arduino MCU
[ESP32-CAM-MB CH340G Serial Micro USB]
Description:
The ESP32-CAM-MB module is a small camera module with a size of 39.8*27*. This module can work independently as the smallest system. A new WiFi+Bluetooth dual-mode development board based on ESP32 design, using PCB on-board antenna, with 2 high-performance 32-bit LX6CPU, using 7-level pipeline architecture, main frequency adjustment range 80MHz to 240Mhz. Ultra-low power consumption, deep sleep current is as low as 6mA. It is an ultra-small 802.11b/g/n Wi-Fi + BT/BLE SoC module
ESP32-CAM-MB adopts Micro USB interface, convenient and reliable connection method, which is convenient to be applied to various IoT hardware terminal occasions.
 
Parameters:
Using low-power dual-core 32-bit CPU, it can be used as an application processor.
The main frequency is up to 240MHz, and the computing power is up to 600 DMIPS
Built-in 520 KB SRAM, external 8MB PSRAM
Support UART/SPI/I2C/PWM/ADC/DAC and other interfaces
Support OV2640 and OV7670 cameras, built-in flash
Support picture WiFI upload
Support TF card
Support multiple sleep modes.
Embedded Lwip and FreeRTOS
Support STA/AP/STA+AP working mode
Support Smart Config/AirKiss one-click network configuration
Support secondary development
 
Application:
Home smart device image transmission
Wireless monitoring
Smart agriculture
QR wireless recognition
Wireless positioning system signal
And other IoT applications
 
Specification:
Working voltage: 4.75 -5.25V
SPIFlash: 32Mbit
RAM: Internal 520KB + external 8MB PSRAM
Wi-Fi: 802.11b/g/n/e/i
Bluetooth: Bluetooth 4.2BR/EDR and BLE standard
Support interface: (2Mbps) UART, SPI, I2C, PWM
Support TF card: up to 4G
IO port: 9
Serial port rate: 115200bps
Spectrum range: 2400 -2483.5MHz
Antenna form: onboard PCB antenna, gain 2dBi
Image output format: JPEG (only OV2640 support), BMP, GRAYSCALE
Transmit power:
802.11b: 17±2dBm (@11Mbps)
802.11g: 14±2dBm (@54Mbps)
802.11n: 13±2dBm (@MCS7)
Receiving sensitivity:
CCK, 1Mbps: -90dBm
CCK, 11Mbps: -85dBm
6Mbps(1/2BPSK): -88dBm
54Mbps(3/464-QAM): -70dBm
MCS7 (65Mbps, 72.2Mbps): -67dBm
Power consumption:
Flash off: 180mA@5V
Turn on the flash and adjust the brightness to the maximum: 310mA@5V
Deep-sleep: The lowest power consumption can reach 6mA@5V
Moderm-sleep: The minimum can reach 20mA@5V
Light-sleep: The lowest can reach 6.7mA@5V
Security: WPA/WPA2/WPA2-Enterprise/WPS
Working temperature: -20℃ -70℃
Storage environment: -40℃ -125 ℃, <90%RH
 
[ESP32-CAM]
Modle: ESP32-CAM
Operating Voltage: 5V
SPI Flash: 32 Mbit
RAM: Inter 520KB+, External 4M PSRAM
Bluetooth: BLuetooth 4.2 BR/EDR & BLE standard
WIFI: 802.11/b/g/n/e/i
Port: UART, SPI, I2C, PWM
IO Port: 9
Serial port rate: 115200 bps
Picture form: JPEG (only OV2640 support), BMP, GRAYSCALE
Spectrum range: 2412 -2484MHz
Antanna: Onboard PCB Antanna 2dBi
Security: WPA/WPA2/WPA2-Enterprise/WPS
Operating Temperature: -20 -85℃
Storage Tepmerature: -40 -90℃, <90%RH
 
Transmit power: 
802.11b: 17+/-2 dBm (@11Mbps)
802.11g: 14+/-2 dBm (@54Mbps)
802.11n: 13+/-2 dBm (@MSC7)
 
Receive Sensitivity:
CCK, 1 Mbps: -90dBm
CCK, 11 Mbps: -85dBm
6 Mbps(1/2 BPSK): -88dBm
54 Mbps (3/4 64-QAM): -70dBm
MCS7 (65 Mbps, 72.2 Mbps): -67dBm
 
[ESP32-S]
The main chip uses a low-power dual-core 32-bit CPU with a frequency of up to 240MHz and a computing power of up to 600DMIPS.
Default 32Mbit SPI Flash, 520KB SRAM
Support SoftAP and Station mode
Ultra-small 802.11b/g/n Wi-Fi + BT/BLE SoC module
Support UART/SPI/I2C/I2S/PWM/ADC/DAC, etc.
Support for firmware upgrade (FOTA)
Antenna supports on-board antenna or IPEX block output
 
[OV2640 Camera Module]
Feature:
The OV2640 image sensor features 2 megapixels (1632x1232 pixels)
Small size, low operating voltage, and provides all the features of a single chip UXGA camera and image processor.
Through the SCCB control, you can output the entire frame, sub-sampling, take the window, and a variety of resolution 10-bit sampling data.
The product UXGA images up to 15 frames per second.
The user can fully control the image quality, data format and transmission mode.
 
Specification:
High sensitivity for low-light applications
Low voltage for embedded applications
Standard SCCB interface, compatible with I2C interface
RawRGB, RGB (GRB4: 2: 2, RGB565 / 555/444), YUV (4: 2: 2) and YCbCr (4: 2: 2) output format
Supports UXGA, SXGA, VGA, QVGA, QQVGA, CIF, QCIF and up to 40x30 size
Supports Vario Pixel sub sampling mode
Automatic impact control functions include: automatic exposure control, Automatic gain control, automatic white balance, automatic elimination of light stripes, automatic black level calibration. Image quality control including color saturation, hue, gamma, sharpness ANTI_BLOOM
ISP with noise cancellation and dead pixel compensation
Support image scaling
Lens loss compensation
Saturation automatic adjustment
Edge enhancement automatic adjustment
Noise reduction automatic adjustment
Sensing array 1632 x 1232
Maximum format UXGA IO
Voltage 1.7V -3.3V
Analog voltage 2.5 -3.0V (internal LDO to power supply 1.2V)
Power consumption TBD sleep<20uA
Temperature operation -30 -70℃
Stable working 0 to 50 Degrees Celsius
Output format (8-bit)
YUV / YCbCr4: 2: 2 RGB565 / 555/444
GRB4: 2: 2 Raw RGB Data
Optical size 1/4"
Viewing angle 25°
Maximum rate 15fps
SXGA sensitivity 1.3V / (Lux-sec )
Signal to noise ratio 40dB
Dynamic range 50 dB
View mode Progressive electron exposure 1 line to 1247 lines
Pixel area 2.2 um x 2.2 um
Dark current 15 mV / s at 60℃

Thursday, September 17, 2020

ESP32-Cam-tank: fpv vehicle powered by esp32 cam




Kun Li created this amazing Tank Teleoperated Robot. 

ESP32-Cam-tank

a fpv vehicle powered by esp32 cam.
This project use a esp32-cam chip to make a common toy into a fpv rc toy.
It can record videos. It also has telemetry to monitoring the battery voltage and wifi signal strength.
Welcome to modify/upgrade and share.


material list:
ESP32-cam x 1
MX612/MX612E x 2
dc-dc converter 1.5~4.2v to 5.2v x 1
resistor a 5.1kΩ x 1
resistor b 3.2kΩ x 1
capacitor a 100μf x 1
capacitor b 10μf x 2
3.7v lithium battery x 1
switch x 1
tank base with motor and gear x 1
wire x n





Find the code here. 
https://github.com/leoncoolmoon/ESP32-Cam-tank