# Trying to bring my data to thingspeak

**URL:** <https://forum.arduino.cc/t/trying-to-bring-my-data-to-thingspeak/956684>\
**Category:** Programming\
**Created:** [February 8, 2022, 12:54pm UTC](https://forum.arduino.cc/t/trying-to-bring-my-data-to-thingspeak/956684 "2022-02-08T12:54:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![theresio](https://avatars.discourse-cdn.com/v4/letter/t/a9adbd/32.png) [@theresio](https://forum.arduino.cc/u/theresio)\
**Post date:** [February 8, 2022, 12:54pm UTC](https://forum.arduino.cc/t/trying-to-bring-my-data-to-thingspeak/956684/1 "2022-02-08T12:54:25Z")

</div>

im using a elegoo 2560 mega board with a esp-01 wifi. below here i will post my code which works on the arduino and getting data in my serial. how can i bring this data to thingspeak with these hardwares?

const int ledPin = 13; // LED connected to digital pin 13  
const int knockSensor = A0; // the piezo is connected to analog pin 0  
const int threshold = 10; // threshold value to decide when the detected sound is a knock or not

// these variables will change:  
int sensorReading = 0; // variable to store the value read from the sensor pin  
int ledState = LOW; // variable used to store the last LED status, to toggle the light

void setup() {  
pinMode(ledPin, OUTPUT); // declare the ledPin as as OUTPUT  
Serial.begin(9600); // use the serial port  
}

void loop() {  
// read the sensor and store it in the variable sensorReading:  
sensorReading = analogRead(knockSensor);

// if the sensor reading is greater than the threshold:  
if (sensorReading \>= threshold) {  
// toggle the status of the ledPin:  
ledState = !ledState;  
// update the LED pin itself:  
digitalWrite(ledPin, ledState);  
// send the string "Knock!" back to the computer, followed by newline  
Serial.println("intruder alert!");  
}  
delay(100); // delay to avoid overloading the serial port buffer  
}

---

<div class="post-metadata">

**Author:** ![StefanL38](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/stefanl38/32/713548_2.png) [@StefanL38](https://forum.arduino.cc/u/StefanL38)\
**Post date:** [February 8, 2022, 6:43pm UTC](https://forum.arduino.cc/t/trying-to-bring-my-data-to-thingspeak/956684/2 "2022-02-08T18:43:31Z")

</div>

You can post code by using this method that adds the code-tags  
There is an automatic function for doing this in the Arduino-IDE  
just three steps

1. press Ctrl-T for autoformatting your code
2. do a rightclick with the mouse and choose "copy for forum"
3. paste clipboard into write-window of a posting

Depending on how much hardware you have connected to your 2560 Mega the easiest way to bring data to thingspeak is to  
connect all your sensors, displays buttons etc. to a ESP32nodeMCU  
and use the ESP32 as a **replacement** for your Arduino-mega 2560.

If you have a lot of sensors connected to the arduino mega I would use a serial connection from mega 2560 to an ESP32 node-MCU to transfer the data into the wifi-cabable microcontroller and then programming the wifi-cabable microcontroller to forward the data to thingspeak.

best regards Stefan

---

<div class="post-metadata">

**Author:** ![theresio](https://avatars.discourse-cdn.com/v4/letter/t/a9adbd/32.png) [@theresio](https://forum.arduino.cc/u/theresio)\
**Post date:** [February 9, 2022, 1:18am UTC](https://forum.arduino.cc/t/trying-to-bring-my-data-to-thingspeak/956684/3 "2022-02-09T01:18:46Z")

</div>

so ure saying it wont just work alone with the esp-01 wifi module?

---

<div class="post-metadata">

**Author:** ![blh64](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/blh64/32/605986_2.png) [@blh64](https://forum.arduino.cc/u/blh64)\
**Post date:** [February 9, 2022, 1:46am UTC](https://forum.arduino.cc/t/trying-to-bring-my-data-to-thingspeak/956684/4 "2022-02-09T01:46:57Z")

</div>

Of course it will work. Google will give you many, many examples:

> **[IoT Made Easy With UNO, ESP-01, ThingSpeak and MIT App Inventor](https://www.instructables.com/IoT-Made-Easy-With-UNO-ESP-01-ThingSpeak-and-MIT-A/)**
>
> IoT Made Easy With UNO, ESP-01, ThingSpeak and MIT App Inventor: This Instructable is competing on contests: "Remote Control", and "Arduino", If you like it, please give your vote by clicking at the above banner. Thanks a lot! ;-)
> Our goal will be...

---

<div class="post-metadata">

**Author:** ![theresio](https://avatars.discourse-cdn.com/v4/letter/t/a9adbd/32.png) [@theresio](https://forum.arduino.cc/u/theresio)\
**Post date:** [February 9, 2022, 3:44pm UTC](https://forum.arduino.cc/t/trying-to-bring-my-data-to-thingspeak/956684/5 "2022-02-09T15:44:35Z")

</div>

ill check this up now

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [August 8, 2022, 3:44pm UTC](https://forum.arduino.cc/t/trying-to-bring-my-data-to-thingspeak/956684/6 "2022-08-08T15:44:39Z")

</div>

Closed on August 8, 2022, 3:44pm UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
