2

For college, I have been tasked with a project where I have to give wireless connectivity to a sensor, and to collect the wireless data on the field and present it to the user I would like to use a raspberry pi Zero.

The plan is to have the Zero run a local webserver to present the information in an html, and also send it to a remote location if an internet connection is available.

So for that, I would like the zero to get internet access if connected over USB to a PC, so the user can access the zero webserver through that connection and the zero to be able to send packets through the internet, while also being able to connect it to an android phone doing usb tethering and have the same functionality (not at the same time of course, just one or the other depending on what the user has on hand). All without using keyboard mouse or display just plug and go.

I have seen posts illustrating how to do either of those things, but since they have different steps I am not sure if I can do both at the same time.

1
  • Frankly if you want network access don't use a PiZero. Use a proper Pi.
    – Milliways
    May 25, 2020 at 11:24

1 Answer 1

4

It should not be a problem to use OTG gadget mode on the USB connection to create an ethernet connection to your PC. It is part of the PC to route its internet connection to the RasPi and well known but out of scope here.

Doing tethering with an android cellphone is working out of the box with the default Raspbian image.

So it should be possible to use the USB connection either to the PC or to the android cellphone to get it connected to the internet.

An other issue is to address the RasPi from the internet to get connected to its webserver. Depending on what connection it is just using, there are different routes to access it and different port forwarding configurations, if you need that to access the RasPi. I think that it isn't easy to manage and may need additional third party support (e.g. public ip addresses, dyndns, reverse tunnel, gateway server on the internet, vpn provider, or something like that).

1
  • Addressing the pi should not be a real issue since the only device that must connect to the pi directly is the one providing it with internet (either PC or android phone) so I imagine it would be a simple issue of scanning the IP addresses of the LAN they created for it and using the only one there is.
    – metichi
    Jun 3, 2020 at 11:35

Your Answer

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

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