Clear all

Need help getting Bluetooth working WeMos D1 R2

2 Posts
2 Users
0 Reactions
Joined: 1 year ago
Posts: 13
Topic starter  

I purchased a WeMos D1 CH340 WiFi Arduino with built in WiFi and Bluetooth using an onboard ESP-12F chipset. This is an ESP8266 based processor sold by LOLIN. I am trying to program it using the Arduino IDE. I have the board manager set up for the WeMos D1 R2 & Mini as the object board. I have been able to compile and run the Blink program, and have been able to compile and run a WiFi program where I can turn on and off an LED from a web browser, either on my PC or on my Android phone.

My ultimate goal is to create a stepper motor controller that I can run forward or backwards, and perhaps change the speed through and App on my Android phone using a Bluetooth connection. I have access to the MIT website for creating the phone App. I also have the shields needed to complete the project if I can get Bluetooth to work. I have tried many different libraries on the IDE with no success so far.

I tried to follow great example posted on the workshop

Introduction to ESP32 - Getting Started

that got the Blink and WiFi sketches working, but it fails on Bluetooth:

I have tried to compile a Bluetooth and a BLE notify program designed for the ESP32 board, (by Evandro Copercini updated by chegewara) but ran into difficulties. None of the libraries I have found include examples for my board, and when I try to adapt an example from the ESP32 board, I have problems with the "#include esp_xxx.h" files installed on my IDE. There are a large number of header files missing causing fatal compile errors. I have tried numerous compiles, adding the header files as they are found to be missing. I am not certain I am doing it right though.

When I find a file missing (e.g. esp_bt_main.h) I create a directory C:\Program Files\Arduino\libraries\esp_bt_main, then go to and locate the missing file. I copy the file found into the directory and try to compile again. It gets further, but another file will be  missing. I continue the process, but finally I get an error for a header file called by some other header file:

C:\Users\Bob\My Documents\Arduino\libraries\ESP32_BLE_Arduino\src/FreeRTOS.h:14:10: fatal error: freertos/FreeRTOS.h: No such file or directory
14 | #include <freertos/FreeRTOS.h> // Include the base FreeRTOS definitions.
| ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Using library ESP32_BLE_Arduino at version 1.0.1 in folder: C:\Users\Bob\My Documents\Arduino\libraries\ESP32_BLE_Arduino
Using library esp32-sdk-master in folder: C:\Program Files\Arduino\libraries\esp32-sdk-master (legacy)
Using library esp_gap_ble_api in folder: C:\Program Files\Arduino\libraries\esp_gap_ble_api (legacy)
Using library esp_err in folder: C:\Program Files\Arduino\libraries\esp_err (legacy)
Using library esp_compiler in folder: C:\Program Files\Arduino\libraries\esp_compiler (legacy)
Using library esp_bt_defs in folder: C:\Program Files\Arduino\libraries\esp_bt_defs (legacy)
Using library esp_gattc_api in folder: C:\Program Files\Arduino\libraries\esp_gattc_api (legacy)
Using library esp_gatt_defs in folder: C:\Program Files\Arduino\libraries\esp_gatt_defs (legacy)
Using library esp_bt in folder: C:\Program Files\Arduino\libraries\esp_bt (legacy)
Using library esp_bt_main in folder: C:\Program Files\Arduino\libraries\esp_bt_main (legacy)
Using library esp_gap_bt_api in folder: C:\Program Files\Arduino\libraries\esp_gap_bt_api (legacy)
Using library esp_bt_device in folder: C:\Program Files\Arduino\libraries\esp_bt_device (legacy)
Using library esp_spp_api in folder: C:\Program Files\Arduino\libraries\esp_spp_api (legacy)
Using library Blynk at version 1.2.0 in folder: C:\Users\Bob\My Documents\Arduino\libraries\Blynk
Using library esp_gatts_api in folder: C:\Program Files\Arduino\libraries\esp_gatts_api (legacy)
exit status 1
Error compiling for board LOLIN(WEMOS) D1 R2 & mini.
Invalid library found in C:\Program Files\Arduino\libraries\ESP32_BLE_Arduino: no headers files (.h) found in C:\Program Files\Arduino\libraries\ESP32_BLE_Arduino

I located the missing file FreeRTOS.h at github, but it seems to be structured differently. No matter where I try to copy it, it is not found on the next compile. It seems to be looking in a directory I am not allowed to access:

C:\Users\Bob\My Documents\Arduino\libraries\ESP32_BLE_Arduino\src/FreeRTOS.h:14:10:

Any suggestions? Am I totally off base here, or something?

Has anyone succeeded in getting this D1 board to work with Bluetooth?

Father of a miniature Wookie
Joined: 4 years ago
Posts: 7410

@bbutcher85 I can tell you that you are doing it wrong. If you have everything set up correctly it will work. By messing with github and creating those random entries you are masking the problem. I can tell you with a lot of confidence as I have helped many people with library issues. Your error is either you have the wrong board selected, you have the wrong library selected, or you have previously messed with the environment and now it is broken.

The best approach at this time is to delete the Arduino15 dir and reinstall, re-setup and do one compile then show me the error, screenshot of the tools menu, screenshot of the additional board's field expanded in the preferences pane, screen shot of the entire preferences panel. and ONLY the first error or two at the most.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.