tip v Sylvain platformio d1_mini / d1_mini_pro

Voor 3M spiffs in je config toevoegen build_flags = -Wl,-Teagle.flash.4m.ld upload_speed = 460800 of upload_speed = 921600 voor snellere uploads, bij mij lijkt 460800 sneller, denk dat de io wellicht blocked bij hogere snelheden

Async TCP Client


  • ``` Async is nothing like Sync :)

You do not have available(), instead you have onData callback to handle incoming data as it comes. Basically the whole thing is event based and you have callback for each different event. For example:

You start with connect(host, port, onConnectCallback) and attaching onError callback if connect fails. Once you have connected, you can attach the rest of the callbacks and start sending and receiving data. Once you get onDisconnect or you close the client, you will no longer get onData callbacks and you can not send data. That’s about it.

client = new AsyncClient();

if(!client)//could not allocate client

  client->onConnect([](void * arg, AsyncClient * client) {

client->onData([](void *arg, AsyncClient *c, void *data, size_t len) {
        Serial.print("async_recv(): onData len = %d\n", len);

lib_deps ESPAsyncTCP in platformio.ini

platform = espressif8266
board = d1_mini
framework = arduino

lib_deps =

OTA (over the air update)

platformio run -t upload --upload-port

mkspiffs error when running ‘pio run -t buildfs’

pio run -t buildfs     # or uploadfs
[Tue Jan 30 21:33:25 2018] Processing d1_mini_pro (platform: espressif8266; board: d1_mini_pro; framework: arduino)
Verbose mode can be enabled via `-v, --verbose` option
Collected 26 compatible libraries
Scanning dependencies...
Library Dependency Graph ( )
|-- <ArduinoOTA> v1.0
|   |-- <ESP8266WiFi> v1.0
|   |-- <ESP8266mDNS>
|   |   |-- <ESP8266WiFi> v1.0
|-- <Hash> v1.0
|-- <ESP8266WiFi> v1.0
|-- <ESP8266mDNS>
|   |-- <ESP8266WiFi> v1.0
Building SPIFFS image from 'data' directory to .pioenvs/d1_mini_pro/spiffs.bin
libc++abi.dylib: terminating with uncaught exception of type std::length_error: vector
*** [.pioenvs/d1_mini_pro/spiffs.bin] Error -6

There could be an error in ~/.platformio/platforms/espressif8266/builder/ Somehow the size is negative (-s -1069056):

"mkspiffs" -c data -p 256 -b 8192 -s -1069056 .pioenvs/d1_mini_pro/spiffs.bin

Could line 212 in be faulty? "-s", "${int(SPIFFS_END, 16) - int(SPIFFS_START, 16)}",

ESP D1 Mini Pro (

ESP D1 mini

  • geleend van Sy1vain
  • In Arduino IDE in add this URL in preferences:
  • then open ‘boards manager’

ESP D1 mini via PlatformIO

mkdir ESP2
cd ESP2
brew install platformio
pio boards esp8266
pio init -b d1_mini
subl .
pio run
pio run -t upload
mkdir data
cd data
echo hallo > index.htm
cd ..
pio run -t uploadfs
ping esptje.local

Smart Config

  • ESP8266 SmartConfig Android app
  • Cordova Plugin for EspTouch

  • the ESP8266 is actually a 32-bit Tensilica Xtensa LX106 processor running at 80 MHz with a full WiFi stack.
  • [[ ElectroDragon ESP8266 Wiki]]
  • [[ Zeflo’s Arduino code + wiring example]]
  • [[ NURDspace on ESP8266]]
  • [[ ESP8266 at]]
  • [[ ESP8266 projects on instructables]]
  • [[ user forum]]
  • [[]] (of 3.3 voltage regulator van pc moederbord afsolderen bijv BA033)
>> AT

<< OK

<< 00150900

Set Wifi mode to both Access Point and STAtion: AT+CWMODE=3 List Access Points: AT+CWLAP get the connection status AT+CIPSTATUS restart the module AT+RST check SSID of connected network AT+CWJAP? get IP address AT+CIFSR

send something to a UDP server running on your computer

  • on your computer run a UDP server: nc -lu 9999
  • then connect to the UDP server and send 5 bytes: AT+CIPSTART=4,”UDP”,””,9999 AT+CIPSEND=4,5

    12345 SEND OK

setup a tcp server


NodeMCU firmware


  • GPIO0 needs to be connected to ground to flash the chip.
  • Download NodeMCU firmware from:
  • sudo ./ --port /dev/tty.usbserial write_flash 0x00000 nodemcu.bin
  • run examples from
  • download [[ LuaLoader]]

NodeMCU API documentation


    =wifi.sta.getip() =wifi.ap.getip()

NodeMCU Lua ESP8266 ESP-12E WiFi Development Board

  • [[]]
  • [[ esp8266 development board on]]
    • When turning on, this board will create a wifi network (doitWifi). The password is 12345678 You can very easily upload your own LUA scripts with [[ ESPlorer]].


function dir() l = file.list(); for k,v in pairs(l) do print("name:"..k..", size:"..v) end end


# connect to your wifi network

wifi.setmode(wifi.STATION) wifi.sta.config(“SSID”,”password”) print(wifi.sta.getip()) –

# create a http get function

function dns(domain,cb) sk=net.createConnection(net.TCP, 0) sk:dns(domain,function(conn,ip) cb(ip) end) end

function httpget(domain,file) dns(domain, function(ip) sk=net.createConnection(net.TCP, 0) sk:on(“receive”, function(sck, c) print(c) end ) sk:connect(80,ip) sk:send(“GET “ .. file .. “ HTTP/1.1 Host: “ .. domain .. “ Connection: keep-alive Accept: /

”) end) end ```

Compile NodeMCU firmware yourself to disable certain modules=