Return to site

Let's get started with ESPresso Lite (Beta)

We will be updating this tutorial frequently. Please check back regularly.

NOTE: This tutorial is applicable only for users of the ESPresso Lite (beta).
The ESPresso Lite (beta) has been replaced with the made-for-mass production, ESPresso Lite V2.0.

For more information about using ESPresso Lite V2.0, please click here.

Please forward your comments or feedback to hello@espert.co

1. ESPresso Lite (beta) Pinout diagram

 

The ESPresso Lite board helps to breakout the pins of the ESP8266 chip inside the ESP-
WROOM-02 module, allowing anyone to use these IO pins to blink their LEDs, read button switch, take reading from sensors or to control an actuator like an Arduino board.

 

ESPresso Lite is designed to takes in power voltage between 3.3V to 6V but no more than that.
The board has 11 GPIO pinouts (labelled in yellow) and can be used as an input or output. The
corresponding Arduino pin number is also displayed (in brown).

There is however a lone analog input pin labelled AD. Be careful when using this pin as it can only take in maximum of 3.3V.

 

2. USB to Serial Connection

 

 

As a development board, the ESPresso Lite can be programmed by connecting to the 6 serial pins labelled DT, TX, RX, V5, RT & G using an FTDI cable (above) or FTDI Friend (below).

 

ESPresso Lite do not provide the on-board USB to Serial connector (e.g. a microUSB) because we believe that the serial port (UART) should be able to use with other peripherals e.g. using to communicate with Raspberry Pi or with Serial based sensors.

NOTE: When programming the ESPresso Lite using the FTDI USB-Serial cable:

  1. If the RESET button is pressed while the 'Serial Monitor' is open on Arduino IDE, the ESPresso Lite will go into 'flash' mode. i.e. it is ready to download your sketch to run on ESPresso Lite.
  2. On the other hand, if the RESET button is pressed when the 'Serial Monitor' is closed, the ESPresso Lite will reboot, to 'run' whatever sketch that was uploaded previously. 

For example, if you need to test some feature where the ESPresso Lite is required to reboot (e.g. Smart Config examples) while it is connected to the computer using FTDI USB-Serial cable, you will need to close the 'Serial monitor' in the Arduino IDE.

 

3. Installing Arduino IDE version 1.6.7

 

 

We recommend using the Arduino IDE to program and upload the sketches to the ESPresso Lite. The Arduino IDE (version 1.6.7 is recommended although earlier version 1.6.5 is still okay) can be downloaded from https://www.arduino.cc/en/Main/Software

 

NOTE: Newer versions of the esp8266 board managers will also work with the ESPresso Lite (beta)

    • Open Board Manager from Tools > Board > Board Manager and then install esp8266 by ESP8266 Community (current version is 2.2.0)
    • From menu Tools > Board select Generic ESP8266 Module

4. Install the ESPert Library

  • Open Library Manager (menu Sketch > Include Library > Manage Libraries…) then install the Espert library by Jimmy Version 1.2.4

5. Install dependency for ESPert

Continue to follow up on Library Manager (menu Sketch > Include Library > Manage Libraries…) to install the following libraries (*Updated 30th June 2016)

  • DHT sensor library by Adafruit (working version 1.2.3)
  • PubSubClient by Nick O'Leary (working version 2.6.0)
  • ArduinoJson by Benoit Blanchon (working version 5.2.0)
  • HttpClient by Adrian McEwen (working version 2.2.0)
  • ESP8266 Oled Driver for SSD1306 display by Daniel Eichborn (working version 2.0.2)
  • Adafruit NeoPixel by Adafruit (working version 1.0.5)

These steps will also provide Espert library as well as sample codes needed for your IoT project on Arduino (Step 4) and hardware addons/sensors support (Step 5).

Once done, access the sample codes from the File -> Examples -> Espert submenu in your Arduino:

6. Using & uploading example sketches

Always remember to press RESET button switch at the ESPresso Lite BEFORE uploading the a new sketch. To check if you have successfully, reset it, open the Serial Monitor and see if a string of 'garbage' characters is displayed (see below) when the reset button is pressed.

  • To use the ESPert example sketches, open File > Examples > ESPert.
  • To upload the sketch, click on the 'Upload' button (show below) in the Arduino IDE.

Example _0010_Blink

The ‘Blink’ example is the universal hardware version of the popular ‘Hello World!’ text displayed by someone programming for the first time. By making the LED blink, the user is able to upload the codes as well as made an error-free codes in Arduino IDE.

      • The onboard green LED happens to be also connected to GPIO16
      • The green LED (GPIO16) is always pulled high and upon uploading it, it will blink intermittently (every 1000 ms or 1 second).

Example _1040_ Sleep

ESP8266 has a sleep feature for certain applications that requires low power consumption. There are two ways to wake it up: 1) to reset it manually (or via Bluetooth) or 2) wait for it to complete its sleep cycle.

      •  To use ESP8266 sleep feature, GPIO16 is needed to wake the CPU up. You can RESET GPIO16 by shorting the circuit as shown in picture below.
      • If the GPIO16 is used for waking up, the onboard green LED (since they are linked together) can no longer be used. Instead, plug in another LED into GPIO12 as shown in picture below.

During wakeup phase, RTC will generate a pulse to GPIO16 so as to reset the chip. Below is the waveform observed on GPIO16/RST. The falling edge actually only reaches 1.96V then it climbs immediately, with effective pulse width only 5.2us. (Ref: @Ba0sh1)

Example _0020_BlinkEspert (Blink using ESPert library)

Another way to blink the LED is to call a pre-written function instead of directly drive current to a particular pin

      •  Create and initialize your ESPert library object (e.g. espert)
      •  Use the .LED function of ESPert library object to control LED (e.g. espert.LED.on() )

The default GPIO for LED is GPIO16. If there is a need to use other GPIO to control the LED (for example, the GPIO16 is being used to wake the ESP8266 from deep sleep), assign another GPIO number to the LED using espert.LED.init(<pin number>)

Example _0030_BoardInfo

This sketch will display some pertinent information about ESP8266 boards (not limited to ESPresso Lite only):

  • ESP Chip Id
  • ESPert library version
  • Flash memory size
  • Flash chip info

This feature is used to verify that the 'Flash Size' setting is correct for ESPresso Lite (4Mb) instead of default 512k. If there is a mismatch, the serial monitor will indicate an error in configuration message (shown below)

To rectify the error, simply go to Tools > Flash Size and select 4M (3M SPIFFS). After the re-uploading the sketch, the serial monitor will display an OK configuration message.

Example _0040_Button

The onboard button switch labelled USER is using GPIO2 and is being pulled high normally. Pressing the button switch will change the GPIO2 state to LOW. This will switch the LED to the ON state.

Example _0050_OLED

A neat feature of the ESPresso Lite is that any sensors or external devices that requires I2C can be easily stack on top of the board. In this example, a generic OLED display module can be plug in directly to the I2C headers (V3, G, CL & DA) without the need to use any jumper wires

    • To change the text display size, modify espert.OLED.setTextSize (<number>)
    • To change the text colour, modify espert.OLED.setTextColor (espert_<color>)
    • To set the cursor position, modify espert.OLED.setCursor (<x>,<y>)
    • To display text, modify espert.OLED.println(“<text>”)

Example _0060_DHT

We can measure temperature and humidity easily with an inexpensive DHT22 sensor. This is easily done by plugging in the DHT22 sensor directly into the V3, 12, 14, G header, just above the OLED. There is no need to connect any resistors as pin 12 (where the data pin for the DHT22 is) has inbuilt pull-ups.

The reading is taken every 5 seconds and the information will be displayed in the OLED display.

In the later ‘Webserver’ example, we can turn the ESPresso Lite as a webserver to return any web request for temperature or humidity data online.

Connecting to Wi-Fi

From example 7 onwards, the ESPresso Lite will need to be connected to Internet via Wi-Fi

There are 3 ways to set up the Wi-Fi connection for the ESPresso Lite:

1. Autoconnect to Wi-Fi using previous login credentials

  • When it is booted up, it will try to connect to Wi-Fi with the login credentials used in the previous connection by default. It will keep trying to get connection for 30 secs.

2. Smart Config

  • Next it will enter into SmartConfig mode where the ESPert app can be used to set up the Wi-Fi for one to multiple ESPresso Lite units simultaneously.
  • See Example 7 - Smart Config below for a more elaborate explanation.
  • To go to AP mode, press and hold the USER button for 5 seconds.

3. AP mode

  • Hold the button switch for a long time, makes the ESPresso Lite go into AP (access point) mode. 
  • Check the available WI-Fi network and connect to it. In this AP mode, the ESPresso Lite will indicated as ‘ESPERT-<chip-id>’ in Wi-Fi network list.
  • Key in the IP address indicated in the OLED display e.g. 192.168.4.1 in the URL panel of your browser to access the Wi-Fi setup panel to connect the ESPresso Lite to an available Wi-Fi point by selecting the appropriate SSID & entering the password.

(Without opening the Arduino serial monitor), press RESET button to reboot and the ESPresso Lite should be connected (almost) instantaneously to the Wi-Fi.

Example _0070_SmartConfig

Smart Config is a feature where (one to multiple) ESPresso Lite(s) can be connected to the Wi-Fi access point of your choice simultaneously by use of either 1) the ESPert mobile app or 2) using the AP mode feature of the ESPresso Lite.

After uploading the sketch, the OLED display should indicate that its ready for Smart Config.

First, ensure that the mobile device is connected to a Wi-Fi access point which the ESPresso Lite will need to be connected to eventually (by keying in the Wi-Fi SSID & password).

The app for iOS & Android can be downloaded at http://www.espert.io/app

Next, indicate the number of devices to be configured (minimum is 1)  and press Start Smart Config. Once connected, the OLED display should show the IP address of the connected Wi-Fi

Example _0080_Webserver

In Example 8, you can turn your ESPresso Lite to become a temperature-humidity webserver using the DHT-22 sensor.

The ESPresso Lite board allows generic OLED display to be plug in directly to the I2C headers. Similarly the DHT22 sensor can be inserted directly into the V3, GPIO12, GPIO14 (not used), GND UART headers without the need to have additional jumper wires or passive components.

Go to File > Examples > ESPert > _0080_WebServer to get the sketch below

* Remember to press RESET before uploading the sketch into the ESPresso Lite.

After the sketch is uploaded, set up the Wi-Fi connection using the methods described in "Connecting to Wi-Fi" above.

After setting up the Wi-Fi connection, enter into the URL the IP address indicated in the OLED display e.g. 192.168.1.9

After a few seconds, the information about the humidity and temperature is displayed online.

Example _0110_ButtonToPushMessage

This sketch allows anyone to create a HOT Button (an IoT button like the Amazon Dash button) that is built from ESPresso Lite.

When user press the button, the ESPert cloud will be triggered and it will send the notification to a pre-set smartphone. You can apply this to many IoT solutions:
• Order coffee from favourite cafe
• Tell your parents you are at home now
• Press order for office or household supply
• Play games
• (lots lots more…)

For this sketch to work, you will need to:

  • Create an account at Espert.io .Check out this tutorial here to learn how to create one.
  • Obtain your smartphone_key (a string of numbers generated in your Espert.io account when download the Espert app and log in with it)
  • Connect ESPresso Lite to Wi-Fi

In the Arduino sketch, you can modify the code by:

  • Changing message to change the content of the message.
  • Changing smartphone_key to match your own key (shown below)
All Posts
×

Almost done…

We just sent you an email. Please click the link in the email to confirm your subscription!

OKSubscriptions powered by Strikingly