ESP32 WiFi Interface and Propeller 2 - possible support and request for community input!
Ken Gracey
Posts: 7,392
Hello,
It seems that most Propeller 2 products, projects, and applications will include a connection to the internet in some way. Of the early product examples we've seen, each has included the ESP32 - just like we saw in yesterday's Propeller 2 Live Forum - Peter Jakacki Presents P2D2 presentation. Two other product design efforts I'm aware of also include an ESP32 (one in remote environmental sensing, another for machine control).
I imagine many of us have knowledge around both the ESP32 and the P2.
Parallax would like to offer a Spin2 object (and ESP32 firmware) for our customers which is easy to use, reliable, and fully (enough) featured. The internet already has so many examples with ESP32 - a quick look turned up this interesting site Random Nerd Tutorials and others. GitHub is loaded with examples as well from an active community of developers, often around the Arduino. The ESP32 module is a dual-core processor and it runs Arduino firmware, too.
How to proceed with creating a useful interface for the P2 is currently beyond my current level of understanding. @"Jeff Martin"
has far more knowledge on the subject and @JonnyMac has included this as an important addition to our list of needed objects.
Some of the thoughts I have about it:
Do we really only need a Spin2/PASM object if we can use the Arduino firmware and libraries? It seems that the Arduino ESP32 firmware does what would be commonly needed for the Propeller - except for the "more of it, faster" part to satisfy the P2's many I/Os and high baudrate capability. Could existing firmware be leveraged for our use, or is it already useful?
What uses would the P2 present that are already not provided for by other processors? Many examples I see are fairly simple and very useful: activate an alarm, send an e-mail, turn things on and off. These can be easily achieved with current examples and hardware.
What does the Propeller 2 community need in a ESP32 object? Parallax needs to sell P2 chips to applications that have some potential. If the needs are limited to detecting your dog with RFID and counting doggy-door clicks, this has already been solved. If you're making a product, what are your exact needs?
As mentioned above, we're willing to support an effort but we're not sure that it's actually needed or how we'd define the scope of work to be done. We'd like this to be easy for our customers to use and properly supported.
To move forward, perhaps it makes sense to schedule this topic as a Propeller 2 Live Forum - Early Adopter Series. Or, you can place your thoughts here. How do we move forward with IoT for the P2?
Thanks,
Ken Gracey
It seems that most Propeller 2 products, projects, and applications will include a connection to the internet in some way. Of the early product examples we've seen, each has included the ESP32 - just like we saw in yesterday's Propeller 2 Live Forum - Peter Jakacki Presents P2D2 presentation. Two other product design efforts I'm aware of also include an ESP32 (one in remote environmental sensing, another for machine control).
I imagine many of us have knowledge around both the ESP32 and the P2.
Parallax would like to offer a Spin2 object (and ESP32 firmware) for our customers which is easy to use, reliable, and fully (enough) featured. The internet already has so many examples with ESP32 - a quick look turned up this interesting site Random Nerd Tutorials and others. GitHub is loaded with examples as well from an active community of developers, often around the Arduino. The ESP32 module is a dual-core processor and it runs Arduino firmware, too.
How to proceed with creating a useful interface for the P2 is currently beyond my current level of understanding. @"Jeff Martin"
has far more knowledge on the subject and @JonnyMac has included this as an important addition to our list of needed objects.
Some of the thoughts I have about it:
Do we really only need a Spin2/PASM object if we can use the Arduino firmware and libraries? It seems that the Arduino ESP32 firmware does what would be commonly needed for the Propeller - except for the "more of it, faster" part to satisfy the P2's many I/Os and high baudrate capability. Could existing firmware be leveraged for our use, or is it already useful?
What uses would the P2 present that are already not provided for by other processors? Many examples I see are fairly simple and very useful: activate an alarm, send an e-mail, turn things on and off. These can be easily achieved with current examples and hardware.
What does the Propeller 2 community need in a ESP32 object? Parallax needs to sell P2 chips to applications that have some potential. If the needs are limited to detecting your dog with RFID and counting doggy-door clicks, this has already been solved. If you're making a product, what are your exact needs?
As mentioned above, we're willing to support an effort but we're not sure that it's actually needed or how we'd define the scope of work to be done. We'd like this to be easy for our customers to use and properly supported.
To move forward, perhaps it makes sense to schedule this topic as a Propeller 2 Live Forum - Early Adopter Series. Or, you can place your thoughts here. How do we move forward with IoT for the P2?
Thanks,
Ken Gracey
Comments
Github: Parallax-ESP32
Maybe a better mouse trap can be constructed since this firmware came along.
Mike
Many IoT projects are just going to be able to use a standalone ESP32 and Arduino code. It has a couple ADCs, it has a couple UARTs, and most stock modules expose ten or so pins.
Where the P2 comes in, I think, is twofold. One case is "I really like working with the propeller and want to code everything in Spin, and want an easy wifi/bluetooth/TCPIP coprocessor". The other is "I am building something too big for an ESP32", such as home automation (way too many I/Os) or doing something more than a toy application for the audio processing or machine vision capabilities of the ESP32 (they really don't work if you put any other load on the micro).
I think a big part of the attraction is that an ESP32 provides this functionality for less money than a lot of standalone radio modules.
I think your primary focus here is WiFi links, rather than being locked to ESP32 per-se ? so it may be worth looking at what else is out there, for WiFi bluetooth
The WIO terminal I've linked before, at just $29 it has an enclosure and a LCD display.
https://www.seeedstudio.com/Wio-Terminal-p-4509.html
https://files.seeedstudio.com/products/102110419/Basic documents/00014457-UM0401-RTL872xD-Datasheet-v1.7_205016.pdf
https://files.seeedstudio.com/wiki/Wio-Terminal/res/Wio-Terminal-SCH-v1.2.pdf
The RTL872xD Wifi/Bluetooth module is $3.90 1+ here
https://www.seeedstudio.com/Realtek8720DN-2-4G-5G-Dual-Bands-Wireless-and-BLE5-0-Combo-Module-p-4442.html
The Realtek WiFi/Bluetooth chip/module used here, looks to support 2.4GHz and 5GHz WiFi, and one data sheet says RTL872xD has 4MBytes PSRAM included, and there is also mention of HS-USB and i2s Audio codecs.
I think the gateway for success is in making the default be as simple as possible. For most users, there should be no need to access the ESP32's inner workings. The ESP32 should just be the WiFi (or Bluetooth) interface for the P2, just as the FTDI chips (or other simple USB interface options) are to USB.
Of course, there could be access for more-experienced developers, with specific needs that require ESP32 firmware changes or alternate modes of use (sockets, UDP, etc...). Just make sure to keep those options more simple than what is currently available in the Arduino world. The experience of getting several different microcontroller types to communicate via WiFi (Arduino, ESP32, M5Stick, etc...) is an effort, with each having its own libraries and APIs.
And, just make sure there are libraries available from the get-go!
dgately
Mike, I was looking for a better description of your port with the hope of finding an example. Can you describe what this port can/can't do with the P2 (or is the code for P1?)? I'm wondering if it could be the starting point for a complete ESP32 system, or if it may already be.
Thanks,
Ken Gracey
Ken Gracey
Should you get a hankering for more in your copius free time, try the object shared by iseries above. I'm wondering if we could build upon this code.
Ken Gracey
The only thing the ESP32 brings to the table is that it can do Bluetooth. Whether it's straight Bluetooth or the new BLE. With BLE it would be possible to advertise services that your project supports.
I use the WX module to do code updates and to push data on my local network and to interface to internet services.
Mike
So perhaps it is better, to see esp32 as master and use whatever wifi library is needed for the application.
P2 can be used as subsystem with tachyon as already existing very powerful protocol over a serial line.
For this kind of usage/connection, only a few examples are needed in the arduino environment of esp32.
I'm interested in hearing more. I share your experience with the codebase, though it's to be expected - a large, unconnected open source community is going to produce a lot of code that needs to get done quickly and work once.
sure some projects require more adc, dac or io but there are some solutions for this on the market.
To benefit P2 and to benefit education Projects we need a simple WiFi board for the p2 that needs no further thinking of. Just add the board. Rum some p2 code and you have ip Communication
It you can deliver a zero maintain board I take it. If I have to program the esp forget it. Even loading the firmware one time is too much trouble.
The ESP32 is a board with a dual core micro that can clock up to 200MHz (though with only an internal clock) designed for inexpensive IoT (internet of things) devices. They're dirt cheap, and have built in WiFi and Bluetooth radios. They can be programmed in C with their own libs or in Arduino C (by down-compiling). They're an amusingly cheap way to add radio functionality to a project running on another micro such as a P2, without requiring as much processing load on the main micro.
Yes and no.
The ESP32 is a WiFi MCU, so it needs something loaded to make it 'look like' a useful bridge.
I did find this
https://subethasoftware.com/2018/02/28/wire-up-your-own-rs-232-wifi-modem-for-under-10-using-esp8266-and-zimodem-firmware/
which covers the TXD.RXD and also expands into the other handshake lines too. ( DCD CTS RTS RI DTR DSR )
This comment was interesting :
"Serial Drivers
Most of the low-cost ESP parts use serial hardware that is not recognized by a Mac or PC (not sure about Linux). If you plug up your ESP part to your computer and it is not recognized as a serial port (Like COM5: on windows, or /dev/cu.SLAB_USBtoUART on Mac), you will need drivers.
Most sellers will provide links to where to find drivers. For the Amazon parts I purchased, they used the CP2012 chipset, and I had to download and install the drivers for it. Once installed, you can plug the ESP module up and it should show up as a new serial port device."
So it looks like you can load Zimodem or equiv and a suitable compatible PC-side driver, and have things 'look like' you have a CP2102 - which is the same driver the EFM8UB3 uses on P2D2x
I think they are saying once loaded, the WiFi block looks just like a serial port to the user.
Yes, agree. It has amazing capabilities for a relatively inexpensive device.
That's my thought, yeah.
P..S I noticed that the comment said "CP2012" but that sounds like a mistake, just like it was a mistake to assume he had to download the drivers.
Now, as for whether it is simple depends upon the hardware implementation. Take for example the tiny EFM8UB3 USB micro I designed into my P2D2 hardware, while there has been a lot of work in getting the USB serial software and support functions functioning correctly, for the user they either just use it as is with this software preloaded, or else they can download new firmware as a binary blob from the PC. So the details can be ignored, just treat it like any other preprogrammed black-box micro, and besides, the EFM8UB USB serial bridge appears as a common and known CP21xx device to the PC.
On the P2PAL, an optional companion layer on the P2D2 board, I have an ESP32 designed in, The WiFi serial bridge firmware will be preloaded but the firmware can be updated OTA or via the P2 in a number of ways. One way to change the firmware from the PC would be via a script (python etc) that would load the P2 serially as one normally does but with an ESP32 loader program, and then send the ESP32 binary.
As for the ESP32 replacing the P2, that is like saying let my little USB serial bridge replace it because it is good at this one USB thing. While the ESP32 has a lot of memory, it "only" has 2 cores The ESP32 has been designed specifically for this WiFi use and while it can run other software, including microPython and "flash leds", it can never come close to matching a P2 with its capabilities. I imagine that if the Espressif people were able to use the P2 as the CPU for the ESP32 40nm silicon!!!, what they would be able to achieve would be far far greater than what they have now, it would be the ESPP2 and the existing ESP32 would start to look like a crippled ESP8266 does now.
But don’t overlook the popularity of esp chips now. Some special things the p2
Can give you are also possible with esp like some basic streamer over i2s.
People have managed to output cvbs or vga over this streamer interface.
If I can have wish granted I will wish for a transparent WiFi BT „thingy“ to attach to the
P2. Include a spin object or a Pam file and get my communication handled.
So no need to fire up some esp toolchain to make a P2 design work.
I also wish to get some pc/Mac/Linux driver/api to do communication with p2 then
Get time and date from internet.
Serial connection with putty terminal
Behave like a NAS file server
Write and Read from a Nas
Mqtt
Internet Server
Also can handle TLS and SSL encryption
I use the ESP 32 for experminting and like the idea.
Here's an M5JoyC (joystick: https://m5stack.com/products/joyc-w-o-m5stickc), talking over WiFi to an ESP32 Developer Module, that is in-turn, talking via serial to a P2ES. The M5JoyC is coded in Arduino as is the ESP32. The P2 just uses SmartSerial via flexgui (thanks ersmith!) to interface with the ESP32.
The M5JoyC is just using the stock UDP-based code that it normally uses to talk to the M5StickC-based RoverC robot (https://m5stack.com/products/rovercw-o-m5stickc). No changes needed. The ESP32 board uses a modified version of the M5StickC Rover code that just sends the command data that it receives from the joystick to the P2 for display. At some point the P2 will use the command data to do something "useful"!
In the image, the terminal on the left is displaying date from the ESP32. The P2 is displaying its input from the ESP32 in a CoolTerm terminal window.
dgately