ESP32-C3-(01M|M1) boards for tiny robot wireless MicroPython REPL

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
HermannSW
Posts: 197
Joined: Wed Nov 01, 2017 7:46 am
Contact:

ESP32-C3-(01M|M1) boards for tiny robot wireless MicroPython REPL

Post by HermannSW » Sun Dec 26, 2021 8:59 pm

For some time I am building tiny robots (8 sofar):
"Tiny MicroPython robots (the PCB IS the robot platform)"
viewtopic.php?f=5&t=11454
Image


For one the motor+controller base is very small (16.0×15.8mm from top). If I ever will get ESP8266 model ESP-01F soldered (1.1mm spacing!) , that would be my favorite (10×11×2mm), although it has a tiny external antenna. I bought two ESP32-C3 models (01M and M1) because of small size. I used Dremel to reduce Tiny2040 MCU (contains Raspberry RP2040) down from 22.9×18.2mm to 19.5×14.9mm Tinier2040:
Image


Today I did the same with ESP32-C3-01M, dremeled down from 18×18mm to 18×15.8mm (0.25mm on antenna side, the remainder on contact side):
20211226_192234.part.20%.jpg
20211226_192234.part.20%.jpg
20211226_192234.part.20%.jpg (42.18 KiB) Viewed 9506 times


All started last night by soldering 3.3/RX/TX and GND/I09/EN pins. I only need the TX/RX pins once for flashing MicroPython onto the module, start a MicroPython session and do "import webrepl_setup" to enable Webrepl. Form that time on I use I06/I09/I20(RX)/I21(TX) to control two micro motors via DRV8833 motor controller [that DRV8833 module is dremeled as well :) ]:
Image


I tested that all 4 pins can do PWM before using Dremel, and tested after done that they are still working:
20211225_232427.15%.jpg
20211225_232427.15%.jpg
20211225_232427.15%.jpg (51.44 KiB) Viewed 9506 times

Last night I flashed MicroPython onto the module, after having learned that ESP32-C3 works different to ESP8266 and to ESP8285. Powering with I09 low brings module into flash mode. And it keeps in flash mode until reset with I09 not low (it is pulled up):

Code: Select all

esptool.py -p /dev/serial0 flash_id
esptool.py -p /dev/serial0 erase_flash
esptool.py --chip esp32-c3 --port /dev/serial0 --baud 460800 write_flash -z 0x0000 esp32c3-20211214-unstable-v1.17-231-g0892ebe09.bin

To my surprise, after "import webrepl_setup" and final reset of module, webrepl did not work. Reason was that for some reason networking did not get started. I started (in minicom session) by hand:

Code: Select all

import network                                                              
ap=network.WLAN(network.AP_IF)                                              
ap.active(True)  
After that webrepl worked. So I downloaded boot.py with webrepl, inserted those three lines and uploaded boot.py using webrepl:

Code: Select all

pi@raspberryPi400:~ $ cat boot.py
# This file is executed on every boot (including wake-boot from deepsleep)
#import esp
#esp.osdebug(None)
import webrepl
import network                                                              
ap=network.WLAN(network.AP_IF)                                              
ap.active(True)  
webrepl.start()
pi@raspberryPi400:~ $ 
Since that point in time, I only connect 3.3/GND/EN pins of ESP-C3-01M with 3V3/GND/3V3 pins of Pi400.

I used my oscilloscope to verify that PWM works for the female headers soldered to the 4 ESP32 pins. This is webrepl session verifying that IO6 PWM does work (25% duty):

Code: Select all

Welcome to MicroPython!                                                                                                                               
Password:                                                                                                                                             
WebREPL connected                                                                                                                                     
>>>                                                                                                                                                   
>>>                                                                                                                                                   
>>> from machine import PWM,Pin                                                                                                                       
>>> Pin(6,Pin.OUT).value(1)                                                                                                                           
>>> Pin(6,Pin.OUT).value(0)                                                                                                                           
>>> p6=PWM(Pin(6))                                                                                                                                    
>>> p6.duty(256)                                                                                                                                      
>>>  
Pico-W Access Point static file webserver:
https://github.com/Hermann-SW/pico-w

Tiny MicroPython robots (the PCB IS the robot platform)
viewtopic.php?f=5&t=11454

webrepl_client.py
https://github.com/Hermann-SW/webrepl#webrepl-shell

HermannSW
Posts: 197
Joined: Wed Nov 01, 2017 7:46 am
Contact:

Re: ESP32-C3-(01M|M1) boards for tiny robot wireless MicroPython REPL

Post by HermannSW » Mon Dec 27, 2021 12:32 pm

I completely forgot about my own "webrepl_client.py" work from 3 years ago:
https://github.com/Hermann-SW/webrepl#webrepl-shell

After cloning the repo, and these pip3 installs:
sudo pip3 install websocket
sudo pip3 install websocket_client

No browser is needed for accessing the ESP32-C3-01M webrepl with that, here I tested again with oscilloscope that PWM on IO6 does work. Unlike the Raspberry Pico MicroPython default PWM frequency just below 2KHz, for ESP32 modules it is 5KHz:

Code: Select all

pi@raspberryPi400:~/webrepl $ ./webrepl_client.py 192.168.4.1
Password: 

WebREPL connected
>>> 
MicroPython v1.17 on 2021-12-14; ESP32C3 module with ESP32C3
Type "help()" for more information.
>>> from machine import Pin,PWM
>>> p6=PWM(Pin(6))
>>> p6.duty(896)
>>> p6.duty(128)
>>> p6.freq()
5000
>>> 

In different thread "Dremel 18×18mm ESP32-C3-01M down to 18×15.8mm fully functional" ESP_Sprite proposed to use ESP32-C3-M1 instead because of its size (16.6×13.2mm):
https://esp32.com/viewtopic.php?f=12&t=25219#p89364

I answered that I have those modules already (in middle box), but that the pin spacing of that module is even less than the 1.1mm of ESP-01F ...
20211227_085724.20%.jpg
20211227_085724.20%.jpg
20211227_085724.20%.jpg (46.28 KiB) Viewed 9443 times
Pico-W Access Point static file webserver:
https://github.com/Hermann-SW/pico-w

Tiny MicroPython robots (the PCB IS the robot platform)
viewtopic.php?f=5&t=11454

webrepl_client.py
https://github.com/Hermann-SW/webrepl#webrepl-shell

User avatar
Len
Posts: 3
Joined: Sat May 26, 2018 6:36 pm

Re: ESP32-C3-(01M|M1) boards for tiny robot wireless MicroPython REPL

Post by Len » Tue Mar 15, 2022 3:06 pm

Perhaps you can help me get this board running.

I downloaded and installed the latest micropython for the ESP32-C3. The install looked fine. When it did the hard reset the board powered off.
Resetting the board had no effect. I had to disconnect it and reconnect it, but whenever I start any kind of tool that communicates with it, it immediately powers down.

I have the same results with Arduino, the install looks fine, but if it tries to communicate with the serial monitor it powers down. All the other ESP32-C3 boards I have work fine, just this one does this and I have tried three different boards like this and they all behave the same.

Edit: I noticed you were using TX and RX so after sending an Arduino program to the device, I moved over to the TX and RX pins, and upon resetting it, there it was. I did have to move the Serial Port which changed from plugged into the device USB to running thru a USB adapter to the TX and RX pins. I like your little robots, there was one for about $20 at EBay, that was a cat toy, this board will fit above the existing one and splice into the motor control chips the web page control will have a slider for left to right and another slider for stop to full speed.
Attachments
cattoy.jpg
cattoy.jpg (148.26 KiB) Viewed 7955 times

MaxMin
Posts: 6
Joined: Mon Aug 22, 2022 4:41 am

Re: ESP32-C3-(01M|M1) boards for tiny robot wireless MicroPython REPL

Post by MaxMin » Mon Aug 22, 2022 10:57 am

RE: your "webrepl_client.py": Circuitpython 8.0 beta Web Workflow support may overlap...
viewtopic.php?f=18&t=12952

(If I can just get the ESP32-C3-01M-Kit to work with Circuitpython, crazy symtom is the RGB softly glowing white)

A fix others mentioned for Arduino serial monitor disabling the ESP32-C3 processor, patching the boards.txt file changing false to true fixes it.

Code: Select all

esp32c3.serial.disableDTR=true
esp32c3.serial.disableRTS=true

Post Reply