Write POST Data to Server with Arduino Uno with WiFi

Sdílet
Vložit
  • čas přidán 11. 07. 2019
  • Find code and diagrams at: www.elithecomputerguy.com/201...
    This project shows you how to send data to a server with POST from an Arduino Uno with WiFi and to have the server parse the data using a PHP script.
    Functional Parts in the Project:
    Arduino Uno - store.arduino.cc/usa/arduino-...
    Breadboard Kit - amzn.to/2Xih5ei
    560 Piece Jumper Wire Kit - amzn.to/2MsCLjL
    Analog Temperature Sensor - amzn.to/2Rkkl3k
  • Věda a technologie

Komentáře • 82

  • @smarty1064
    @smarty1064 Před 2 lety

    This guy is a Legend, when i started learning computer classes back in 2009 i saw some of his videos! A legend indeed!

  • @adityapandey7708
    @adityapandey7708 Před 4 lety

    Ohh !!!! Let me tell you that you are a saviour. I am a beginner with Arduino and almost spent a week to do this. I was looking for ESP-01 with arduino to achieve this. But here you are !! Thanks a lot. GOD bless :)

  • @ricardoramirez3084
    @ricardoramirez3084 Před 4 lety +7

    The information on your website and in the video was instrumental in helping me post data from the Arduino Uno WiFi Rev 2 to a website. One problem I struggled with was an error in the php code line 3 or $tempF = $_POST["temp"];. I was having problems so I started checking the error logs in my FTP application and found the following: Undefined index: temp. I changed line 3 to the following: $tempF = $_POST['temp'];. Maybe this problem is server specific. Just wanted to post this to help anyone encountering the same problem.

  • @okekekennedy2785
    @okekekennedy2785 Před 4 lety +1

    Thanks man I've really been learning a lot from your videos.

  • @Cameramorphic
    @Cameramorphic Před 5 lety +2

    Great series! I like how these concepts you show are gradually getting more sophisticated!
    It would be very cool if you could expand on this in a future video, because at the moment only the most recent temperature is stored in the HTML file, whereas saving to a file would also allow for logging previous temperatures.
    As I'm planning on building an RFID based workplace login/logout tracker, it would be great to just transmit the ID and let the PHP script log it to a HTML with timecode and other info, ideally in a (styled) table of some sort.

    • @rafehn
      @rafehn Před 4 lety

      Were you able to finish the project? I am also doing something similar.

  • @Paul_Burns
    @Paul_Burns Před 2 lety

    Thanks for making the time to teach me. Great video. Super approachable.

  • @KhalidAli-ju4lo
    @KhalidAli-ju4lo Před 4 lety

    Thanks man I've been searching this for a long time now really Thanks

  • @QualityRecord
    @QualityRecord Před 3 lety +1

    Thanks, got me kick started. Posting data all day long to my server. But, once the data is posted, I'd like to return data to the Arduino, just pass a few variables. 1) Post data to server, 2) Do some calculations with that data 3) Return some data to the Arduino. Could be as simple as 22,54,12

  • @capistor1
    @capistor1 Před 4 lety +1

    That was so helpful...there almost isnt any support for wifi and http protocols... This helped clear a little.

  • @rverm1000
    @rverm1000 Před rokem

    Fantastic video. Exactly what i want to do. Been learning python, html ,css , bootstrap to accomplish that goal.

  • @plontvh
    @plontvh Před 3 lety

    Very helpful video, thank you very much for the clarification 👌

  • @ferdibayir2433
    @ferdibayir2433 Před 3 lety

    I know nearly nothing about arduinos but I know some coding. I was looking for a solution to use in a field to check weather stats for the crops. The infos you gave are amazing and I will order the components and do the project right now. Thanks a lot!

  • @qangelov
    @qangelov Před 4 lety +1

    priceless, thanks man

  • @artemyevtushenko8722
    @artemyevtushenko8722 Před 4 lety +2

    Great content! Will an interrupt function break the WiFi connection?

  • @raybright5805
    @raybright5805 Před 4 lety +1

    Great tutorial ... Now did you do a followup on GET data from the server - couldn't see it on your site

  • @darren_bassett
    @darren_bassett Před 4 lety +6

    Many thanks for this. This has really helped me out.
    I tip my hat to you, sir.

    • @paulyousef7044
      @paulyousef7044 Před 3 lety

      i realize it is kinda off topic but do anybody know of a good place to watch new tv shows online ?

    • @kylerkieran6546
      @kylerkieran6546 Před 3 lety

      @Paul Yousef Flixportal :P

    • @paulyousef7044
      @paulyousef7044 Před 3 lety

      @Kyler Kieran Thank you, I signed up and it seems to work :D Appreciate it!

    • @kylerkieran6546
      @kylerkieran6546 Před 3 lety

      @Paul Yousef you are welcome :)

  • @rahalhettiarachchi8967

    Thank you Sir!

  • @HolzmannCFD
    @HolzmannCFD Před 2 lety

    Excellent. Thanks for your video. That was my missing input.

  • @Tobby4063
    @Tobby4063 Před 3 lety

    Excellent video.

  • @from2Dto3Dto4D
    @from2Dto3Dto4D Před rokem

    great explanation thanks

  • @bubbelut
    @bubbelut Před 2 lety

    Hey man awesome content! If it possible to receive a live stream to the webserver without refreshing the page constantly? (dynamic webserver?) for a local network?

  • @jorgevillarreal2245
    @jorgevillarreal2245 Před 4 lety

    Hello Eli, I'm currently trying to do what you did here, but for a power outlet, to be honest I'm kind of lost in how to get the readings of the power comsumption. Any advice on where to start ? Thanks alot for this kind of videos I really appreciate them.

  • @PaulCr125
    @PaulCr125 Před 3 lety

    Eli.... Great stuff. Can you comment on how you would do this with localhost and other than the normal port IE 8080? In other words a development machine.

  • @normd2004
    @normd2004 Před rokem

    Thanks!

  • @proCode10
    @proCode10 Před 3 lety

    I have an ESP 8266 (version 01) which therefore includes a GPI0 0 and a GPIO 2 (it seems to me that on this version is only usable the GPIO 2), but my concern is that all my sensors and other components are on the arduino card, so I don't see how to already transmit the data to the arduino card, and how to do with a single output to communicate all this to it, reciprocally from the card to the ESP

  • @iebstudent
    @iebstudent Před 4 lety

    Great! IMHO, the only thing you shoud clarify is that you are using the html file as a temporary data storage, i.e. Arduino (client A) posts data to server > server writes to html file in its filesystem > Browser (client B) gets html file with data

  • @EgyptFishingVideos
    @EgyptFishingVideos Před rokem

    Informative and to the point! Thanks.
    Will search your library for an equivalent ESP8266 setup (as compared to WiFi Uno used here)

  • @robboss4036
    @robboss4036 Před 4 lety

    Just starting out with arduino and was wondering: is it able to run a script that makes your computer go to a link

  • @medilies
    @medilies Před 4 lety +1

    I wnat to send data from my apache/php server to arduino client

  • @shawn576
    @shawn576 Před 3 lety

    Interesting tip with the timecode to check if the script is actually updating (at 13 minutes).

  • @adityasangamnerkar8516

    How can I do the same by using flask for making my webpage ?
    Thank you

  • @mr.boombastic7526
    @mr.boombastic7526 Před 4 lety +6

    Hey man, great content! I just wanna ask what should i change in the code if i want to insert 4 more sensors and send the data to a local server?

  • @yohanesie6038
    @yohanesie6038 Před 4 lety

    can you do this with IR sensor? to count people but connected to server

  • @PhilLu58
    @PhilLu58 Před 2 lety

    Hi Eli,
    I just need to send a string (variable) from a ESP32 (client) to another ESO32 (Access point) as string (also a variable :-))
    but I found a lot of PHP, JSon, LED or App management examples... is there a way to just send "hello"?
    Many thanks,
    Phil

  • @gechgondar4481
    @gechgondar4481 Před 4 lety +1

    how can we post fingerprint data to website

  • @andrejchranovsky4278
    @andrejchranovsky4278 Před 4 lety

    Hello! How to do it with a module enc28j60?

  • @raf1800
    @raf1800 Před 2 lety

    Awesome

  • @danemarkabad8651
    @danemarkabad8651 Před 4 lety

    Hi do this work for remote servers?

  • @ahmadcza
    @ahmadcza Před 4 lety

    can you help me to make the API instead of php I wanna use ASP api??

  • @kiranghatge4301
    @kiranghatge4301 Před 3 lety

    I need your help to do the "HTTP server which is waiting for HTTP Post request. These requests then proceed with string masks and parameters for LED and Display control are flirting. Then ESP turns on / off a certain LED and shows a number or string on Display.
    please help with how to start with.

  • @artem2060
    @artem2060 Před 4 lety +10

    Can you also do the same thing with a local server with an ip adress?

  • @davidecheverri1975
    @davidecheverri1975 Před 3 lety

    Thank you for this video... Its possible to have the code for a connection between Arduino UNO WIFI and google sheets. Tks

  • @sidhomamine1323
    @sidhomamine1323 Před 2 lety

    Thank you very much i would send data to node js server using WIFININA. Library how can i do this i’m stuff please can you help me ?

  • @markanthonysamson2357
    @markanthonysamson2357 Před 4 lety

    send the wifi data SSID and password to esp8266 using post?

  • @adubz54
    @adubz54 Před 4 lety

    can you do one on how to use a raspberry pi as a server and have the data be saved in something like a text file ?

  • @jay-rtillo8452
    @jay-rtillo8452 Před rokem

    can someone help me how to solve this warning. Undefined array key "temp"

  • @rupeshpatil1811
    @rupeshpatil1811 Před 2 lety

    What will be the server name and port number if i deployed my php on heroku? Please help!!

  • @999sosna999
    @999sosna999 Před rokem

    this php script is like on the server, not on the machine with arduino, right?

  • @Prizrak-cz5ur
    @Prizrak-cz5ur Před rokem

    Can you tell how to make this with external esp8266 wifi module?

  • @maincraft4034
    @maincraft4034 Před 5 lety

  • @user-fo9ce3hr5h
    @user-fo9ce3hr5h Před 4 lety

    what if i want to post in my local host, how should i change these lines:
    char server[] = "www.afdkjflas.com";
    if (client.connect(server, 80)) {
    client.println("POST /test/post.php HTTP/1.1");
    client.println("Host: localhost");
    client.println("Content-Type: application/x-www-form-urlencoded");

  • @juanclopgar97
    @juanclopgar97 Před 3 lety

    Hi, can someone help with this, How can you just listen to your arduino??, just that client, because you can have like 10 fake clients but you don't wanna do anything with that information, like a filter, JUST THAT DEVICE, to avoid "hacked information" and Is it posible refresh just that part of the HTML automatically?, can you use an AJAX for this? thank you.

  • @MrArod1207
    @MrArod1207 Před 3 lety

    Can someone help me out with espruino

  • @daniyalasif104
    @daniyalasif104 Před 4 lety +1

    Sir how you connect arduino with wifi without any external circut?

  • @AdrianRonin1
    @AdrianRonin1 Před 2 lety

    Nice, can you do it without manual refreshing?

  • @Adriel_Sandoval
    @Adriel_Sandoval Před 7 měsíci

    I'm trying this with the new Arduino Rev 4 WiFi and using python instead of php, and i can't get it to send data.

  • @mrtrader3661
    @mrtrader3661 Před rokem

    I tried but the time never changes and no value for temp. what is wrong?

  • @gouravkolhatkar3623
    @gouravkolhatkar3623 Před 5 lety

    What laptop you used ?

  • @muhammedozdogan5133
    @muhammedozdogan5133 Před 3 lety

    Good point 22:00

  • @rafaelsolis8599
    @rafaelsolis8599 Před 4 lety

    how to print data on list form with timestamp in php ?

  • @chengningloong7691
    @chengningloong7691 Před 4 lety

    is it possible to send data from multiple Arduino Unos with WiFi to a laptop?

    • @elithecomputerguy
      @elithecomputerguy  Před 4 lety

      yes... you should just add some type of device identifier for each device that posts...

    • @chengningloong7691
      @chengningloong7691 Před 4 lety

      @@elithecomputerguy i am not sure if I understand it correctly. Suppose that I have 10 Arduino unos with WiFi. When I send data from the first Arduino uno, I include a text of "1" in the data to indicate that it is from the first Arduino uno. For second Arduino uno, I include "2". And so on and so forth. Am I correct?

  • @manoelguimaraes37
    @manoelguimaraes37 Před 3 lety

    Amigo ensina a gente a fazer post via arduíno uno e o ethernet shild

  • @Unbiased201
    @Unbiased201 Před 3 lety

    here you already have website(server) but what if we dont have it do we have to create one or it will automatically created due to code?

  • @Unbiased201
    @Unbiased201 Před 3 lety

    but what should we do if we don't want to post but get command from laptop through server?

  • @superliegebeest544
    @superliegebeest544 Před 2 lety

    U make.good.videos. does post also works the other way? ,I want to make a webshop on a pi, that sends the order to the arduino that controls my vending machine

  • @flexterion
    @flexterion Před rokem

    Good! How can I send info to localhost?

  • @rahulshewani8323
    @rahulshewani8323 Před 2 lety

    Hi there, thankyou for the tutorial. I needed a small help. I am using an arduino wifi rev 2 board to connect to SQL on local host via Wifi. My php files are located in xampp/htdocs and I am able to write data in the sql table hosted on local host via writing an http request on my laptop. However when I try doing the same through my arduino, I face the following issue:
    HTTP/1.1 504 Gateway Time-out
    Server: WebProxy/1.0 Pre-Alpha

    My Arduino code:
    #include
    #include
    int HTTP_PORT = 80;
    String HTTP_METHOD = "GET";
    char HOST_NAME[] = "161.23.56.190";
    String PATH_NAME = "/index1.php";
    String queryString = "?temperature=29.1";
    //WiFiClient client;
    WiFiClient client1;
    #define SECRET_SSID "******"
    #define SECRET_PASS "******"
    ///////please enter your sensitive data in the Secret tab/arduino_secrets.h
    char ssid[] = SECRET_SSID; // your network SSID (name)
    char pass[] = SECRET_PASS;
    void setup() {
    Serial.begin(9600);
    // attempt to connect to Wifi network:
    Serial.print("Attempting to connect to WPA SSID: ");
    Serial.println(ssid);
    while (WiFi.begin(ssid, pass) != WL_CONNECTED) {
    // failed, retry
    Serial.print(".");
    delay(5000);
    }
    Serial.println("You're connected to the network");
    Serial.println();
    Serial.print("SSID: ");
    Serial.println(WiFi.SSID());
    IPAddress ip = WiFi.localIP();
    IPAddress gateway = WiFi.gatewayIP();
    Serial.print("IP Address: ");
    Serial.println(ip);

    }
    void loop() {
    // connect to web server on port 80:
    if(client1.connect(HOST_NAME, HTTP_PORT)) {
    // if connected:
    Serial.println("Connected to server");
    // make a HTTP request:
    // send HTTP header
    client1.println(HTTP_METHOD + " " + PATH_NAME + queryString + " HTTP/1.1");
    client1.println("Host: " + String(HOST_NAME));
    client1.println("Connection: close");
    client1.println(); // end HTTP header
    delay(5000);
    }
    while(client1.connected()) {
    if(client1.available()){
    // read an incoming byte from the server and print it to serial monitor:
    char c = client1.read();
    Serial.print(c);
    }
    }
    // the server's disconnected, stop the client:
    client1.stop();
    Serial.println();
    Serial.println("disconnected");
    }
    PHP file:
    It would be of great help if you could have a look at it and help me out with it!