| 1 | The WeMos D1 and clones is a single board computer based on the ESP8266 which combines a 32-bit RISC processor with a WiFi transceiver. The WeMos and clones are available on eBay, amazon, and [https://www.aliexpress.com/item/USB-CP2102-32M-FLASH-WeMos-D1-ESP8266-Internet-Wifi-Module-for-Nodemcu-Lua-V3-DC-Power/32814901470.html AliExpress for $3.19]. |
| 2 | |
| 3 | It can be programmed using Arduino after installing support for the ESP8266 platform: |
| 4 | 1. Install board manager URL (http://arduino.esp8266.com/stable/package_esp8266com_index.json) in File->Preferences->Additional Board Manager URLs. |
| 5 | 2. Install board manager Tools->Board->Boards Manager->esp8266 (at bottom of list) |
| 6 | |
| 7 | Test by entering a basic sketch: |
| 8 | |
| 9 | {{{ |
| 10 | #define LED_BUILTIN 2 |
| 11 | |
| 12 | // the setup function runs once when you press reset or power the board |
| 13 | void setup() { |
| 14 | // initialize digital pin LED_BUILTIN as an output. |
| 15 | pinMode(LED_BUILTIN, OUTPUT); |
| 16 | // initialize serial communications interface |
| 17 | Serial.begin(115200); |
| 18 | } |
| 19 | |
| 20 | // the loop function runs over and over again forever |
| 21 | void loop() { |
| 22 | static uint32_t count; |
| 23 | Serial.println(count++); |
| 24 | digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) |
| 25 | delay(1000); // wait for a second |
| 26 | digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW |
| 27 | delay(1000); // wait for a second |
| 28 | } |
| 29 | }}} |
| 30 | |
| 31 | * Configure the interface to your board: |
| 32 | 1. Tools->Board->Generic ESP8266 Module |
| 33 | 2. Tools->Flash Mode->DIO |
| 34 | 3. Tools->Flash Size->4M (1M SPIFFS) |
| 35 | 4. Tools->Reset Method->nodemcu |
| 36 | 5. Tools->CPU Frequency->160MHz |
| 37 | 6. Tools->Upload Speed->921600 |
| 38 | 7. Tools->Port-> <COM Port your board is on...see Windows Device Manager> |
| 39 | |
| 40 | * Compile your program (sketch) and upload it to the board by pressing the -> tool |
| 41 | When the download finishes, the blue LED on your board should be blinking and if |
| 42 | you launch the serial monitor (Magnifying glass tool in the far right of the toolbar), |
| 43 | you should see your board sending out an increasing count every 2 seconds. |
| 44 | |
| 45 | The WeMos D1 pin mappings are [https://github.com/esp8266/Arduino/blob/master/variants/d1_mini/pins_arduino.h#L49-L61 here] |