I ordered myseld a ESP8266 (model ESP-201) WiFi module to experiment with. These modules are really popular at the moment because you can get the for 4NZD of eBay and consist of a 160mHz ARM processor and 512Kb of flash ( some versions have up to 4Mb) and have a full WiFi stack build in. They contain several IO pins that you can access and one analog to digital converter(ADC). It also support interrupts on most pins,
While I wait for the module to arrive in the mail I decided to have a look what needs to be done to port my weather station code over to this device. Actually it is fairly simple. First you need to install the ESP8266 Arduino library and replace the ethernet library at the top of the sketch with the ESP8266 WiFi library. Second we need to change over from initialising the ethernet library to initialising the new wifi library. This includes the SSID and password of the network you are trying to connect to. Thats all that isrequired for connecting to wunderground through the ESP8266 with my original project code. In my original code I use A1 for reading the position of the wind vane. The ESP8266 only has one ADC so the pin number to be used is A0. The ADC on the ESP8266 has an input voltage between 0V and 1.1V. A extra voltage divider is required to get a valid output when using a VCC of 3.3V. Connect the anemometer to a valid interrupt capable pin in change accordingly in the code. The Unified Sensor Library from Adafuit gave me an error along the lines of couldn't include <avr/pgmspace.h>. I fixed this by editing Adafruit_Sensor.cpp. The original looks like this:
I changed it to this:
Save the .cpp file and restart the Arduino IDE before recompiling the project code.
After these changes the code compiled without errors. Until I receive the actual hardware this is as much as I can do. Ones I tested the code with an ESP8266 i will make the ported code available on my github page.
0 Comments
Your comment will be posted after it is approved.
Leave a Reply. |
AuthorGeorge Timmermans, Research Toolmaker, Software Engineer and Tinkerer Archives
April 2023
Categories |