BLYNK
BLYNK.IO       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Need help migrating to Blynk IoT

Hey Pete - I’m working on a similar issue with new Blynk (Only forced because my phone died and I couldn’t recover the app… drat.)

Attached is the working code I had for previous blynk, I’m having trouble finding the porting instructions or - really - making sense of how to do what I was doing before - but now… can you help?

Attached is the code:


/******************************************************************
Fermenter 2 Controller
******************************************************************/
#include <OneWire.h> // http://www.pjrc.com/teensy/td_libs_OneWire.html
#include "SSD1306Wire.h" // https://github.com/ThingPulse/esp8266-oled-ssd1306
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

#define glycolS 0
#define PRV 16

int sp_gl, sv_gl, sp_prv, gl_OFF, gl_ON, prv_OFF, prv_ON;
bool Glyc, prv;


#define BLYNK_PRINT Serial
//---BLYNK SETUP---
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "MZ_Ffb8JihHREJiD_CbOaXXXm9fA1iyo";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "XXXX";
char pass[] = "XXXXXXXXX";


// OLED
SSD1306Wire  display(0x3c, D2, D5);

// DS18B20+
OneWire  ds(5);

//----Function to send sensor Data to Blynk
void sendSensor()
{
Glyc=digitalRead(glycolS);
  
}







void setup()
{
  
  Blynk.begin(auth, ssid, pass);  
    // OLED
    display.init();
    display.flipScreenVertically();
    display.setFont(ArialMT_Plain_24);    
]
    display.setTextAlignment(TEXT_ALIGN_CENTER);
    display.setFont(ArialMT_Plain_10);

//  write the buffer to the display
    display.display();
    delay(1500);
}

void loop()
{
  Blynk.run();
    byte i;
    byte present = 0;
    byte type_s;
    byte data[12];
    byte addr[8];
    float celsius, fahrenheit;
    
    if (!ds.search(addr))
    {
        ds.reset_search();
        delay(250);
        return;
    }

    ds.reset();
    ds.select(addr);
    ds.write(0x44, 1); // start conversion, with parasite power on at the end
    
    delay(1000); // maybe 750ms is enough, maybe not
    present = ds.reset();
    ds.select(addr);    
    ds.write(0xBE); // Read Scratchpad
    
    // we need 9 bytes
    for (i = 0; i < 9; i++) 
    {  
        data[i] = ds.read();
    }
    
    // Convert the data to actual temperature
    int16_t raw = (data[1] << 8) | data[0];
    
    if (type_s) 
    {

        raw = raw << 3; // 9 bit resolution default
        if (data[7] == 0x10) 
        {
            // "count remain" gives full 12 bit resolution
            raw = (raw & 0xFFF0) + 12 - data[6];
        }
    } 

    else 
    {
        byte cfg = (data[4] & 0x60);
        // at lower res, the low bits are undefined, so let's zero them
        if (cfg == 0x00) raw = raw & ~7;  // 9 bit resolution, 93.75 ms
        else if (cfg == 0x20) raw = raw & ~3; // 10 bit res, 187.5 ms
        else if (cfg == 0x40) raw = raw & ~1; // 11 bit res, 375 ms
        // default is 12 bit resolution, 750 ms conversion time
    }
    
    celsius    = (float)raw / 16.0;
    fahrenheit = celsius * 1.8 + 32.0;
    

    // celsius

    display.clear();
    display.setTextAlignment(TEXT_ALIGN_LEFT);
    display.setFont(ArialMT_Plain_16);
    display.drawString(0, 5, "Temperature");
    display.setFont(ArialMT_Plain_24);
    display.drawString(0, 30, String(celsius));
    display.drawString(65, 30, "C");
    
    // write the buffer to the display

    display.display();
    delay(2000);
    
    // fahrenheit

    display.clear();
    display.setTextAlignment(TEXT_ALIGN_LEFT);
    display.setFont(ArialMT_Plain_16);
    display.drawString(0, 5, "Temperature");
    display.setFont(ArialMT_Plain_24);
    display.drawString(0, 30, String(fahrenheit));
    display.drawString(65, 30, "F");
    
    // write the buffer to the display
 
   display.display();
    delay(2000);


    Blynk.virtualWrite(V0, fahrenheit);
}

@Interstaller5555 ive moved your post to a new topic.

Please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly correctly.
Triple backticks look like this:
```

Pete.

Hi Pete - Thanks for doing that, Also - I added all the tripe backticks, can you provide some insight on the migration from one blynk to the other? I’ve already paid the annual membership to upgrade my account now I would love to get the software running so I can get my brewery back online… lol.

No, you’ve added some characters, but not triple backticks, despite me giving you some to copy/paste.
You’ve also dotted them all over the place, instead of at the beginning and end.

Pete.

hey Pete - I added the aforementioned triple back ticks. Thanks for taking a look at this!

Clean your loop first :stuck_out_tongue_closed_eyes:

as you pointed out, I’m not a programmer. I do however know that cleaning the loop isn’t going to help me migrate tot he new version of blynk. any help you can provide directly addressing the code is greatly appreciated.

Very shortly - install the latest Blynk library for your IDE, go to blynk.cloud (create account if you have not it yet), create template for your devivce (+ edit data stream for V0), get template ID and device name from your template, add new device manually and get auth for it, put it all into your sketch like this:

#define BLYNK_TEMPLATE_ID “TMPLxxxxxxxxx”
#define BLYNK_DEVICE_NAME “ESP8266”
char auth[] = “MZ_Ffb8JihHREJiD_CbOaXXXm9fA1iyo”;

compile and download your code to your device, install and edit new Blynk IoT application, try how it’s work together.

thanks! so what is the equivalent of

“Blynk.virtualWrite(V0, fahrenheit);” in the new version of blynk?

It’s exactly the same.

Pete.

thanks Pete! So if I’m getting this correctly - I basically just change the firmware configuration (ID, template, and token) and it should all “work” am I close? what about the “Blynk.run” commands etc this edgent stuff has me confused. I’m sorry for all the trouble I’m causing. just need my brewery back online… 10BBL of beer doesn’t take care of itself!

Yes. You do need to set-up the template and device in the web console and create your datastreams though.

It’s the same. Ignore the Edgent stuff.

I’m sure that there are numerous community members who could help you to “take care” of a quantity of beer :beer:

Pete.

I’d be happy to pour!!! as I’m setting this up, the mobile dashboard shows the correct value but the web dashboard does not. this is really frustrating… lol any idea why this may be?

Are you looking at the device or the template view?
Template view shows random data for visualisation purposes.

Pete.

sorry - no, I’m looking at it in web dashboard

Web dashboard has two views, template and device.

Pete.

when I go to blynk.console - I only have the option of “templates” - am I missing something?

The magnifying glass at the top should show you your devices. If not then you haven’t created any devices yet.
I’d suggest that you follow the documentation.

When you are in template view then the data you see is just for visualisation purposes, it’s not real data from your device.

Pete.

Got that! Thank you!!! Now I’m stuck because I can’t change the tile design in the mobile app! Damnit!

Details?

Pete.