This guide will show you how to create plug & play DIY Anet A8 wifi module, which can also be used as an ESP-01 breakout module.
The module will allow you to print wirelessly from your PC via WiFi using Pronterface, Simplify3D etc.
What you need
- ESP-01 wifi module – http://www.ebay.com/itm/171907296150
- Micro USB to UART TTL module – http://www.ebay.com/itm/162037276744
- AMS1117 3.3V voltage regulator – http://www.ebay.com/itm/251877250760
- 2 resistors – 1K and 2K2
- male headers: 3 pin x 1 row; 4 pin x 1 row; 6 pin x 1 row; 3 pin x 2 row
- female headers: 4 pin x 2 row; 5 pin x 2 row; 6 pin x 1 row
- one momentary push button – http://www.ebay.com/itm/322360144383
- 3 jumpers or 3 female-female jumper wires
- single sided pcb
- micro usb A to usb cable (regular phone charging cable)
- a Linux PC (Windows / Mac should also work, but the instructions are for Linux)
For the headers you can also use those (and cut them):
- male headers – http://www.ebay.com/itm/181918556293
- female headers – http://www.ebay.com/itm/130714103880
Building the PCB
Use the supplied schematic and pcb layout (in Eagle format) to build your own PCB and solder the components. How exactly you are going to do it is not the subject of this guide 🙂
Link to the schematic & pcb: https://drive.google.com/drive/folders/0B6YtfITnaa9zUzJJc1BDVHNHN3M?usp=sharing
Notes about the PCB:
- headers SV1 and SV5 are FEMALE
- SV5 and IC1 are soldered on the BOTTOM side of the PCB:|
- solder the 6 x 1 female header to the usb to uart adapter:
Flash esp-link firmware
- plug in the USB to UART module, the ESP-01 module, and a jumper on SV3 as shown on the picture
- connect the USB to UART adapter to the PC
- if everything is correctly built, the red led on the ESP-01 and the led on the USB to UART adapter should be glowing. The ESP-01 is in “firmware update” mode now, and you can continue with flashing the esp-link firmware.
- execute these commands in a terminal (each paragraph is a single command – make sure you are pasting the whole command!):
wget https://github.com/jeelabs/esp-link/releases/download/v2.2.3/esp-link-v2.2.3.tgz -O- | tar xzf - cd esp-link-v2.2.3 wget https://github.com/espressif/esptool/archive/v1.2.1.tar.gz -O- | tar -zxvf - --strip=1 sudo python esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash -fs 4m -ff 40m 0x00000 boot_v1.5.bin 0x1000 user1.bin 0x7E000 blank.bin
You should see someting like this in the terminal:
Connecting... Running Cesanta flasher stub... Flash params set to 0x0000 Wrote 4096 bytes at 0x0 in 0.1 seconds (322.0 kbit/s)... Wrote 307200 bytes at 0x1000 in 7.6 seconds (323.4 kbit/s)... Wrote 4096 bytes at 0x7e000 in 0.1 seconds (322.7 kbit/s)... Leaving...
Now remove the jumper from SV3 and press the reset button on the PCB.
After a while, your PC should see a new wifi network, called something like ESP_E5E693.
Connect to it, and load http://192.168.4.1/ in your browser.
You should be able to see the “admin” web interface of the module. Now select “esp-01” from the “Presets” dropdown, uncheck the “RX pull-up” checkbox, and click “Change!”:
Now click the “WiFi Station” link on from the menu on the left side of the screen, and click “Switch to STA+AP mode”. You might have to wait a while, but eventually, you will see a list of the available wifi networks. Select your own, enter the password, and click “Connect”
The module should be now connected to your wifi. Write down it’s IP address from “WiFi State” table:
If you now click the STA Mode link, the module will switch in “station mode”, and will act like regular device, connected to your wifi (e.g. it won’t create it’s own wifi network). It is recommended to switch it to STA Mode once you have set up the connection parameters.
Use http://the-ip-address/ to access it afterwards (in my case http://192.168.2.195). You can also set-up static IP adress from the WiFi station menu (recommended). Just select “Static IP” and enter the desired IP address (I used the same I got from DHCP – 192.168.2.195).
Finally, click the “Debug log” link from the menu, and on “UART debug log” select OFF.
The device is ready!!!
Now prepare the printer’s motherboard. It requires a simple modification, that does not interfere with it’s operation afterwards – just solder 3 pin x 2 row male header on J8, and add 2 jumpers (or jumper wires) as shown on the picture:
You will also have to unsolder the resistors R52 and R53 – they are zero ohm resistors, and serve no other purpose than connecting the atmega chip directly to the onboard USB to UART converter (the CH340 chip). Do it VERY careful – you don’t want to damage your board. If you don’t feel confident – don’t do it.
This addon board can work without unsoldering these resistors, but then it works in parallel with the onboard usb to uart converter, and there is a risk of damage to both chips (the CH340 and the ESP)
Now connect the module to the motherboard:
It’s highly recommended to apply some tape on the bottom of the addon board – for insulation. You don’t want to acidentally create short circuit.
Power on the printer, and try to load http://192.168.2.195 (or whatever IP you are using) after a couple of seconds.
Now go to “µC Console” and scroll the console box to the bottom. Don’t worry if you are seeing a lot of “Resend:1 ok” lines there.
Enter M105 on the text box below, and press Enter:
The printer should report it’s status:
ok 0 T:16.28 /0 B:18.76 /0 B@:0 @:0
Next…
Create virtual com port
It’s pretty easy actually. Just execute this command:
if [ ! -e /dev/ttyS99 ]; then sudo echo "Got root access"; sudo socat pty,link=/dev/ttyS99,raw tcp:192.168.2.195:23 & sleep 2; sudo chmod 777 /dev/ttyS99; fi
And you are done! This command must be executed every time before you start Pronterface/Simplify3D/Whatever.
You can now start Pronterface and connect to /dev/ttyS99 just like a regular com port.
Notes
Add the com port to WINE (if your slicer is Windows-only but works with WINE)
First, make a symlink to your serial device by executing the following command in terminal (change ttyS99 accordingly if you use different device name):
ln -s /dev/ttyS99 ~/.wine/dosdevices/com1
Then add this to ~/.wine/system.reg
[Hardware\\Devicemap\\Serialcomm] 1231984861 "Serial0"="COM1" [Hardware\\Devicemap\\Serialcomm] 1131331688 "COM1"="COM1"
J3 Pinout
Windows support
I was unable to get it running with the windows version of socat, but it’s working with this: http://www.hw-group.com/products/hw_vsp/index_en.html – download and install HW VSP: Singleport 3.1.2, and then add the port from the Virtual Serial Port tab in the app.
Reliability
The device has not been tested with long prints. It’s recommended to use it with short prints first, until it’s confirmed it works stable. If the network connection drops or the ESP-01 module resets/hangs for some reason, the print WILL fail.
Uploading gcode file to the printer instead of “streaming”
You can use the “SD Upload” function in Pronterface – this function uploads the whole gcode file to the printer’s SD card. Then you can use the SD Print function, and print it from the SD card.
If your connection drops while using it – no problem, just connect again. The print won’t fail, and you can continue monitoring it in the Pronterface log window.
Important
If you want to be able to print over USB, you have to move the J8 jumpers on the USB side:
Show Respect
If you like this project, and you want to support me & show respect, you can make a small donation via PayPal:
Disclaimer
As with everything on the internet, you are solely responsible for any harm to you or your printer!
The content on this document is licensed under the following license: CC Attribution-Share Alike 4.0 International