Shop OBEX P1 Docs P2 Docs Learn Events
ESP32 WiFi Interface and Propeller 2 - possible support and request for community input! - Page 2 — Parallax Forums

ESP32 WiFi Interface and Propeller 2 - possible support and request for community input!

2»

Comments

  • Please please please work on this if possible. We are working on a commercial product involving automation which right now is using many Prop 1 chips and a CAN bus with a made up messaging format.

    But we are now adding in MQTT messaging for integration with the myriad of home automation products that are out there, including sending this data to an internet cloud repository for monitoring. Right now our option for MQTT is just using the ESP32 on it's own. We would much rather find a way to use the Prop 1 (and soon Prop 2) and let the ESP32 be a slave/bridge device instead. So yes, a Parallax supported ESP32 library with easy MQTT support would be awesome!!! In the Arduino world for the ESP32 it's a few lines of C++ code for MQTT communication which is what the home automation and IOT world are using.

    Also site note: please keep moving with the C/C++ support. All of our devlopers have years of higher level language programming like C++, and trying to convince them to go from deep templated/object oriented languages to SPIN for the Prop 2 will be tough. Luckily we are getting by with the C++ support for the Prop 1 and the team is loving it compared to some of the SPIN code they have seen.

    Thanks!
  • I'm a kinetic artist and licensed pyrotechnician and flame effects specialist. I've been using dozens of propellers ever since I discovered Jon's articles in NutsnVolts, (and he has graciously mentored me on MANY occasions). I'm not the power user writing interrupt service routines, reentrant code, etc.; as everyone's time is limited, I have chosen not to dedicate the time to learning assembly. I like to drop in a controller into something and get it going, which is why the P1 has been a multitasking miracle for me who wants to do more than just blink an LED (o:.

    The Random Nerd Tutorials website is a diamond in the rough. Rui and Marie Santos have created an excellent resource for the ESP32, which a plethora of examples to do an amazing array of functions with copy and paste code the run "right out of the box" and I have used that resource extensively. I think an ESP32 piggy-backed on a P2 would create an awesome juggernaut of a controller. I've used the ESP32 to do a quick and dirty wireless comms for the P1.

    The ESP32 also has smart pins (I've run a dozen PWM'ed LED systems off an ESP32 without any processor load, leaving its dual cores for my clumsy code(o:). All pins are mux'ed but it has defaults for it's three UARTs, as well as I2C and SPI, so I would think it would lend itself well to integration. But where it shines is ALL its modes of communications: In addition to WiFI (it can act as a webpage server), Bluetooth, and BLE (I've used them all) many of the boards have LoRa implemented (Long range low baud rate comms over a kilometer; but for most not that important), and my personal favorite, ESP-NOW, which uses the wifi radio to communicate directly to other ESP32s (no need for wifi connection), including a mesh network mode to communicate with many simultaneously and with the bonus of encrypting if you are worried about hackers.

    .......for what it's worth from a dumb user, in case you haven't received enough input yet (o:
  • whicker wrote: »
    I don't understand what an ESP32 is. Can the details be ignored, and just used as an inexpensive serial to WiFi bridge?


    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.

    There's also Annex32 BASIC interpreter. Don't think they have Bluetooth working yet, though.

  • I'm not sure if there is any plan to get Java Script running on the P2 however, the ESP can run a version of it and it should be capable of making nice gauges to display output from the P2

    The ESP32 is a dual core Tensilica LX6 microcontroller with 520 KB SRAM, integrated Wifi, Bluetooth, and more. Espruino is a very light weight JavaScript interpreter that runs on the ESP32, and other microcontrollers.

    https://www.espruino.com/ESP32

  • The first rev of this ESP32 object (a set of objects, actually) is now in the propeller repo here: https://github.com/parallaxinc/propeller/tree/master/libraries/community/p2/All/esp32

    Please check it out and give feedback here for Parallax and @RbtsEvrywhr_Riley to consider.
  • Looking forward to hearing from you guys regarding what we have here.

    The idea is that we wanted something plug-and-play to run with stock ESP32s, so "support the AT firmware in ways that does all the serial parsing for people".

    This is still an alpha, current state is "it works and the unit tests pass".
  • JonnyMacJonnyMac Posts: 8,924
    edited 2020-09-17 20:23
    The keyword DEBUG is used in testesp32.spin2 as a local variable name.
  • JonnyMac wrote: »
    The keyword DEBUG is used in testesp32.spin2 as a local variable name.

    Huh. That's interesting, I'm wondering why that's not having any issues in either compile or runtime. That's neat. Good catch.
  • JonnyMacJonnyMac Posts: 8,924
    edited 2020-09-17 21:16
    Depends on which version of PNut or Propeller Tool you're using to compiler. I'm using the latest Propeller Tool, which is just a few steps behind PNut.
    1920 x 1040 - 136K
  • Strange. I guess because it is an uncalled variable, it compiles on some compilers and not on others? Either way, I'll push a new build that just removes it, since it isn't used anymore.

    I need to get around to writing a spin linter lol
  • FYI the fix to that got committed a while ago, if anyone missed it. I've been playing around with it a little further, but haven't had any more changes to make. How's everyone else making out?
  • bob_g4bbybob_g4bby Posts: 401
    edited 2020-10-19 07:48
    Having the ESP32 or ESP8266 connected to the propeller and acting just as a serial link to wifi bridge would seem to be a waste of a powerful 32 bit wifi engine.

    A combination I intend to explore is Tachyon / Taqoz as realtime controller, linked by the user terminal serial port to an ESP running a Basic interpreter. Having reviewed punyforth, lua and python for ESP, my favourite ide is currently Annex Basic https://sites.google.com/site/annexwifi/home, which runs on both types. Particularly attractive is the ability to create web page based front panels of buttons, gauges, text boxes and many other types with very little web design knowledge. The system can connect to your wifi router, or act like a router for you to connect directly to. It also supports ESP-Now which allows up to 20 ESP slaves to connect to it in a self-healing mesh. ( So distributed measurement and control is possible beyond wifi router range ) Loads of displays supported too, if local indications are needed. There is a lot more, and the help and examples are excellent. The IDE, incidentally, is all on the ESP with a web based editor, configuration tool and more. So this can be used on anything from a phone to a desktop. A good alternative would be ESP8266 Basic esp8266basic.com/ but which has fewer features and there is no ESP32 version.

    Assume the Tachyon / Taqoz application launches as many cogs as are needed to control the 'plant', but leaves cog0 at the user input prompt. Thus the application can be controlled using normal forth words and parameters. Rather than doing that from a terminal, the ESP application, running with it's wifi based web page 'front panel', issues the required forth phrases to the propeller when web page buttons are pressed, sliders slid etc. Likewise, the state of the forth application can be interrogated by more short forth phrases and displayed in the web page on leds, gauges, graphs etc.

    Thus, the forth application runs at full tilt, with minimal user interface load. The ESP, running an Annex Basic script takes care of the user interface. The fact that the ESP is running a relatively slow interpreted program is very often not important. To speed things up, many 'events' are available, which can trigger a piece of script to run e.g. serial port message received. This gets rid of a lot of wasteful polling. The website discusses Easynet, a udp based system suitable for home automation etc. When standing on the shoulders of others, I always like to choose the tallest pair!

    The big plus has to be how little effort and knowledge is needed to achieve a simple web-based system - compared to the Lua or Python interpreters, which don't automate the web page generation for you. For a hardware engineer, Annex reduces the initial learning curve to a tolerable level.
  • This is actually right up the ally of what I'm working on. An ESP32 running FreeRTOS as the controlling threaded application for behaviors on a robotic rover and the P2 with a high-speed link to handle the sensors and timing related work. The ESP32 is just not great at doing things on precision or very short timescales but it's got really good multitasking support for a complex application plus the ability to add WiFi to the project with ease. I'm thinking of setting the Prop2 up as an SPI slave device for non-bus type hardware sensors.

    Have not seen a slave implemented on this platform but I'm hunting for some examples.

  • I have that setup for the P1, at 2 or 3MBit. I know P2 assembly is different, but maybe it gets you going on a bit banging implementation:

    https://github.com/deets/deets-fpv-laptimer/blob/master/spin/spi-laptimer.spin

    Smart pin would be great but I need updated docs for that.

Sign In or Register to comment.