Espruino WiFi

Espruino WiFi

Note: Espruino WiFi provides an easy, well-supported way to get on the Internet, however it's not the only way to access a WiFi network from an Espruino board. See here for more information.

Features

  • 30mm x 23mm (1.2 x 0.9 inch)
  • On-board Micro USB connector
  • 2 rows of 11 0.1" pins, with 2 extra 0.1" holes
  • 21 GPIO pins : 8 Analog inputs, 20 PWM, 1 Serial, 3 SPI, 3 I2C
  • Three on-board LEDs (2x user programmable, 1x WiFi activity) and one button.
  • STM32F411CEU6 32-bit 100MHz ARM Cortex M4 CPU
  • 512kb flash, 128kb RAM
  • ESP8266 WiFi (802.11 b/g/n)
  • All GPIO is 5 volt tolerant (Arduino compatible)
  • RTC with external oscillator
  • On-board 3.3v 250mA voltage regulator, accepts voltages from 3.5v to 5v (please see notes under (pinout)[#pinout] below)
  • Current draw in sleep: < 0.05mA - over 2.5 years on a 2500mAh battery
  • 500mA polyfuse on board

Buying

Espruino WiFi is currently only available from our Tindie store.

Pinout

Hover the mouse over a pin function for more information. Clicking in a function will tell you how to use it in Espruino.

  • Purple boxes show pins that are used for other functionality on the board. You should avoid using these unless you know that the marked device is not used.
  • ! boxes contain extra information about the pin. Hover your mouse over them to see it.
  • 3.3v boxes mark pins that are not 5v tolerant (they only take inputs from 0 - 3.3v, not 0 - 5v).
  • 3.3 is a 3.3v output from the on-board Voltage regulator.
  • GND is ground (0v).
  • ADC is an Analog to Digital Converter (for reading analog voltages)
  • PWM is for Pulse Width Modulation. This creates analog voltages from a digital output by sending a series of pulses.
  • SPI is the 3 wire Serial Peripheral Interface.
  • USART is a 2 wire peripheral for Serial Data.
  • I2C is the 2 wire Inter-Integrated Circuit bus.
A10 PWM USART1 RX
A8 I2C3 SCL PWM USART1 CK
ADC PWM A0
ADC PWM A1
ADC USART2 CK A4
ADC PWM SPI1 SCK A5
ADC PWM SPI1 MISO A6
ADC PWM SPI1 MOSI A7
ADC PWM B1
I2C2 SCL PWM SPI2 SCK B10
PWM SPI2 SCK B13
PWM SPI2 MISO B14
PWM SPI2 MOSI B15

Pins not on connectors

A2 ! ADC ESP8266 PWM USART2 TX
A3 ! ADC ESP8266 PWM USART2 RX
A9 USB PWM USART1 TX
A11 USB PWM USART6 TX
A12 USB USART6 RX
A13 ! ESP8266
A14 ! ESP8266
A15 ! ESP8266 PWM
B2 LED1 BOOT1
B12 LED2
C13 BTN1
C14 OSC RTC
C15 OSC RTC
H0 OSC
H1 OSC

Note: Unlike Espruino Pico and the original Espruino board, Espruno WiFi doesn't contain any battery switchover circuitry. The +/+VUSB pin is connected straight to USB 5V, and shouldn't be used to power the WiFi board while Micro USB is plugged in, unless it is via a diode from 5V.

Information

Using WiFi

To use wifi, simply require the EspruinoWiFi module and call connect:

var WIFI_NAME = "";
var WIFI_OPTIONS = { password : "" };

var wifi = require("EspruinoWiFi");
wifi.connect(WIFI_NAME, WIFI_OPTIONS, function(err) {
  if (err) {
    console.log("Connection error: "+err);
    return;
  }
  console.log("Connected!");
  getPage();
});

function getPage() {
  require("http").get("http://www.pur3.co.uk/hello.txt", function(res) {
    console.log("Response: ",res);
    res.on('data', function(d) {
      console.log("--->"+d);
    });
  });
}

Note: If you want Espruino to connect at power on, make sure that you call the WiFi initialisation code inside an onInit function - eg:

var WIFI_NAME = "";
var WIFI_OPTIONS = { password : "" };

var wifi;

function onInit() {
  wifi = require("EspruinoWiFi");
  wifi.connect(WIFI_NAME, WIFI_OPTIONS, function(err) {
    if (err) {
      console.log("Connection error: "+err);
      return;
    }
    console.log("Connected!");
    getPage();
  });
}

Espruino WiFi's module is designed to work similarly to the ESP8266 native WiFi module, however you can't use the WiFi module directly. Eventually you will, however this is still in development.

/* Power on the ESP8266 and connect to the access point 
      apName is the name of the access point
      options can contain 'password' which is the AP's password
      callback is called when a connection is made
*/
exports.connect = function (apName, options, callback) { ... }

/* Disconnect from the WiFi network and power down the
ESP8266.
*/
exports.disconnect = function () { ... }

/* Get the Access point's IP and MAC address and call 
callback(err, { ip : ..., mac : ...}). If err isn't null,
it contains a string describing the error
*/
exports.getIP = function (callback) { ... }

/* Create a WiFi access point allowing stations to connect.
     ssid - the AP's SSID
     options.password - the password - must be at least 8 characters (or 10 if all numbers)
     options.authMode - "open", "wpa2", "wpa", "wpa_wpa2"
     options.channel - the channel of the AP
*/
exports.startAP = function (ssid, options, callback) { ... }

/* Stop being an access point and disable the AP operation mode. 
   AP mode can be re-enabled by calling startAP.
*/
exports.stopAP = function () { ... }

/* Scan for access points, and call the callback(err, result) with 
   an array of {ssid, authMode, rssi, mac, channel}
*/
exports.scan = function (callback) { ... }

Tutorials

Tutorials using the Espruino WiFi Board:

No tutorials use this yet.

There aren't currently many tutorials using this board, however it can be used just like the Espruino Pico, which has a lot of tutorials available.

Hardware Limitations

  • You can only have one watched pin of each number (Watching A0 and A1 is fine, but watching A1 and B1 isn't)
  • When in Deep sleep, pin B9 cannot be used as a watch (as A9 is used to wake up on USB)

Troubleshooting

Please see the Troubleshooting section.

Advanced Reflashing

In very rare cases (if you are experimenting with writing to Flash Memory), you may be able to damage the bootloader, which will effecitively 'brick' the Espruino WiFi.

To fix this, you'll have to use the hard-wired USB DFU (Device Firmware Upgrade) bootloader. You can also use this method for flashing non-Espruino firmwares to Espruino.

Just:

  • Short out the BOOT0/BTN solder jumper on the back of the board - you can do this by drawing over it with a pencil.
  • Install ST's DFU utility on Windows, or dfu-util for Mac or Linux
  • Download the latest Espruino WiFi binary from espruino.com/binaries
  • Hold down the Espruino WiFi's button while plugging it into USB
  • Use the DFU tool to flash the firmware. Using the GUI on windows, or with the command sudo dfu-util -a 0 -s 0x08000000 -D espruino_binary_file.bin for dfu-util on Mac/Linux.
  • Un-short the BOOT0/BTN jumper to re-use the original Espruino Bootloader. If you used a Pencil mark then you may need to use cleaning fluid and a small brush to totally clear out the graphite.

This page is auto-generated from GitHub. If you see any mistakes or have suggestions, please let us know.