Lesson 1 Start ESP8266 - Water-Monitor/IoT-Portfolio-FJS GitHub Wiki
ESP8266
Why ESP8266?
- Many varieties
- Many possibilities
- Price and programmability: very affordable and easy to connect with other sensors
What is the connection to coffee?
- A few share even the same name (Espresso Light)
- Both are affordable, enjoyable and powerful
Working with ESP8266
Install Arduino
- Go into preferences and add the URL for ESP8266
- Go to Tools > Board Manager and type in ESP8266 and install it
- In Tools: make sure ESP8266 is really selected
- Choose LOLIN(WEMOS) D1 R2 & mini
ESP8266 Micro Sensor
- Find the right sensor and a USB-cable
- Put everything together and plug it into the PC
First Exercise: Blink
- In Arduino, go to File > Example > Basics > Blink
- Verify it, choose port and click on the arrow to upload.
- Let it blink.
- You can change the delay and creater longer breaks
Note from Ulrich:
- ESP8266 always works with 3V. Everything higher will destroy the sensor. However, the hardware has a regulator to make a connection with USB-port possible (USB has 5V).
- On the sensors are many letters: D(GPIO = General Port Input Output), AO(Analog) & G(Ground)
HelloServer-Exercise
- File > Examples > ESP8266WebServer > HelloServer
- Analyze Code
- Add a SSID and its password
- Go to Tool > Serial Monitor and set baud to 115200 (or the serial that is specified in the code)
- Use the ESP8266 reset-button and achieve an ip address
- Put the ip address in the browser and get the message
- Add lines from the blinking code and restart code
- Add /on or /off to the URL in the browser and you should be able to turn off or on the light on the sensor
Note: The command is inverted. /on turns off the LED and /off turns on the LED, because in the hardware 0 and 1 are switched.