Having device hardware issues with my Spark Core and need some help

I have flashed firmware to the Spark Core but I am having a hard time with keeping it online and stable.

I really don’t think it has anything to do with the firmware but I can post what I have anyway.

What it’s doing is at any random time, usually shortly after being online and breathing cyan, it cuts out and goes into quickly flashing cyan. After that, it flashes green quickly until the device reboots.

What I have done is factory reset the device and reflashed the firmware numerous times but the problem keeps coming back.

Here is what I am flashing to it:

// Include Blynk API
#include "blynk/blynk.h"

#define BLYNK_PRINT Serial

// Blynk cloud API access token
char auth[] = "0123456789abcdef";

// Constructor for terminal widget - remote debug (if local, use Serial)
WidgetTerminal terminal(V3);

void setup() {
  Serial.begin(9600);
  delay(5000); // Allow board to settle
  Blynk.begin(auth);
  
  pinMode(A0, INPUT);
  
  // Determine if this is subject to daylight savings--if not, set it manually for the given month (int)
  Time.zone(-6);
  }

void loop() {
  Blynk.run();
  Blynk.virtualWrite(V1, temperature());
  
  // Samples analog readings from TMP36 on the top of every hour
  if((Time.minute() == 0) && (Time.second() == 0)) {
    int reading = temperature();
    }
  }

int temperature() {
  double reading = analogRead(A0);  
  float tempC = (((reading * 3.3)/4095) - 0.5) * 100;
  int tempF = (tempC * 1.8) + 32;
  Serial.println(tempF);        // for debugging - remove when finalized
  return tempF;
  }

The only thing I have connected to it is a TMP36 with a 103 ceramic cap and a 47kohm resistor (RC filter) to ground and I am powering it through the 3v3* pin. I also have it connected via USB for power.

I have 3 separate Cores and this one is acting different compared to the others. I’ll try to flash it to another Core that I have and I will post the results on this thread.

It’s a very basic app that I have written and there are no frills on the hardware peripheral side. I really don’t think it is anything to do with that and I am worried my Spark Core is about to go tango uniform.

What should I do?

@eavery, you are running Blynk.virtualWrite(V1, temperature()); at full loop() speed! You may want to put a delay on that line. Even better, do the write only when you update the temperature in if((Time.minute() == 0) && (Time.second() == 0)). BTW, you will be reading the temperature on every loop() for an entire second until it Time.second() changes to 1. You may want to change your logic to look for a change in the hour, like this:

//(global variable)
int lastHour = 25;  // Setting to 25 will cause the temperature to be written on first run.  After that, it will sync to every hour change.

setup() {
...

lastHour = Time.hour();
}

loop() {
  Blynk.run();
  
  // Samples analog readings from TMP36 every time the hour changes
  if (Time.hour() != lastHour) {
    lastHour = Time.hour();
    int reading = temperature();
    Blynk.virtualWrite(V1, temperature());
    }
}

:smile:

3 Likes