Dick Chan in Discussions
上次活动时间: 2022-7-23

Dear all, I am using the micro:bit with ESP-01s and the CO2 sensor to monitor indoor air quality. Thingspeak cannot show the data eventhough the ESP is connected to the wifi (checked with the router). Failed to talk to my ESP even I have setup a new channel many times. Can anyone advise me what to do? Thank you for your help in advance. ESP-01 communication problem with thingspeak using a micro:bit Share a code snippet please. Consider using the <https://github.com/mathworks/thingspeak-arduino ThingSpeak library> . It has good examples as well. But first, see if you can update your channel using the web browser. If you click the API keys tab on your channel you will see the format for updating in the browser address window. Me too, my micro:bit data not showing on the thingspeak dashboard. micro:bit esp-01s
Samuel Adesola in Discussions
上次活动时间: 2021-7-7

I'm accessing internet on my Arduino uno using esp-01, is there a thingspeak Library i can use on this to send data to my thingspeak channel. Thingspeak Library on Arduino Uno This should work: <https://github.com/mathworks/thingspeak-arduino> Take a look at the examples in there as a good starting point. arduino thingspeak esp-01
Md. Najmul Hasan in MATLAB Answers
上次活动时间: 2021-5-25

i am using arduino mega and esp 01.i am getting reading on serial monitor.but thingspeak shows 0 for 5 sensors data fields.where is the problem in this code please help me. Esp 01 code- #include "ThingSpeak.h" #include <ESP8266WiFi.h> char ssid[] = "xxxxxxx"; // SSID here char pass[] = "xxxxxxxx"; // Passowrd here unsigned long Channel_ID = xxxxxx; // Channel ID const char * myWriteAPIKey = "xxxxxxxx"; // Write API key const int Field_Number_1 = 1; const int Field_Number_2 = 2; const int Field_Number_3 = 3; const int Field_Number_4 = 4; const int Field_Number_5 = 5; String value = ""; int value_1 = 0, value_2 = 0, value_3 = 0, value_4 = 0, value_5 = 0; WiFiClient client; void setup() { Serial.begin(115200); WiFi.mode(WIFI_STA); ThingSpeak.begin(client); internet(); } void loop() { internet(); if (Serial.available() > 0) { delay(100); while (Serial.available() > 0) { value = Serial.readString(); if (value[0] == '*') { if (value[11] == '#') { value_1 = ((value[1] - 0x30) * 10 + (value[2] - 0x30)); value_2 = ((value[3] - 0x30) * 10 + (value[4] - 0x30)); value_3 = ((value[5] - 0x30) * 10 + (value[6] - 0x30)); value_4 = ((value[7] - 0x30) * 10 + (value[8] - 0x30)); value_5 = ((value[9] - 0x30) * 10 + (value[10] - 0x30)); } } } } upload(); } void internet() { if (WiFi.status() != WL_CONNECTED) { while (WiFi.status() != WL_CONNECTED) { WiFi.begin(ssid, pass); delay(5000); } } } void upload() { ThingSpeak.writeField(Channel_ID, Field_Number_1, value_1, myWriteAPIKey); delay(15000); ThingSpeak.writeField(Channel_ID, Field_Number_2, value_2, myWriteAPIKey); delay(15000); ThingSpeak.writeField(Channel_ID, Field_Number_3, value_3, myWriteAPIKey); delay(15000); ThingSpeak.writeField(Channel_ID, Field_Number_4, value_4, myWriteAPIKey); delay(15000); ThingSpeak.writeField(Channel_ID, Field_Number_5, value_5, myWriteAPIKey); delay(15000); value = ""; } arduino code- #include <dht.h> #define soilWet 56 #define soilDry 50 const int LM35 = A0; // Soil Temperature pin // lowest and highest sensor readings (Rain Detection) const int sensorMin = 0; // sensor minimum const int sensorMax = 1024; // sensor maximum #define sensorPower 5 // Motor pin int obstaclePin = 10; // IR sensor pin 7 int hasObstacle = HIGH; // High means no obstacle const int trigger = 34; const int echo = 35; long T; float distanceCM; dht DHT; #define DHT11_PIN 30 int humi,temp; void setup(){ pinMode(sensorPower, OUTPUT); // Initially keep the Motor OFF digitalWrite(sensorPower, HIGH); pinMode(obstaclePin, INPUT); pinMode(trigger, OUTPUT); pinMode(echo, INPUT); Serial.begin(9600); } void loop() { int moisture = (100 - ((analogRead(A1)/1023.00)*100)); digitalWrite(trigger, LOW); delay(10); digitalWrite(trigger, HIGH); delayMicroseconds(10); digitalWrite(trigger, LOW); T = pulseIn(echo, HIGH); distanceCM = T * 0.034; distanceCM = distanceCM / 2; int ADC; float tempS; ADC = analogRead(LM35); tempS = (ADC * 4.88); tempS = (tempS / 10); int sensorReading = analogRead(A2); // Rain detection pin A2 int range = map(sensorReading, sensorMin, sensorMax, 0, 3); // Rain detection switch (range) { case 0: // Sensor getting wet Serial.println("Rain Status : ***Raining***"); break; case 1: // Sensor getting wet Serial.println("Rain Status : **Rain Warning**"); break; case 2: // Sensor dry - To shut this up delete the " Serial.println("Not Raining"); " below. Serial.println("Rain Status : *Not Raining*"); break; } DHT.read11(DHT11_PIN); humi=DHT.humidity; temp=DHT.temperature; Serial.print("Air Temperature = "); Serial.print(temp); Serial.println("°C "); Serial.print("Air Humidity = "); Serial.print(humi); Serial.println(" %"); Serial.print("Distance = "); Serial.print(distanceCM); Serial.println("cm"); Serial.print("Soil Temperature = "); Serial.print(tempS); Serial.println("°C"); Serial.print("Soil Moisture = "); Serial.print(moisture); Serial.println(" %"); if (moisture < soilWet) { Serial.println("Status: Soil is too wet"); } else if (moisture >= soilWet && moisture < soilDry) { Serial.println("Status: Soil moisture is perfect"); } else { Serial.println("Status: Soil is too dry - time to water!"); } if (moisture < 35) { digitalWrite(sensorPower, HIGH); // turn ON motor Serial.println("Motor is ON"); } if (moisture > 35 && moisture < 37) { digitalWrite(sensorPower, HIGH); //turn ON motor Serial.println("Motor is ON"); } if (moisture > 38) { digitalWrite(sensorPower, LOW); // turn OFF motor Serial.println("Motor is OFF"); } hasObstacle = digitalRead(obstaclePin); //Reads the output of the obstacle sensor from the 7th PIN of the Digital section of the arduino if (hasObstacle == LOW) //LOW means something is ahead { Serial.println("Something is ahead !!!"); } else { Serial.println("Path is clear"); } Serial.println("--------------------------------------------------------------------------"); Serial.println(""); delay(3000); }

关于 ThingSpeak

The community for students, researchers, and engineers looking to use MATLAB, Simulink, and ThingSpeak for Internet of Things applications. You can find the latest ThingSpeak news, tutorials to jump-start your next IoT project, and a forum to engage in a discussion on your latest cloud-based project. You can see answers to problems other users have solved and share how you solved a problem.