Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.0.x] ESP32 WiFi interface #11209

Merged
merged 3 commits into from
Mar 13, 2019

Conversation

grownseed
Copy link
Contributor

Description

@simon-jouet is doing some amazing work on the ESP32 and has already added support for it in Marlin, so this PR is for taking this a step further and taking advantage of the ESP32's WiFi module.

It adds support for serial over websocket as well as a web UI to control the printer over WiFi. A number of new configuration options have also been added (Web, OTA, ... support). It also uses bonjour so that your printer automatically gets a local domain on your network (http://marlin.local by default).

This is still very much a work in progress, but I'd appreciate any early feedback!

marlin-web-ui

Benefits

Marlin over WiFi!

Notes

  • the websocket serial implementation has some buffering issues at the moment, seems to have to do with the ESP async server and I'm still looking into that
  • the web UI is kept fairly simple and entirely self-contained on purpose, i.e. you shouldn't need an internet connection to run your printer, so no external deps

@thinkyhead thinkyhead force-pushed the bugfix-2.0.x branch 2 times, most recently from f454bf2 to 63f4c9b Compare July 7, 2018 02:34
@thinkyhead
Copy link
Member

thinkyhead commented Jul 7, 2018

Good work!

Rebased, squashed, reverted some platformio.ini changes, and moved datadir under the esp32 environment. To get the rebased and modified code…

git fetch origin
git checkout websocket-serial
git reset --hard origin/websocket-serial

@thinkyhead thinkyhead added the T: HAL & APIs Topic related to the HAL and internal APIs. label Jul 7, 2018
@grownseed
Copy link
Contributor Author

@thinkyhead thank you! I'll keep at it and @simon-jouet is sending me a board so that should help.

@Drachenkaetzchen
Copy link
Contributor

This sounds pretty cool! I'm right now exploring the possibility to have a standalone ESP32 with attached LCD (some of those pretty cheap 2" TFTs with touch), originally intended to use with OctoPrint - but controlling a printer directly via WiFi is another beast :)

@psavva
Copy link
Contributor

psavva commented Jul 24, 2018

How would you connect it all up?
Would you be to use this with Ramps for example?

@grownseed
Copy link
Contributor Author

@psavva please check the details of the work from @simon-jouet here #6524 (comment), he's building an entire board around the ESP32. Towards the end of that thread is a question similar to yours and some helpful comments from Simon.

@thinkyhead thinkyhead force-pushed the bugfix-2.0.x branch 4 times, most recently from 0226dcc to 834ea7f Compare August 14, 2018 09:47
@thinkyhead thinkyhead changed the title ESP32 WiFi interface [2.0.x] ESP32 WiFi interface Aug 15, 2018
@thinkyhead thinkyhead force-pushed the websocket-serial branch 2 times, most recently from 6d3fc7e to a218d42 Compare August 15, 2018 20:47
@thinkyhead thinkyhead force-pushed the bugfix-2.0.x branch 4 times, most recently from 9fb4e95 to ad12b9b Compare August 21, 2018 14:48
@thinkyhead thinkyhead force-pushed the bugfix-2.0.x branch 2 times, most recently from 9d867f9 to 849dea9 Compare September 24, 2018 03:23
@thinkyhead thinkyhead force-pushed the bugfix-2.0.x branch 2 times, most recently from 579c7f3 to d52deeb Compare October 9, 2018 21:49
@vivian-ng
Copy link
Contributor

@grownseed Has this branch been merged into bugfix-2.0.x? Or should I get a copy from your repository to explore this? Because I do not see the files for web (web.cpp, wifi.cpp, etc.) in bugfix-2.0.x and it seems like an interesting feature to have.

Also, I wonder how much work needs to be done to migrate @luc-github ESP3D into this branch. This would then offer not just a terminal, but additional web-based controls.

@thinkyhead
Copy link
Member

Has this branch been merged into bugfix-2.0.x?

Not yet…
image

@vivian-ng
Copy link
Contributor

I think having the ESP32 as a built-in module on the board itself is a $5 solution that brings connectivity to any new printer board. In fact, one of my side projects is to design a board based on STM32F407, which Marlin has some support for, with an ESP32 connected to RX/TX to provided web interface via @luc-github ESP3D. But that is paused for now while I work on my ESP32-based board. Once the design has been tested, I will be releasing the design as open source under GPL license. If the design is not released, it means I failed. Haha.

BTW, @luc-github, I have partially hooked up my LOLIN32 board flashed with your ESP32 web interface branch to a Morpheus board using jumper wires. The motors work, temperature reading seems to work, the only thing I couldn't really test was heating. I think it is because my test power supply (cheap Chinese 12V 5A) couldn't deliver enough juice, causing the rigged setup to reset each time I try to heat the nozzle. But so far, two feedback:

  1. Is there a way to enable OLED via I2C on the web interface like in ESP3D v2.1? So that IP address can be seen without having to connect via USB cable.
  2. Can the user/admin toggle the need to sign in each time the web interface starts?

Another thing I thought of was EEPROM support. Marlin already has support for I2C EEPROM, so I think it should not be too difficult to add one. But how much work do you think is needed to set aside a portion of flash memory to store the printer settings, and use that to emulate EEPROM? Or is there a way to store printer settings via the web interface, and use that to "configure" the ESP32 each time the printer starts up?

@luc-github
Copy link
Contributor

luc-github commented Dec 8, 2018

@vivian-ng
1 - Yes, but you you also have SSDP implemented for windows so the device should appear in your Network page:
image

mDNS is also implemented so you should be able to access using <hostname>.local

2 - Just comment #define ENABLE_AUTHENTICATION in HAL_ESP32/wificonfig.h

3 - Yes, I see in others HAL persistent_store_impl.cpp and persistent_store_flash.cpp so we just need to add them and make them to use the ESP32 EEPROM functions to access to the 4KB nvs reserved for this purpose, it won't be emulation as ESP32 has reserved area for this.

I think it is better to move discussion to another thread in Marlin issue tracker, or in Simon repository (https://github.com/simon-jouet/Marlin), or even in my repository (https://github.com/luc-github/Marlin)
Here is a PR and from another person for another project - It would be better not to hack it- I just answered because I was mentioned, I do not want disrespect @grownseed

@thinkyhead thinkyhead force-pushed the bugfix-2.0.x branch 2 times, most recently from a32ec92 to a59d3d4 Compare January 3, 2019 23:07
@thinkyhead thinkyhead force-pushed the websocket-serial branch 2 times, most recently from 7e736ee to 144815d Compare February 27, 2019 04:02
@thinkyhead
Copy link
Member

Rebased, squashed, cleaned up a bit more, and added an ESP32 test for Travis CI. This can be merged pretty soon. To get the latest code use Git Console:

git fetch origin
git checkout websocket-serial
git reset --hard origin/websocket-serial

@thinkyhead thinkyhead force-pushed the websocket-serial branch 6 times, most recently from b0176fd to 71004fb Compare February 27, 2019 11:24
@thinkyhead thinkyhead force-pushed the websocket-serial branch 3 times, most recently from d04d271 to 0a51330 Compare February 27, 2019 12:41
@thinkyhead
Copy link
Member

@grownseed — I've done a lot of cleanup on this to get it down to a good zen level. Please confirm that it all still works for you, and if so then I guess we can go ahead and merge it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: New Feature T: HAL & APIs Topic related to the HAL and internal APIs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants