I need to send Arduino some instructions from the web. Basically I would have a web app with a few buttons, and when I press them they send an instruction to Arduino to move for example a motor or turn a lamp. This has to function remotely, so not locally.

I'm using an Arduino Yùn.

How should I do this? Websocket? How? Thanks!

  • You should send commands through a socket, yes. You can either make your own on your own port or you can just make HTTP requests (for instance GET requests). Just search for a tutorial that shows how to do it with a webpage, then discard all the webpage design and implement just the get pages. From the remote web app, then, call these pages. Or just make your own protocol
    – frarugi87
    Mar 12, 2016 at 16:43

3 Answers 3


It becomes lots easier if you see the yun as a linux computer with a arduino connected over serial.
Then the question becomes: what is the best way to send commands over the internet to a (linux) computer.
Answer: there are so many ways because there is no best way.
What are the main key drivers: Your linux computer needs to be reachable from the internet. That means opening your local network(firewall). The firewall is there for a reason. Do you have the skills to open your firewall and still be safe? If so you can run a service (lots of options) and reach your yun from anywhere on the internet. Just as you do locally.

If not you will need to go to a polling system. You use a server which is on the internet and send you request to that server. Your yun polls that server to get the messages you send.

There is a third option: If you can open your firewall from the internet, and you are the only user of the service and you very rarely need the service you can temporarily open the firewall when you need it .


Another option, if you can be limited to controlling your device from a mobile app, is blynk.cc. They provide mobile apps for Android and iOS, that let you build a control panel via drag-and-drop, and embedded platform libraries for Arduino, standalone ESP8266, RPi, and others, that talk both ways between the app and your embedded device, as well as between devices.

The embedded devices and the mobile apps communicate as clients to their servers (or to your server, if you choose to host the open-source server code) so you don't have to open any ports on your router or firewall.

You won't have the full freedom (or requirement!) of designing custom web-pages; but OTOH, you can be up and running with their example code in a few minutes.

I have a couple of room-temperature monitors on my desk that can report the temperature (plus history) to me anywhere I can get a web connection. I put two buttons on my panel to turn on, or blink, 2 LEDs on the board. With my feet up on the hearth I control the LEDs. There are slider-controls that can talk to the PWM ports as well. All the capabilities you need are there, at least to get started.


The simplest way to do this would be to host a webpage with the buttons on the Yùn itself, like for example this here. There are loads of examples for stuff like this out there.

To access it "remotely" - I presume you mean from anywhere on the internet - you would have to forward a port from your home router to the Yùn, like this. This will make the Yùn accessible from the internet. You only have to know your outside address (Google: "Find my IP") and then you can access your arduino from all over the world.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.