loading
23 Comments

Tell us about yourself!

Complete Your Profile
  • PeterB57 commented on deba168's instructable ESP8266 Weather Widget1 month ago
    ESP8266 Weather Widget

    Cheers! This works for me:// sda-pin=12 and scl-pin=14SSD1306 display(0x3c, 12, 14); // for Node MCU - [ADDRESS, SDA, SCL]Originally, the code would have defined the D pins:#define D5 14#define D6 12SSD1306 display(0x3c, D6, D5);

    View Instructable »
  • PeterB57 commented on deba168's instructable ESP8266 Weather Widget1 month ago
    ESP8266 Weather Widget

    I'm using 1.6.10

    Remove the equals (=) sign

    It's the extra semi-colon after #include "fonts.h"

    It would be better if you showed the compilation error of the IDE in your image.One error that I can see is referred to by RodriC1 in the comments: Remove the = from void (*frameCallbacks[])(int x, int y) = {drawFrame1, drawFrame2, drawFrame3, drawFrame4};to make it:void (*frameCallbacks[])(int x, int y) {drawFrame1, drawFrame2, drawFrame3, drawFrame4};Please check all the comments, as many of the issues have already been addressed. Good luck!

    View Instructable »
  • PeterB57 commented on deba168's instructable ESP8266 Weather Widget3 months ago
    ESP8266 Weather Widget

    Adding DS18B30 temperature device:/*Parts by Daniel EichhornPermission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTI...see more »Adding DS18B30 temperature device:/*Parts by Daniel EichhornPermission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THESOFTWARE.*/#include <JsonListener.h>#include <ESP8266WiFi.h>#include "ssd1306_i2c.h"#include "Wire.h"#include "WundergroundClient.h"#include "fonts.h"#include <Ticker.h>#include "TimeClient.h"#include<stdlib.h>#include <OneWire.h>#include <DallasTemperature.h>// Initialize the oled display for address 0x3c// sda-pin=14 and sdc-pin=12// SSD1306 display(0x3c, D6, D5); // for Node MCUSSD1306 display(0x3c, 0, 2); // for ESP8266-01 - [ADDRESS, SDA, SCL]// Set to false, if you prefere imperial/inches, FahrenheitWundergroundClient wunderground(true);float utcOffset = 9.5; // enter your UTCTimeClient timeClient(utcOffset);// Add your wounderground api key hereString apiKey = "abcdefghijklmnop";String country = "AU";String city = "Adelaide";// this array keeps function pointers to all frames// frames are the single views that slide from right to left///void (*frameCallbacks[])(int x, int y) = {drawFrame1, drawFrame2, drawFrame3, drawFrame4};void (*frameCallbacks[])(int x, int y) {drawFrame1, drawFrame2, drawFrame3, drawFrame4};int numberOfFrames = 4;//void (*frameCallbacks[])(int x, int y) {drawFrame1, drawFrame2, drawFrame3, drawFrame4, drawFrame5};//int numberOfFrames = 5;// flag changed in the ticker function every x minutes: Adjust "ticker.attach(x * 60, setReadyForWeatherUpdate);" -line 109bool readyForWeatherUpdate = false;String lastUpdate = "--";Ticker ticker;#define ONE_WIRE_BUS 2// (try to avoid using pin D0, i faced some problems when i use pin D0)// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)OneWire oneWire(ONE_WIRE_BUS);// Pass our oneWire reference to Dallas Temperature. DallasTemperature sensors(&oneWire); // constructor for our DS18B20 sensor to read temperature using DallasTemperature libary//char buffer[10];char buffer[5];float temperatureDegC = -127;void setup() { Serial.begin(115200); // initialize dispaly display.init(); display.clear(); display.display(); WiFi.begin("SSID", "Password"); sensors.begin(); // by default, we'll generate the high voltage from the 3.3v line internally! (neat!) int counter = 0; while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); counter++; } display.setFrameCallbacks(numberOfFrames, frameCallbacks); // how many ticks does a slide of frame take? display.setFrameTransitionTicks(10); // how many ticks should we wait until the next transition begins? display.setFrameWaitTicks(150); timeClient.updateTime(); wunderground.updateConditions(apiKey, country, city); wunderground.updateForecast(apiKey, country, city); lastUpdate = timeClient.getFormattedTime(); ticker.attach(120 * 60, setReadyForWeatherUpdate);}void loop() { if (readyForWeatherUpdate && display.getFrameState() == display.FRAME_STATE_FIX) { timeClient.updateTime(); wunderground.updateConditions(apiKey, country, city); wunderground.updateForecast(apiKey, country, city); readyForWeatherUpdate = false; lastUpdate = timeClient.getFormattedTime(); } sensors.requestTemperatures(); // Send the command to DS18B20 to get temperatures temperatureDegC = sensors.getTempCByIndex(0); display.clear(); display.nextFrameTick(); display.display();}void drawFrame1(int x, int y) { display.setTextAlignment(TEXT_ALIGN_CENTER); display.setFont(ArialMT_Plain_10); String date = wunderground.getDate(); int textWidth = display.getStringWidth(date); display.drawString(64 + x, 10 + y, date); display.setFont(ArialMT_Plain_24); String time = timeClient.getFormattedTime(); textWidth = display.getStringWidth(time); display.drawString(64 + x, 20 + y, time); display.setTextAlignment(TEXT_ALIGN_LEFT);}void drawFrame2(int x, int y) { display.setFont(ArialMT_Plain_10); display.drawString(64 + x, 10 + y, wunderground.getWeatherText()); display.setFont(ArialMT_Plain_24); String temp = wunderground.getCurrentTemp(); display.drawString(64 + x, 20 + y, temp); int tempWidth = display.getStringWidth(temp); display.setFont(Meteocons_0_42); String weatherIcon = wunderground.getTodayIcon(); int weatherIconWidth = display.getStringWidth(weatherIcon); display.drawString(32 + x - weatherIconWidth / 2, 10 + y, weatherIcon); display.drawString(64 + tempWidth + x, 15 + y, "*");}void drawFrame3(int x, int y) { display.setTextAlignment(TEXT_ALIGN_CENTER); display.setFont(ArialMT_Plain_10); display.drawString(32 + x, 0 + y, "Humidity"); display.drawString(96 + x, 0 + y, "Pressure"); display.drawString(32 + x, 28 + y, "Precipit."); display.drawString(96 + x, 28 + y, "Inside"); display.setFont(ArialMT_Plain_16); display.drawString(32 + x, 10 + y, wunderground.getHumidity()); display.drawString(96 + x, 10 + y, wunderground.getPressure()); display.drawString(32 + x, 38 + y, wunderground.getPrecipitationToday()); display.drawString(96 + x, 38 + y, dtostrf(temperatureDegC,3,1,buffer)); //display.drawRect(64 + x, 0 + y, 0, 54); //display.drawRect(0 + x, 27 + y, 128, 0); //display.drawString(64 + x, + y, lastUpdate);}void drawFrame4(int x, int y) { drawForecast(x, y, 0); drawForecast(x + 44, y, 2); drawForecast(x + 88, y, 4);}/*void drawFrame5(int x, int y) { drawForecast(x, y, 2); drawForecast(x+44, y, 2); display.setTextAlignment(TEXT_ALIGN_CENTER); display.setFont(ArialMT_Plain_10); display.drawString(88 + x, 0 + y, "Hello");}void drawFrame6(int x, int y) { drawForecast(x, y, 4);}*/void drawForecast(int x, int y, int dayIndex) { display.setTextAlignment(TEXT_ALIGN_CENTER); display.setFont(ArialMT_Plain_10); String day = wunderground.getForecastTitle(dayIndex).substring(0, 3); day.toUpperCase(); display.drawString(x + 20, y, day); display.setFont(Meteocons_0_21); display.drawString(x + 20, y + 15, wunderground.getForecastIcon(dayIndex)); display.setFont(ArialMT_Plain_16); display.drawString(x + 20, y + 37, wunderground.getForecastLowTemp(dayIndex) + "/" + wunderground.getForecastHighTemp(dayIndex)); //display.drawString(x + 20, y + 51, ); display.setTextAlignment(TEXT_ALIGN_LEFT);}void drawFrame7(int x, int y) {}void setReadyForWeatherUpdate() { //Serial.println("Setting readyForUpdate to true"); readyForWeatherUpdate = true; }

    View Instructable »
  • PeterB57 commented on deba168's instructable ESP8266 Weather Widget3 months ago
    ESP8266 Weather Widget

    Cool, got it going.Now for a cool custom case!and a DS18b20...

    I have SDA -> GPIO0 and SCL -> GPIO2and lots of decoupling capacitance!To flash: GPIO0 -> GND and had to re-power & "Upload" quite a few times before it worked. You get dots then info. in a Serial Monitor

    View Instructable »