unable to display the data on Thingspeak | ThingSpeak API | Forum

Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —






— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
unable to display the data on Thingspeak
No permission to create posts
January 5, 2019
2:54 am
Avatar
ajay17
New Member
Members
Forum Posts: 1
Member Since:
January 5, 2019
sp_UserOfflineSmall Offline

Hello there, I was trying to upload a program based on collecting the sensor data from LDR and uploading it on Thingspeak . However, even after successfully uploading the code from node-mcu and making proper connections, I cannot see the graphical representation on my channel. I need some help. Here is the code below.

define ldrpin A0
#include ;
#include ;
#include ;

const char ssid[] = "mallu";
const char password[] = "malika178";
WiFiClient client ;
unsigned long myChannelNumber = 668318;
const char myWriteAPIKey[] = "5K9LRBN5Q8G3MTKM";

void setup() {

Serial.begin(9600);
WiFi.begin(ssid,password);
ThingSpeak.begin(client);

// put your setup code here, to run once:

}

void loop() {
int val;
val = analogRead(ldrpin);

Serial.print(val);
Serial.println(" ");
delay(1000);
ThingSpeak.writeField(myChannelNumber, 1,val, myWriteAPIKey); //Update in ThingSpeak

}

note that wificlient, esp8266wifi and thingspeak library were included.

January 5, 2019
5:39 pm
Avatar
Vinod

MathWorks
Members
Forum Posts: 258
Member Since:
May 1, 2016
sp_UserOfflineSmall Offline

Have you tried some of the examples here:

https://www.mathworks.com/help/thingspeak/arduino-or-particle-photon.html

You should be able to start from one of those and modify them for your application.

January 7, 2019
5:04 pm
Avatar
cstapels
Moderator
Members


Moderators
Forum Posts: 545
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

Are you able to see data in your channel when you use a rest call in your browser window? For example, try, something of this format:
https://api.thingspeak.com/update?api_key=YOUR_WRITE_API_KEY&field1=1230

That way you can be sure you have the correct channel and API key.

Once that is done, I recommend using some of the examples at the site Vinod pointed out. There are also some examples in the ESP8266 section that I would recommend for your Node MCU. These have a bit more verbose seral comments, so you can make sure the device is connecting to the wifi, first for example. Then you can also make sure the write was successful.

See this example perhaps: https://www.mathworks.com/help/thingspeak/read-and-post-temperature-data.html

Do you see the number of entries increasing on your channel? If you are writing string type data, the number of entries will grow, but the plot will not be able to display the data.
Last, check the display settings on your thingSpeak chart. Your data may be off scale.

Forum Timezone: America/New_York

Most Users Ever Online: 166

Currently Online:
29 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 272

Vinod: 240

piajola: 95

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 8665

Moderators: 1

Admins: 2

Forum Stats:

Groups: 3

Forums: 14

Topics: 1600

Posts: 5760

Newest Members:

Richard, naturepur, Nimper, kaplan@sor.cz, projectid030, mrlee234

Moderators: cstapels: 460

Administrators: Hans: 405, lee: 457