Write POST Data to Server with Arduino Uno with WiFi

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 ก.ค. 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
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 82

  • @smarty1064
    @smarty1064 2 ปีที่แล้ว

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

  • @okekekennedy2785
    @okekekennedy2785 4 ปีที่แล้ว +1

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

  • @adityapandey7708
    @adityapandey7708 3 ปีที่แล้ว

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

  • @Paul_Burns
    @Paul_Burns 2 ปีที่แล้ว

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

  • @Cameramorphic
    @Cameramorphic 4 ปีที่แล้ว +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 4 ปีที่แล้ว

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

  • @KhalidAli-ju4lo
    @KhalidAli-ju4lo 3 ปีที่แล้ว

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

  • @ricardoramirez3084
    @ricardoramirez3084 4 ปีที่แล้ว +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.

  • @rverm1000
    @rverm1000 ปีที่แล้ว

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

  • @capistor1
    @capistor1 4 ปีที่แล้ว +1

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

  • @darren_bassett
    @darren_bassett 4 ปีที่แล้ว +6

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

    • @paulyousef7044
      @paulyousef7044 2 ปีที่แล้ว

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

    • @kylerkieran6546
      @kylerkieran6546 2 ปีที่แล้ว

      @Paul Yousef Flixportal :P

    • @paulyousef7044
      @paulyousef7044 2 ปีที่แล้ว

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

    • @kylerkieran6546
      @kylerkieran6546 2 ปีที่แล้ว

      @Paul Yousef you are welcome :)

  • @QualityRecord
    @QualityRecord 3 ปีที่แล้ว +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

  • @ferdibayir2433
    @ferdibayir2433 3 ปีที่แล้ว

    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!

  • @plontvh
    @plontvh 3 ปีที่แล้ว

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

  • @raybright5805
    @raybright5805 4 ปีที่แล้ว +1

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

  • @artemyevtushenko8722
    @artemyevtushenko8722 4 ปีที่แล้ว +2

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

  • @HolzmannCFD
    @HolzmannCFD 2 ปีที่แล้ว

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

  • @bubbelut
    @bubbelut 2 ปีที่แล้ว

    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?

  • @mr.boombastic7526
    @mr.boombastic7526 4 ปีที่แล้ว +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?

    • @hectortabora6904
      @hectortabora6904 3 ปีที่แล้ว

      I have the same question!

    • @andremurilobr
      @andremurilobr 2 ปีที่แล้ว

      Me too,.. great video! Thank you Eli

    • @haileysanphy2288
      @haileysanphy2288 2 ปีที่แล้ว

      I am also looking for a solution to this! I look forward to seeing what he has to say

  • @qangelov
    @qangelov 4 ปีที่แล้ว +1

    priceless, thanks man

  • @PaulCr125
    @PaulCr125 3 ปีที่แล้ว

    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.

  • @from2Dto3Dto4D
    @from2Dto3Dto4D ปีที่แล้ว

    great explanation thanks

  • @shawn576
    @shawn576 3 ปีที่แล้ว

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

  • @jorgevillarreal2245
    @jorgevillarreal2245 4 ปีที่แล้ว

    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.

  • @proCode10
    @proCode10 3 ปีที่แล้ว

    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

  • @Tobby4063
    @Tobby4063 3 ปีที่แล้ว

    Excellent video.

  • @EgyptFishingVideos
    @EgyptFishingVideos ปีที่แล้ว

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

  • @rahalhettiarachchi8967
    @rahalhettiarachchi8967 4 ปีที่แล้ว

    Thank you Sir!

  • @iebstudent
    @iebstudent 3 ปีที่แล้ว

    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

  • @adityasangamnerkar8516
    @adityasangamnerkar8516 3 ปีที่แล้ว

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

  • @artem2060
    @artem2060 4 ปีที่แล้ว +10

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

  • @robboss4036
    @robboss4036 4 ปีที่แล้ว

    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 4 ปีที่แล้ว +1

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

  • @normd2004
    @normd2004 ปีที่แล้ว

    Thanks!

  • @PhilLu58
    @PhilLu58 2 ปีที่แล้ว

    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

  • @yohanesie6038
    @yohanesie6038 3 ปีที่แล้ว

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

  • @davidecheverri1975
    @davidecheverri1975 3 ปีที่แล้ว

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

  • @gechgondar4481
    @gechgondar4481 4 ปีที่แล้ว +1

    how can we post fingerprint data to website

  • @sidhomamine1323
    @sidhomamine1323 2 ปีที่แล้ว

    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 ?

  • @ahmadcza
    @ahmadcza 4 ปีที่แล้ว

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

  • @adubz54
    @adubz54 4 ปีที่แล้ว

    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 ?

  • @andrejchranovsky4278
    @andrejchranovsky4278 4 ปีที่แล้ว

    Hello! How to do it with a module enc28j60?

  • @kiranghatge4301
    @kiranghatge4301 3 ปีที่แล้ว

    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.

  • @999sosna999
    @999sosna999 ปีที่แล้ว

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

  • @raf1800
    @raf1800 2 ปีที่แล้ว

    Awesome

  • @jay-rtillo8452
    @jay-rtillo8452 ปีที่แล้ว

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

  • @Prizrak-cz5ur
    @Prizrak-cz5ur ปีที่แล้ว

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

  • @danemarkabad8651
    @danemarkabad8651 3 ปีที่แล้ว

    Hi do this work for remote servers?

  • @markanthonysamson2357
    @markanthonysamson2357 4 ปีที่แล้ว

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

  • @Adriel_Sandoval
    @Adriel_Sandoval 5 หลายเดือนก่อน

    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.

  • @rupeshpatil1811
    @rupeshpatil1811 2 ปีที่แล้ว

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

  • @juanclopgar97
    @juanclopgar97 3 ปีที่แล้ว

    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.

  • @mrtrader3661
    @mrtrader3661 ปีที่แล้ว

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

  • @user-fo9ce3hr5h
    @user-fo9ce3hr5h 4 ปีที่แล้ว

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

  • @daniyalasif104
    @daniyalasif104 4 ปีที่แล้ว +1

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

  • @AdrianRonin1
    @AdrianRonin1 2 ปีที่แล้ว

    Nice, can you do it without manual refreshing?

    • @angry_moose94
      @angry_moose94 ปีที่แล้ว

      you would need to use javascript.

  • @maincraft4034
    @maincraft4034 4 ปีที่แล้ว

  • @MrArod1207
    @MrArod1207 3 ปีที่แล้ว

    Can someone help me out with espruino

  • @muhammedozdogan5133
    @muhammedozdogan5133 3 ปีที่แล้ว

    Good point 22:00

  • @chengningloong7691
    @chengningloong7691 4 ปีที่แล้ว

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

    • @elithecomputerguy
      @elithecomputerguy  4 ปีที่แล้ว

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

    • @chengningloong7691
      @chengningloong7691 4 ปีที่แล้ว

      @@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 3 ปีที่แล้ว

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

  • @gouravkolhatkar3623
    @gouravkolhatkar3623 5 ปีที่แล้ว

    What laptop you used ?

  • @rafaelsolis8599
    @rafaelsolis8599 4 ปีที่แล้ว

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

  • @Unbiased201
    @Unbiased201 3 ปีที่แล้ว

    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 3 ปีที่แล้ว

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

  • @superliegebeest544
    @superliegebeest544 2 ปีที่แล้ว

    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 ปีที่แล้ว

    Good! How can I send info to localhost?

    • @Roxill_19
      @Roxill_19 4 หลายเดือนก่อน

      I wanna know to bro

  • @rahulshewani8323
    @rahulshewani8323 ปีที่แล้ว

    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!