Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
kalindud
New Member

Streaming with ESP8266

Hello,

 Is it possible to stream data using a ESP8266 Module directly to the API Link?

 

Im using the following code.

#include <ArduinoJson.h>

#include <ESP8266HTTPClient.h>
#include <ESP8266WiFi.h>


 
void setup() {
 
  Serial.begin(115200);                                  //Serial connection
  WiFi.begin("DiAlOg-1", "dialog456@");   //WiFi connection
 
  while (WiFi.status() != WL_CONNECTED) {  //Wait for the WiFI connection completion
 
    delay(500);
    Serial.println("Waiting for connection");
 
  }
 
}
 
void loop() {
 
 if(WiFi.status()== WL_CONNECTED){   //Check WiFi connection status
 
   HTTPClient http;    //Declare object of class HTTPClient
 
   

    const size_t bufferSize = JSON_ARRAY_SIZE(1) + JSON_OBJECT_SIZE(2);
    DynamicJsonBuffer jsonBuffer(bufferSize);
    
    JsonArray& root = jsonBuffer.createArray();
    
    JsonObject& root_0 = root.createNestedObject();
    root_0["Value1"] = 100;
    root_0["Value2"] = 200;

  
    char JSONmessageBuffer[300];
    root.prettyPrintTo(JSONmessageBuffer, sizeof(JSONmessageBuffer));
    Serial.println(JSONmessageBuffer);

    http.begin("https://api.powerbi.com/beta/852c5799-8134-4f15-9d38-eba4296cc76f/datasets/6014dfc1-93f3-42bb-8ae8-7ec52b051bc8/rows?key=kcW8AI0bvDrT%2BukEOZSFfRxh39HqH0z8hNNPqMqB2PlzlAXvwtw8S9CLCnga3g4tiz2vSonttPDHKfbmNkEUYA%3D%3D");     
    http.addHeader("Content-Type", "application/json");  
 
     int httpCode = http.POST(JSONmessageBuffer);
 
 
   http.end();  //Close connection
 
 }else{
 
    Serial.println("Error in WiFi connection");   
 
 }
 
  delay(1000);  //Send a request every 30 seconds
 
}

And this is the serial Output:

[
  {
    "Value1": 100,
    "Value2": 200
  }
]
[
  {
    "Value1": 100,
    "Value2": 200
  }
]

 

 

It doesn't show any value in the dashboard.. Should this work? What am i doing wrong?

I followed the following tutorial, but instead of the Raspberry Pi, Im using a ESP8266.

https://www.youtube.com/watch?v=0YIBHfgasok

(see 30:50)

 

Your help is much appreciated. thank you.

 

 

 

5 REPLIES 5
Anonymous
Not applicable

@kalindud did you manage to do it?

 

Been trying to do it myself but can't make the response to reach power Bi....

v-shex-msft
Community Support
Community Support

Hi @kalindud,

 

I think it is possible to use device to send data if you can achieve below prerequisite:
1. Power bi account and stream api url.
2. Device can access to website, support programming and send data to network.

 

How did you setting steaming tile, please share more detail information. (Notice: current streaming dataset not works for normal tiles and visuals)

5.PNG

 

 

BTW, you need to check your data formula if it not similar as sample data shows.

Create Dataset

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hello,

 


BTW, you need to check your data formula if it not similar as sample data shows.

Create Dataset



 

 What do u mean by this?

 

 

And yes I created a Streaming Data tile like you shown in the screenshot. It didnt get any values.

Any help? Should my code work?

 

Thank you!

Hi @kalindud,

 

I'd like to suggest you copy your formula and debug on PC side, if power bi can analytics your data, it means you send-up correct format data.(issue may related to device, for e.g. lite version of dlls or others)


Otherwise I think you need to correct data format first.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Anonymous
Not applicable

@v-shex-msft can you help please?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors