ESP8266
- Setup, use and troubleshooting MCUs based on ESP8266
Introduction
This page gets you started with ESP8266 programming, helps you with troubleshooting and brings you joy. Maybe not joy.
Hardware
- ESP8266 (We usually use Wemos D1 Mini)
- USB cable
Getting started / Software
Keep ESP8266 disconnected when installing drivers.
- Download and install latest version of Arduino IDE. Windows users may use Windows Store version.
- Open Arduino IDE, go to Preferences and add this URL to Additional Boards Manager URL: http://arduino.esp8266.com/stable/package_esp8266com_index.json
- In Arduino IDE, go to Tools --> Board --> Boards Manager. Search for ESP8266 and download/install the latest version of this package.
- Download and install CH340 drivers for ESP8266. You may have to restart your computer after installation.
NB: MAC OS users!: after restart, connect the cable to ESP8266. Go to System Preferences on MacOS --> Security & Privacy and click on Allow under General tab. This is to allow proper installation of the driver.
- Mac OS
- Windows 7,8,10
- Linux distros usually have the driver preinstalled. Problems? Scroll down to "Help".
- Plug USB cable into your ESP8266.
- Open Arduino IDE, go to Tools --> Board and select eitherWemos D1 R2 & Mini or LOLIN(WEMOS) D1 R2 & Mini (only one of them will be visible).
- In the same tools menu, change upload speed to 115200.
- In the same tools menu, under Port, select the correct COM port for your USB device. Mac OS and Linux users: select proper device (usually something with usb in its name). ESP8266 needs to be connected for it to show up here. Not showing up? Reinstall driver, restart computer and go into Security settings to allow proper installation.
- In Arduino IDE, go to File --> Examples --> ESP8266 --> Blink. Click Upload button and verify that sketch gets uploaded to your device and that your device starts blinking.
- Done!
Hjelp / feilsøking
Mac OS
Hvis mikrokontrollerne ikke dukker opp i Arduino IDE etter du har installert driver OG restartet maskinen, sjekk følgende:
- Gå til System Innstillinger/System Preferences
- Gå til Security and Privacy
- Under tabben General: sjekk om du har tillatt å installere software utenfor AppStore
Linux
Linux har i utgangspunktet driver innebygd, men det kan være flere ting som gjør at det ikke fungere. Prøv følgende:
- Restart maskinen (ja, det funka for en på kurset (!))
- Endre rettighetene til USB-devicen slik:
sudo usermod -aG dialout *dittBrukernavn*
sudo chmod 777 /dev/ttyUSB0
Kompileringsfeil i Windows (kan gjelde andre OS):
Feilen kom fra en annen kompilator for Simula som allerede lå inne i systemet. Når Arduino prøvde å installere greide den ikke skrive over den systemvariabelen som allerede lå der. Simula er verdens første objektorienterte programmerings språk og henger igjen via noen nostalgiske forelesere. Det eneste faget det brukes i er PYSE (pålitelighet ytelese og simulering) på NTNU.
How to fix:
Cmd "echo %GCC_EXEC_PREFIX%"
Hvis den returnerer en path må pathen slettes.
Kontrollpanel ->
System ->
Avanserte systeminstillinger ->
miljøvariabler (Enviroment variables)
Finn " GCC_EXEC_PREFIX " i bruker og/eller system listene og slett.
Restart pc.
Takk til Jonas T. Gedde-Dahl
Noe annet?
Spørsmål? Lenker som ikke fungerer? Vil du ha en workshop holdt hos deg? Ta kontakt med
Nikhil André Luthra!