WiFi
| Documentation/HOWTO | /Wifi |
How to connect your NG to the internet
The cheap chinese ESP8266 Wifi modules can be used to establish a WLAN connection to your NG easily.
Prepare your ESP8266 module
Pin Connection
| ESP8266 Pin | connect to |
| VCC | 3,3V. 100µF Tantal capacitor between VCC and GND |
| GND | GND |
| RXD | NG-TXD |
| TXD | NG-RXD, 4k7 pullup resistor to 3,3V |
| REST | 4k7 pullup resistor to 3,3V |
| CH_PD | 4k7 pullup resistor to 3,3V |
| GPIO0 | 4k7 pullup resistor to 3,3V. Connect to GND for firmware flashing |
| GPIO15 | GND |
Initial settings
Connect your ESP8266 to your PC with a NGUSB or other serial UART adapter. Attach a 3,3V power supply.
Open a serial terminal (minicom, TeraTerm, Putty, …)
Find out the baudrate of your ESP8266. Try out different baudrates, reboot the ESP8266 and see if readable text appears on your terminal. Set the baudrate to 115200 . {{{ AT+CIOBAUD=115200 }}} Some firmwares need CR+LF for command confirmation. Most terminals only send LF when pressing Return. Press CTRL+M, CTRL+J after every AT command in this case.
For more details and troubleshooting, see http://www.esp8266.com/wiki/doku.php?id=getting-started-with-the-esp8266
Firmware Update
The AT+GMR command should print your firmware version: . {{{ AT+GMR 00200.9.5(b1) compiled @ Dec 25 2014 21:40:28 AI-THINKER Dec 25 2014
OK }}} Firmware binaries and update instructions can be found here: http://www.electrodragon.com/w/ESP8266_Firmware
My module is working with AI-v0.9.5.0 AT Firmware
Operate your ESP8266 at your NG
Connection
Connect the ESP8266 module to a UART of your NG. Make sure there is a 3,3V supply at the VCC pin of your NG uart. Check the soldering jumpers of your UAVP-FC.
In the NGOS settings, configure the uart to operate in esp8266 mode: . {{{ set HW.uart0.baud 115200 set HW.uart0.mode esp8266 }}}
Reboot your NG or start the WLAN module with . {{{ wlan init }}}
Show the connection state . {{{ wlan status Connection established to 192.168.4.2. }}}
Modes of Operation
There are two different modes of operation:
| Access Point Mode | The ESP8266 Wifi module opens an access point. Use your PC/Phone to connect to this AP. IP settings are done automatically. |
| Station Mode | Connect to a WLAN access point. You need to know the IP address of the computer you want to talk with |
The module usees WPA2 PSK encryption.
Configure AP mode
In the NGOS settings, set . {{{ set WLAN.SSID <CreateAnAPName> set WLAN.pw <YourTopSecretPassword> set WLAN.NGisAP yes }}}
Configure station mode
In the NGOS settings, set . {{{ set WLAN.SSID <YourLocalSSID> set WLAN.pw <YourTopSecretPassword> set WLAN.NGisAP no set WLAN.ip <IP address of the PC you want to connect to> }}}
Connect a Linux Console to your NGOS
Using the UNIX command NC to wait on a port for incoming connections
After a WLAN connection is established, the NG tries to establish a connection to TCP port 1234.
On Linux, you can use netcat to establish a console connection to your NG . {{{ nc -l -C -p 1234 UAVP connected.
}}}
Using the UNIX command SOCAT to wait on a port for incoming connections
After a WLAN connection is established, the NG tries to establish a connection to TCP port 1234.
On Linux, you can use socat to establish a console connection to your NG . {{{ socat -d -d TCP4-LISTEN:1234,crnl READLINE,history=$HOME/.http_history UAVP connected.
}}}
Using the UNIX command SOCAT to connect to a port on the NG
. {{{ socat -d -d READLINE,history=$HOME/.http_history TCP4:172.x.y.z:1234,crnl }}}