Reader small image

You're reading from  ESP8266 Home Automation Projects

Product typeBook
Published inNov 2017
PublisherPackt
ISBN-139781787282629
Edition1st Edition
Tools
Right arrow
Authors (2):
Catalin Batrinu
Catalin Batrinu
author image
Catalin Batrinu

Catalin Batrinu graduated from the Politehnica University of Bucharest in Electronics, Telecommunications, and Information Technology. He has been working as a software developer in telecommunications for the past 16 years. He has worked with old protocols and the latest network protocols and technologies, so he has experienced all transformations in the telecommunication industry. He has implemented many telecommunications protocols, from access adaptations and backbone switches to high-capacity, carrier-grade switches on various hardware platforms from Wintegra and Broadcom. Internet of Things came as a natural evolution for him and now he collaborates with different companies to construct the world of tomorrow that will make our life more comfortable and secure. Using the ESP8266, he has prototyped devices such as irrigation controllers, smart sockets, window shutters, Digital Addressable Lighting Controls, and environment controls, all of them controlled directly from a mobile application over the cloud. An MQTT broker with bridging and a WebSockets server was even developed for the ESP8266. Soon, all those devices will be part of our daily life, so we will all enjoy their functionality.
Read more about Catalin Batrinu

View More author details
Right arrow

Installing Arduino IDE


ESP8266 can be used with the official EspressIf's SDKs that contain the NonOS and FreeRTOS SDKs writing code in C/C++, but other companies and people add other programming languages to it, such as Lua, Javascript, or MicroPhyton.

This book will use the NonOS SDK and as a development IDE, the Arduino IDE. In this part you will download the Arduino Software (IDE), configure it and install the ESP8266 SDK.

Downloading the Arduino Software IDE

To download the Arduino IDE, go to https://www.arduino.cc/en/Main/Software and download the latest version:

Now, you can download the version you want depending on your operating system. There are versions for Windows with and without admin rights, macOS X, and Linux for 32 bits, 64 bits, or ARM processors so that you can install and work, even on a Raspberry Pi.

After you have downloaded the Arduino IDE, you need to install it on your local computer.

If you are on Linux, you need to use the xz and tar command to open the Arduino IDE archive, then you can go into Arduino-1.8.2 and start it with sudo ./arduino.

In Windows, just launch the Arduino executable file, as follows:

Congratulations! You have installed the Arduino IDE and now it is time to configure it for ESP8266.

Configure Arduino IDE

To configure the Arduino IDE for ESP8266 you need to go to File | Preferences. The initial screen looks as follows:

In this screen, you can customize some fields as follows:

  • Sketchbook location: Here you can choose where your project files are stored.
  • Editor language: If you prefer another language to the default one, you can change this field here; but after this, you need to restart the IDE.
  • Editor font size: This is the font size used in the IDE.
  • Show verbose output during: compilation and upload: I suggest you check both of them to have a detailed output during compilation, where you can see files and their paths and also the upload.
  • Display line numbers: This field is good to see the line number in the right part of your IDE number.
  • Enable Code Folding: This field gives you more space on the screen.
  • Additional Boards Manager URLs: Here is the field that allows us to get and install the ESP8266 Xtensagcc compiler, required tools to flash the obtained firmware into the ESP8266 flash memory along with other board types. In this field, you need to add http://arduino.esp8266.com/stable/package_esp8266com_index.json and the Preferencesscreen will look as follows:

After you set up your preferences, you can click on the OK button. Don't forget that you are behind a proxy server; you need to fill in the details required in the Network tab.

Installing the ESP8266 SDK

After the preferences have been configured, now it is time to actually get the ESP8266 SDK and tools.

For this, you need to go to the following path and follow these steps:

  1. Go to Tools | Board: "Arduino/Genuino Uno" | Boards Manager... :
  2. Subsequently, the Boards Manager will be opened.
  1. Go to the end of the list and select the ESP8266 board and click on Install:
  2. Now, depending on your internet connection, this can take some time. Sit back and relax, you are about to enter into the IoT world.
  3. Look for the INSTALLEDmessage, as in this picture:
  1. Now, go back to Tools | Board: "Arduino/Genuino Uno" and you should see a lot of ESP8266-based boards in the lower section:
  1. Select NodeMCU 1.0 (ESP-12E Module) and go back to the Tools menu, where you will see other configurations that you can perform for ESP8266:
    • CPU Frequency: "80 MHz": This can be changed from 80 MHz to 160 MHz
    • The memory size of your module and the size of SPIFFS (1 or 3 MiB)
    • The upload speed for the UART interface between your computer and the ESP8266 module. Select from Upload Speed: "115200" so that the binary file will be flashed 8 times faster than the default value of 115200:
  1. If you now have a module, you can connect it to your computer. Going again to Tools menu now, you will see this from the Port menu and you can go and select your serial interface connected to the ESP8266 module. For Linux, you can select /dev/ttyUSB0 and for Windows, one of your COM ports.

Before starting any program, let's look at the IDE buttons:

Let's start from left to right:

  • Verify:  This allows you to compile and check your code for errors
  • Upload: This does what Verify does plus uploads generated firmware into ESP8266's flash memory
  • New: This opens a new window so that you can create another program
  • Open: This opens an existing program from your local disk
  • Save: This saves your files on the disk
  • Serial Monitor: This opens a window where you will be able to see and debug what you add into your program
Previous PageNext Page
You have been reading a chapter from
ESP8266 Home Automation Projects
Published in: Nov 2017Publisher: PacktISBN-13: 9781787282629
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Authors (2)

author image
Catalin Batrinu

Catalin Batrinu graduated from the Politehnica University of Bucharest in Electronics, Telecommunications, and Information Technology. He has been working as a software developer in telecommunications for the past 16 years. He has worked with old protocols and the latest network protocols and technologies, so he has experienced all transformations in the telecommunication industry. He has implemented many telecommunications protocols, from access adaptations and backbone switches to high-capacity, carrier-grade switches on various hardware platforms from Wintegra and Broadcom. Internet of Things came as a natural evolution for him and now he collaborates with different companies to construct the world of tomorrow that will make our life more comfortable and secure. Using the ESP8266, he has prototyped devices such as irrigation controllers, smart sockets, window shutters, Digital Addressable Lighting Controls, and environment controls, all of them controlled directly from a mobile application over the cloud. An MQTT broker with bridging and a WebSockets server was even developed for the ESP8266. Soon, all those devices will be part of our daily life, so we will all enjoy their functionality.
Read more about Catalin Batrinu