Building Weather Station. Only First Field is being updated. | ThingSpeak Projects | 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
Building Weather Station. Only First Field is being updated.
No permission to create posts
February 15, 2017
8:03 pm
Avatar
hannon1000
New Member
Members
Forum Posts: 2
Member Since:
December 27, 2016
sp_UserOfflineSmall Offline

I can only update one data field at time. Pls advise. My work flow was create TS channel/fields, add channelID and APIKey info to Arduino sketch, add the code below to sketch. All data is seen on computer monitor.

 

void loop() {

BME280Temp=(bme.readTemperature()*1.8+32);
  ThingSpeak.writeField(myChannelNumber,1,BME280Temp,myWriteAPIKey);
 
  Atemp=(am2315.readTemperature()*1.8+32);
  ThingSpeak.writeField(myChannelNumber,2,Atemp,myWriteAPIKey);
    
  BME280Humi=(bme.readHumidity());
  ThingSpeak.writeField(myChannelNumber,3,BME280Humi,myWriteAPIKey);
 
  Ahumi=(am2315.readHumidity());
  ThingSpeak.writeField(myChannelNumber,4,Ahumi,myWriteAPIKey);
 
  BME280StationPressureMillibars=(bme.readPressure()/100);
  BME280EquivSeaLevelPressureMillibars=(BME280StationPressureMillibars+(16/9.2));
  BME280Press=(BME280EquivSeaLevelPressureMillibars*0.02953);
  ThingSpeak.writeField(myChannelNumber,5,BME280Press,myWriteAPIKey);
 
  Serial.print(BME280Temp,0);
  Serial.print(" F  ");
  Serial.print(Atemp,0);
  Serial.print(" F  ");
  Serial.print(BME280Humi,0);
  Serial.print("%  ");
  Serial.print(Ahumi,0);
  Serial.print("%  ");
  Serial.print(BME280Press,2);
  Serial.println(" InHg");
 
  delay(20000);

February 15, 2017
8:37 pm
Avatar
Vinod

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

You're attempting to write to multiple fields in a channel faster than your capacity as a free user allows you. Take a look at this example:

https://github.com/mathworks/thingspeak-arduino/blob/master/examples/WriteMultipleVoltages/WriteMultipleVoltages.ino

It uses setField to set each individual field and combines the data from multiple fields into one write using writeFields.

February 17, 2017
10:44 pm
Avatar
hannon1000
New Member
Members
Forum Posts: 2
Member Since:
December 27, 2016
sp_UserOfflineSmall Offline

Thank-you very much Vinod for your kindness while pointing out my "duh". 

I added delay lines. I see all graphs being updated.  Next steps are to add code that resets comm with TS if comms lost and code for sleep mode. Thanks again!!

Kevin

February 18, 2017
11:12 am
Avatar
Vinod

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

You're welcome, Kevin.

If you have a public channel and a blog or video linked to the project, maybe others can learn from it too.  We'd love to hear more about your project on the forum. 

Forum Timezone: America/New_York

Most Users Ever Online: 114

Currently Online:
21 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 261

Vinod: 196

piajola: 85

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 5703

Moderators: 0

Admins: 2

Forum Stats:

Groups: 4

Forums: 17

Topics: 1313

Posts: 4565

Newest Members:

BarryMaync, ThomasRougs, DonaldGen, prince, JrGordon, Elamsweems

Administrators: Hans: 387, lee: 457