Skip to content

Instantly share code, notes, and snippets.

@rodolpheh
Last active September 3, 2019 22:01
Show Gist options
  • Save rodolpheh/5a050e621ef5cd96347ace18e4a7bca9 to your computer and use it in GitHub Desktop.
Save rodolpheh/5a050e621ef5cd96347ace18e4a7bca9 to your computer and use it in GitHub Desktop.
Weather Station Simple Tutorial

Weather Station

First, make sure you have a valid Python 3 installation. When typing python in a terminal, it should open the Python REPL :

Python 3.7.4 (default, Jul 16 2019, 07:12:58) 
[GCC 9.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> ▯ 

Create a new folder that will contain the project, go into the new folder and create a Python virtual environment :

python -m venv env

Source the environment and install PlatformIO inside it using pip :

# On Linux and MacOS
source env/bin/activate
# On Windows
env\Scripts\activate.bat
# Install platformio
pip install platformio

Initiate a new PlatformIO project :

platformio init

This will create a few files and folders. Open platformio.ini and write the following inside :

[env:nodemcuv2]
platform = espressif8266
board = nodemcuv2
framework = arduino
lib_deps =  ESP8266 Weather Station,
            JsonStreamingParser,
            ESP8266_SSD1306,
            simpleDSTadjust

Add those 3 files into the src folder :

And rename WeatherStationDemo.ino to main.cpp. Then build and upload the project by doing :

platformio run --target upload

To get data, be sure to set the following variables in main.cpp :

L49: const char* WIFI_SSID = "yourssid";
L50: const char* WIFI_PWD = "yourpassw0rd";

...

L72: String OPEN_WEATHER_MAP_APP_ID = "XXX";

...

L79: String OPEN_WEATHER_MAP_LOCATION_ID = "2657896";

...

L89: String OPEN_WEATHER_MAP_LANGUAGE = "de";

The comments above the variables should explain their meanings and how they should be filled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment