Posts: 2
Joined: Thu Sep 12, 2019 5:37 pm

Automation system from Internet via Pi

Thu Sep 12, 2019 6:14 pm

Hello all,

I have a project in mind to control my Raspberry Pi through the internet(possibly from my website) to get data and/or control some processes from far away and I would like to know the best possible ways on how to start on this, here is the draft on what the system will look like:
- A Raspberry Pi 3B+ connected to a monitor, an internet modem(through lan or Wi-fi) and a microcontroller (lets say named A1) through USART.
- The microcontroller(A1) is used to get the inputs(from various sensors) and also give the outputs(motor control, light switch on/off etc.) and is connected to the Raspberry Pi via USART (2-way communication between them).

I can handle the input-output and the uart connection part of the microcontroller, I will also write a gui (probably in pyqt5) for other users in the vicinity to observe and control the system.

What I want is help or even the direction I'm supposed to go on how to communicate the Pi with my website, I don't have much knowledge on that part (what topics, protocols, languages should I look up, etc.). The website I have is made through wordpress, I believe I can make an interface on the website for specific users to control the system. If possible, after I make the communication, I want the access to be limited, maybe accesing only specific memory blocks of the Pi, so that I don't have control over any other things.

Helpful research, video and/or experience is appreciated.

Thanks in advance

Posts: 103
Joined: Sat Sep 29, 2018 11:27 am

Re: Automation system from Internet via Pi

Sun Sep 15, 2019 6:22 pm

This all depends on your website :-)

Do you have remote file access to your web server?
If you can then this is great news.
You can simply get your RPi to transfer your data backwards and forwards using scp. and script your web page to look at / update the files that you periodically update with your RPi.

If you don't then the only way I can think to do this would be to create a number of custom pages for the RPi to use. The Pi then logs in as a 'specific user' with access to those pages. You will then need to send data by having your Pi pretend to be a web browser :-)


Posts: 2
Joined: Thu Sep 12, 2019 5:37 pm

Re: Automation system from Internet via Pi

Mon Sep 16, 2019 8:04 pm

I believe that the website is hosted on a linux space, and in the website there are some tutorials on remote access of mysql through cpanel and such, so I guess there is. So maybe I can gather a space in MYSQL and inject information there regularly and display that in Wordpress.
I was searching on what methods to use for communicatng as well and the ones I've stumbled upon was rest api and websockets, and as I've seen there is some knowledge on how to use rest api with wordpress, I'm also going to take a look at that.
Aside from that, instead of using a python interface on the Pi maybe I can go with node.js to control the hardware on pi and an html gui, after that maybe I can port that out and get in connection with the wordpress rest api ? (I'm still hazy on the topic, might need to look deeper into it, but I also don't want to dive in unnecessarily deep and get things complicated)

Posts: 6
Joined: Mon Aug 07, 2017 11:21 pm

Re: Automation system from Internet via Pi

Mon Sep 16, 2019 10:46 pm

You might find PiSimpleGUI to be an easy solution to your GUI and Web interface requirements.

Python GUI For Humans - Transforms tkinter, Qt, Remi, WxPython into portable people-friendly Pythonic interfaces


Posts: 103
Joined: Sat Sep 29, 2018 11:27 am

Re: Automation system from Internet via Pi

Wed Sep 18, 2019 7:49 am

You are talking about controlling the hardware on the RPi vi\ a remote website.

May I make a recommendation

decouple, Decouple, DECOUPLE :-)

Split your programs into a modular system.

Have all your RPi hardware contol and feedback simply talk to a file on your RPi (this could be a RAMDisk in /dev/shm because you don't care about the data if the unit gets rebooted)

Have a separate program handle data transfer to and from your Web-server PC (as the web-server PC is remote make sure it is encrypted! ) this could be TLS transport to a MYSQL database running on your web-server PC (Don't forget there should be a firewall on the web-server PC as well, and you will need to open a port for your RPi to access from as this will be data arriving on a different port than https/http - you may be able to restrict this port to just the location of your RPi)

Finally have your web server interact with data from your MYSQL database.

have fun


Return to “Automation, sensing and robotics”