arduino icon indicating copy to clipboard operation
arduino copied to clipboard

Add ESP32 to board defs

Open d1runberg opened this issue 9 years ago • 50 comments
trafficstars

It would be awesome to add ESP32 to the board defs for standardfirmatawifi/ bluetooth! The GPIO capability is much better than the 8266

d1runberg avatar Nov 02 '16 19:11 d1runberg

Do you have an ESP32 board? I don't and need someone to verify the defs if I add them.

soundanalogous avatar Nov 02 '16 20:11 soundanalogous

Not yet, but I will probably have one in about a week ;)

d1runberg avatar Nov 02 '16 20:11 d1runberg

Also I'm not sure if anyone has added Arduino support for it yet. Will need to wait until it's available in the Arduino Board Manager.

soundanalogous avatar Nov 02 '16 20:11 soundanalogous

Here is the Arduino core...

https://learn.sparkfun.com/tutorials/esp32-thing-hookup-guide?_ga=1.116824388.33505106.1471290985#installing-the-esp32-arduino-core

Derek Runberg Regional Education Developer Sparkfun Electronics Inc.

Boulder, CO. Cell: 971-344-2355 [email protected] http://www.sparkfun.com http://learn.sparkfun.com

On Wed, Nov 2, 2016 at 1:50 PM, Jeff Hoefs [email protected] wrote:

Also I'm not sure if anyone has added Arduino support for it yet. Will need to wait until it's available in the Arduino Board Manager.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/firmata/arduino/issues/315#issuecomment-257994689, or mute the thread https://github.com/notifications/unsubscribe-auth/AI0_VGuerB46dO7q2bnVY8Z4_thy69SHks5q6PeAgaJpZM4KnrgO .

d1runberg avatar Nov 03 '16 22:11 d1runberg

Thanks! Hadn't realized you worked at Sparkfun.

soundanalogous avatar Nov 03 '16 23:11 soundanalogous

;)

Derek Runberg Regional Education Developer Sparkfun Electronics Inc.

Boulder, CO. Cell: 971-344-2355 [email protected] http://www.sparkfun.com http://learn.sparkfun.com

On Thu, Nov 3, 2016 at 4:40 PM, Jeff Hoefs [email protected] wrote:

Thanks! Hadn't realized you worked at Sparkfun.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/firmata/arduino/issues/315#issuecomment-258306548, or mute the thread https://github.com/notifications/unsubscribe-auth/AI0_VHZ3I3gZzmIdGkxtClc2XybEMPvQks5q6nDfgaJpZM4KnrgO .

d1runberg avatar Nov 03 '16 23:11 d1runberg

Thank for working on this.

I see that the tools install themselves into the Arduino environment by following the Sparkfun site instructions. What, if anything, else needs to be done to run WiFi Firmata on the ESP32?

deadprogram avatar Jan 13 '17 09:01 deadprogram

A lot needs to be done. An entry for the ESP32 is needed in Boards.h. An entry must also be added to wifiConfig.h and any pins that need to be ignored must be specified. Changes may need to be made to WiFiStream.h to handle any ESP32-specific behavior that is not 100% aligned with the Arduino Wi-Fi 101 library behavior, etc.

I recently picked up an ESP32 Thing board so I'll be adding this at some point in the coming weeks.

soundanalogous avatar Jan 13 '17 17:01 soundanalogous

Hi @soundanalogous anything happen on this, or anything I can do to help out with it?

deadprogram avatar May 17 '17 09:05 deadprogram

I haven't had any time to work on it. Adding UART support would only take a few minutes, but adding Wi-Fi and BLE will take a lot longer. I don't even think the ESP32 Thing has an Arduino BLE library yet. It does have Wi-Fi though.

soundanalogous avatar May 17 '17 16:05 soundanalogous

Thanks for the reply @soundanalogous

If it is literally that easy, perhaps you could add the UART support, and then others like myself can work on adding WiFi support using https://github.com/espressif/arduino-esp32/tree/master/libraries/WiFi

It does appear that there is also now BLE support as well https://github.com/espressif/arduino-esp32/tree/master/libraries/SimpleBLE

deadprogram avatar May 17 '17 17:05 deadprogram

That would be great if you want to take on Wi-Fi support! I'll see if I can find time to add basic support this weekend.

I've looked at SimpleBLE, but unfortunately it's not comprehensive enough. I'm hoping ESP32 support is added to the BLEPeripheral library at some point since that already works with Firmata.

soundanalogous avatar May 17 '17 18:05 soundanalogous

I looked into this today. It turns out to be not so simple because the arduino-esp32 library does not yet support analogWrite or the Servo library which are both expected by StandardFirmata (and variants). I don't want to add an #ifdef to StandardFirmata just for this architecture either.

I could probably add the board to ConfigurableFirmata, but a user would have to know to exclude the analogWrite and Servo features in order to avoid compiler errors.

soundanalogous avatar May 20 '17 21:05 soundanalogous

The esp32 HAL also redefines the standard INPUT and OUTPUT constants which is annoying. It's a relatively easy fix in Firmata however.

soundanalogous avatar May 20 '17 23:05 soundanalogous

Requiring a specific ConfigurableFirmata is not a problem for me personally, and certainly is an interim step until those other entrypoints are supported by arduino-esp. As long as it is documented, others will be able to avoid pitfalls with that.

deadprogram avatar May 21 '17 10:05 deadprogram

This board is not proving to be very Firmata friendly. Turns out it spits out a large string of text on startup and upon establishing a new Serial connection:

⸮⸮⸮�⸮���⸮�⸮⸮⸮⸮⸮�⸮⸮�������������⸮���⸮��������⸮��������⸮�⸮⸮⸮�⸮⸮�⸮⸮��⸮�⸮⸮��⸮���⸮⸮�⸮�⸮⸮�⸮����⸮⸮�����⸮��⸮⸮⸮�⸮⸮⸮⸮⸮⸮⸮�⸮��⸮⸮⸮�⸮��⸮⸮⸮⸮��⸮⸮⸮⸮�⸮⸮�⸮⸮⸮⸮�⸮�⸮⸮⸮⸮�⸮��⸮���⸮⸮⸮⸮⸮⸮⸮�⸮⸮�⸮����⸮⸮��⸮�����⸮�⸮�⸮⸮�⸮⸮⸮��⸮⸮⸮⸮��⸮⸮�⸮⸮�⸮⸮�⸮⸮⸮⸮⸮⸮��⸮��⸮⸮�⸮⸮�⸮⸮��⸮⸮⸮⸮��⸮⸮�⸮⸮�⸮�⸮⸮⸮⸮�⸮ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0x00
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0008,len:8
load:0x3fff0010,len:160
load:0x40078000,len:10632
load:0x40080000,len:252
entry 0x40080034

A firmata client would need to interpret and ignore this data in order for this board to work over a Serial transport. This won't affect Wi-Fi however so that is still a possible option, but overall this board seems like a poor choice for Firmata applications.

soundanalogous avatar May 22 '17 03:05 soundanalogous

I have ConfigurableFirmata branch with ESP32 support that sorta works for Wi-Fi: https://github.com/firmata/ConfigurableFirmata/pull/71. It's far from stable however. Needs testing and I could use some help improving it... especially in figuring out a buffering scheme that will likely lead to a larger structural change in using non-Serial/USB transports with Firmata.

soundanalogous avatar May 29 '17 06:05 soundanalogous

any progress? im thinking of picking up an esp32 soon

Wqrld avatar Jul 18 '17 13:07 Wqrld

I would not recommend purchasing an ESP32 board specifically for use with Firmata any time soon. Buy an ESP8266 board instead.

soundanalogous avatar Jul 18 '17 18:07 soundanalogous

okay, now i have to decide to get bluetooth or firmata. Anyway, thanks for your work on this awesome project.

Wqrld avatar Jul 18 '17 18:07 Wqrld

BLE is supported for Firmata on the Arduino 101 and the RedBear BLE Nano (with some minor changes). However, that said, BLE does not work well with Firmata because Firmata is stream-based and BLE is not designed for large data transfers.

soundanalogous avatar Jul 18 '17 19:07 soundanalogous

I should add that how well BLE works with Firmata really depends on your application. It actually works well if you just need data from a single sensor or need to control a single actuator. It doesn't work well for general purpose control of a microcontroller where you need to use various digital and analog signals simultaneously.

soundanalogous avatar Jul 18 '17 19:07 soundanalogous

Ups, I wanted more pins and changed to esp32, but firmata is not supported... :-( Any news/infos/plans on this issue?

ttww avatar Jan 05 '18 16:01 ttww

The biggest blocker is that the Arduino analogWrite method is not yet supported on the esp32.

soundanalogous avatar Jan 05 '18 17:01 soundanalogous

I'm using ledcwrite as a workaround until we get analogwrite: https://github.com/monteslu/ble-io/blob/master/arduino/esp32/esp32.ino#L229

Might still be helpful to have the board definition so we know what pins can do what in the meantime

monteslu avatar Jan 05 '18 17:01 monteslu

Thanks for that tip :-)

ttww avatar Jan 05 '18 21:01 ttww

does anyone has a functioning fork with the ESP32 working? i don't need analogWrite so this ain't a problem for me.

draeron avatar Aug 11 '19 20:08 draeron

@draeron you can try this branch and see my notes about it here.

soundanalogous avatar Aug 13 '19 04:08 soundanalogous

thx i'll be sure to check it out.

draeron avatar Aug 13 '19 15:08 draeron

Firmata provided in IDE 1.8.13 still seems not to be working on bpi:uno32 , any plan to solve this issue ?

T0T4R4 avatar Jul 26 '20 04:07 T0T4R4