Skip to content

Program Arduino with esp link

pixiandreas edited this page May 30, 2018 · 1 revision

Program Arduino over wifi with esp-link.

This guide is written for Linux but can still be used for both Mac and Windows users. With some small modifications.

Hardware Required:

  • 1 St Nodemcu. The wifi circuit is an esp8266-12e
  • 1 St Arduino, I have tried with Uno and Mega (obs mega requires an alpha version of esp-link)
  • Some dupont cables
  • 1 St micro usb cable to program Nodemcu

Software:

I have chosen Nodemcu because they are easy to program and don't need an separate programmer.

A esp8266-01 should also work it requires a separate programmer

I have tried Nodemcu V0.9 and V3 but will also work with a Wemos D1 or similar.

Further in the guide, I call Nodemcu for esp.

1.

Start by programming the esp according to the following guides:

Uno:

https://github.com/jeelabs/esp-link/blob/master/FLASHING.md#initial-serial-flashing

Be sure to choose the right size, select "32Mbit / 4Mbyte module" if you use Nodemcu

Mega:

For Mega, you need to download an "Alpha" version of esp-link. The stable version has a bug that does not work to program Mega.

Available here: http://s3.voneicken.com/esp-link/esp-link-v3.2.47-g9c6530d.tgz

Note this is an "Alpha" release so there may be bugs. I have run this alpha without any problems. More info: https://github.com/jeelabs/esp-link/releases

Follow the Uno wizard but skip the first curl command.

Untar the downloaded fil “tar xvf esp-link-v3.2.47-g9c6530d.tgz

Then continue with the esptool command. Be sure to use the right paths to your file.

2.

When done, restart esp and a you will see new wifi network (ESP_XXX)

3.

Connect and you will get an IP (192.168.4.XXX)

4.

Open the web page 192.168.4.1 , here is the esp-link website.

5.

Now connect the esp to your wifi.

6.

Start by choosing "WIFI Station", then select "Switch to STA + AP mode"

7.

Now your wifi’s ssid will seen under "WiFi Association" and select your wifi’s and enter your key.

8.

Connect to your wifi watch if you can access either hostname "esp-link" or the ip address , you will found it in you router.

9. Now it's time to connect esp and Arduino

esp (pin) <-----> Arduino (pin)

TX <-----> RX

RX <-----> TX

D6 <-----> REST This is not easily available on the morgan card, I solder on top on the morgan sheild (See picture 1) Later i did an "esp" shield (see picture 2 and 3)

Wine <-----> 5v (the Arduino 5v may work but a separate power is recommended.)

Gnd <-----> GND

10.

The first thing to do is select the esp type under "Pin assignment". Select esp-12 if you are using a nodemcu.

11.

Let try if the communication works. Load some simple prg with serial.print on the Arduino.

Choose "uc console" and select the correct baud rate (same as you set in Arduino prg)

If everything works properly, you'll see the print on the web page.

12.

Programming of Arduino

You can only program with a .hex file

Arduino ide

Under the Sketch menu use "Export Complied Binary"

Now, a .hex file will be created in the same directory as the .ino file

Platformio

The hex file automatically created when you build your project.

And the file is created in a hidden directory in you project folder.

/Liam/.pioenvs/XXXXXX/firmware.hex

XXXXX = Name of the board you build it for.

13.

Flashing

Uno

Use “avrflash" available in the esp-link directory.

Esp-link is available here if you have not already downloaded it:

https://github.com/jeelabs/esp-link

Then run the following command but replace the correct ip and hex file.

./avrflash -v 192.168.6.152 /home/andreas/src/liam/Liam.ino.uno.hex

Mega

Use "megaflash" in the esp-link (alpha) directory.

This is available here if you have not already downloaded it:

http://s3.voneicken.com/esp-link/esp-link-v3.2.47-g9c6530d.tgz

Then run the following command but replace the correct ip and hex file.

./megaflash -v 192.168.6.152 /home/andreas/src/liam/Liam.ino.mega.hex

Now you will see that Arduino begins to "blink" as it does when programming via USB.

More info about programming:

https://github.com/jeelabs/esp-link/blob/master/UC-FLASHING.md

Other info on esp-link see:

https://github.com/jeelabs/esp-link

Other great features that you can play with:

  • At port 23 or 2323 on esp-link, you can see all info that the Arduino serial port print out.
  • Reboot Arduino directly from the web page under "uc console" using the “reset uc“ button.
  • In "uc console" you can not only read but also send to Arduino

I have also made a movie that shows what it looks like when programming with esp-link. https://youtu.be/HALPIWW_FLA

Clone this wiki locally