Making Raspberry Pi Web Controls

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 มิ.ย. 2024
  • This video will show you how to control your Raspberry Pi's GPIO pins from a web interface. This will allow you to control motors, lights and other electronics from the web! You can even make your own Raspberry Pi Web controlled robot like this one:
    • Web Controlled Spybot
    More Web Programming Tutorials:
    HTML - • Tinkernut - Website Ba...
    Javascript - • Tinkernut - Website Ba...
    PHP - • Tinkernut - Website Ba...
  • วิทยาศาสตร์และเทคโนโลยี

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

  • @alanderson78
    @alanderson78 8 ปีที่แล้ว

    Very cool and concise. I hate watching 30 minutes of video to get as much information as you cover in 5. Can't wait to try it out.

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

    Haven't tried this yet but thanks for making it so simple and outlining all steps.

  • @creativemindz8977
    @creativemindz8977 9 ปีที่แล้ว

    Thanks for the inspiration dude keep up the creativity- loving your work

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

    Excellent video, best way I've found on the web of doing this, many thanks :)

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

    Awesome man. I will consider donating when i revisit to use this tutorial!

  • @alankaradas
    @alankaradas 9 ปีที่แล้ว

    I've never used this pie technology but still love the way you explain it. Amazing!

  • @thomasdamerau4339
    @thomasdamerau4339 8 ปีที่แล้ว

    Thanks! Works just fine. Looking forward for new cool stuff.

  • @tinujatinpatel
    @tinujatinpatel 8 ปีที่แล้ว

    Awesome. Very well detailed view and a good explanation on how things are working.

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

    Thanks! You made the PHP call quite complicated. No need to, just simple HTML code can call a second page.

  • @xcruell
    @xcruell 6 ปีที่แล้ว

    EXACTLY what i needed, that you sir

  • @quintenvanginderen8635
    @quintenvanginderen8635 6 ปีที่แล้ว

    thanks man it really worked i've been looking for this for 2 days. just make shure you have installed php... my webserver just showed the code that was in the php files.

  • @MrAnsariu
    @MrAnsariu 6 ปีที่แล้ว

    Great job bro... As i able i will support you with money
    And thanx for posting this usefull video

  • @kingsleyhart
    @kingsleyhart 9 ปีที่แล้ว

    Nice video buddy, very informative. Thank you for sharing with us :-)

  • @mgadbois124
    @mgadbois124 8 ปีที่แล้ว

    Nice video, thanks for sharing!

  • @thadeusronnthomas6522
    @thadeusronnthomas6522 7 ปีที่แล้ว

    great work..., Thanks for the video

  • @nisonusMusic
    @nisonusMusic 9 ปีที่แล้ว

    Nice tutorial!

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

    I love it. Can't wait to try it out

  • @PhG1961
    @PhG1961 6 ปีที่แล้ว

    Great video ! Thnxs for sharing !

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

    thanks a lot for this !

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

    Great Video helped me Greatly 👌

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

    love it, great work !!!

  • @captainahab4202
    @captainahab4202 7 ปีที่แล้ว

    Many thanks, brother.

  • @redeyz1885
    @redeyz1885 7 ปีที่แล้ว

    Thanks man liked subscribed

  • @joaofelipe2060
    @joaofelipe2060 9 ปีที่แล้ว

    Great video,Tinkernut.keep this good work coming.
    I have a doubt:The process to interact the webpage with the device would be similar to make if I use an Arduino instead?if so,would be doable to implement using a smartphone app to control the Raspberry/Arduino?

  • @muziekklas22
    @muziekklas22 9 ปีที่แล้ว

    Note AJAX is not only a link between PHP and JS. It just makes a request to any provided url. This DOES NOT limit it to PHP files (works with ASP.net, Ruby,Python,.. Even other HTML files)

  • @NodePoint
    @NodePoint 9 ปีที่แล้ว

    If you give the buttons name attributes then you can trigger the LED state using one PHP file (like triggerled.php), making it more cleaner. Of course that would mean checking the value of that input.
    I assume it was intended for it to be set out in a basic way.
    Also, I've noticed that you've used the system() function in this video. Does it matter which three functions (system(), shell_exec() and exec()) should be used?

  • @shawnstarr1
    @shawnstarr1 9 ปีที่แล้ว

    awesome stuff!

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

    This is great. I'd like to know what's the best lightweight webserver for the RPI, i use apache on my daily basis but can't tell which one is better in terms of resourses and extensibility, just in case..

  • @jebe5247
    @jebe5247 8 ปีที่แล้ว +6

    thank you for this video it works great:D I made a few changes I whould like to share
    little code i found to help it look right on a cellphone
    in the I added
    it shows up better on my phone so i dont have to zoom every time, I also renamed the controls.php to index.html so i can just use the pi's ip to bring up the buttions

  • @kashminderful
    @kashminderful 9 ปีที่แล้ว

    that was cool! Is there a way so that i could start or log off my computer remotely?

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

    cool man.. keep it up.

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

    awesome! how can I control it from the wider internet without port forwarding or third party wormholes/tunneling like dataplicity? Would it be possible to view this exact webpage but have it control the pi via the cloud?

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

    Great video! Is it possible to make the pi camera take a photo via a web interface?

  • @EastOnyx
    @EastOnyx 9 ปีที่แล้ว

    Great video :)

  • @shahnawaazsoogun9268
    @shahnawaazsoogun9268 8 ปีที่แล้ว

    hi,
    thanks for this awesome video :)
    i did it with a relay module, using your code i am able to turn on on relay
    i created all the pin on and pin off php pages for each relay, i have 8 relay in all
    but when using the buttons with different IDs i am not able to switch on and off individual relays..
    can you help me out please ?

  • @mariustancredi2192
    @mariustancredi2192 8 ปีที่แล้ว +1

    Why not use $.ajax() or $.get()?
    Also, will Node.JS gives a smoother control? I never tried Raspberry Pi so I'm not sure if Node.JS will even work on that...

  • @DarrenRainey
    @DarrenRainey 9 ปีที่แล้ว

    you could also use php shell exec

  • @violet-fire5848
    @violet-fire5848 4 ปีที่แล้ว

    thank you

  • @oldciscodude
    @oldciscodude 8 ปีที่แล้ว

    Outstanding!

  • @someguy3032
    @someguy3032 9 ปีที่แล้ว

    VERRY GOOD VIDEOS !

  • @ScottieD369
    @ScottieD369 9 ปีที่แล้ว

    Really Nice

  • @RuiSantosdotme
    @RuiSantosdotme 9 ปีที่แล้ว

    Which software you use to record your RPi screen? Are you simply connected via SSH with PuTTY and recording with camtasia?

    • @Tinkernut
      @Tinkernut  9 ปีที่แล้ว +1

      Rui Santos I'm using SSH and a screen recorder. It's on a mac, so I didn't need putty.

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

    I got pinon.php and pinoff.php run by changing ...system(... to echo exec('gpio -g mode ...'); perfect !!

  • @robr7363
    @robr7363 9 ปีที่แล้ว

    Here is a beer for helping me get my project going faster! *****

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

    What is a good way of implementing a listening service on multiple Pis to control the GPIO pins according to commands issued over ethernet?
    To be clear, I intend to have a bespoke program / web page on a windows or mac machine that takes commands through a GUI, such as button presses, to control multiple Pis on the same network.
    For example, 'click this button to turn on red LED on Pi 6', or 'type here and click send to display a message on Pi 2'. Thanks in advance.

  • @chadmasta5
    @chadmasta5 9 ปีที่แล้ว

    Is there a way to make a momentary button press? For example having one button, clicking it, and have it load the on page. for one second and then automatically switch to the off page. Sorry if I sound dumb but I am a total noob when it comes to this and I'm still learning.

  • @rorycormack7577
    @rorycormack7577 7 ปีที่แล้ว

    Hi. I am very interested in computing and programming involving the raspberry pi.
    I have watched your video and copied all the code from the first part (before the button website) but got some reason it will not work. I have a raspberry pi model b so I'm not sure if that will matter but I was wondering if you Could could go a bit more in depth or just give me a few tips or a bit of help.
    Thanks and I look forward to hearing from you.

  • @nathangek
    @nathangek 9 ปีที่แล้ว

    if you want a lot of buttons but don't want to copy the ajax code for every button you could also just listen for button clicks with the class of ajax or something and put the name of the file you want to visit in the button as an attribute like: then get the script file by doing: var scriptFile = $(this).attr("script-file"); and then a.open("GET", scriptFile);

  • @imppaco
    @imppaco 9 ปีที่แล้ว

    Is it possible to do an OnMouse event, so 1 button will light the LED when clicked, but turn off when released?

  • @pauls7544
    @pauls7544 9 ปีที่แล้ว

    Hi TinkerNUT love your shows but lately you seem to be a bit hung up on PI?, no offence meant or anthing but is there any chance you'd have time to take a look at the ioio boards? I like the idea of them but I'm wondering about the advantages or disadvantages of these platforms..would really like to hear your opinion on this. BTW Keep up the great work:)

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

    Ohh cool, Im assuming you can also use CSS on top of HTML to give that controller a nice and clean look.

    • @420oppa69
      @420oppa69 3 ปีที่แล้ว

      Ofc, Why not

  • @ohhhleslie
    @ohhhleslie 9 ปีที่แล้ว

    Thank you for this wonderful tutorial.
    I would like to ask what if we want the website to be available online? Like we'll be able to control the whole system anywhere as long as there is an internet connection?
    Also, what if we have several functions to control, or like for that video;
    if we have 5 LED to turn on/off, and the controls need to be in the same page as well.. will be doing this same thing? Thank you so much. I hope you can reply, it is for a project we're working on.
    Please & thank you.

    • @colinhoek
      @colinhoek 9 ปีที่แล้ว

      Leslie Brillantes if you want to access it on every internet connection on the world.you have to portforward

    • @ohhhleslie
      @ohhhleslie 9 ปีที่แล้ว

      Thank you for replying.. I'm sorry in advance, because im really an amateur in programming... But what do you mean by PortForward?

  • @marcus4619
    @marcus4619 8 ปีที่แล้ว

    do you have a video on how to make a pi server that is actually on the internet?

  • @ahmedadeli9405
    @ahmedadeli9405 7 ปีที่แล้ว

    hi my friend this is good tutorial
    but i have a quistion how to make this dashboard access for anyone in the web

  • @TheNikolaschoulakis
    @TheNikolaschoulakis 6 ปีที่แล้ว

    Hi thanks for this is there a link to Git or something with all of the code pls?

  • @mcandryan
    @mcandryan 9 ปีที่แล้ว

    Which is better in your opinion: arduino or raspberry pi ?

  • @itzmeuday
    @itzmeuday 9 ปีที่แล้ว +1

    +@Tinternut,
    can u please mention what are the prerequisites that needs to be installed before proceeding to code in php. if possible with commands. i am new to raspberry pi.

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

      You need Apache + PHP + WiringPI

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

    Is it possible to create this using a HTA type interface so the user can't alter or change the page or close it rather use it as a UI overlay in the Pi's OS?

  • @Honeypottr
    @Honeypottr 9 ปีที่แล้ว +1

    Yay he said Nginx correctly this time, virtual high five!

    • @Tinkernut
      @Tinkernut  9 ปีที่แล้ว +1

      chris I haha. i have you to thank for that ;-)

  • @jancastro4772
    @jancastro4772 9 ปีที่แล้ว

    Hello,
    I am kinda new with the raspberry pi. I was able to create the files. however, I cannot seem to understand how the process worked on how will the browser from a phone/computer be getting the php file to run. Is there something else that needs to be configured?

  • @robin_be
    @robin_be 9 ปีที่แล้ว

    Script tags should be placed just before the closing body tag, because they block every other request (stylesheets, images etc). Ok, doesnt make difference here, but its good practise in general

  • @badcatalex
    @badcatalex 9 ปีที่แล้ว

    I want some Raspberry PI!

  • @Jangofett165
    @Jangofett165 9 ปีที่แล้ว

    Can you do wireless web controls with an arduino?

  • @bigaone22
    @bigaone22 9 ปีที่แล้ว

    Hey Tinkernut, will you be so kind as to tell me how to use this code to control multiple led's thanks

  • @markuskosters4301
    @markuskosters4301 7 ปีที่แล้ว

    is there an easy way to activate the led as long as you click the button?

  • @attitudefever1
    @attitudefever1 6 ปีที่แล้ว

    what is the advantage of using PHP on backend than Node.js ?

  • @revtmyers1
    @revtmyers1 8 ปีที่แล้ว

    I really appreciate the video. Had no issues with the command line prompts nor any with creating the little PHP files for pin on and off, but for the life of me I cannot get the button one to work. I noticed the version is updated on jQuery to 1.11.3 and still absolutely nothing. Has anyone else got this to work yet? (Never mind I forgot to end the script.... Works awesome now. Thanks)

    • @bberg82
      @bberg82 8 ปีที่แล้ว

      +Thomas Myers How did you get it to work?

    • @revtmyers1
      @revtmyers1 8 ปีที่แล้ว

      +B Berg I literally just typed in his script. The only reason at first it didn't work for me was because I missed a but once added I no issues at all.

    • @bberg82
      @bberg82 8 ปีที่แล้ว

      +Thomas Myers I got the end bracket for the script but I still can't get buttons to work, it only works with direct page i.e. Ipaddress Pinoff.php

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

    how can we play a audio file as well as "Turning on the LED" whenever ON button is clicked ?

  • @antoinebrossault5015
    @antoinebrossault5015 8 ปีที่แล้ว

    nice !

  • @unicodefox
    @unicodefox 9 ปีที่แล้ว

    Is there a way so i can make a webserver to run commands (eg. Reboot system, startx, etc)

  • @DigitalMetal
    @DigitalMetal 9 ปีที่แล้ว +4

    Great video. A few suggestions.
    These are just my thoughts. What you have works, but you can slim down the code some.
    First off, as someone else already mentioned, you've already imported jQuery, so you could shorten your code up some by using it's $.get functionality.
    Another thing that you can do to really shorten things up is to not have two function for "ON" and "OFF". What you could do is give each button an attribute of some sort that has a value of "ON" or "OFF". You can then use one function and call it based on "CLASS" (or even object "TAG" in this case) rather then "ID".
    Again, what you have is great, and it's already done, so no need to change it. But you can save yourself some typing and code size in the future. Plus, creating one function instead of two would help you if you ever need to make changes. You wouldn't have to make every change twice.

  • @Xoan_Cosmed
    @Xoan_Cosmed 9 ปีที่แล้ว

    Which is better ? WiringPi or WebIOPi ? Could you make a tutorial about WebIOPi, please ?

    • @Tinkernut
      @Tinkernut  9 ปีที่แล้ว +2

      I beleive I've used WebIOPi in a previous video. I think WebIOPi is better because it's more full featured. But Wiring Pi is definitely easier to understand for beginners, which is why I used it.

  • @SkanderBibani
    @SkanderBibani 9 ปีที่แล้ว

    Cool.

  • @__-zu7tx
    @__-zu7tx 3 ปีที่แล้ว

    How do you use webcontrols to make a camera module take a picture?

  • @IoanKatalinn
    @IoanKatalinn 9 ปีที่แล้ว

    Unbelievable. CAN YOU MAKE THAT HAPPEN?

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

    I can add a camera field in the same page ?

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

    nice

  • @qoxop168
    @qoxop168 9 ปีที่แล้ว

    Is there an easy way to use this methode with UART?

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

    Good evening, please, I have a Raspberry project which takes values from the sensors and it stores it on a web server then the access of it is given that it is done using a mobile application, but I have a small problem " how to store this data on web server ".

  • @easyc4862
    @easyc4862 6 ปีที่แล้ว

    This tutorial was very helpful to me, however, I failed to get the javascript working. to resolve the issue I had to a redirection into the pinon.php and pinoff.php file so that once clicked instead of loading the page redirect back to the controller page. If this is something you would like to try just add the following meta tage below in head section of your pinoff and pinon files

  • @skaoi39
    @skaoi39 6 ปีที่แล้ว

    Hi, you can help me, how can use a public addres (public ip ) to access to web page thanks

  • @calvinjanson75
    @calvinjanson75 7 ปีที่แล้ว

    is there a way that i can see if a port already is opened?

  • @ftv5397
    @ftv5397 6 ปีที่แล้ว

    great.......

  • @zulfitrihazim1138
    @zulfitrihazim1138 8 ปีที่แล้ว

    bro kalau tak pakai wifi adapter tu boleh tak ?

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

    Hi bro I am new in programme I am not learn any programing language but in my project required to program resberry pi pls give me some tips about programming how to progr. It pls tell

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

    do raspberry pi act as a server automatically? if no then how to setup it as a server?

  • @nene7190
    @nene7190 8 ปีที่แล้ว

    Is there any way we could do this off of an actual webpage, so we could access it from anywhere, not just when we're connected to our home router?

    • @tomhartogs1362
      @tomhartogs1362 8 ปีที่แล้ว +2

      +Ne ke All you'd have to do is register your home ip-adress with a DNS server and allow port forwarding from your router to your pi. You will then be able to acces your webserver from anywhere.

  • @ms12349648
    @ms12349648 9 ปีที่แล้ว

    So what about if im planning to control motors on the raspberry pi while watching a stream on the web page. So for controlling the motors do we use the same code for rotating and everything else or we make diffrent ? If you know how please explain. Thanks

    • @Tinkernut
      @Tinkernut  9 ปีที่แล้ว

      UnknownDeveloper I actually just showed how to do that in my previous video.

    • @ms12349648
      @ms12349648 9 ปีที่แล้ว

      Tinkernut In the last one it was with the ball but not with the DC motors. So how can we control those DC motors. I would do the stream and all but the DC motors ??

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

    Can you make this work with the freenove car I’m using an android to control my pi car wanna make it so I don’t have to have to phones

  • @pearinnovation1419
    @pearinnovation1419 6 ปีที่แล้ว

    hii i want to control my robot and view video feed from pi cam on my web page but i dont want it should run on local but i can control from anywhere from internet. can you help me

  • @ayomaggotz
    @ayomaggotz 9 ปีที่แล้ว

    Interesting

  • @APTAC01
    @APTAC01 9 ปีที่แล้ว +3

    Ok, now I can make whole smart house with web controlled devices and home made rasp server

  • @deepakchawla35
    @deepakchawla35 7 ปีที่แล้ว

    hey can anyone tell me which device he uses with led to attach with raspberry pi

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

    good

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

    Will this work through internet or on same wifi network

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

      If you port forward the rpi private LAN ip to the public WAN ip of the modem, you should have access from the wider internet.

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

    I typed out the script but must have an error, is the script available somewhere for easy copy or download?

  • @nvang1985
    @nvang1985 8 ปีที่แล้ว +1

    I just wanted to point out that you included the incorrect script src library. Correct library that worked for me is here:
    ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"
    caused me a lot of pain and turmoil. Nevertheless, it works now.

  • @dfmrrd
    @dfmrrd 9 ปีที่แล้ว +1

    I need help for me it says URL not found

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

    Does anyone know if he has a copy of the code he used in this video online somewhere?

  • @kholikmawarjisaragih5818
    @kholikmawarjisaragih5818 7 ปีที่แล้ว

    not foud in cd www..
    can u help me, please.
    how to install webserver and php?