This is a compilation of various projects for ESP8266 and ESP8266MOD. However, the code can run on most Arduino devices with minor modification.
There are instructions in the the readme of each folder/project, along with pictures of the setup. The code itself is commented and tried to make easy to understand.
- mqtt_led This project is using the MQTT protocol to receive commands and execute light functions on LEDs. Good introduction to MQTT using built-in LED and 4 monochrome LEDs.
- mqtt_potentiometer First part of code for a two device project. Run this code on one ESP8266 device and run mqtt_servo on another. Publishes data using MQTT when user rotates a potentiometer and controls the servo on the other device.
- mqtt_servo Second part of code for a two device project. Run this code on one ESP8266 device and run mqtt_potentiometer on another. Receives data using MQTT to control/rotate a servo, corresponding to a potentiometer on another device.
- rfid_read Simple RFID read of a tag's ID.
- rfid_read_store Extention of the rfid_read, including code to store and recognize specific tags, both before and in runtime.
- rfid_mqtt Extention of the rfid_read_store, using MQTT to publish recognized tags.
- ultrasonic_distance Distance measuring using ultrasonic sensor (HC-SR04) and ESP8266MOD. Uses 5v supply and outputs distance in cm.
Arduino IDE with ESP8266 Arduino Core installed.
- Install the current upstream Arduino IDE at the 1.8 level or later. The current version is at the Arduino website.
- Start Arduino and open Preferences window.
- Enter
http://arduino.esp8266.com/stable/package_esp8266com_index.json
into Additional Board Manager URLs field. You can add multiple URLs, separating them with commas. - Open Boards Manager from Tools > Board menu and install esp8266 platform (and don't forget to select your ESP8266 board from Tools > Board menu after installation).
All libraries used in these projects can be found in Library Manager in the Arduino IDE with the given name below, and Github links are included for manual download.
- PubSubClient by Nick O'Leary (MQTT)
- MFRC522 by GithubCommunity (RFID)
- ESP8266WiFi by Ivan Grokhotkov (included in ESP8266 Arduino Core)
- Serial Peripheral Interface (SPI) by Arduino (included in Arduino IDE)
Standard LoLin ESP8266 with NodeMCU v3
ESP8266 modification with 5v supply
MH-ET LIVE ESP32 (ESP-WROOM-32). Haven't used this device much in these projects.