A little overview of my project. Iâm making a wireless thermometer for smoking meats on a Big Green Egg. I currently have an iGrill which only has Bluetooth connectivity, which presents range issues. Here is my hardware progress thus far.
Hardware
Arduino Nano ATmega328
ESP8266-12
(Note: The ESP came with the latest AT build installed. I did not have to flash backwards to legacy firmware versions like many others users here have suggested. I may have gotten lucky)
Problem
I recently added the OLED screen picture above, and Iâve lost connectivity to Blynk with the addition of the Adafruit libraries. Iâve come to a point where Iâm not sure what else to troubleshoot, so Iâm hoping for some direction. My sketch is approaching the flash limit at about 87% storage space used and it suggests there may be stability issues. Iâm hoping thatâs not the problem. Below are versions 1.3 which works perfectly, and version 1.4 where I have issues. I pinpointed that connectivity issues happen by removing all the Adafruit code to just when the screen is defined with
#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
If all the screen code is commented out, but the Adafruit libraries are included it works as well. Does anyone have any thoughts or suggestions?
1.3
`/***************************************************************
-
VERSION Thermometer 1.3
Arduino Nano connected to ESP8266-12 Hard Serial
**************************************************************/
//#define BLYNK_DEBUG
//#define BLYNK_PRINT Serial
#include <ESP8266_HardSer.h>
#include <BlynkSimpleShieldEsp8266_HardSer.h>
#include <SimpleTimer.h> //Simple Timer Library`// Set ESP8266 Serial object
#define EspSerial SerialESP8266 wifi(EspSerial);
char auth[] = âxxxxâ;
WidgetLED led1(V4);
WidgetLED led2(V5);
WidgetLED led3(V6);
WidgetLED led4(V7);int Probe[4] = {0,0,0,0};
double Temp[4] = {0,0,0,0};
int LED[4] = {0,0,0,0};
int i = 0;SimpleTimer timer; //Create a Timer object called âtimerâ
void setup()
{
// Set console baud rate
Serial.begin(9600);
delay(10);
// Set ESP8266 baud rate
EspSerial.begin(115200);
delay(10);analogReference(EXTERNAL);
Blynk.begin(auth, wifi, âxxxâ, âxxxxâ);
timer.setInterval(2000, sendTemperatures);
timer.setInterval(1333, sendLED);}
void sendTemperatures()
{
Blynk.virtualWrite(V0, int(Temp[1]));
Blynk.virtualWrite(V1, int(Temp[2]));
Blynk.virtualWrite(V2, int(Temp[3]));
Blynk.virtualWrite(V3, int(Temp[4]));}
void sendLED()
{
led1.setValue(int(LED[1]));
led2.setValue(int(LED[2]));
led3.setValue(int(LED[3]));
led4.setValue(int(LED[4]));
}void loop()
{
Blynk.run();
timer.run();Probe[1] = analogRead(A0);
Probe[2] = analogRead(A1);
Probe[3] = analogRead(A2);
Probe[4] = analogRead(A3);for(int i =1; i < 5; i++)
{if((Probe[i])<421) { Temp[i] = -61.3*log(Probe[i])+488.4; LED[i] = 255; } if(420<(Probe[i]) && (Probe[i]<1022)) { Temp[i] = (-0.116*Probe[i])+168.8; LED[i] = 255; } if((Probe[i])>1022) { Temp[i] = 0; LED[i] = 0; }
}
}
1.4
/**************************************************************
* VERSION Thermometer 1.4
Arduino Nano Connected to ESP8266-12 Hard Serial
**************************************************************/
//#define BLYNK_DEBUG
//#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <ESP8266_HardSer.h>
#include <BlynkSimpleShieldEsp8266_HardSer.h>
#include <SimpleTimer.h> //Simple Timer Library
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
// Set ESP8266 Serial object
#define EspSerial Serial
ESP8266 wifi(EspSerial);
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxx";
WidgetLED led1(V4);
WidgetLED led2(V5);
WidgetLED led3(V6);
WidgetLED led4(V7);
int Probe[4] = {0,0,0,0};
double Temp[4] = {0,0,0,0};
int LED[4] = {0,0,0,0};
int i = 0;
int j = 0;
SimpleTimer timer; //Create a Timer object called "timer"
void setup()
{
// Set console baud rate
Serial.begin(9600);
delay(10);
// Set ESP8266 baud rate
EspSerial.begin(115200);
delay(10);
analogReference(EXTERNAL);
Blynk.begin(auth, wifi, "xxx", "xxx");
timer.setInterval(2000, sendTemperatures);
timer.setInterval(1333, sendLED);
//timer.setInterval(3667, sendOLED);
delay(50);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.display();
delay(2000);
display.clearDisplay();
/*
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.println("Blynk.begin");
display.println("Connecting");
display.display();
delay(1000);
display.clearDisplay();
*/
}
void sendTemperatures()
{
Blynk.virtualWrite(V0, int(Temp[1]));
Blynk.virtualWrite(V1, int(Temp[2]));
Blynk.virtualWrite(V2, int(Temp[3]));
Blynk.virtualWrite(V3, int(Temp[4]));
}
void sendLED()
{
led1.setValue(int(LED[1]));
led2.setValue(int(LED[2]));
led3.setValue(int(LED[3]));
led4.setValue(int(LED[4]));
}
/*
void sendOLED()
{
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.clearDisplay();
display.print("AMB: ");
display.print(Temp[1]);
display.println(" F");
display.print("P1: ");
display.print(Temp[2]);
display.println(" F");
display.print("P2: ");
display.print(Temp[3]);
display.println(" F");
display.print("P3: ");
display.print(Temp[4]);
display.println(" F");
display.display();
delay(5000);
display.startscrollright(0x00, 0x0F);
delay(5000);
display.clearDisplay();
}
*/
void loop()
{
Blynk.run();
timer.run();
Probe[1] = analogRead(A0);
Probe[2] = analogRead(A1);
Probe[3] = analogRead(A2);
Probe[4] = analogRead(A3);
for(int i =1; i < 5; i++)
{
if((Probe[i])<421)
{
Temp[i] = -61.3*log(Probe[i])+488.4;
LED[i] = 255;
}
if(420<(Probe[i]) && (Probe[i]<1022))
{
Temp[i] = (-0.116*Probe[i])+168.8;
LED[i] = 255;
}
if((Probe[i])>1022)
{
Temp[i] = 0;
LED[i] = 0;
}
}
}