AnthonyTheKoala
Posts: 7
Joined: Sat May 27, 2017 10:17 pm

Want headless via putty & download via wireless

Sat May 27, 2017 10:47 pm

This is my first ever posting. I believe this may be appropriate because I want to avoid trouble for the following enquiry.

Is there a way of having a headless control via a UART and at the same time a wireless (WiFi) connection. Yes I know there is plenty of material regarding headless control via UART, but wish to use the RPi's wireless to download at the same time. My RPi is an RPi Wireless Zero.

Put it another way.

One has a Windows computer. The Windows computer is connected via USB to the RPi's USB. Control/communication is via the putty program. One wants to download updates or new programs to the RPi via the wireless especially if the programs or updates are very large. Downloading via 'Putty' may be slow.

To put it in another way: I would like to control the RPi via Windows through Putty. At the same time download programs and or updates to the RPi via wireless or Ethernet (using an usb/ethernet adapter).

Yes I know there is plenty of material on headless RPi control. BUT is there a method of downloading updates or new programs via Ethernet (10/100MBs) or WiFi with headless control via "Putty" through a Windows 8 machine.

I would like to know also what I need to do to the RPi's configuration files and any other programs before I run the RPi. Again I would like to enable 'Putty' control of the RPi via a Windows machine but download programs, updates, large files via the RPi's wireless.

Thank you
Anthony, Sydney NSW

What do I need to do to the RPi's configuration files before I start this.

klricks
Posts: 7172
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Want headless via putty & download via wireless

Sun May 28, 2017 4:26 am

Since you asked about UART, yes you can connect to the RPi console by UART with an appropriate 3V3 TTL to RS232 adapter module attached to the RPi GPIO pins TX, RX and GND. Then to your Windows machine via RS232 cable or RS232 to USB adapter if your Windows computer does not have a legacy serial port.
You could then configure WIFI and enable SSH etc. Once WIFI and SSH are enabled then there is no point to use the UART console anymore as you can connect to the RPi from Windows over ssh via WIFI over your local network.

HOWEVER All the above is not really needed. Instead you can configure WIFI and enable SSH in another much easier way without UART and all the adapters.
You can just put a valid copy of wpa_supplicant.conf with your WIFI credentials in the /boot folder of the SD card. This will be the only folder visible when the SD card is in a Windows computer.
To enable ssh just put an empty file with filename ssh or ssh.txt in the same /boot folder. You can make the ssh files with Windows Notepad. (Be sure to rename the wpa file and drop the .txt extension).
Then boot the SD card in the RPi.
If successful then the wpa_supplicant.conf file will be moved to its proper location and the ssh file will be deleted.
WIFI and SSH should now work.

Note all this is assuming that your RPi and Windows machine will be connected to your local network (router) via WIFI or Wired connection.

You could now also enable VNC and have remote access with GUI. (SSH is console only).

Also once WIFI and/or Wired connection is established then you can use either the UART connection or SSH or VNC connection to do updates, install software etc. There is nothing special to send over the PuTTy connection.
It just works as if you were using a local keyboard/mouse etc.
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

AnthonyTheKoala
Posts: 7
Joined: Sat May 27, 2017 10:17 pm

Re: Want headless via putty & download via wireless

Sun May 28, 2017 7:28 pm

Thank you for your reply, it is appreciated. The overall aim is to connect the RPi via my computer to download large files and/or run programs as a headless arrangement such that one can download/update a files in the most rapid time. The RPi's GPIO UART connection has a limitation of up to 1.2MBs. When using the wireless network inbuilt such as the RPiZW or through a USB dongle, one would like to download files through a headless arrangement at rates >>> 1.2MBs, say 54MBs or 150MBs. Again I thank you for your assistance.

There are two sections to this reply, what I want to do and what I want to do with a variation.

This is what I want to do
I understand with the latter method after the "HOWEVER" paragraph will save me time.
For the 'VNC' (virtual network computing) software, I presume that you are referring to the using VNC on the Windows computer to connect to the RPi rather than the pre-installed version in the RPi.
Accordingly I have downloaded three versions of the VNC program: Setting up the conf file for the wireless and ssh file in the /boot folder
  • In your computer, open wpa_supplicant.conf

Code: Select all

network={
    ssid="SSID"
    psk="password"
    key_mgmt=WPA-PSK
}
Question: Do I need a 'sniffer' program to work out the "SSID"?
  • Using a text editor, create an empty file called ssh.
Don't write anything in it.
  • Reboot the RPi.

Code: Select all

   @reboot 
Example of code to run on RPi through laptop using VNC
This is an example set of commands I want to perform on the RPi through my laptop I want to do via VNC.

Code: Select all

wget https://github.com/[i]whatever project[/i]archive/master.zip
unzip and rename the project:

Code: Select all

unzip master.zip && mv fred-master gifcam
Run the installer script:

Code: Select all

sudo ~/[i]whatever project[/i]/installer.sh
What I want to do with a variation
In the previous section, with both laptop's and RPi's require a separate logon to the wifi - one logon for the computer and another logon for the RPi. please correct me on this if I am wrong - thank you

However I don't want to log on separately. For example, I would like to use the University's WiFi and download/update files to my RPi. I would like to use the headless connection, this time via VNC and/or by ssh ('putty') as described above in the reply. I would the downloads to the RPi to go via the laptop.

There is a "Virtual Router" program which turns your laptop's PC into a 'virtual' router such that you can connect other computers such as the RPi to the laptop to a particular WiFi connection, say your university's.

Questions please
In relation to the RPi, what do I need for the RPi to 'log' into my laptop?
If my laptop's connection to the University's WiFi is say 54MBs using my laptop's wifi connection, OR assuming I have setup my laptop's usb 150MBs wifi dongle to connect to the University's WiFi network, will the RPi's Wireless Zero be able to download files to say 54MBs.

Alternatively.
If I connect a usb/LAN adapter to my RPiWZ and connect to my laptop and want to go to logon my University's WiFi, what is/are the logon credentials for connecting the RPi to the laptop. Again, aim is to connect the RPiWZ to the laptop which connects to the WiFi.

Thank you,
Anthony from Sydney Australia

klricks
Posts: 7172
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Want headless via putty & download via wireless

Mon May 29, 2017 12:43 am

AnthonyTheKoala wrote:Thank you for your reply, it is appreciated. The overall aim is to connect the RPi via my computer to download large files and/or run programs as a headless arrangement such that one can download/update a files in the most rapid time. The RPi's GPIO UART connection has a limitation of up to 1.2MBs. When using the wireless network inbuilt such as the RPiZW or through a USB dongle, one would like to download files through a headless arrangement at rates >>> 1.2MBs, say 54MBs or 150MBs. Again I thank you for your assistance.
The UART connection would not be suitable for downloading. You would issue commands over UART but the actual download would be over WIFI or Ethernet.
AnthonyTheKoala wrote:......I understand with the latter method after the "HOWEVER" paragraph will save me time.
For the 'VNC' (virtual network computing) software, I presume that you are referring to the using VNC on the Windows computer to connect to the RPi rather than the pre-installed version in the RPi.
Accordingly I have downloaded three versions of the VNC program:
None of the above. The RealVNC server needs to be running on the RPi. To do that you need only enable VNC on the RPi by using sudo raspi-config. This is of course assuming that you are running the full Raspbian Jessie (Pixel) OS.

The remote client will need to be running the viewer software from here: https://www.realvnc.com/download/viewer/ This viewer software is free and unlimited and not the same as you linked to above. The Home (free) version or other versions are only required if you plan to use the cloud service. (Connect to your RPi from outside your local network).
AnthonyTheKoala wrote:
Setting up the conf file for the wireless and ssh file in the /boot folder
  • In your computer, open wpa_supplicant.conf

Code: Select all

network={
    ssid="SSID"
    psk="password"
    key_mgmt=WPA-PSK
}
Question: Do I need a 'sniffer' program to work out the "SSID"?
Edit the file and enter your SSID and psk with the same credentials that you would use to connect any other device to your WIFI network.
You may need to use a sniffer or look in your routers status pages to find the IP address of the RPi. Or configure your router to use DHCP to MAC reservations so the RPi always gets the same IP.
AnthonyTheKoala wrote:
  • Using a text editor, create an empty file called ssh.
Don't write anything in it.
It does not matter if the file contains text or not. An empty file is less keystrokes .........
AnthonyTheKoala wrote: Example of code to run on RPi through laptop using VNC
This is an example set of commands I want to perform on the RPi through my laptop I want to do via VNC.

Code: Select all

wget https://github.com/[i]whatever project[/i]archive/master.zip
unzip and rename the project:

Code: Select all

unzip master.zip && mv fred-master gifcam
Run the installer script:

Code: Select all

sudo ~/[i]whatever project[/i]/installer.sh
Most software is downloaded and automatically installed using sudo apt-get but those commands above can be done as well. Just make sure the code was compiled to run on the RPi, and NOT x86 or any other platform.

Code: Select all

sudo apt-get update
sudo apt-get install program
AnthonyTheKoala wrote: What I want to do with a variation
In the previous section, with both laptop's and RPi's require a separate logon to the wifi - one logon for the computer and another logon for the RPi. please correct me on this if I am wrong - thank you

However I don't want to log on separately. For example, I would like to use the University's WiFi and download/update files to my RPi. I would like to use the headless connection, this time via VNC and/or by ssh ('putty') as described above in the reply. I would the downloads to the RPi to go via the laptop.

There is a "Virtual Router" program which turns your laptop's PC into a 'virtual' router such that you can connect other computers such as the RPi to the laptop to a particular WiFi connection, say your university's.

Questions please
In relation to the RPi, what do I need for the RPi to 'log' into my laptop?
If my laptop's connection to the University's WiFi is say 54MBs using my laptop's wifi connection, OR assuming I have setup my laptop's usb 150MBs wifi dongle to connect to the University's WiFi network, will the RPi's Wireless Zero be able to download files to say 54MBs.

Alternatively.
If I connect a usb/LAN adapter to my RPiWZ and connect to my laptop and want to go to logon my University's WiFi, what is/are the logon credentials for connecting the RPi to the laptop. Again, aim is to connect the RPiWZ to the laptop which connects to the WiFi.

Thank you,
Anthony from Sydney Australia
You can do internet connection sharing with a direct connection from RPi to laptop. I have never done so myself but there are many discussions in these forums about that and also Google has many tutorials as well.
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

jahboater
Posts: 5825
Joined: Wed Feb 04, 2015 6:38 pm
Location: West Dorset

Re: Want headless via putty & download via wireless

Mon May 29, 2017 8:56 am

It seems you are over-thinking it.

If this is all you want, then it is simple:-
AnthonyTheKoala wrote: To put it in another way: I would like to control the RPi via Windows through Putty. At the same time download programs and or updates to the RPi via wireless or Ethernet (using an usb/ethernet adapter).
The internet connection is multi-tasking, you only need one connection.

Plug the Pi into the router with your usb/ethernet adapter.
(Wireless is much slower, and needs the extra setup step to provide the SSID and credentials).

The Pi is just like any other computer on your network.

You can connect to the Pi with putty and once logged in, do your updates or installs as usual. You do not need a serial console (UART) and you do not need to connect via the PC (plug the Pi into the router instead).
I repeat for emphasis: the Pi is just like any other computer on your network.

Please follow klricks helpful instructions for the details.

AnthonyTheKoala
Posts: 7
Joined: Sat May 27, 2017 10:17 pm

Re: Want headless via putty & download via wireless

Mon May 29, 2017 4:04 pm

Dear klricks and jahboater,
Thank you for your replies.
I don't want to plug my RPiWZ into a router, especially if the router does not belong to me, such as the University's or other WiFi point.
The above responses have clarified my 'vision' for connecting an RPiWZ to my laptop which is connected to a WiFi which does not belong to me, such as a University's WiFi or somebody else's WiFi.
I thank you for that. I will add my knowledge of connecting the RPi through a router when I set up a personal WiFi system.

At the moment using the responses from klricks and jahboater I want to connect my RPiWZ to laptop to my University's WiFi in the following systems word diagram:
  • RPiWZ connected either by Wireless or usb or usb/LAN (adapter) to -> Laptop connected to RPi (Wireless or LAN or USB) with the -> Laptop connected to WiFi that does not belong to me eg University or someone else's WiFi.
  • Control of the RPiWZ is connected to the Laptop via a 'putty' connection via the UART to RPiWZ to issue linux commands to download etc.
Questions please for clarification of what needs to be done
  • This assumes that I have a 'putty' control via the GPIO's UART from laptop to RPiWZ.
  • For wireless communication directly between the RPi and Laptop, just follow the instructions for the wpa_supplicant.conf 2 postings ago.
  • If I have a usb-to-LAN adapter and enable LAN connection to my RPiWZ then connect a LAN cable to the laptop - are there any configuration files for and credentials needed to set a LAN connection to the RPiWZ to allow downloads and updates to/from my RPiWZ and laptop as in the setting up of a LAN (wired) connection.
  • Suppose I now have the RPiWZ set up for control by putty via UART and downloads/updates come via the RPiWZ-to-Laptop, I then want to enable internet sharing to the wifi via my laptop:
    In my laptop I do the following:
    Control Panel -> Network and Internet -> Network Connections
  • Inbuilt Wireless Connection -> Properties -> Sharing -> click "Allow other network users to connect through this computer's internet connection"
  • Local Area Connection (LAN) -> Properties -> Sharing -> click "Allow other network users to connect through this computer's internet connection"
    Such that the resulting ability to download/update large files to my RPiWZ is now made via the following connection:
    RPiWZ -> Laptop -> WiFi (University, someone else's)
    Any idea of the speed between the RPiWZ and Laptop given the speed between the Laptop and the WiFi (University) is 150MBs.
Again, thanks to klricks and jahboater for inspiring me to think,

Anthony of Sydney NSW

User avatar
B.Goode
Posts: 10356
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Want headless via putty & download via wireless

Mon May 29, 2017 4:29 pm

A completely non-technical thought related to what you are attempting...

Are you sure that 'sharing' your University WiFi connection in this way is permitted by the Acceptable Use and Connection Policies that your use of University facilities will be subject to?

Ernst
Posts: 1335
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: Want headless via putty & download via wireless

Mon May 29, 2017 7:08 pm

AnthonyTheKoala wrote: Local Area Connection (LAN) -> Properties -> Sharing -> click "Allow other network users to connect through this computer's internet connection"
Such that the resulting ability to download/update large files to my RPiWZ is now made via the following connection:
RPiWZ -> Laptop -> WiFi (University, someone else's)
Any idea of the speed between the RPiWZ and Laptop given the speed between the Laptop and the WiFi (University) is 150MBs.
The first thing you must do is to forget the W in RPiWZ, you do not need WiFi at this moment, next you must forget the internet (for the moment) and concentrate on connecting from your laptop by using the RPi[W]Z as an ethernet gadget with dwc2,g_ether. I am not giving you the details, this you must look up yourself, there are plenty articles on this subject. Start with the latest release of Raspbian, do not use NOOBS. Do not forget to enable SSH and do not configure WiFi. This should take you about 10 minutes (excluding the time to read the installation documentation and to find the information on gadget mode). Now plug the RPi[W]Z using a normal (meaning NOT OTG) USB cable into your laptop and use putty from your laptop to connect to the RPi[W]Z. With a little bit of research you should be able to find the IP-address of the RPi[W]Z using bonjour. Warning: if you see an 192.168.137.x address then you have already done the next step, you should see a 169.254.x.x (link local) address on both interfaces. Before continuing remove the RPi[W]Z from your laptop after using the command "sudo halt", watch the green activity light and wait for it to go off completely before removing power. Now you can configure ICS (Internet Connection Sharing) on your laptop. With a little bit of research you will be able to find the information on the internet. Warning: Do not even consider using static ip-addresses, dhcp will do this for you. When completed you will be able to access the RPi from your laptop and the RPi will be able to access the internet to be able to update the software. What can not be done is to connect from the internet to the RPi through the Laptop.

Total time for the above procedure is maximum 15 minutes which is less time I needed to write this.
The road to insanity is paved with static ip addresses

AnthonyTheKoala
Posts: 7
Joined: Sat May 27, 2017 10:17 pm

Re: Want headless via putty & download via wireless

Mon May 29, 2017 10:16 pm

Dear B. Goode and Ernst.
Thank you for your reply.
First to B. Goode, I have checked my university's acceptable use policy. The university's acceptable use policies are summed up in: don't violate/infringe the copyright of a copyright holder in downloading or sharing documents, software, audio, video, movies. Students have been traced, caught, fined and excluded from using the computing facilities especially with bit-torrents. The policies include not to distribute or download illicit/pornographic and violent materials. It also extends to not 'hogging' the bandwidth.

The university allows connection of not only laptops, but tablets and smartphones with various OS. There is documentation on how to set up a connection to its WiFi. There is nothing specific to excluding a Linux machine. Nor is there any rule excluding connecting a peripheral device to the laptop with internet access such as a webcam.

However, just because nothing is mentioned in the rules, I've always asked as a matter of courtesy and ethics the university's IT department if it is acceptable to download software updates for my Laptop and Linux for the RPi especially where they are very large files and they said as long as it does not violate infringing any copyright. So it does not hurt to ask the IT department to be safe.

For others reading this and wanting to connect to your particular University's wifi, read the 'acceptable use' policies and ask if there in doubt.
Thank you B. Goode for reminding us.

For Ernst, thank you very much for your 'condensed' method. I will follow the steps and do my research where necessary. Again the aim is to have a headless connection of the RPiWZ through the laptop to a WiFi without the RPiWZ going through a router.

To klricks and jahboater, thank you as well. I will be applying the ideas when wanting to use a router.

Thank you,
Anthony of Sydney NSW

AnthonyTheKoala
Posts: 7
Joined: Sat May 27, 2017 10:17 pm

Re: Want headless via putty & download via wireless

Mon May 29, 2017 10:26 pm

Dear all,
Apology. I mentioned that there is nothing to connect a Linux machine to the university's WiFi. I was wrong. The university does provide a guide to connecting a Linux machine to the WiFi.
While this may indirectly apply to me because I am making an indirect connection via my laptop, it is good to know.
Thanks
Anthony of Sydney NSW

Return to “Troubleshooting”