Hosting on local network - sensors via vpn?

Hello everyone nice to have a new forum for farmOS,

I am using farmOS on a local server and connect via VPN to it when I am in the field.
I used this setup because it was easy and I believe its a bit more secure this way especially if I miss a important security update. I know I could host it on farmier but I would like to run it myself.

I had to learn a bit about raspberry pi for my weather station so now I would like to try
this project https://farmhack.org/tools/collecting-sensor-data-farmos-using-grovepi-and-node-red
and integrate sensor data into farmOS.

What would be the ideal network setup to keep farmos on the local network?

My plan would be.

  1. collecting data with a solar power wifi pi
  2. send it to a solar powered wifi router (will be in the field for the weather station)

3.? Use the router VPN to connect to the my home server (that runs farmOS)
or
3.? Have a VPN connection running from the local server to the router or sensor Pi (not sure if this is even possible)

What setup would you suggest?

Another question would be how to graph the data that are collected in farmOS.
Is there a easy way without learning to use mathlab or javascript to use plotly.js?

BTW are there any plans to integrate Weewx data feeds to farmOS?

Thanks!

3 Likes

@Lars I’m curious about your VPN setup. Mostly depends if your home is physically near the field in question.

Would the wifi router in the field be extending your home network (assuming the field is close to your home)? If so, you might want to consider modifying the VPN so it’s only required when accessing from a WAN (outside your home network). Otherwise, I would configure the router to connect to the VPN - the major advantage is that anything else you connect to the router would already be connected to the VPN and require less configuration in the future (even your phone if you connect to that wifi router when you’re out in the field)

You also might be interested in using the LoRa protocol for your sensor… if the field isn’t too far away (within 1-2km) it might be easier and cheaper! You could power a LoRa gateway at your house or barn (wherever you have power) instead of via solar panel.

Also, re: node-red, I’m interested in creating a farmOS library for node-red. Adding support for sensors would be a great (and primary) use case. Check out my post: Node-RED farmOS library - I haven’t gotten to this yet, but definitely am interested in using more node-red!!

Oh also…

Is there a easy way without learning to use mathlab or javascript to use plotly.js?

Data from sensors are automatically graphed in an embedded plotly.js graph on the Sensor asset’s page. It works quite well! I just set up auto graphing of solar data and got these graphs “for free” ! Note that right now the graphs are limited to the last 100 data points. But this will likely be changed going forward…

I’m not familiar with Weewx data feeds, but looks like it would be a great thing to support :slight_smile:

3 Likes

@paul121 Thank you very much for your fast and detailed reply!

The TP Link router in the field has an internal VPN option that I plan to use to read data from my home pc. I assume I can reach this router via VPN from my home network (still having some setup issues). Our just recently established “farm” is at the moment just one field about 40min away from home. Therefore getting as much information with sensors is very useful.
I completely agree with the setup you suggested
SensorPI --> LTE Field Router with VPN --> Public Network --> VPN Server - Synology on home network
The problem with this might be that I need a VPN client app for connecting on the LTE router.
I guess I could use the (weather collection) pi as a VPN server with a client app but that would meen
SensorPI --> Wifi to LTE Router (probably longer wifi range) --> LAN to Weather Pi --> VPN and LAN to LTE Field Router --> Public Network --> VPN Server… This setup would probably too complicated.

I had never heard of LoRa its certainly very interesting and I will look into it in the future.
I envision that I have about 10 solar sensor Pi in the field that collect soil moisture readings. For this LoRa might be the way to go depending how complicated it is. My weather station also uses 868 Mhz would there be any interference with LoRa or is this unlikely?

This node-red lib is very interesting although I have no idea how this works.

Thank you for mentioning the data graphing option! Now its even more likely that I try this project :grinning:

2 Likes

The problem with this might be that I need a VPN client app for connecting on the LTE router.

I think I see what you’re saying… it probably depends how the LTE router/modem is setup.

  • If it is an LTE Modem with built in Wifi router, I’m not quite sure how you will connect the TP Link Router to the LTE Modem. The TP Link could “Extend” the Wifi, but this probably won’t allow you to configure the VPN client… like you said, in this case the LTE modem/router would need the VPN client. OR each SensorPi would need to have a VPN client themselves (which is probably possible on a raspberry pi?)

  • If the LTE modem can plug into the TP Link router via ethernet, then you should be able to configure your TP Link router to connect to your home VPN Server (as you described). Sensors connected to the TP Link wifi should be on the VPN, too, and be able to send data to farmOS.

My weather station also uses 868 Mhz would there be any interference with LoRa or is this unlikely?

I think that’s unlikely? LoRa uses 868 in Europe and 915 in Americas. Even if you’re in Europe, might just need to keep radios a little distance apart, ie not next to each other? I’m not an expert on that though :smiley:

1 Like

Hi @Lars! I’ll defer to @paul121 on the VPN stuff - he’s more knowledgeable on all those considerations.

Regarding weewx - I too am interested in this! I actually got a weather station as a gift and was hoping to set it up with weewx and a custom script to push to farmOS, but unfortunately I haven’t yet been able to make the connection between weewx and the station (it is a newer module and maybe isn’t “supported” yet). I would love to hear if you have any success. I imagine we could eventually build a general-purpose script that would connect to weewx and then push data to farmOS sensors. Perhaps this could warrant its own forum post.

Hi @mstenta, I have written a new topic that includes all the knowledge that I have gathered about weewx and possibilities to get data into farmOS.
edit:
It can be found here Weewx data integration - Dev idea

1 Like

@paul121 thank you very much for your reply.
I think the VPN client app on the Pi is the best option.
I found one example for openVPN it sounds pretty easy to setup.
edit: forgot the link http://kernelreloaded.com/openvpn-client-on-raspberry-pi/

I certainly will keep the LoRa Option in mind, sounds very promising.

2 Likes