Hello,
I just recently re-flashed my Particle Photon (last night); I have several connected to my 2.4 network. I finally realized last night I was only able to flash my Photons OTA when I set the board the Magenta Safe Mode. Every time I tried to flash (Saving firmware first) without Magenta Safe Mode, the console would show “Flash Started” but eventually showed “Flash Failed”. Only when I was in Safe Mode did I actually get to compile the firmware to the board.
This took several hours to figure out, no more flashing for me unless I’m in Safe Mode…
The Particle Console, after successfully flashing in Safe Mode only displays the “DHT11 - PLANT IT AND IT SHALL GROW” once, but never displays the Temperature or Humidity readings or displays them in the Blynk App like it use to.
I’m running two (2) Photons that have DHT11 hooked up. One board has been running for over two years, displaying both Humidity and Temperature both in the Particle Console and the Blynk App Gage Modules. But all of this effort has been erased now that I have updated my firmware as of yesterday - the other board with the same wiring never worked as I only recently started working on it.
My code is a bit jumbled, it was parsed with other examples and it worked for several years flawlessly but no longer does, does anyone see something obvious in my code? I can still control a relay etc from the App but I want my information to Publish again and show up in the Blynk App (Temp/Humidity) - Which it does not.
Any help would be great. I’m also running 0.7.0 on the boards because anything higher caused my Photons to FLASH SOS RED (I made a separate topic on this in 2019 and it was resolved)
My App was working before I flashed last night:
//11-27-2018
// Version1: float temp = (float)DHT.getFahrenheit(); was (float)DHT.getCelcius();
// Particle.publish("DHT11 - firmware version", VERSION, 60, PRIVATE); was Particle.publish("DHT22 - firmware version", VERSION, 60, PRIVATE);
// Particle.publish("The temperature from the dht11 is:", tempInChar, 60, PRIVATE); was Particle.publish("The temperature from the dht22 is:", tempInChar, 60, PRIVATE);
// Particle.publish("The humidity from the dht11 is:", tempInChar, 60, PRIVATE); was Particle.publish("The humidity from the dht22 is:", tempInChar, 60, PRIVATE);
// Comments: App switches back and forth on reading and displays deciminal points.
// This #include statement was automatically added by the Particle IDE.
#include <blynk.h>
// This #include statement was automatically added by the Particle IDE.
//#include <PietteTech_DHT.h>
// This #include statement was automatically added by the Particle IDE. (07/31/2020 - NEW VERSION ADDED)
#include <PietteTech_DHT.h>
// system defines
#define DHTTYPE DHT11 // Sensor type DHT11/21/22/AM2301/AM2302
//#define DHTPIN 4 // Digital pin for communications
#define DHTPIN 5 // Digital pin for communications
#define DHT_SAMPLE_INTERVAL 60000 // Sample every minute
//declaration
void dht_wrapper(); // must be declared before the lib initialization
// Lib instantiate
PietteTech_DHT DHT(DHTPIN, DHTTYPE, dht_wrapper);
// globals
unsigned int DHTnextSampleTime; // Next time we want to start sample
bool bDHTstarted; // flag to indicate we started acquisition
int n; // counter
//this is coming from http://www.instructables.com/id/Datalogging-with-Spark-Core-Google-Drive/?ALLSTEPS
char resultstr[64]; //String to store the sensor data
//DANGER - DO NOT SHARE!!!!
char auth[] = "NOT FOR YOUR EYES"; // Put your blynk token here
//DANGER - DO NOT SHARE!!!!
char VERSION[64] = "0.04";
#define READ_INTERVAL 60000
void setup()
{
System.disableUpdates();
//STARTUP(WiFi.selectAntenna(ANT_EXTERNAL));
Blynk.begin(auth);
DHTnextSampleTime = 0; // Start the first sample immediately
Particle.variable("result", resultstr, STRING);
Particle.publish("DHT11 - PLANT IT AND IT SHALL GROW", VERSION, 60, PRIVATE);
}
// This wrapper is in charge of calling
// must be defined like this for the lib work
void dht_wrapper()
{
DHT.isrCallback();
}
void loop()
{
Blynk.run(); // all the Blynk magic happens here
// Check if we need to start the next sample
if (millis() > DHTnextSampleTime) {
if (!bDHTstarted) { // start the sample
DHT.acquire();
bDHTstarted = true;
}
if (!DHT.acquiring()) { // has sample completed?
float temp = (float)DHT.getFahrenheit();
int temp1 = (temp - (int)temp) * 100;
char tempInChar[32];
sprintf(tempInChar,"%0d.%d", (int)temp, temp1);
Particle.publish("The temperature from the dht11 is:", tempInChar, 60, PRIVATE);
//virtual pin 1 will be the temperature
Blynk.virtualWrite(V1, tempInChar);
Blynk.virtualWrite(V3, tempInChar);
//google docs can get this variable
//sprintf(resultstr, "{\"t\":%s}", tempInChar);
float humid = (float)DHT.getHumidity();
int humid1 = (humid - (int)humid) * 100;
sprintf(tempInChar,"%0d.%d", (int)humid, humid1);
Particle.publish("The humidity from the dht11 is:", tempInChar, 60, PRIVATE);
//virtual pin 2 will be the humidity
Blynk.virtualWrite(V2, tempInChar);
Blynk.virtualWrite(V4, tempInChar);
n++; // increment counter
bDHTstarted = false; // reset the sample flag so we can take another
DHTnextSampleTime = millis() + DHT_SAMPLE_INTERVAL; // set the time for next sample
}
}
}