0

Circuitpython on ESP32
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Circuitpython on ESP32

by ray_leiter on Wed Sep 22, 2021 8:26 pm

I was wondering if it is possible to use the Arduino IDE with ESP32 and Circuitpython?
I suppose Circuitpython would have to be uploaded to the ESP32 first and then the Arduino IDE has to be told to use Circuitpython instead of C?
Assuming this is all possible, how does one go about doing it?

ray_leiter
 
Posts: 32
Joined: Wed Mar 16, 2016 9:09 pm

Re: Circuitpython on ESP32

by dastels on Wed Sep 22, 2021 9:15 pm

As far as I know, the Arduino IDE is solidly locked to C++. There are several Python IDEs. Mu is a commonly used one that integrates nicely with CircuitPython. https://learn.adafruit.com/welcome-to-circuitpython/installing-mu-editor

Dave

dastels
 
Posts: 7477
Joined: Tue Oct 20, 2015 3:22 pm

Re: Circuitpython on ESP32

by jerryn on Wed Sep 22, 2021 10:24 pm

CircuitPython does not support the ESP32.
It does support the ESP32S2.

jerryn
 
Posts: 1546
Joined: Sat Sep 14, 2013 9:05 am

Re: Circuitpython on ESP32

by dastels on Thu Sep 23, 2021 7:58 am

Oops. I knew CircuitPython never supported the ESP8266 but seemed to remember it supporting the ESP32. I guess not, or no longer anyway. But FWiW the ESP32-S2 is pretty amazing.

Dave

dastels
 
Posts: 7477
Joined: Tue Oct 20, 2015 3:22 pm

Re: Circuitpython on ESP32

by dastels on Thu Sep 23, 2021 8:06 am

Micropython is an option for the ESP32, but doesn't have CircuitPython's ease of use.

Dave

dastels
 
Posts: 7477
Joined: Tue Oct 20, 2015 3:22 pm

Re: Circuitpython on ESP32

by ray_leiter on Thu Sep 23, 2021 9:02 am

To Dave and jerryn:
Thank you both for the info.
Its very helpful -- I'm going to look into Circuitpython with the ESP32-S2.
Meanwhile I'll continue with the Arduino IDE (C++) with my ESP32.
(if only I could get it to work with my Geekcreit® 0.96 Inch OLED I2C IIC Communication Display 128*64 LCD Module).

Thanks again;
Ray

ray_leiter
 
Posts: 32
Joined: Wed Mar 16, 2016 9:09 pm

Re: Circuitpython on ESP32

by jerryn on Thu Sep 23, 2021 10:40 am

Just to clarify, CircuitPython did support the ESP8266 through Version 3.0 but it was dropped due to the lack of native USB and the difficulty of maintaining it. Since the ESP32 also lacked native USB, it was never supported. The ESP32S2 works very well.

I would expect the SSD1306 library to work with that display. It should be supported by the Arduino IDE or by MicroPython.

jerryn
 
Posts: 1546
Joined: Sat Sep 14, 2013 9:05 am

Re: Circuitpython on ESP32

by ray_leiter on Thu Sep 23, 2021 1:24 pm

jerryn;
I'm not exactly sure what you mean by "native USB".
I'm using the ESP32 DEVKIT V1 board (the DOIT board) which has a mini USB connector that I use to connect it to my PC.
Does that mean my ESP32 based board has "native USB" ?

To tell you the truth -- it probably doesn't matter since I can't get the Adafruit example sketch "ssd1306_128x64_i2c" to work with my Geekcreit SSD1306 based 4 pin OLED module.
I see output when I run it, but only on the approx top 2 mm of the 15 mm display.
Its as though the program or the OLED module thinks the display is 128x10 or something similar.
Its interesting to note that when I change the screen height from 64 to 32, I actually get a little bit more of the output (still, its along the top of the display, while the rest is mostly pixels ON). It looks like random garbage in the display buffer.

ray_leiter
 
Posts: 32
Joined: Wed Mar 16, 2016 9:09 pm

Re: Circuitpython on ESP32

by jerryn on Thu Sep 23, 2021 2:18 pm

Native USB refers to the chip itself supporting the USB connection (there will be pins for D+/D-) on the chip.
The ESP32 does not have this, so the boards use a USB-Serial converter like the CP2104 to connect to the chips UART. You can use it for communication, but not for many other USB functions that CircuitPython relies on.

CircuitPython requires "native" USB so it can mount the file system as a USB flash drive -- this is used for the US2 Bootloader and the CIRCUITPY drive used to hold and execute code.

I hope that makes sense.

jerryn
 
Posts: 1546
Joined: Sat Sep 14, 2013 9:05 am

Re: Circuitpython on ESP32

by ray_leiter on Thu Sep 23, 2021 8:13 pm

jerryn wrote:Native USB refers to the chip itself supporting the USB connection (there will be pins for D+/D-) on the chip.
The ESP32 does not have this, so the boards use a USB-Serial converter like the CP2104 to connect to the chips UART. You can use it for communication, but not for many other USB functions that CircuitPython relies on.

CircuitPython requires "native" USB so it can mount the file system as a USB flash drive -- this is used for the US2 Bootloader and the CIRCUITPY drive used to hold and execute code.

I hope that makes sense.


jerryn;
It makes very good sense -- I understood it all.
Perhaps I could ask a related question?
I am not having any luck getting my 4 pin SSD1306 based 128x64 OLED display to work with my ESP32.
The 4 pins are Vdd, Gnd, SCL and SDA. I'm using the 3.3v supply from the ESP32 and the correct pins for SCL and SDA (Pins 22 & 21).
The real problem is I don't have a very good handle on the problem of which piece of code I can use to demonstrate the display works!
There are many variations of this OLED module, although all seem to have 0x3C as their I2C addr.
When I run the example from the Adafruit library on the Arduino IDE, "ssd1306_128x64_i2c", it shows the output on the first few lines of the display -- the rest of the display appears to have random garbage (most pixels are ON).
I have been searching far and wide for a simple "Hello World" program to run on the ESP32 to convince myself the OLED module is OK -- so far, no luck.
I encountered this trouble while taking the course "Learn the ESP32 with Arduino IDE" from RandomNerdTutorials.com owned and operated by Rui Santos in Portugal. I have asked for help but so far I haven't gotten very far -- still hoping to hear more from Rui.
Do you know of anyone who has used the ESP32 with the 4 pin 128x64 OLED modules within the Arduino IDE environment?
Thanks;
Ray

ray_leiter
 
Posts: 32
Joined: Wed Mar 16, 2016 9:09 pm

Please be positive and constructive with your questions and comments.