wokwi-features
wokwi-features copied to clipboard
ESP-01 WiFi modem (AT command)
Would it be possible to add the equivalent of an ESP-01 component for integrating to an Arduino Uno or Mega project at a WiFi modem. Some ideas:
- 4-pin interface
- USART interface (Rx and Tx only)
- 5V supply + Ground
- AT commands, which match the Espressif command set (https://docs.espressif.com/projects/esp-at/en/latest/AT_Command_Set/index.html). A subset to enable a WiFi link and data transmission will be a great start.
- TCP/IP traffic sent via browser (not sure if this is possible)
Thanks.
Thanks for the suggestion @MykolaKyrylenko !
Would an ESP32 simulation also fit for your use case? Or do you need at ESP-01 specifically?
Thanks for the response. I am flexible with the implementation, so an ESP32 will be good. Are you intending an AT command interface?
Are you intending an AT command interface?
Not at the moment. But if you run your code directly on the simulated ESP32, you should be able to use the WiFi functions directly. Does this not fit your needs?
I lecture at a technical college, and we are using the Atmel processor on the Arduino Mega to teach low level C programming, e.g. DDR, PORTC, etc. registers. The ESP32 will be too complicated for our students. We are trying to incorporate IoT thinking, and I believe the simplest way it to have a "WiFi modem", with AT commands and a serial interface. I would prefer not to change processors / boards part way through the topic.
NOTE: in industry I had to integrate a cellular modem to a microcontroller, and that worked well.
Got it. Yeah, ESP32 is indeed pretty complex.
There might be a way, at some point, to run both the AVR and ESP32 simulators in different tabs and have them communicate over virtual UART, which may be helpful.
How long until you get to teaching the WiFi modem part?
Thanks for that. Either solution will be great. We are teaching the WiFi modem part in about 4 weeks, so I do not expect this feature this semester. But we teach this topic each semester, so it will be great for the future.
PS I noticed another enhancement request, was using WebSockets. Can something be done with that work?
I had an interim solution, if that is of interest.
Would it be possible to have a 'serial' device which just sends a HTTP POST request? e.g. https://randomnerdtutorials.com/cloud-weather-station-esp32-esp8266/ [same hardware interface as my original post]
PS to my previous comment. Sort of like the CURL command (https://curl.se/) to generate HTTP requests.
Sorry - I forgot to reply to your suggestions :)
There's a way to achieve what you suggested with the features that we already have, though it's not very straightforward (and also undocumented):
- Use the Chrome browser
- Use wokwi-serial-port together with a virtual com port driver (see here for details)
- Write some script that will read the requests from a serial port (e.g. a curl command), perform them, and write the result back to the serial port. You could probably do with with python + PySerial.
I'm pretty positive that we'll have something usable for the next semester. You can track the roadmap in the public features page.
How's the semester going so far?
Thanks for the message. Some of our students are remote, so doing your suggestion will confuse them. For this purpose, I am getting them to use real hardware. It will be great to have something by next semester.
Overall, the students are loving Wokwi. I needed to adapt bits due to known limitations, e.g. resistor divider network cannot be created for A/D conversion, so I used the potentiometer slider instead. A full integration of Wokwi and Falstad will be gold. Great work.
Thanks for the feedback!
I opened a new issue (#203) for the resistor divider network, it's now also open for vote. Let's see how much love it gets!
This one is getting many votes recently, making its way to the top of the list. We may start working on it soon if it keeps coming up the list!
Some updates: I'm looking into using the official ESP-AT Firmware on ESP32-C3 to provide this functionality. Anyone interested in beta testing?
I would be interested. Do you think the ESP32-C3 can be included with an Arduino on the same project?
Thanks! In general, it is not possible to run two MCUs at once (at least until we tackle #186).
For the AT modem specifically, I'm working to make it possible. I'll share the details about the beta testing here in a few days.
So, here's something working - you can interact with the modem directly through the virtual serial monitor:
https://wokwi.com/projects/330317327704785492
The performance is pretty bad, and I haven't tried to connect it with an Uno yet (but in theory, that should also work). The only way to connect it is through diagram.json, as there's no UI element yet.
The WiFi works similar to how it does in the ESP32 - same access point configuration, uses the same gateway settings, etc.
WoW ...
I tested it here, by the messages I saw that it is simulating very real... Are you using real hardware on the server side??

Thanks @ricardojlrufino! Behind the scenes, we're simulating the ESP-AT firmware using the same simulation engine that powers the ESP32 simulation. So it's not real hardware, but your questions shows that we are probably doing pretty good job with the simulation :-)
yes ... failures are often good signs that things are working... =]
Some more updates: the performance is now somewhat better (the simulation runs at 100% speed on my PC), and also fixed some issues with the UART output (wrong baud rate, missing chars when there's a lot of output, etc.).
So it should already be usable now. It will probably take some time until I get to create the board graphics, though.
Excellent work. I had similar results to Ricardo. Very fast performance.
I am assuming IP addresses are not being fed at the moment?

Thanks! This was a bug - can you please try again now?
Excellent:
AT+CWMODE=1 had instant resppnse
AT+CWLAP responded in a few seconds
AT+CWJAP repsonded with 'WIFI CONNECTED' instantly, and then after about several more seconds completed the response
Hooray :)
If anyone gets a chance to test this with the Uno (or other Arduino board), I'd love to learn how it works
I tried it with the Mega using Serial 1. The code is very crude, but commands get sent and responses are received. Works well. Responses appear on Serial Monitor. See here: https://wokwi.com/projects/330589181982016082
Cool! I see you also tried to get an HTTP request working, any luck with that yet?
I managed to get a POST request received on our server:

The AT+HTTPCLIENT came back with an error:

Interesting, so it sent the POST request, but then said "ERROR" without telling anything else.
Do you have a physical ESP chip to try it and see if you get a different result?
I have a physical ESP-01, and will try to get it going.
Some more information:
I sent a single POST request and 11 messages appeared on the server, with a 1 second gap between them.
Could be a timeout issue?
CURL command did as expected, with only 1 record sent:

Downloading a PCAP packet capture could be helpful to understanding what's going on