How to flash, install firmware on your ESP8266-03 with a Mac OSX (windows is similar)

Started on the old forum in June 2016 · view the original in the archive · old links redirect here

#ams1117 #esp8266-03 #esplorer #esptool #usbtotll

2 replies · 966 views · started 10 years ago · 3 min read

2 participants
GumSlone Administrator Principal · 1,690 posts #1

Required hardware: AMS1117 USB to TTL Programmer Breadboard ESP8266 ESP-03

Software installation

sudo nvram boot-args="kext-dev-mode=1"

and restart your Мac.

Install an esp flasher Esptool software via Mac Terminal with this command:

pip install esptool

more infos about esptool you can find here: https://github.com/themadinventor/esptool

(Windows users can use this tool: https://github.com/nodemcu/nodemcu-flasher)

Download Esplorer from: http://esp8266.ru/esplorer/ or directly http://esp8266.ru/esplorer-latest/?f=ESPlorer.zip it requires Java which you can install from https://www.java.com/en/download/ (in case you don't have it).

Hardware preparation

Now you need aн ESP8266-03 Module, which looks like this: temp_5614_1467017853778_168 ESP8266-03 with a pinout: temp_5621_1467018050925_350

Use a solderer with a tiny tip to solder wires to the pins of the module.

Afterwards you esp should look like this: temp_5617_1467017792889_18 temp_5616_1467017812723_61

Now prepare the ESP826-03 for flashing. Important it requires 3,3 Volt power supply, so don't try to connect it directly to 5 Volts because it will destroy your chip. Many of USB to TTL programmers can provide 3,3 Volt power, so you can connect your ESP8266-02 to the 3,3 Volt pin of your programmer. I have used AMS1117 power converter, which converts 4,7 to 12 Volt into 3,3 Volts and connected it to the 5Volt output of my USB to TLL programmer, which looks like this: temp_5620_1467020190328_442 temp_5619_1467020208649_382

and the AMS1117 looks like this: temp_5618_1467020258702_97

at VIN+ you connect the 5 Volt of your USB to TTL programmer and at GND you connect the Ground pin of USB to TTL programmer, VOUT+ provides the required 3,3 Volt to power your ESP8266-03.

Now lets connect everything on a breadboard and prepare the ESP8266-03 for flashing firmware, for flashing firmware you need to connect these pins: CONNECT GPIO15 TO GROUND CONNECT CH_PD TO HIGH(VOUT+) CONNECT GPIO 0 TO GROUND RX Programmer to TX ESP8266-03 TX Programmer to RX ESP8266-03 Like this: temp_5622_1467025316185_47 and this is how it looks like with breadboard temp_5615_1467025598275_77

Get the firmware

Now get the latest firmware from here: http://nodemcu-build.com/ (select only the needed firmware modules because your chip has limited space and flashing firmware may fail due to lack of space on the chip, standard modules are selected by default and its recommended to include them in your build) I have selected the dev build with following additional modules: dht, file, gpio, http, mdns, net, node, rtcfifo, rtcmem, rtctime, tmr, uart, wifi.

After the firmware is ready, download it and place it into your user folder on MAC.

Flash the firmware

Now you can connect USB to TTL programmer to usb port of your Mac, open CoolTerm click Optionslook in the ports for something that looks similar to /dev/cu.wchusbserialfa130, your port name will be same or different, write down the port name which you see in CoolTerm. If you don't see it, make sure that you installed all the drivers and executed

sudo nvram boot-args="kext-dev-mode=1"

in terminal and restart your MAC.

Now open the terminal, and execute this commands step by step:

  1. to go to the use folder
cd
  1. before you execute the next command replace the /dev/cu.wchusbserialfa130 with your port name and nodemcu-dev-13-modules-2016-06-26-20-11-56-float.binwith the firmware file name that you have built and downloaded previously.
esptool.py --port=/dev/cu.wchusbserialfa130  write_flash  -fm=dio -fs=32m 0x00000 nodemcu-dev-13-modules-2016-06-26-20-11-56-float.bin

If you did everything correctly, the firmware will be written into the chip. If you get an error in the terminal output, make sure that your breadboard setup is correct and you are using the correct port.

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

Attachments: photo-153359.jpg photo-153360.jpg photo-153361.jpg photo-153362.jpg photo-153363.jpg photo-153364.jpg photo-153365.jpg photo-153366.jpg photo-153367.jpg photo-153368.jpg
GumSlone Administrator Principal · 1,690 posts #2

Start using your flashed chip

Now when new firmware is flashed, you can start programming it with Esplorer tool (which you have previously downloaded). Before you start: disconnect USB to TTL programmer from your MAC disconnect the GPIO0 from the Ground, so it will look like this: temp_5623_1467028883546_820

connect the USB to TLL back to your Mac.

Click the ESPlorer.jarfile to start the tool, it will take several seconds until its ready to go, (if the tool doesn't open make sure that you have java installed).

If you don't see your USB to Serial port that looks like /dev/cu.wchusbserialfa130execute

sudo nvram boot-args="kext-dev-mode=1

in terminal and restart your Mac.

When the ESPlorer is ready, select your port and click Open button to connect to your ESP8266-03, you should see an output like this: temp_5624_1467029021562_325 what is good, but this is not what we need. Click the close button and open button again, you may have to click close and open button several times until you see the proper output result, sometimes you need to reconnect your USB to TTL programmer and start over connecting with ESPlorer again. The output result that we want to have should look like this:

PORT OPEN 9600

Communication with MCU... Got answer! AutoDetect firmware... Communication with MCU established. NodeMCU firmware detected. =node.heap() 42624

temp_5625_1467029189355_898

Now you can start programming your ESP chip.

here is an example of init.lua file which connects your ESP8266-03 to wifi network:

--init.lua
wifi.setmode(wifi.STATION)
wifi.sta.config("WIFI_Network-XXXX", "Password")
wifi.sta.connect()

-- Connect
tmr.alarm(1, 1000, 1, function()
    if wifi.sta.getip()== nil then
        print("IP unavaiable, Waiting...")
    else
        tmr.stop(1)
        print("Connected to wifi")
    end
end)

Send GET Request with some data to a remote server i.e. you could use this code to send you data from dht11 or dht22 temperature humidity sensor to your server init.lua code:

--init.lua
wifi.setmode(wifi.STATION)
wifi.sta.config("WIFI_Network-XXXX", "Password")
wifi.sta.connect()

-- Connect
tmr.alarm(1, 1000, 1, function()
    if wifi.sta.getip()== nil then
        print("IP unavaiable, Waiting...")
    else
        tmr.stop(1)
        dofile ("main.lua")
    end
end)

main.lua code:

-- main.lua --
sensor = 1
pin = 4

tmr.alarm(2, 60000, tmr.ALARM_AUTO, function()

status, temp, humi, temp_dec, humi_dec = dht.read11(pin)
http.get("http://mysite.com/test.php?temp="..temp.."&humi="..humi.."&sensor="..sensor.."", nil, function(code, data)
    if (code < 0) then
      print("HTTP request failed")
    else
      print(code, data)
    end
  end)

end )

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

Attachments: photo-153377.jpg photo-153378.png photo-153379.png

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close