Building Weather Station. Only First Field is being updated. | ThingSpeak Projects | Forum

Avatar

Please consider registering
Guest

Search

— Forum Scope —






— Match —





— Forum Options —





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

Register Lost password?
sp_Feed sp_TopicIcon
Building Weather Station. Only First Field is being updated.
Avatar
hannon1000
New Member
Forum Posts: 2
sp_UserOfflineSmall Offline
1
February 15, 2017 - 8:03 pm
sp_Permalink sp_Print

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);

Avatar
Vinod

Forum Posts: 183
sp_UserOfflineSmall Offline
2
February 15, 2017 - 8:37 pm
sp_Permalink sp_Print sp_EditHistory

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.

Avatar
hannon1000
New Member
Forum Posts: 2
sp_UserOfflineSmall Offline
3
February 17, 2017 - 10:44 pm
sp_Permalink sp_Print

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

Avatar
Vinod

Forum Posts: 183
sp_UserOfflineSmall Offline
4
February 18, 2017 - 11:12 am
sp_Permalink sp_Print

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:
26 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 252

Vinod: 164

cstapels: 96

piajola: 75

vespapierre: 63

Adarsh_Murthy: 59

Newest Members:

candacele1

WilliamBer

roxieob18

Metawatch

ozayagw

ubabeutiti

Forum Stats:

Groups: 4

Forums: 17

Topics: 1313

Posts: 4565

 

Member Stats:

Guest Posters: 1

Members: 5703

Moderators: 0

Admins: 2

Administrators: Hans, lee