Author Archives: R-B

Tutorial 2: EasyESP-1 “Hello World” Example

After setting up the Arduino IDE to enable support for ESP8266, it’s time to write your first code for EasyESP-1 board. We will start with the classic hello world! example of electronics, a flashing LED. This is the best example to start with any new hardware platform as it gives us an opportunity to verify that the required software tools/drivers are installed properly and ready to rock.

Hardware Setup

In this example, we will connect the LD1 and D1 pins of J3 header together with a jumper wire as shown below. This will connect the LD1 LED near the bottom right corner of EasyESP-1 to the D1 I/O pin (or GPIO5) of ESP8266.

Connections for the “Hello World” example

Connections for the “Hello World” example

Software

Open a new window on Arduino IDE and select appropriate options for Boards, Serial Port, CPU frequency, and Upload speed. You need to choose NodeMCU 1.0 (ESP-12E Module) from Board menu, set CPU frequency to 80 MHz, Upload Speed to 115200, and match Serial Port to the one that your EasyESP-1 is connected to. Check out my previous tutorial “Getting started with EasyESP-1 using Arduino IDE” for more details on this. Your selected options are shown in the bottom tab of the Arduino IDE, make sure they match with the ones shown below.

IDE1

Arduino IDE option setup for EasyESP-1

As I described in the EasyESP-1 Introduction, EasyESP-1 uses the same I/O indexing as used by NodeMCU. This does not match with internal GPIO indexing. For example, pin D1 is actually mapped to internal GPIO5. In Arduino IDE, you can access this pin in both ways. For example, digitalWrite(D1, LOW) and digitalWrite(5, LOW) will both do the same thing, writes out logic ‘low’ to D1 pin. Next, copy the following code and paste it into your empty program window. The program is written to blink the LD1 LED at a rate of 1Hz. Save the code, verify it, and upload it to EasyESP-1 board in the same way as you do for Arduino.

/*
 Hello World example for EasyESP-1
 Blink the red LED (LD1) on the EasyESP-1 board at 1Hz
 */
 
#define LD1   D1  // Define LD1 as D1 I/O pin
// Alternatively, you can also define it as GPIO5
//#define LD1 5
 
void setup() {
  pinMode(LD1, OUTPUT); // Initialize LD1 as output
}
 
void loop() {
  digitalWrite(LD1, LOW);   // Turn ON LD1
  delay(500);               // Wait for 0.5 sec
  digitalWrite(LD1, HIGH);  // Turn it off
  delay(500);               // Wait for 0.5 sec
}

Output

If everything worked perfectly, you would see LD1 flashing at 1 Hz and with 50% duty cycle (i.e. on and off time are both 0.5 sec).

LD1 flashes at 1Hz rate

LD1 flashes at 1Hz rate

Buy EasyESP-1 board

Tutorial 1: Setting up the Arduino IDE for EasyESP-1

One of the simplest way to program the ESP8266 chip on board EasyESP-1 is using the Arduino IDE. Following steps describe how to enable the ESP8266 support in the Arduino environment.

Step 1 : Install Arduino IDE
The first step toward setting up the Arduino platform for programming EasyESP-1 is to download and install the Arduino IDE. Go to the Arduino website and download Arduino IDE 1.6.11.

Step 2: Install ESP8266 core package
Next step is to install the ESP8266 core for Arduino IDE. It is an add-on that allows to write sketches for ESP8266 using the Arduino IDE  and its libraries. The easiest way to install the ESP8266 core is by typing in http://arduino.esp8266.com/stable/package_esp8266com_index.json
into Additional Board Manager URLs field in the Arduino-> Preferences window (see figure below).

Adding ESP8266 support to Arduino IDE using Preferences window

Adding ESP8266 support to Arduino IDE using Preferences window

Click OK and then go to Boards Manager and install the ESP8266 core. It appears at the end of the list as esp8266 by ESP8266 Community (see figure below). Select 2.3.0 version from the dropdown list.

Installing ESP8266 core from Boards Manager

Installing ESP8266 core from Boards Manager

Step 3: Select the right board
Next you need to select NodeMCU 1.0 (ESP-12E Module) from Board menu.

Select NodeMCU 1.0 (ESP-12E Module)

Select NodeMCU 1.0 (ESP-12E Module)

Go to Tools and make sure the CPU Frequency is set to 80 MHz and Upload Speed to 115200. If not, change them to correct options.

CPU clock should be set to 80 MHz and Upload Speed to 115200

CPU clock should be set to 80 MHz and Upload Speed to 115200

Step 4: COM Port selection
Finally, you need to select the right COM port that your EasyESP board is connected to. Obviously, you need to connect the EasyESP-1 to the computer through a USB cable. If the driver for SiLabs CP2102 USB-UART device is installed properly, it will show up in the Arduino IDE Tools->Port list as a new serial port. In Windows machines it shows up as a new COMx port. The following figure shows how it appears on a MAC computer. You should select the matching serial port for the CP2102 device on EasyESP from the Port list.

Select the right serial port (MAC computer)

Select the right serial port (MAC computer)

Now you are all set to write and upload your first ESP8266 program using the Arduino IDE.

ESP8266 experimenting made easy with EasyESp-1

ESP8266 experimenting made easy with EasyESP-1

Buy EasyESP-1 board

Managing a menu driven user interface on a Nokia 5110 LCD

An interactive menu driven LCD user interface (UI) is really useful in embedded applications that require setting up parameters for operation. This YouTube tutorial demonstrates how to manage a simple menu driven UI on a Nokia 5110 LCD for Arduino applications.

User interface menu on Nokia 5110 LCD

User interface menu on Nokia 5110 LCD

This is the project we are going to build. In the display a simple menu appears, and with the help of three buttons I can navigate up, or down and select a menu item. Let’s select the first option. As you can see a new a UI screen is displayed and by pressing the up and down buttons we can change the contrast of the display. If we press the middle button again, we go back to the main UI screen. If we now select the second menu item and press the middle button we can turn the backlight of the display on or off. Lastly if we navigate to the last menu item we can reset the settings for the display to the default values. Of course this is just a demonstration project, you can modify it to build your own more complex menus if you wish. Let’s now see how to build this project.

Watch the tutorial video below:

ESP8266 garage door opener and data logger

This ESP8266 controlled garage door opener activates the garage switch via commands send over an web browser. In addition, it also records the activities to a Google Sheet using the IFTTT.com services.

ESP8266 garage door opener

ESP8266 garage door opener

There seems to be an unstoppable drive in the hacker DIY community for web based garage door openers and we were compelled to respond.  The garage door opener we have opens/shuts from a push button switch that basically creates a short to connect two terminals on the garage door opening unit.  That allows easy implementation because all that is required is a ESP8266 controlled relay wired across those two terminals to create a switch closure.

 

Portable RPi game emulator

This Portaberry RPi game emulator is a Raspberry Pi powered portable gaming console running the Retropie operating system.

It allows you to play an extremely wide range of classic video games from the Atari 2600 to the Playstation 1.

The main features of this project are as follows:

  • 5″ HDMI Display
  • Full complement of modern controls (2 analog sticks, d-pad, 4 action buttons, start/select, and L/R shoulder and trigger buttons)
  • Raspberry Pi 2 Running Retropie 4.1
  • Stereo Speakers and headphone jack
  • 4400mAh battery giving roughly 4 to 5 hours of play time
  • USB micro charging input using Adafruit Powerboost1000c
  • Accommodations for laser cut front and rear panels
Portable Rpi game emulator

Portable Rpi game emulator

« Older Entries Recent Entries »