Here is a short post to help document communicating a Adafruit BME680 (Adafruit BME680 – Temperature, Humidity, Pressure and Gas Sensor) on a Wemos D1 Mini (ESP8266).
Yes this is normally a Security/Server blog but I needed a break (and an excuse to teach my 10 year old son how to code). I have promised my son I will make an IoT Easter Hat for school this year. Why not have an 80Mhz ESP8266 and a few sensors in his hat.

A few years back before I got into Server’s and Security I was developing a weather related mobile app IoT device and . n have always had a hardware and coding bug.
I have played with Arduino’s in the past but I wanted a micro controller with WiFi, enter the ESP8266

WeMos Mini D1
Maybe it is time to upgrade to the ESP8266 with WiFi
I was temped to order a cheaper Wemos D1 Mini from China (eBay) but delivery is usually 2 months.

I ordered a Wemos D1 Mini from Australia (eBay) but it did not turn up after 10 days (6 days after the estimated delivery), I got a refund from the seller.

I ended up visiting my new Jaycar store and purchased a WeMos D1 Mini.

$24.95 is a lot but they have it in stock (and are open on Sundays).
#win #win
Soldering the Wemos D1 Mini
This is what it looked for before I soldered the pins on.

I decided to solder the board this way.

It had been a while since I soldered (was previously Leaded solder).
I got some Lead Free solder from Jaycar and tested some soldering (lead free is harder than leaded solder).

I got some new Flux from Jaycar as the flux I had was old and dry.

I practices some soldering again. Lead free solder needs good flux and a higher solder temperature.
Even though my short sight is an issue (I am getting old) solder joints seem ok (for Lead Free). New flux did the trick. Thank’s JayCar

(Now I need to get some reading glasses for close up activity)
Sensors
I had a few DHT11 and DHT22 sensors laying around but they don’t measure barometric pressure so time to upgrade.

I ordered a BME280 (GYBEMP) from eBay but it did not like the Arduino IDE and I could not get any data from the device.

I looked for tutorials on YouTube and the newer 6 pin BMP280 seemed to be the device to get (Smarter Home Things).

This sensor was no good either, I could not get any data from it. Libraries were installed too???
From now on I will only use Adafruit sensors as they are well supported libraries and they have fritzing compatible parts (https://github.com/adafruit/Fritzing-Library)

I purchased a Adafruit BME680 and an Adafruit Analog UV Sensor.

ESP8266 Board (Arduino IDE)
You will need to add ESP8266 Boards added to the Arduino IDE (read more here: https://github.com/esp8266/Arduino).
Open the Ardiono IDE and click, File then Preferences and add this URL to the Additional Boards Manger URLs.
https://arduino.esp8266.com/stable/package_esp8266com_index.json

Re-open your Arduino IDE and click Tools, Boards, Boards Manager and add the “ep8266” boards

Now I can choose ESP8266 Boards in the Arduino IDE

I have a WeMos D1 Mini (ESP8266) so I will choose it.
Adafruit BME8266 Arduino IDE Libraries
Now I need to add the Adafruit BME680 library to the Arduino IDE.
I added the Adafruit BME680 librarary to Android IDE (I restarted the IDE)

In the Android IDE I clicked on File, New then Adafruit BME680 Library then eme680test

Code
This is the code in the sketch
/***************************************************************************
This is a library for the BME680 gas, humidity, temperature & pressure sensor
Designed specifically to work with the Adafruit BME680 Breakout
----> http://www.adafruit.com/products/3660
These sensors use I2C or SPI to communicate, 2 or 4 pins are required
to interface.
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing products
from Adafruit!
Written by Limor Fried & Kevin Townsend for Adafruit Industries.
BSD license, all text above must be included in any redistribution
***************************************************************************/
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include "Adafruit_BME680.h"
#define BME_SCK 13
#define BME_MISO 12
#define BME_MOSI 11
#define BME_CS 10
#define SEALEVELPRESSURE_HPA (1013.25)
Adafruit_BME680 bme; // I2C
//Adafruit_BME680 bme(BME_CS); // hardware SPI
//Adafruit_BME680 bme(BME_CS, BME_MOSI, BME_MISO, BME_SCK);
void setup() {
Serial.begin(9600);
while (!Serial);
Serial.println(F("BME680 test"));
if (!bme.begin()) {
Serial.println("Could not find a valid BME680 sensor, check wiring!");
while (1);
}
// Set up oversampling and filter initialization
bme.setTemperatureOversampling(BME680_OS_8X);
bme.setHumidityOversampling(BME680_OS_2X);
bme.setPressureOversampling(BME680_OS_4X);
bme.setIIRFilterSize(BME680_FILTER_SIZE_3);
bme.setGasHeater(320, 150); // 320*C for 150 ms
}
void loop() {
if (! bme.performReading()) {
Serial.println("Failed to perform reading :(");
return;
}
Serial.print("Temperature = ");
Serial.print(bme.temperature);
Serial.println(" *C");
Serial.print("Pressure = ");
Serial.print(bme.pressure / 100.0);
Serial.println(" hPa");
Serial.print("Humidity = ");
Serial.print(bme.humidity);
Serial.println(" %");
Serial.print("Gas = ");
Serial.print(bme.gas_resistance / 1000.0);
Serial.println(" KOhms");
Serial.print("Approx. Altitude = ");
Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA));
Serial.println(" m");
Serial.println();
delay(2000);
}
Connecting the WeMos D1 Mini to the Adafruit BME680
This is the wiring guide. My wire colours are in the brackets
Wemos D1 Mini | Adafruit BME680 |
3V3 (RED) | 3V |
Ground (BLACK) | Ground |
D1 (BLUE) | SCK |
D2 (YELLOW) | SDI |

I used the Fritzing program to make the above circuit diagram.
Adafruit make available Fritzing compatible parts (https://github.com/adafruit/Fritzing-Library) for their products.
Here is the Fritzing Sketch (you may need to add “Adafruit BME680.fzpz” from the Adafruit parts library
Full credit for this wiring goes to esp8266learing.com for the original diagram (I redid it to make the labels on the BME680 visible (OCD))
I used the Adafruit parts library for Fritzing.

Wemos D1 Mini (JayCar) Driver
I had to install the CP210x USB to UART Bridge VCP Drivers from Silicon Labs (CP210x_Windows_Drivers.zip) tpo get the JayCar WeMos D1 Mini working
The supplied “setup.exe” program did not work for me (it kept crashing) so I added the driver by manually to Windows.
Add Hardware
Click Start then type Run and press Enter.
Type “hdwwiz.exe” and click OK

The Add Hardware Wizard will show, click Next

Click Next (Show All Devices is selected)

Click Have Disk

I selected the “slabvcp.inf” from the extracted “CP210x_Windows_Drivers.zip“

I clicked Open then OK, I selected “Silicon Labs CP210x USB to UART Bridge” and clicked Next

The driver installed.
I rebooted (to be sure) then checked in device manager for the device.

I can see the “Silicon Labs CP210x USB to UART Bridge” is setup as port 10
Wiring
Make the wiring as pictured below.

Here is the Fritzing Sketch (you may need to add “Adafruit BME680.fzpz” from the Adafruit parts library
Close enough

I doubled checked the wiring.

I plugged in the USB cable.

Wait until you hear the add new hardware sound (if you have sounds in Windows)
Arduino IDE Setup
In the Arduino IDE make sure you choose the same COM port as the previously installed UART Bridge and ensure “WeMos D1 R1” is selected as board type and check that the programmer is “AVRISP mkII“

I clicked Upload Sketch in the Arduino IDE

I can now get Temperature, Pressure, Humidity and Gas readings over 3 wires 🙂

Conclusion
- Don’t use cheap sensors or ESP8266 micro controllers from eBay.
- Use Lead free solder (practice soldering).
- Use fresh Flux (not old stuff)
- JayCar is convenient
From now on I will use Adafruit sensors. It’s a shame Jaycar don’t have Adafruit sensors.
Now I need to output the information to a screen.

Maybe I connect this to https://blynk.io/
Maybe create a local web server?
Thanks for reading.
v1.3 New Featured Image
v1.1 Moved Heading.
v1.0 Initial Draft