13walkec
Posts: 5
Joined: Wed Aug 10, 2016 4:04 am
Location: Central Wisconsin, USA

Posting data to internet = read anywhere

Mon Aug 22, 2016 1:08 pm

Hello all I'm stuck again,

I currently have my Arduino mega attached to my Raspberry pi via USB. I have it so my raspberry pi can read my Arduino data via the terminal window and via a Python 2 code. Now my next step is to get it so I'm able to read it over the internet no matter where I am. I have never done anything like this before and I have no idea what to do. I have done some research but still can't seem to get it... I tried to use Apache2 and can't get anything to work there and I'm not sure where to go from this point.

What I want to be able to do.
Take the 3 data sets that my Arduino is giving to my Pi and then be able to view them anywhere at any time. It doesn't have to be anything fancy (at this point anyway). So again if someone could point me in the right direction that would be appreciated!

I have internet access either wifi or ethernet available. I have access to Python 2 and have access to Python 3.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
"You know you're in the wrong class when more than 3 students are female, and they're all hot."

barry914
Posts: 48
Joined: Sat Aug 20, 2016 7:40 pm

Re: Posting data to internet = read anywhere

Mon Aug 22, 2016 2:50 pm

If I understand the question correctly, you want your Apache 2-based web server to be visible to the outside world. If it's working on your local area network, you only need to enable port forwarding on your router. Edit /etc/apache2/ports.conf

Code: Select all

sudo nano /etc/apache2/ports.conf
and add

Code: Select all

Listen (port number)
. You can leave the existing

Code: Select all

Listen 80
if you want to continue to access the server on your LAN on port 80. You must enable port forwarding on your router to forward the port number you chose and direct it to the IP of your Pi. Reboot your Pi and you should be able to access your Pi using the external IP of your router.

If you are using a router-assinged DHCP IP for your Pi, it would be best to assign a static IP instead. This is most easily done in your router's address distribution setup. You'll have to check the documentation for your router to see how this is done.

The last issue is you probably have an dynamic external IP assigned to your router by your provider, which is likely to change at any time. Either obtain a static IP from your provider ($) or use a dynamic DNS service like http://no-ip.com which will give you a host name that will route to your assigned IP by installing a process on PC connected to your LAN that tracks your IP and reports it to the dynamic DNS service.

steveb4pi
Posts: 62
Joined: Sun Aug 11, 2013 6:12 pm

Re: Posting data to internet = read anywhere

Mon Aug 22, 2016 3:42 pm

Just be aware, that if you use you use any device in your home for on-line Banking, eBay / PayPal / Amazon or anything else you can expect the 'script kiddies' to 'spot' a wide open server within 5 mins ..

After that it's only a trivial matter to instruct the Pi to 'trawl' all your other devices and deliver every log-in and password combination you ever made the mistake of allowing any web browser to 'remember' (yes = that's what the browser does when you click 'remember me' or 'log in automatically' on a web site == it remembers your log-in and delivers them automatically next time 'you' go to the 'same site' ..)

My suggestion is to think twice before 'opening up' to the world ...at the very least you need to 'isolate' your Pi from anything else in your home LAN (use wire not WiFi .. if the Pi has a WiFi adpater a hacker can use that to directly access any other WiFi device in range) and assign it to a different subnet) -

When it comes to running your own web sever .. well, you had better understand what ".htaccess" is all about (or just get used to a Bank Account with the maximium overdraft and debt collectors at your door demanding repayment of loans you never took out )

Return to “Beginners”