Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using a $5 Wi-Fi module I now have a Wi-Fi enabled Da Vinci
This is only a working prototype as it assumes a fixed IP address plus hardcoded network SSID and password. But it should be relatively straight forward to add some configuration options to the firmware to make these configurable options.
For me it works and I may not invest much more time in this but I thought others might want to take this forward.

So how does it work?
a) It uses an ESP8266 (Esp-01) Wi-Fi module (available for a few bucks on eBay from China). These modules are 3.3V compatible and very small so they are easy to attach directly to the Da Vinci motherboard.
b) The module has its own CPU which has been programmed to provide a transparent Wi-Fi to UART interface. There is an SDK available for the chips and a large number of different firmware images each providing different features. For simplicity I used the ModeMCU image which allows programming the board using LUA scripts. Everything you need to know about programming the LUA firmware onto ESP8266 and creating LUA scripts is available from this excellent site
c) Once the ESP8266 board has a working ModeMCU firmware image it is capable of running LUA scripts. For the moment I use a single “init.lua” to log into my local area network, establish a “server” on port 8080 and then pass data backwards and forwards between the network connection and the ESP8266 UART.
d) The ESP8266 UART is connected to the 4 pin UART0 interface available on V1 boards (presumably this port is available on later boards as well)
e) I then simply modified the repetier firmware to use the UART instead of the USB port

There are no changes to repetier host application as it already supports TCP connections.

The only downside it the Wi-Fi module needs to be removed to allow re-flashing the actual printer firmware as the sam3x8e allows re-flashing via both interfaces and if the module is not removed there is a conflict which will cause a failure on the USB port while in programming mode. This does not affect normal operation of the USB port.

Depending on how far one wanted to modify the repetier firmware there is no reason why the printer could not support a Web interface in addition to supporting a direct TCP Wi-Fi connection described above as the ESP8266 module can support up to four simultaneous connections (in fact it can even host its own mini website or act as an standalone access point).

If anyone is intrested I will upload my modified hal.h file for the firmware and init.lua script for the ESP8266.
I am Interested please share
How do did you connected it ?


I added an image to the origional post showing how theESP8266 connects to the motherboard.

My board wasent fitted with a socket so I ended up attaching fly leads to the pads - if you plan to follow this approach be carefull. It is very easy to lift the track on pin 1, while 2 & 3 (the power pins) require a lot more heat due to heat disapation within the board.

If you do lift the track pin 1 it will be necessary to attach directly onto one of the processor pins.
Thanks for the picture - on My 2.0 I have also UART0 but I do not have this socket neither
I should get one ESP8266 this week so will try to implement something in FW
I must have a limit on file attachments as I cannot add anymore....
OK, I added the files as a single zip to my origional message.

There are three files that need to be loaded onto the ESP8266 running the latest version of the nodemcu-firmware.

init.lua simply sets the default baud rate for the ESP8266 to 19200 baud on boot.

The other two scripts are evoked by the Da Vinci.

DHCPServer.lua takes two arguments the SSID and the Network Password. It then connects to the specified AP, get an IP address via DHCP and then opens port 8080. It then loops reading data from the UART and TCP and outputting to the alternate interface. Since the reset line is not connected the only way to stop this script once started it to power off and on.

StaticServer.lua does the same but takes additional arguments for a static IP address, NETMASK and GATEWAY (this is untested).

The screen shot shows how I configured the Da Vinci on Repetier host and the wiring diagram is a poor drawing of how to attach the ESP8266 to the Da Vinci. Note I accidently left off a extra jumper on the 3.3v power line on my first attempt.

I also included my modified HAL.H file for the repetier firmware. This is based on the testing branch in GitHub and is only a quick hack to get the printer working with Wi-Fi and you will need to hardcode your own SSID and network password into the code before compiling.

Finally I included testing code for the Da Vinci that effectively turns it into a dumb USB to Serial adapter to that you can talk to the ESP8266 directly while it is attached to the Da Vinci. This code is setup for a baudrate of 115200 which will need to be changed to 19200 if using the above init.lua script or 9600 if using a fresh ESP8266.

While the ESP8266 and Da Vinci seem happy to run at 15200 baud using my test app the repetier firmware runs into problems above 19200 baud.....
I probably should have mentioned I use my DHCP server to fix the allocated IP address based on the MAC address of the ESP8266 so it always receives the same IP address even though it is using DHCP (most routers can do this).

It has always been my intention to use Wi-Fi as a means to load files onto the SDHC card for off-line printing - this hack was not intended for "online" printing.
so you use repetier host to upload the gcode to sdcard ? if yes, file copy is pretty slow as each commands are interpreted before being copied, it can take several minutes to copy few mega when it need few seconds using wifi SDCard

one question :why to use lua instead of AT commands ? all sketch I saw use AT commands to connect ,so no need to flash to define wifi ssid and password, I am not familiar with this , sorry if my question looks stupid

Edit: just check the files thanks a lot for sharing, I will "play" when I got my module ^_^
The truthful answer is this was a quick and dirt hack on my part Smile

Originally I planned to use the AT firmware since this would have allowed up to four simultaneous communication channels and provide a means to do both in-band and out-of-band communications providing full control of the ESP8266 even while sending data. But when I looked at the repetier firmware I discovered it assumes a character based processing of a data stream. Implementing the AT firmware would have required ripping out GCode::readFromSerial() and replacing it with something better suited for multi-streamed packet based protocols. Plus at the time I was not sure how repetier host used its tcp socket interface i.e. was there going to be another wrapper around the data when using this mechanism.

So bottom line is my knowledge of the repetier firmware is limited and I don't know what factors effected the original design but personally I would have implemented GCode::readFromSerial() in a very different way.
Thanks for sharing - I go module -wow very small!!!
Need to buy a connector for davinci board this week end, waiting for this will try to play on Due tomorrow if I have time
I created an entry in tracker :
I am busy right now with 0.92.2 and 0.92.3 import ,and this make realize that Davinci FW really need some clean up for better import.
So unfortunatly I have no time right now for ESP8266 but I hope will be ok end of next week
DAVINCI Custom FW has now basic support for Wifi using ESP8266 module - still area for improvement but bridge is set, web configuration is working, test and feedback are welcome

I downloaded the latest firmware from the github, which has the patch for the wifi module. Uploaded it to my da vinci. I see the option for wifi in the menu, but don't see anywhere in the config file, or in the menus on where to set the SSID and password. Am I just being blind or do I have to do that somewhere else?
this is currently done by module FW not yet from printer
the module FW is here:
So, I'm trying to get this working and am struggling.

At first I tried following the first post, which I realize now has been overcome by events.

Next I tried flasing the ESP8266 firmware from the linked github ( After that I was able to log into the ESP8266's AP and see the settings. I was not able to get it into client mode for some reason though, everytime I tried to navigate to the page, it would just time out.

When I uploaded the latest repetier firmware with the wifi enabled in the configuration, the printer would boot loop. I tried it with the wifi module plugged in and not plugged in.

Did I do something wrong or miss a step? Is there any way I can help debug?
for Davinci reboot:
What IDE version do you use?
I never got this but I suspect something with watchdog:
in variant.cpp, there is a line 421


uncomment it

and reflash, this will stop restart

then comment again a flash again this should set timer properly

for ESP module:
what IDE do you use ? and what module version ?

Do you have a screenshot of module first page ?

here is mine [Image: Capture_2015-07-05-2.PNG]
In regards to the IDE, I used 1.5.8 for the da vinci. For the ESP I used 1.6.5.

I just flashed the da vinci again with WDT_Disable(WDT); uncommented. This fixed the boot loop, but now it just sits on black bars on the LCD. The LED case lights came on though. This is the same with the wifi module connected and not connected. Nothing on the status from the ESP page.

The esp module looks identical to the one in the first post. It was labeled as ESP-01. I understand there are a few versions of the board... I bought it from amazon (
Hmm try to flash printer without the module connected - it happened to me time to time
also need to use jumper to erase before flashing to have clean flash

about ESP module I was talking about SW version - I guess you use the board manager one
please use the staging version which has several fixes, add it in preferences :
For any issue with ESP module please key issue in, this will help to track everything as it is in early development and still need several updates
I do flash with the ESP module disconnected, as I understand that can cause issues (since it's sharing the same bus?).

I upgraded the ESP module to the same firmware using the staging version of the board manager. I selected the generic ESP module in the board manager.

After re-loading the wifi module with the firmware again using the staging board manager, I get the same wifi configuration page, and was easily able to connect to my wifi rather than running in AP mode. All is good there. (Image of the status page attached as requested).

I'm still getting stuck on boot on the da vinci however. It still stays on the black bars...[Image: ESP_2015-07-05.jpg]

Forum Jump:

Users browsing this thread: 1 Guest(s)