Controlling Arduino from an exernal (nice) webpage

Hi,

did anything change in the last 7 years when it comes to technologies used for a similar project?
I have Raspberry Pi which controls an Arduino and I'm planning to point the Raspberry to a website which would act as a user interface. The user would push a button in the browser which should send a command to an Arduino.

Thanks,
George

You are stilling thinking of it the same way the OP did, 7 years ago.

Maybe you didnt understand what was said?

If the webpage is HOSTED somewhere else... doesnt matter what 'computer' you use to view the webpage.

If the webpage itself was HOSTED on the RPi.. you wouldnt have any problems.

What you -could- do is,... have thew webpage save (whatever) to a database.. upon page submit/button press...

And then your ethernet/wifi enabled Arduino could call some script (hosted on same site as above).. ie: a PHP script or something.. that queries this database and returns the data/action/command you are looking for.

That being said.. that is a HORRIBLE idea/approach... and not efficient AT ALL.

Why?

Because your Arduino has NO IDEA if there is an action/command waiting for it.. so it just pols the database OVER AND OVER AND OVER AND OVER.. until it sees it has some data available.

Thats like:

  • calling your friend
  • his mom answers
  • says friend is not home
  • hangs up

You call right back and:

  • his mom answers
  • says friend is not home
  • hangs up

You call right back and:

  • his mom answers
  • says friend is not home
  • hangs up

You call right back and:

  • his mom answers
  • says friend is not home
  • hangs up

Instead of something like:

  • call your friend
  • his mom answers
  • says friend is not home
  • but this time,.... instead of hanging up.. she says I'll have HIM call YOU once he is available.

So now you dont have to spend all day polling over and over to see if your friend is home.

This last approach is called a PUB & SUB approach..or commonly referred to as MQTT server/broker...

Your Arduino's 'subscribe' to a topic (event).. and when there is a change.. an update is PUBLISHED to all 'subscribed' clients..

Usually an MQTT broker/server is a PC or a RPi... however there are web based (free?) services that you can use.

Perhaps your webpage can send some sort of data/update to one of these free MQTT webservices instead..?

Followup to a seven year old discussion?