BLYNK
HOME       πŸ“² GETTING STARTED       πŸ“— DOCS       ❓HELP CENTER       πŸ‘‰ SKETCH BUILDER

Cmd error - auth key repeated - Nano, ESP and ADS1115 Setup

Hi Guys,

Have a weird issue, if I attempt to read and ADS1115 on the I2C bus and then pump the information up using Blynk using virtualwrite to a V## process to start sending the information up doesnt work. This only occurs if I use Blynk Timer and the recommended way of calling all functions with timers.

Core below that causes the issue:

#define BLYNK_PRINT Serial
#define BLYNK_DEBUG
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
#include <SoftwareSerial.h>
#include <Adafruit_ADS1015.h>

char auth[] = "***";
char ssid[] = "***";
char pass[] = "***";

SoftwareSerial EspSerial(2, 3); // RX, TX

#define ESP8266_BAUD 9600
ESP8266 wifi(&EspSerial);

BlynkTimer timer;
Adafruit_ADS1115 adsA(0x48);      /* Use this for the 16-bit version */

void setup()
{
  Serial.begin(9600);
  delay(100);

  adsA.setGain(GAIN_ONE);           // 1x gain   +/- 4.096V  1 bit = 2mV      0.125mV
  adsA.begin();
  
  EspSerial.begin(ESP8266_BAUD);
  delay(100);
  
  Blynk.begin(auth, wifi, ssid, pass);



  timer.setInterval(1000L, countuptime);
  timer.setInterval(2000L, systemvoltage);
}

void loop()
{
  Blynk.run();
  timer.run(); // BlynkTimer is working...
}

void systemvoltage()
{

  // IF I COMMENT OUT ALL OF THE BELOW IN THIS FUNCTION THE CODE RUNS.
  Serial.println("System Voltage (RAW): ");
  int16_t adcA0;
  adcA0 = adsA.readADC_SingleEnded(1);
  Serial.println(adcA0);
  Blynk.virtualWrite(V13, adcA0);
  
}

void countuptime()
{
  Serial.println("System Uptime Function: +1");
  Blynk.virtualWrite(V12, millis() / 1000);
}

Blynk debug shows the following error:
[22318] <[11|00|02|00]gver[00]0.6.1[00]h-beat[00]10[00]buff-in[00]256[00]dev
[32429] Cmd error
[42877] <[1D|00|01|00] my blynk auth key is repeated here
[53619] <[1D|00|01|00] my blynk auth key is repeated here
[64445] <[1D|00|01|00] my blynk auth key is repeated here

The ADS115 unit works as it should standalone, I2C scanner reads successfully and also ADC reads are good too.

Also, if I move the below into VOID LOOP and remove all TIMER code it works and info is uploaded into server/app/widget. But this isnt recommend and the use of timers is best practice, which is what I want to acheive.

  Serial.println("System Voltage (RAW): ");
  int16_t adcA0;
  adcA0 = adsA.readADC_SingleEnded(1);
  Serial.println(adcA0);
  Blynk.virtualWrite(V13, adcA0);

I’m assuming there might be some conflict between the ADS library and Blynk timer (which is an adopted Simplertimer varient/tweaks.

Any help would be muchly appreciated.

Cheers,