-
Notifications
You must be signed in to change notification settings - Fork 98
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
Add Support for ESP8266 wifi module #58
Comments
Starting looking at documentation GPIO pin on this module is available, so can add led to give a visual status: connected, on, off... also may need an additional pin to control the hard reset from printer would be good to connect a switch to power off/on manually the module to avoid to unplug it if need flash arduino and there is conflict, this should allows to hard control the module one part need to check if one module can listen 2 ports : need to see if UART0 is not available for any reason, can we use software serial ? need pins available like using top sensor pin, jam sensor pin, spool EEPROM communication pin, etc.... an interesting task so far ^_^ http://rancidbacon.com/files/kiwicon8/ESP8266_WiFi_Module_Quick_Start_Guide_v_1.0.4.pdf |
I need to finish 0.92.2 and 0.92.3 import and code cleaning first so will do next week |
(Different alias but I'm the person who created the ESP8266 thread on the Voltivo forum) The board I suggest to you on the Voltivo forum, the ESP-01, has limited GPIO but there are other versions such as the ESP-07 and ESP-12 that provide access to more of the the chips GPIO pins. The following site shows some of the variations. It should be possible to reset the ESP8266 by wiring its reset pin to the main processors reset pin so that a reset on one causes a reset on the other. Causing the watchdog to fail in software would then reset both. I believe the Da Vinci reset line is accessible via the right hand pads of SW2 which is the "Reset button" on V1 boards). My board did not have the button populated but I added it to make it easier when re-flashing the DDa Vinci firmware. Hardware resetting of the ESP8266 is really only necessary if using the LUA I provided. After you questioned me on the Voltivo forum I thought about it some more and I think I should have stuck with my original plan and used the AT firmware for the ESP8266. While it involves a lot more changes to the repetier firmware the results would be far superior. I'd be happy to do some work on this but I still need to get a better understanding of the repeter firmware before making changes and I don;t have a lot of free time. |
Hi welcome and again thanks for pushing this module, really good one - I was looking for this for another project and it match exactly my needs, so I will definitly jump on it ^_^ For GPIO I was just thinking about led, so I guess 2 are enough, I think the needs of more GPIO will be defined when we will better defined what we want the module do with printer. About reset, actually I was mentioned it because I read on one forum that the board could stay in busy state if web browser is closed when displaying the web page - they mentioned (was in 2014) in future it could have a SW update fixing that, but waiting for this, a hard reset may be necessary to reset board time to time. Same for LUA or AT or new SDK based FW, I read people did a FW with embedded web server, and some create a library to help to build one, but did not did out more, too much to check, I read lua based can be easy, but I saw all samples using AT may need a FW update for carriage return, so actually I have no opinion, just a big willing to try all, to see what is best, but if you have already experience / opinion please share it - I am always willing to learn. About Repetier FW -I am currently cleaning/reformating/commenting the code, I need to separate more clearly what is repetier and what is for davinci specific, as it is becoming harder for me to see quickly what impact a new update of repetier will have on Davinci FW. All that to say: understand Repetier FW will be easier once I will clean up code, so no worry I also would be really happy to work with you and learn from you on this. ^_^ |
Ok 0.92.3 Import is finally done so now working on this promising topic |
I flashed my module with latest AT FW 0.9.5.2 which allow a connection at 115000 by default The AT FW allows to configure the Module and change GPIO state, a webserver is also possible but handled by arduino : http://allaboutee.com/2014/12/30/esp8266-and-arduino-webserver/ I did not play with NodeMCU FW yet, but this guy made several videos using it https://www.youtube.com/user/AllAboutEE, looks like in between standalone - need to flash the scripts to ESP - but they can be called from serial according the needs. Seems one module read only one port - so I do not see the way to use same module to be IP/Serial bridge for Host and be a web server to provide a LCD like UI - may need 2 modules |
Ok connector soldered - cables/plug done - Really not easy to do soldering on 2mm pins female connector.... Tomorrow I will implement the module in FW using AT commands and a command to disable wifi in menu |
There is a ESP8266 holder on Thingiverse (http://www.thingiverse.com/thing:642456) |
It is possible to host a webserver directly on the ESP8266 without any addational hardware, see http://www.esp8266.com/viewtopic.php?f=6&t=376, however given it is being connected to the Da Vinci processor it probably makes more cense for its processor to handle the task. It really just boils down to a design decision and how far do you want to stray away from the master Repetier firmware. |
The following article might help if you want to know more about directly programming the ESP8266 i.e. bypassing the AT or LUA firmware images to create you own application directly on the device. |
yes saw the holder, do you use it ? to get webserver allowing to start a print from sd, giving status and sending message when done, it is better to build embeded fw on module to avoid to overload Davinci (due) board, but need to hook some events in repetier fw to trigger some status\messages I do not think it is necessary to have both feature at once because repetier host allows push messages already,but in this case it make no sense to have to flash module according usage, better just to choose on printer menu what do you think? from your perspective what do you expect the module/printer provide to you? |
No, I just have the device dangling out the rear of the printer :-) First let me say I do not understand why "Repetier Host" supports TCP connections yet there is no support in "Repetier Firmware". Are there plans to support TCP in the Repeiter firmware? Knowing the answer to this would make the following an easier choice. If the Repeiter firmware is not going to support TCP connections/settings then it makes sense to use a feature of the ESP8266 where it can simultaneously acts as both an AP and a AP-Client simultaneously. In this mode you would connect to the ESP8266’s AP, be presented with a web page hosted on the ESP8266 that allows scanning the local Wi-Fi, selection of a SSID, definition of the Wi-Fi password and to see the allocated IP once a connection has been made to the private Wi-Fi. The ESP8266 would then remember both the SSID and password which it would use to automatically log back on to the local Wi-Fi when power on. So basically the web interface is just used to connect the ESP8266 to you LAN and the Repeiter firmware has no knowledge of any of the settings. This is basically what this example is doing http://www.esp8266.com/viewtopic.php?f=6&t=376 However there is no reason why the SSID and Wi-Fi password could not be set via the Da Vinci LCD. It is just this would require adding new settings to the Repeiter EEPROM values which is why I asked the first question. |
about tcp/ip support here one answer: http://forums.reprap.org/read.php?267,396191 |
about ssid/password storage, you mean there is a way to store them in esp8266 fw ? I did not found AT command for this, I need to see in SDK |
The ESP8266 has a small external flash chip which is used for storing its firmware. This can also be used for persistent storage of configuration data. The LUA and possibly the AT versions of the firmware do this so to allow automatic reconnection on power on. As for the alternative, I presumed it would be possible to create new variables in the EEPROM data and at those variables would automatically become editable in Repetier Host bypassing the need for alphanumeric entry via the LCD i.e. the EEPROM data is self-describing. This is not something I checked! |
well a network password in clear is not a good idea, it should be encrypted or at least not easily visible, that is why the idea of M101 command, which store password in EEPROM but not visible and encrypted |
One point of not using Host UI : Repetier EEPROM has no type for string, neither variable length data, all is based on strict position in EEPROM, so if need to use the EEPROM interface for password it means rewrite the all EEPROM functions and we cannot rewrite the host part so it won't be possible. M101 command instead could be based on M117 command which accept string, Just sharing, |
Ok seems when setup is done, all nework informations are stored automatically - no need to mention need to store ( at least with AT commands) |
This FW looks doing the bridge : https://github.com/beckdac/ESP8266-transparent-bridge |
I have now a module with latest nodemcu-firmware, the flasher did not worked for my board the esptool.py was fine It seems the modules I have are little bit different: one has blue and red led blinking when power on, when the second one has only the red led blinking - and initial FW were different when I got them. |
Lua bring definitly more control compare to AT commands, and also allows to print less garbage during communications. So we can imagine a script that store all preferences to start AP or Station, DHCP or Static Additionnally, because when server listener is in loop, there is no way to stop it without adding a check that would decrease the bridge performance - I think adding a pin to do the hard reset if we want to change configuration when server is started would be a good solution IMHO, but need also to reset the serial connection in same time with module. :@disneysw I saw you setup 19200 in your script - any reason not to set 115200 or even higher? |
Web UI should looks like this one for configuration based on the very simple code of http://randomnerdtutorials.com/esp8266-web-server/ so actually module can have 3 modes, only one at once : Save will save the changes and apply them at next restart, Apply will save the changes and apply them immediately. Any comments/suggestions about this ? |
You seem to be getting on well. Above 19200 baud I ran into issues due to lack of flow control on the serial connection. The Repetier firmware is based on processing a single character at a time but TCP connections transmit packets. I believe it is the burst nature of the packets which is causing the problem. This could probably be resolved on the Da Vinci side by increasing the serial buffer size or changing the GCode::readFromSerial() routine to deal with packet structures rather than processing the individual characters. You are probably thinking wait, the repetier protocol has a concept of acknowledging receipt of commands (ping-pong), but this increases the latency of individual commands so is not a great strategy when using a guaranteed transmission service like TCP. Thanks for the info on the EEPROM. Glad I did not waste time on that idea! Sounds like the only way forward is to use the Web UI for configuration. If that is the case there is probably no requirement to have any UI via the Da Vinci LCD. The ESP8266 could either be enabled using a #define during the build or the repetier firmware could be modified to take commands from both USB and serial simultaneously. |
Thank you for the feedback as did no test connection with repetier , just simulating answer on keyboard to see if basic is ok, will test using bigger cache size, I am just afraid the about the impact on pause command. I will keep the modification of the readserial() for the end. About repetier protocol ( binary one not text one) - in addition of acknowledgement there is a checksum (https://github.com/luc-github/Repetier-Firmware-0.92/blob/master/repetier%20communication%20protocol.txt) About UI on printerm, it would be simple in case of no PC on USB and new access point for any reason, in a wifi menu : I think UI and repetier should be ready next week as all is pretty clear and defined so far. Sorry to be slow for implementation, I am also busy building another printer from scratch and real life ^_^, Thanks again for bringing this nice module, your code and sharing your experience |
Ok - still fighting with lua and nodemcu bugs and limitations:
Anyway - I am almost ok for UI page, just 2 bugs to solve before first release on github, I should find a solution this week end if no new bug,
|
I am following this with interest. But I looks as if you're trying to invent the square wheel. Implementing the serial to wifi bridge in Lua is ineffective, and others have problems getting any reliable throughput. Have you seen https://github.com/beckdac/ESP8266-transparent-bridge? It only lacks configuration from the serial side, and you could then do all configuration from the Repetier firmware. Also I'm guessing you could add the ESP8266 to the "bluetooth" serial port of Repetier and have it as a 2nd connection, so USB is primary (firmware updates) and the ESP8266 is for everyday use (printing etc). |
Well yes I saw it, read above : #58 (comment) but did not test it, I saw @disneysw tested it - but he did not feedback yet -
I did not experienced performance issue on communication, but I did not stressed it yet. @lkarlslund did you tried the bridge FW ? any feedbacks ? you have which Davinci board ? |
well it depend what you want to do but I won't suggest big web page as they take time to be send by module when they are in memory so should be same when on this FS. using SPIFF fs will definitely help for page customization but need to write template engine for UI, so yes there is lot of space for optimization and improved UI (more javascript, better css, template, etc...) here space for your reference:
|
feel free to join https://github.com/luc-github/ESP8266 and push any code or ideas/suggestion / feedback |
FYI: I just released the ESP FW using templates - I did some long test run on PC first and web UI is now (more ❓ ) stable - did not got any crash in 72h |
After first tests so far so good - latest ESP FW now allow to launch a print from SD Card I will add additional setup descriptions for not DAVINCI boards on my ESP github for standard repetier with DUE/RADDS and may be marlin |
is there a wire diagram for the esp-01 module ? im unsure what the order from the uart pins on the davinci are. |
yes it is here : https://github.com/luc-github/ESP3D/wiki/Davinci-1.0-and-2.0-board |
also is there a way to start a print from a file on sd card. if i were using flashair to put a file called command.txt on with the command run filename.gcode inside of it. it could delete the file after it initiates the commands inside it when its ready for more. |
if you use ESP3D yes |
On davinci 1.0/2.0 there is not choice but enable wifi On 1.0a I would guess UART PC is the USB connector (Serial USB/Native USB port) and UART main is Serial / programming port |
Thank you for the quick reply and advice. I checked Configuration.h and can see the magic ENABLE_WIFI define is disabled. So I'll need to enable the WiFi function and re-flash. I would like to retain the PC UART for USB. So I will also try changing Configuration.h to use SERIAL1 for the WiFi communication. I believe that is what you meant I should do. I'm still debating if I should continue with the ESP3D or switch to the Octoprint instead. I have the build experience and parts to either solution. I'm attracted to Octoprint's vast features, but the simple installation of ESP3D is a compelling benefit. So I have more things to think about. Thomas |
It is definitly question of choice and usage - I personnaly only print from SD and I use S3D as slicer, so using octoprint is not a must there are pro / cons for both IMHO |
I also use S3D and print from a FlashAir card. The DaVinci is in a downstairs room so I use a LAN->USB printer adapter to remotely select/start print jobs from S3D's Machine Control Panel. I believe that the ESP3D functionality is emulated by my current setup, but in a more elegant way. My main goal is to make my work flow more efficient. For example, since ESP3D works well with SD cards, it would be very helpful if had built-in function to handle FlashAir uploading. So if you have an open feature request list, how about adding a button to the Web GUI that (1) allows a user to select a file from his PC workstation, (2) sends it to the FlashAir, then (3) automatically starts the print. :) I fully understand how much work it is to create and support techie projects like yours (I've been in your shoes many times). So this is just a wild-eyed wish request in case you have plans to extend the features. For sure, the project is already fantastic.
|
Flashair support is in ESP3D list already (luc-github/ESP3D-WEBUI#19) Even not yet integrated, because first try was a failure due to Flashair webserver does not allow query from another web server (there is no way to add "Access-Control-Allow-Origin: *" in flashair currently) . Flashair can already be used using Camera tab (which is just an iFrame) to access to Flashair File manager (also on my repo with an updated version : https://github.com/luc-github/Flashair-FM/tree/devt) to do file upload, then just back to main tab you can launch the print from SD panel I am still thinking how to integrate both UI in one panel keeping UI consistency - I have already some ideas but I have other things to finish first |
Thanks for the link.
That's a nice workaround. My printer's IP camera does not work with the WebUI's iframe so the camera tab will be put to use with FlashAir instead.
I installed your new FlashAir file manager. Initially I had trouble getting it to work (FlashAir would not connect to WiFi). But I discovered that the new CONFIG file had UNIX EOL conversion. After rewriting the file with Windows EOL the WiFi access was Ok. Now I can web browse the FlashAir card via WiFi and your file manager works great. I tried accessing the SD card from the WebUI and ran into "trouble." I don't see any SD Card file names. Then I realized that I don't have the NodeMCU wired to my printer so all this trouble will go away when I get it wired.
That is great news. Good luck! |
After some o-scope measurements I discovered that the UART-MAIN is inactive (missing components). So the ESP3D module was wired to the UART-PC port on my Davinci 1.0A. The WEBGUI is now controlling my printer. It reads the SD card, starts print jobs, controls motors, and so on. The WEBGUI works very nice. But after that bit of happy news I discovered that my printer is messed up. The Z-axis limit switch and top lid detect switch are not working. This bit of bad news was discovered on my first print job; It crashed the Z-axis into the frame when the hot end was sent to the home position. Ouch! The printer was working before the reflash. All the cables are plugged in. So I believe it has something to do with today's new Arduino upload. I was hoping to get a bit of advice on the problem. Here's some background info.
Fingers are crossed there's a easy answer to my problems.
|
the variant / pin number has been modified on Z to avoid pin on 127 6e6edc0 the sketch you use (2015) is for previous variant not for the latest one, if you use the 2015 sketch - use this variant - it should solve your issue : https://github.com/luc-github/Repetier-Firmware-4-Davinci/blob/7c0cb5b01cd98d67f19dd57c4a46150477045027/src/ArduinoDUE/AdditionalArduinoFiles/Arduino%20-%201.8.0%20-Due%201.6.8/Arduino15/packages/arduino/hardware/sam/1.6.8/variants/arduino_due_x/variant.cpp it is a mismatch between variant/pinout |
Thank you for the help, I appreciate it. The revised variants.cpp causes a compile error. Attached is the compiler output. So hoping to avoid consuming more of your time I decided to start fresh using your latest Repetier distribution (Aug 2017 build 1). I am using the matching variants.cpp for it. When I compile there is a fatal error due to a missing variant.h. Compiler output: So I'm back again looking for more advice. I don't mind using the old 2015 sketch files or the latest Aug 2017 release. Whichever version you feel is the best to use is the solution I will use.
|
I think you messup your files with all the changes for the other error it is not linked to variant you updated but : I think the best is to delete all, FW and Due module, be sure C:\Users\Tom\AppData\Local\Arduino15\packages\arduino\hardware\sam\ is empty, and do a fresh install: 1 - reinstall 1.6.8 due module I think this is the only advice I can give you |
You are a lifesaver! A fresh re-install of 1.6.8 due solved it. I don't have an explanation for the missing variant.h file (it wasn't in the trash bin, so I didn't directly delete it). My working build is the latest Aug 17 Repetier distribution compiled on Arduino IDE 1.8.5. Just thought I'd mention that since it validates that 1.8.5 is Ok to use (versus 1.8.0). Although yesterday's Z-axis head crash was severe, I think everything survived. Nothing visually is broken and a freshly printed test block looks OK. The latest firmware has some new WiFi status messages that I didn't notice on the old 2015 version. So I am glad I abandoned the old release. Today's compile trouble lead me to use the new release, so I guess the extra frustration provided a better ending to my adventure. I would like to say that the ESP3D mod is worth the effort. The WebUI is fantastic. Nicely done! Thank you for sharing your work. I will soon post some photos of how to wire the NodeMCU WiFi module to a DaVinci 1.0A. Perhaps it will help someone else. It's the least I can do to contribute to the project.
|
Thank you have fun ^_^ |
I edited the Wiki but I cannot upload any photos. I identified an image folder that appeared to be the logical place for the images. All links in my WiKi edits point to it: https://github.com/luc-github/ESP3D/tree/master/images/Davinci Upload attempts state "File uploads require push access to this repository." I tried to use git-scm but I keep getting 403 errors when I push my images. I'm not very familiar with using git and github so the magic to adding new file content remains a mystery to me. EDIT: Davinci 1.0A ESP3D Installation photos removed from this post and added to Wiki (thanks to luc-github). https://github.com/luc-github/ESP3D/wiki/Davinci-1.0-and-2.0-board Thomas |
I have updated images - thank you |
@luc-github Thanks for adding my images to the wiki. I'd rather have done it myself but I'm not familiar with the image upload process. The push instructions I followed ended with the 403 error, which probably means I don't have permission to do it. I'm enjoying the ESP3D features. The workaround of using the camera tab for the FlashAir SD card uploads has helped a lot. Overall ESP3D has improved my workflow. I came across another wish list item. It would be helpful if the WebUI had WiFi RSSI (receive signal strength indicator). I think the best location for the RSSI bar graph would be in the title banner area near the camera icon. Thanks again for publishing the project and all your fantastic help solving my installation problems.
|
The signal strengh is actually in ESP3D status page |
Awesome, found it there. |
as this device is very cheap ~5$ and only need 2 pins and +/- hardware changes are not hard to implement, thank g mcclean for pointing this out.
connection can be done using UART0 non populated connector on main board or any other available pins using softserial
Request is already done in repetier tracker but no response so far.
the goal is:
1 - to see if can allow TCP/IP connection with repetier host
2 - to get a replica of LCD panel on a web page
The text was updated successfully, but these errors were encountered: