Thursday 29 December 2022

Christmas weather station?

 Well, a parcel from Ben arrived today, and apparently it is the components for a weather station. 

[11:30, 29/12/2022] Ben Grant-Jones: Yes, looks about right. Does it have an Arduino, a screen and various sensors?

[11:36, 29/12/2022] Ben Grant-Jones: I think it's called an Ideaspark weather station kit.

https://www.hackster.io/alien-energy-3/what-do-i-build-next-a-simple-weather-station-cdc4ed

The wiring schematic is here

[11:37, 29/12/2022] Peter Merchant: Looks like 4 sensors, a computer board of some type, and other bits.

The computer in it is a LoLin NodeMcu v3.  Onwards and upwards!

Let's look at that Hackster  site and see how I'll put it together and what power supply is required. I think that that power converter that Ben sent in a previous parcel will be required here for 3.3V.

30/12/22 Bits included are:

A very small screen. I can't find a part number on it.   4 pins for power and serial comms. 

GY-30 Light intensity sensor. Also  5 pins for power and serial comms + ADO?

GY-68 180BMP Atmospheric pressure sensor.  4 pins for power and serial comms. 

11DHT (Possibly) Temperature humidity sensor. 

I think it is this: 

https://www.amazon.co.uk/Temperature-Humidity-Atmosphetic-BH1750FVI-YellowBlue/dp/B07GPBBY7F/ref=sr_1_13?crid=VBUYHQW3XS8M&keywords=ideaspark&qid=1672402295&sprefix=ideaspark%2Caps%2C81&sr=8-13

Have downloaded demo software from Blog site.

A BAD NIGHT:  Arduino IDE seems to have disappeared from my computer. I installed  Arduino IDE version 2.01, and it does not have my board, and the Boards manager is not present.   Time to give up for tonight.

Removed Arduino IDE 2.0? and installed 1.8.19

Installed the following libraries to get the hardware and bits to get it to compile

ttps://mcudude.github.io/MightyCore/package_MCUdude_MightyCore_index.json, https://arduino.esp8266.com/stable/package_esp8266com_index.json, 

https://github.com/vlast3k/Arduino-libraries/blob/master/SSD1306/SSD1306Wire.h

It gets over this now, and has an error with:   ESP8266_Weather_Station/src/ESPHTTPClient.h:4:10: fatal error: HTTPClient.h: No such file or directory

Other people who have done it:

https://randomnerdtutorials.com/cloud-weather-station-esp32-esp8266/

https://github.com/ThingPulse/esp8266-weather-station   [ this might be the one used here]

https://thingspeak.com

23/1/2023 - Working through the compilation: 

fatal error: SSD1306Wire.h: No such file or directory

this is installed: SSD1306 oled driver library for the Wemos Mini OLED shield (64x48)

but is it the right one? 

Installed:  / esp8266-oled-ssd1306

That got a lot further, but now:

WeatherStationDemo:70:21: error: 'D3' was not declared in this scope

   70 | const int SDA_PIN = D3;

and same with D4. 

Changed from Generic 8266 Module to Lolin Wemos D1,R2 and Mini

That Verified!  Let's program it. 

25/1/2023

Now all wired up, and connected to Wifi, displaying forecasts. 

There is an error in the wiring diagram in the Hackster weather station that I am building.  The Ground and VCC of the display go to the wrong pins. 

Next step is to look at software and see how to get to read the sensors.

NOTE: when I load software into the Arduino IDE, change board to ESP8266 -> Lolin (Wemos ) D1, R2, and Mini

#define TZ              0       // (utc+) TZ in hours
*** Bad one - later TZ is multiplied!
TZ=0 gave UTC+1, 
TZ= 1 gave UTC+2

But have I not set up something correctly. 

String OPEN_WEATHER_MAP_LOCATION = "London,GB";

STEP 5  Register OpenWeathermap, thingspeak new account

https://github.com/ThingPulse/esp8266-weather-station/blob/master/examples/WeatherStationDemo/WeatherStationDemo.ino
gives a link to Thingspeak to get the API code for the weatherstation. 
I have put this in the .ino file. 
Now I believe i need to select the weathermap location. 

const char *host = "api.thingspeak.com";                  //IP address of the thingspeak server

const char *api_key ="c4b7d4b2331c0baac3e329358384e378";                  //Your own thingspeak api_key

This one is wrong I think

and this one is correct:

String OPEN_WEATHER_MAP_APP_ID = "c4b7d4b2331c0baac3e329358384e378";

String OPEN_WEATHER_MAP_LOCATION = "2633863";

Time is now wrong by +2 hours and all data is set to 0.

and the next few days info is all thurs,thurs,thurs, so something has gone wrong with the timing.

from here: https://nothans.com/thingspeak-documentation/api

In order to update a channel, you need to know your Write API Key. If your Write API Key gets compromised you can generate a new key.
Follow these steps to get your Write API Key:

  • Select Channels
  • Select the Channel to update
  • Select Manage API Keys      
There is also a read API Key. I don't know which I need here. 

On the thingspeak channel display I can see that all sensors are displaying some changes. Success!

--------------- --------------- ------------ -

26/1/23  Got time right. Had to set TZ to -1.

Have to use 'write' API key to write things to thingSpeak. 


This is what serial monitor shows:

temp:18    humi:62

light: 165

Pressure = 103155 Pascal

temp:18    humi:62

light: 165

Pressure = 103153 Pascal

temp:18    humi:62

light: 165

Pressure = 103154 Pascal

temp:18    humi:62

light: 165

Pressure = 103145 Pascal

SO why doesn't it display!

27/1/23 Changed Channel view from private to public, but it still doesn't display, so it doesn't read the stuff. 

29/1/23  Current state.
There are three things, 
1] It gets and displays the time     --Yes
2] It reads the sensors and writes them to Thingspeak  --Yes
3] It reads the weather forecast from OpenWeathermap and displays it on the two screens.   --No. 

Some other sites that may give some help:

https://randomnerdtutorials.com/esp32-http-get-open-weather-map-thingspeak-arduino/

https://forum.arduino.cc/t/arduino-uno-esp8266-01-and-openweathermap-org-for-weather-monitoring/458438
 -- waste of time.

https://www.instructables.com/Esp8266-Weather-Data-Parser-Openweathermap/
 - This uses a totally different TFT screen and would be far too much work to convert. 

Tried it with the Thingspeak API read key for Openweathermap - didn't work.


30/1/2023  End of. Going to leave this project for a bit.