luc-github / Repetier-Firmware-4-Davinci

Repetier-Firmware-0.92 based for DaVinci printer (Beta - so far so good)
GNU General Public License v3.0
194 stars 98 forks source link

Add Support for ESP8266 wifi module #58

Closed luc-github closed 8 years ago

luc-github commented 9 years ago

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

disneysw commented 9 years ago

Hey Luc,

Sorry for disappearing off the face of the planet but as I said at the outset normally I am generally busy with work and if I don't work I don't get paid.

Reading through the thread it looks like you have made a lot of progress. Interestingly I have had different reliability experiences to you but I suppose there could be many reasons for that.

I guess I will have to investigate the ESP8266 Arduino environment and try your code!

luc-github commented 9 years ago

No problem - I should have some free time next week to be able to work on this - so I will update settings according of possibilities and clean the code as they integrated some of my functions in master and Sandeep integrated all updates in 0.0.5 released yesterday

My plan ( if I can follow it....) is to finish the settings/configuration page this week

I may take some time also to check 0.0.5 to be sure no issue

FYI I have also added the gitter IM in my repo feel free to use it : https://gitter.im/luc-github/ESP8266?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge

netpipe commented 9 years ago

got mine flashed today with the arduino ide version, would not take the firmware at any baud other than 115200 sometimes it takes a couple flashes for it to work still.

luc-github commented 9 years ago

it depend what you are using to flash and arduino board or a USB2 serial - it need to unplug/ replug after each flash to be able to reflash again. depending OS or USB adapter some issue has been raised but since I use the USB 2 serial I got no issue

luc-github commented 9 years ago

alpha FW for module is now ready - module is configurable by web interface, bridge is implemented direct commands and Printer UI replicat are not coded/implemented but bridge is working in both ways so the basic it Ok

I will start to implement the repetier part this week :

1- Switch to use WIFI in Settings Menu 2 - Davinci Serial to ESP Serial if wifi is enabled by compilation condition and also settings

luc-github commented 9 years ago

Basic communication is now implemented https://github.com/luc-github/Repetier-Firmware-0.92/commit/1bfd3609a68d2ddba6943bd03df6eef6cc4f9a8f

have a menu in setting to switch from Serial to Wifi currently it works at 115200 but I guess there is a bottleneck with large data like EEPROM content, data is lost after some amount but no issue with manual command

luc-github commented 9 years ago

large data issue is solved by adding a small delay for each line - so far so good I have no time to test on print so if someone want to do - he/she is welcome

I will start to work on commands and front end now

lkarlslund commented 9 years ago

Fantastic progress – I will take a look at it in the weekend if time permits.

Fra: Luc [mailto:notifications@github.com] Sendt: 4. juni 2015 10:54 Til: luc-github/Repetier-Firmware-0.92 Cc: Lars Karlslund Emne: Re: [Repetier-Firmware-0.92] Add Support for ESP8266 wifi module (#58)

large data issue is solved by adding a small delay for each line - so far so good I have no time to test on print so if someone want to do - he/she is welcome

I will start to work on commands and front end now

— Reply to this email directly or view it on GitHubhttps://github.com/luc-github/Repetier-Firmware-0.92/issues/58#issuecomment-108792331.

luc-github commented 9 years ago

Screen (correct one this time) as proof and to show my settings image

luc-github commented 9 years ago

basic reporting is now implemented,( basic UI also) - no action allowed yet but will come soon

page5

luc-github commented 9 years ago

Ok back bone for communication is now ready I guess - I saw some glitch in communication, so it will need some fine tuning, also need to populate necessary commands as I only defined one for basic implementation.

I need to switch to another project for some time so feel free to test and feedback
ServError commented 8 years ago

Any further developments on this? Also, are you using the so called "upgraded" module with additional memory?

luc-github commented 8 years ago

well the repetier part is done I think - I do not see additionnal need as module is pretty much independant - so still working on module fw itself: https://github.com/luc-github/ESP8266.

The only addition that I plan is for not Davinci board like DUE/RADDS, but I did not have time to work on it and I would like to finish module FW first.

I only have ESP8266-01 which is limited to 512K but FW should work with any module. currently pages are hard coded to save space and memory - but when SPIFF will be stable I think I will use template on ESP filesystem for easy modification but this is TBC

ServError commented 8 years ago

Ok cool. Is there anything those of us with the 1mb can do to put that space to use? Optimizations, extra features, prettier webpages? Thanks for all your great work, let me know how I can help.

luc-github commented 8 years ago

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. I worked to reduce the css file because displaying pages took too long with 15k css now it is around 3k and it is correct. currently each page is less than 8k css included - so it should be ok even on 64K SPIFF of ESP-01 Bigger space may help for pictures, but will also bring more delay for displaying pages as module is not multitasking, so first send page then image 1, then image 2 etc.... that is why I embedded css in page, it also save time.

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:

Board Flash chip size, bytes File system size, bytes
Generic module 512k 64k
Generic module 1M 64k, 128k, 256k, 512k
Generic module 2M 1M
Generic module 4M 3M
luc-github commented 8 years ago

feel free to join https://github.com/luc-github/ESP8266 and push any code or ideas/suggestion / feedback you are welcome

luc-github commented 8 years ago

FYI: I just released the ESP FW using templates - I did some long test run on PC first and web UI is now (more :question: ) stable - did not got any crash in 72h I did not have time to test on printer yet, but as workload is decreased on ESP side because UI is handled by client, it can only be better :pray:

luc-github commented 8 years ago

After first tests so far so good - latest ESP FW now allow to launch a print from SD Card current Davinci Repetier FW work with it so I will close topic

I will add additional setup descriptions for not DAVINCI boards on my ESP github for standard repetier with DUE/RADDS and may be marlin

netpipe commented 6 years ago

is there a wire diagram for the esp-01 module ? im unsure what the order from the uart pins on the davinci are.

luc-github commented 6 years ago

yes it is here : https://github.com/luc-github/ESP3D/wiki/Davinci-1.0-and-2.0-board

netpipe commented 6 years ago

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.

luc-github commented 6 years ago

if you use ESP3D yes if you do not use ESP3D repetier is looking for "init.g" at start, if present it launch the print for this file, but I never tested this feature

thomastech commented 6 years ago

Hello,

Thank you for sharing the ESP3D project. I've flash a nodemcu with ESP3D. It is not wired to my Davinci 1.0A yet, but I can access the web page and have configured it (set to static station and so on). So that is good news.

I've read through the docs and I have a couple unresolved questions:

  1. I'm running 0.92 Davinci Repetier FW. Can I continue to use it with ESP3d, or do I need to change to a different version?

  2. I need some advice on the UART wiring. I found two unpopulated UART headers on the Davinci 1.0A controller: UART-MAIN and UART-PC. See photo. davinci_pcb Before I try a coin toss, I thought I'd ask which is the correct header to connect the nodeMCU?

luc-github commented 6 years ago

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 if it is the case using UART PC would not need to update FW but you cannot have USB and ESP in same time, using UART need a reflasfh but keep the feature to connect to PC

thomastech commented 6 years ago

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

luc-github commented 6 years ago

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 Octoprint has more power / features but setup a pi system cost more than 5$ ESP chip - current limitation of ESP is the file upload which is slow like hell unless you connect it to the SD card reader printer - so it need the printer board to be ready for this

there are pro / cons for both IMHO

thomastech commented 6 years ago

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.

luc-github commented 6 years ago

Flashair support is in ESP3D list already (https://github.com/luc-github/ESP3D-WEBUI/issues/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

thomastech commented 6 years ago

Flashair support is in ESP3D list already (luc-github/ESP3D-WEBUI#19)

Thanks for the link.

Flashair can already be used using Camera tab (which is just an iFrame) to access to Flashair File manager {snip} ...

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.

(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 {snip} ...

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.

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

That is great news. Good luck!

thomastech commented 6 years ago

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.

  1. The last time I flashed the printer was in Oct 2015 when I installed Repetier in my DaVinci 1.0A.

  2. The WIN7/32 system I used in 2015 has been retired and I now use a WIN10/64 system. All the sketch files from the old PC were copied to the new PC.

  3. I am using the exact same (working) sketch files from 2015. The only change is that I enabled WIFI.

  4. My Arduino IDE is 1.8.5 (instead of 1.8.0). The Arduino SAM Boards Cortex-M3 is version 1.6.8. I believe I used Arduino IDE version 1.6.5 with DUE 1.6.4 back in 2015, but I'm not 100% sure.

  5. I changed the two AdditionalArduinoFiles (USBCore.cpp & variant.cpp) using the branch for Arduino - 1.8.0 -Due 1.6.8 that I downloaded from github today. I do not know if these files are a good choice for Arduino IDE 1.8.5.

  6. The files were compiled with Arduino Due (Native USB Port) Board type. There were some compile warnings (possible uninitialized variables) but no errors.

  7. During initial use I noticed that the printer's eeprom.bin file was replaced with default values.

  8. The printer appears functional except for the missing Z limit and top door detection.

Fingers are crossed there's a easy answer to my problems.

luc-github commented 6 years ago

the variant / pin number has been modified on Z to avoid pin on 127 https://github.com/luc-github/Repetier-Firmware-4-Davinci/commit/6e6edc0c88aaf6059f231805e25eeccc8f6639e8

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

thomastech commented 6 years ago

Thank you for the help, I appreciate it.

The revised variants.cpp causes a compile error. Attached is the compiler output. compile_fail.txt

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: compile_fail2.txt I cannot find this file in the Arduino installation and it is not in the Repetier release. Google was no help either.

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.

luc-github commented 6 years ago

I think you messup your files with all the changes variant.h is provided by due module - I am guessing you deleted it when you deleted variant.cpp

for the other error it is not linked to variant you updated but : #error "You cannot use DISPLAY_D5_PIN, DISPLAY_D6_PIN or DISPLAY_D7_PIN for "User Keys" with character LCD display" which I have no idea what is come from

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
2 - download latest git for repetier 3 - update usbcore and variant as needed 4 - modify configuration.h for model = 1 and Wifi and reflash

I think this is the only advice I can give you

thomastech commented 6 years ago

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.

luc-github commented 6 years ago

Thank you Yes sharing your wiring on 1.0A would be great - you can directly add it to the wiki page - they are open to everyone

have fun ^_^

thomastech commented 6 years ago

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

luc-github commented 6 years ago

I have updated images - thank you

thomastech commented 6 years ago

@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.

luc-github commented 6 years ago

The signal strengh is actually in ESP3D status page Have fun with your new toy

thomastech commented 6 years ago

The signal strength is actually in ESP3D status page

Awesome, found it there.