Need help flashing blink with arduino

@AirGradient

My D1 Mini is the one that came with the kit I bought from you.

I was also nearing the point of ordering new hardware. Since new parts would be a while in shipping and it was the weekend, I decided to continue stabbing into the dark trying to find success flashing the microcontroller. So here’s my story about how I got the airgradient microcontroller (MC) flashed. I don’t fully understand how the whole process works and my debugging is primitive. I really can’t comment any more than the narrative below.

I asked my wife if I could use her windows 10 laptop computer. Authorization granted, I completed the following on her computer:
Install arduino from the website. Whatever the current version is.

This was a clean install since the computer didn’t have any previous versions.
Restart the computer.

Open the arduino program.
Change the settings in arduino to use an alternate ESP8266 board manager. Look for the pink URL to copy and paste as per the instructions:

Close out arduino and restart the program.

Install the ESP8266 board manager following the instructions on this page:

Close out arduino and restart the program. I am paranoid at this point and I want to make sure all of my changes have been fully implemented.

Select the ESP8266 board manager, and select the board to use.
“LOLIN(WEMOS) D1 R2 & mini”

Check my USB drivers. When I plug in the MC my computer recognizes that something is plugged in and choses a driver that seems correct. I use the tutorial at sparkfun to double check if I am using the correct drivers.
https://learn.sparkfun.com/tutorials/how-to-install-ch340-drivers/all#windows-710
I don’t trust the results and try to install the drivers anyway.
Spark fun link to windows drivers:
https://cdn.sparkfun.com/assets/learn_tutorials/8/4/4/CH341SER.EXE
Drivers from the manufacturer?
https://www.wemos.cc/en/latest/ch340_driver.html
Anyway, it doesn’t seem to make a difference. Actually the computer says I already have a valid driver.
Restart the whole computer. Pretend it’s like the 90s and just restart everything at every step.

Open arduino and go looking for the ESP8266 version of the blink sketch.
Check the board: “LOLIN(WEMOS) D1 R2 & mini”
Confirm the MC is plugged in and I have the right COM port selected.
Take a deep breath and try uploading the blink sketch.
It fails, but I know it’s trying. While trying to connect the light on the MC blinks rhythmically. I get the familiar timeout or header errors. Starting at the top I run down the speeds. At 256k it magically works. I have some fun altering the blinky sketch to make sure it wasn’t a fluke.
Close and restart Arduino.

Save the airgradient sketch to the arduino folder.

In the upper right hand corner click the green code drop down menu, select download zip. Extract the zip and move the “arduino-master” folder to the “libraries” folder.
\Documents\Arduino\libraries\arduino-master
Restart arduino if it’s open.

Open arduino and check to see if the library is there. To open the sketch you want to go to the examples folder and open the CO2_PM_SHT_OLED_WIFI folder and .ino sketch inside.
At the top of the sketch you will see all the headers that need to be included. If the <*.h> references are the same color as the preceding “include” text, you need to go find those header libraries and install them.

WIFIManager.h

drop the header folder into the \Documents\Arduino\libraries\ folder
restart arduino
check to see if the <*.h> name is now orange text

SSD1306Wire.h

drop the header folder into the \Documents\Arduino\libraries\ folder
restart arduino
check to see if the <*.h> name is now orange text

I was getting ready to go find the source for the <ESP8266HTTPClient.h> file but stopped, and tried instead to compile and load the sketch. The sketch compiled without errors this time, but the dreaded timeout and headers errors were back. Sigh.

My next stab in the dark was to run through the upload speeds, again. Starting at the top and running down one by one. I found that the sketch finally loaded at the 256k Upload Speed setting.
Success. Make sure you have edited the variables needed for your particular project. These are the boolean variables for the different sensors and wifi.

If you haven’t assembled the board or installed the screen, success looks like nothing (actually it looks like the absence of errors). No more blinks, no happy tune, no movement. You need to go assembled the board now to be sure you have flashed the MC.

Since I can now program the MC I am no longer trying to find out what is wrong. Sorry I can’t help with your specific situation, however maybe the method I used will help you with your setup.