julyjim
Posts: 117
Joined: Tue Jan 31, 2017 5:04 am

activating wlan on both RPi 3 and Rpi zero

Sun Jun 10, 2018 3:14 pm

I am currently accessing RPi 3 using Ethernet - SSH / TCP .
I like to switch to wlan.
I have been following this procedure
https://www.raspberrypi.org/documentati ... ess-cli.md ,
but to a point.
The procedure really does not explain some of the steps.
I do not want to wipe out my current Ethernet wire access.
I have "installed " SSH / TCP and it was tough going, but it does the job.

Should I be concerned ?

Like to hear "success story" running wlan on both RPi 3 and Zero

epoch1970
Posts: 1840
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: activating wlan on both RPi 3 and Rpi zero

Sun Jun 10, 2018 6:19 pm

julyjim wrote:
Sun Jun 10, 2018 3:14 pm
Should I be concerned ?
What about?
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

User avatar
HawaiianPi
Posts: 2489
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: activating wlan on both RPi 3 and Rpi zero

Sun Jun 10, 2018 9:11 pm

What steps are not explained clearly, and what, exactly do you need help with?

If your WiFi country has been set in raspi-config, or at least included in wpa_supplicant.conf, then WiFi should just work.

Code: Select all

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=GB

network={
	ssid="Your network SSID"
	psk="Your WPA/WPA2 security key"
	key_mgmt=WPA-PSK
}
Take this example of wpa_supplicant.conf and edit country=, ssid= and psk= with your information, then copy the file to the small FAT32 "boot" partition of a Raspbian imaged SD card and boot it in your Pi. Wireless should be working, and should automatically connect. Use a pure text editor, not a word processor to edit the file (for Windows I like Notepad++, but plain old Notepad will work as well).
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

JJL1
Posts: 15
Joined: Mon Jun 11, 2018 2:17 pm

Re: activating wlan on both RPi 3 and Rpi zero

Tue Jun 12, 2018 8:24 pm

In PI 3 its as easy as clicking the lan icon. Turn on WiFi. Enter key when asked. Ethernet connects automatically when it's plugged in. I switch all the time. It even remembers the WiFi key. If you leave WiFi on with no Wifi avail, you need to reboot or, you will need to renter the key to connect. PI 0 you will need command line instructions. I can't help there. Adafruit is a good source for PI how to's.

julyjim
Posts: 117
Joined: Tue Jan 31, 2017 5:04 am

Re: activating wlan on both RPi 3 and Rpi zero

Tue Jun 12, 2018 8:59 pm

Thanks,
I am slowly learning that " Raspberry Pi " is insufficient (description) if one wants to experiment and SOME instructions written earlier obviously cannot make it clear which "model" they are describing.
I just did not want to repeat the painful process of activating Ethernet. I suppose if I just used Ethernet to access social media it would have been a snap.
Now I need to switch from RPi 3B (SSH) to Zero (WLAN) and have same "remote" Access from my PC to Zero - thus replacing current Ethernet SSH usage on RPi 3B with WLAN on Zero.
But I will admit , I am too busy writing code so this "switch" will have to wait for a spell.

julyjim
Posts: 117
Joined: Tue Jan 31, 2017 5:04 am

Re: activating wlan on both RPi 3 and Rpi zero

Thu Jun 14, 2018 1:17 pm

JJL1 wrote:
Tue Jun 12, 2018 8:24 pm
In PI 3 its as easy as clicking the lan icon. Turn on WiFi. Enter key when asked. Ethernet connects automatically when it's plugged in. I switch all the time. It even remembers the WiFi key. If you leave WiFi on with no Wifi avail, you need to reboot or, you will need to renter the key to connect. PI 0 you will need command line instructions. I can't help there. Adafruit is a good source for PI how to's.
Really?
Turn on WiFi. ? I hope you met the WiFI " server / router ".
I am just learning networking terms and "Turn on WiFi." is not telling me much.

I need somebody to tell me how to change Ethernet wire "connection" from my "router" (?) to "WLAN" AKA wireless connection. I need to keep PC connected to router via Ethernet wire connection and connect from router to RPi3 wirelessly. That is not covered by any tutorial, and I did ask Mrs Google.
.
Secondary question - I have not ask Mrs Google , but - how to connect RPi Zero to internet?
All I am getting is - "you are not conceded to Internet" , obviously since there ins no "automatic" Ethernet hardware on RPi Zero.
And then "connect to Internet " duh...

jbudd
Posts: 655
Joined: Mon Dec 16, 2013 10:23 am

Re: activating wlan on both RPi 3 and Rpi zero

Thu Jun 14, 2018 1:58 pm

I need to keep PC connected to router via Ethernet wire connection and connect from router to RPi3 wirelessly.
There is no problem having PC connected by ethernet wire and Pi connected by wifi to the same router. It is the router's job to send any internet data out to the internet and route data between local devices within the local network.

All you need to do is to connect your Pi by wifi.
Essentially the wifi connection data is stored in a file /etc/wpa_supplicant/wpa_supplicant.conf.

If you have access to the Pi GUI you can use the GUI tools to set it up (No details here, I never do it this way)
If you have access to the Pi command line via ssh you can use a text editor to set it up.
If you don't have access to the Pi at all , possibly because you can't connect it to the network there is still a way:


Put the SD card in an SD reader connected to your PC.
Write Raspbian to it with Etcher (I guess you have already passed this step)
When Windows tells you you have to format the SD card, tell it not to.
There will be a partition, maybe D: which Windows Explorer can see. It will probably call it Boot, and it has files cmdline.txt and config.txt among other files on it.
In this partition create a file ssh.txt. It doesn't have to contain anything. This will enable SSH.
Also in this partition create a file wpa_supplicant.conf. Put in it the info given by HawaiianPi above. IMHO country=GB is fine wherever you are, but you have to change the router ssid and password to suit your router.
NB although it's a text file, I think it cannot be called wpa_supplicant.conf.txt (might be wrong there). You have to make sure Windows Explorer doesn't hide file extensions.
Now put the SD card back in the Pi and boot it. After a minute or two, use IPScan24 or Fing or your router setup pages, or any other tool to list devices on your network. You should see the Pi and you can connect to it by SSH using the IP address.

If your wifi network uses an unusual encryption method - WEP for instance, the contents of wpa_supplicant.conf have to be different.

julyjim
Posts: 117
Joined: Tue Jan 31, 2017 5:04 am

Re: activating wlan on both RPi 3 and Rpi zero

Thu Jun 14, 2018 3:29 pm

OK, call me dense.
I can connect from PC to RPi via terminal using SSH.
No issue here.
I am writing C++ code in Eclipse and using TCF to remotely access RPi - no issue here.
TCF has "target ID " TCP:10.0.1.2:1534.

I started looking into using wlan by doing sudo iwlist wlan0 scan on RPi.
Ton of stuff I have no clue how to interpret most of it, but it identified the router "wireless" service.

If I get what you saying I need to "redirect" this ID thru the router to RPi 3B "WLAN0" .
I did get to /etc/wpa_supplicant/wpa_supplicant.conf. but I am hesitant to change things so I do not screw something up.
I;ll do some more reading before my next attempt.
Thanks for your help, appreciate it.

User avatar
HawaiianPi
Posts: 2489
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: activating wlan on both RPi 3 and Rpi zero

Thu Jun 14, 2018 11:22 pm

@ julyjim,
This will be a long read, but I hope it will answer all your questions.

This is the procedure I use for setting up headless boot with SSH and wireless network. It works with Raspbian Jessie or Stretch, Desktop or Lite, and with the built-in WiFi on the Pi3B(+) & Pi Zero W, or a Raspbian compatible USB WiFi dongle on other models. Everything is done before you boot, and can be done on a Windows or Mac computer which only has access to the small FAT32 "boot" partition of a Raspbian imaged SD card.
  1. Grab the latest Raspbian image from https://www.raspberrypi.org/downloads/raspbian/
  2. Grab the Etcher software from https://etcher.io/
  3. Use Etcher to write the Raspbian image to your SD card.
    • You don't need to extract the image or format the card prior to writing.
    • Just run Etcher, choose the Raspbian .zip you downloaded, pick your SD card and write.
    • If you have trouble, verify the SHA256 checksum of the download.
    • Writing an image to your card will erase everything previously on it!
  4. Remove and reinsert the SD card so that your Windows or Mac PC can see the small FAT32 partition on the card (labelled "boot").
    • If you get a message telling you the card must be formatted, cancel it.
  5. On that small FAT32 partition, create a file with the name ssh (or ssh.txt). It can be empty, the contents don't matter.
  6. To connect to a wireless network, create another file on the card called wpa_supplicant.conf, which has the following inside:

    Code: Select all

    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    update_config=1
    country=US
    
    network={
         ssid="Your network name/SSID"
         psk="Your WPA/WPA2 security key"
         key_mgmt=WPA-PSK
    }
    • Edit country=, ssid= and psk= with your information and save the file.
    • Use the 2 letter country abbreviation in CAPS (without this you will have no WiFi).
    • Use a pure text editor, not a word processor, to edit the wpa_supplicant.conf file.
  7. Make sure that both files are in the main directory of the small FAT32 "boot" partition, not in any folder.
  8. Safely eject the card from your PC and use it to boot the Pi.
If Raspbian finds an ssh file it will enable SSH and delete the file. If it finds a wpa_supplicant.conf file, it will move it to its correct location and connect to your wireless network. Give your Pi some time to boot and connect to your network (the first boot always takes longer), then you should be able to SSH into the Pi and configure it how you like.

If you have a Zeroconf network service installed, you can SSH into [email protected] (provided you don't have any other Pi computers on your network with the same default hostname). Otherwise you must SSH into your Pi's IP address, which you can find by logging into your router and checking the list of connected clients, or using a network scanner app (like Fing for smartphones). The latest versions of Windows 10 are supposed to support Zeroconf, and you can install it to older version with Apple's iTunes or Bonjour Print service.

To login using SSH from Windows, you can use an app called PuTTY, which looks like this (click picture for download link).
Image

In the Host Name (or IP address) field, enter either, make sure SSH is selected (it should be by default) and click on Open.

If you have done everything correctly, a terminal window will open and you should see a password request. Although, if it's the first time you've connected to your Pi, you may have to answer "yes" to a security question, and then you'll get the password prompt. After login you'll get a warning about having SSH enabled with the default password, so type passwd[Enter] and enter a new password (twice). And now you can do whatever you need to configure your little Raspberry Pi computer.

Code: Select all

sudo raspi-config
Will bring up the Raspbian configuration utility. If you have more than one Raspberry Pi computer on your network it's a good idea to change the hostnames to something unique so that they can easily be identified.

Note:
If you have attempted this and failed, then unplugged power to turn off your Pi, you should start over with a freshly imaged card. Improperly powering down the Pi can cause SSH key generation to fail, which will prevent SSH logins (even if everything else is correct).

Alternatives to PuTTY:
If your main PC has the Windows 10 OS, there are 2 alternatives to PuTTY. The Windows 10 Fall Creators Update (2017) added the ability to install the Windows Subsystem for Linux, which is a Linux Bash shell for Windows (there are a few different versions of Linux in the Microsoft Store). And the recent Windows 10 Spring Update (2018) added OpenSSH directly to the Windows command and powershell utilities.

Raspberry Pi Zero:
The original model Raspberry Pi Zero and the newer version 1.3 with the camera connector do not have any build in networking capability. No Ethernet, no WiFi, and only a single micro USB OTG data port (the outer port is power only). So how would you connect a Pi Zero (non-W) to the Internet? You could use either a USB to Ethernet adapter, or as I prefer, a USB WiFi dongle. If you use a Raspbian compatible dongle, the procedure above works perfectly.

On my Pi Zero v1.3 I use a pcDuino USB WiFi Dongle with a tiny OTG adapter which fits inside of the USB plug of the dongle.
Image
The components above (USB WiFi Donlge, OTG adapter, Pi Zero). Assembled below.
Image

Just make sure you use a Raspbian compatible WiFi or Ethernet dongle that will not require any additional drivers.

Once you have SSH access you can use SCP to transfer files back and forth, or enable the VLC server included with the Desktop versions of Raspbian to access the Desktop remotely from your main PC using the free RealVNC Viewer software.
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

julyjim
Posts: 117
Joined: Tue Jan 31, 2017 5:04 am

Re: activating wlan on both RPi 3 and Rpi zero

Thu Jun 14, 2018 11:35 pm

I really appreciate your reply. however, it does not do much for me.
I am not in position to replace my OS - I need to keep my remote software development tools.
I may have not emphasized that in my first post.
Simply I cannot start from scratch as you suggested.
Configuring remote access to RPi was not an easy task.
But I think I have enough info now to be able to figure this wireless technology by myself.

The main key is - I cannot afford anything "automatic" , as you stated "SSH " is automatically (?) modified....etc
NO WAY!

As far as Zero goes.
I will admit I did not read the entire post line by line, but I am puzzled by "using external hardware " to set up Zero for network access.
I need to sit on this for a while,

User avatar
HawaiianPi
Posts: 2489
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: activating wlan on both RPi 3 and Rpi zero

Thu Jun 14, 2018 11:54 pm

julyjim wrote:
Thu Jun 14, 2018 11:35 pm
I really appreciate your reply. however, it does not do much for me.
I am not is position to replace my OS - I need to keep my remote software development tools.
What OS are you using? If it's Raspbian, everything above still applies. You can just shut down the Pi, add the wpa_supplicant.conf file to the "boot" partition, and it should connect you your WiFi when you reboot.

julyjim wrote:
Thu Jun 14, 2018 11:35 pm
I will admit I did not read the entire post line by line, but I am puzzled by "using eternal hardware " to set up Zero for network access.
I need to sit on this for a while,
Assuming you meant external hardware, the non "W" models of the Pi Zero have no built-in networking hardware. They are computers that cost only $5 after all, so it shouldn't be that puzzling.

You do have another option that does not require additional hardware (unless you consider a micro USB cable additional hardware). You can configure the Pi Zero as a USB Ethernet Gadget and connect it yo your PC with a standard micro USB cable. Windows will detect it as a USB Ethernet adapter and assign an IP, and then you can SSH/VNC like above, and use ICS for Internet access (although maintaining ICS across reboots can be a little tricky).
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

julyjim
Posts: 117
Joined: Tue Jan 31, 2017 5:04 am

Re: activating wlan on both RPi 3 and Rpi zero

Fri Jun 15, 2018 12:24 am

English is not my mother's tongue - but "it should" is bothersome.
Give me some more time to experiment and get spare SD.
Thanks

jbudd
Posts: 655
Joined: Mon Dec 16, 2013 10:23 am

Re: activating wlan on both RPi 3 and Rpi zero

Fri Jun 15, 2018 12:47 am

I think it's a good plan to get a spare SD card so you can experience setting up WiFi on a fresh copy of Raspbian.

Any computer on a network is identified by it's "IP Address". When a computer connects to your router, the router assigns an IP address, often one that looks something like 192.168.1.24.

I believe you have been using the Pi connected by ethernet cable direct to your PC? That situation is rather different. Neither computer assigns an IP address, you may have had to set up a static IP address on the PC (10.0.1.1 ?) and on the Pi (10.0.1.2) so that the Pi and PC can talk to each other.
If so, it may turn out that the method you used to give the Pi a static IP address will cause difficulties connecting to the router by wifi.

And the IP address issued by the router may be something like 192.168.1.24 rather than 10.0.1.nnn. In that case the TCF (whatever that is) "target ID " will have to be changed to TCP:192.168.1.24:1534

julyjim
Posts: 117
Joined: Tue Jan 31, 2017 5:04 am

Re: activating wlan on both RPi 3 and Rpi zero

Fri Jun 15, 2018 1:47 am

I think I better RTFM
sudo apt-get install hostapd bridge-utils
Yes, the "static IP" is now 10.0.1.2 and I thing the TCF is smart enough to "connect" as long as the "Agent" app is running on RPi..
I neglected to say I do have the "luxury model " RPi Zero W
so I am shooting for WLAN.
Of course there is USB option too, but that would not be "cool".
BTW I did turn on my Zero for a first time and was disappointed with the boot speed. Also did notice "single core" CPU.
But it will work OK with the app I am coding.
Speed is immaterial for it.

User avatar
HawaiianPi
Posts: 2489
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: activating wlan on both RPi 3 and Rpi zero

Fri Jun 15, 2018 5:06 am

I assumed you were using a typical network setup with all machines connected to a common network. Have I misunderstood?

Are you connecting directly to the Pi3B using an Ethernet cable between your PC and the Pi Ethernet ports?
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

julyjim
Posts: 117
Joined: Tue Jan 31, 2017 5:04 am

Re: activating wlan on both RPi 3 and Rpi zero

Fri Jun 15, 2018 1:18 pm

My PC is connected via Ethernet (wired) to a "router" and the RPi 3B is also connected Ethernet (wire) to same router. The router goes to "modem" via Ethernet wired connection.
The router or modem , I really do not know which, has "wireless" hardware and it is working fine.

I suppose the term is VPN - virtual private network ?

My objective is to connect RPI 3B to the router using wlan.
No plans to change the PC to router connection.
Cheers

jbudd
Posts: 655
Joined: Mon Dec 16, 2013 10:23 am

Re: activating wlan on both RPi 3 and Rpi zero

Fri Jun 15, 2018 7:13 pm

Oh. My mistake.
It sounds then like you have a perfectly normal home broadband setup.

In which case, no, the term isn't VPN. I can't understand the relevance of hostapd either.

It really should be trivial to connect the Pi to the router wifi and to access the internet.

julyjim
Posts: 117
Joined: Tue Jan 31, 2017 5:04 am

Re: activating wlan on both RPi 3 and Rpi zero

Fri Jun 15, 2018 9:32 pm

It seem I have been tactfully warned about my "tone".
Before I depart - how am I suppose to sound cheerful if after all this fruitful exchange you tell me that "accessing internet is a piece of cake" ?
The post was NEVER about accessing internet.
Cheers
SOLVED

jbudd
Posts: 655
Joined: Mon Dec 16, 2013 10:23 am

Re: activating wlan on both RPi 3 and Rpi zero

Fri Jun 15, 2018 9:47 pm

Well I don't have any issue with your tone.

It is frustrating that I still don't have a clear idea of what you are trying to achieve and what problems you are experiencing.

Perhaps it's a language difficulty, perhaps it's my failure to read and interpret.

Sorry I've not been able to help.

Return to “Beginners”

Who is online

Users browsing this forum: HawaiianPi and 36 guests