📜 ⬆️ ⬇️

Connection to PiZeroW with Raspbian Stretch Lite, without additional adapters and monitor

In general, the other day I got into the hands of the Raspberry Pi Zero W. But the difficulty was that it only has micro ports for connection, and I did not have adapters for them.
image
And it made it difficult to configure it, unlike the same Raspbery Pi 3+


If you do not resort to a soldering iron, and expansion cards, then on board the raspberry has two microUSB and one microHDMI. If there are two adapters (microHDMI (M) -HDMI (F) and microUSB (M) -USB (F)), you could connect it to the monitor and keyboard, and then configure everything in console mode. But as I said, I did not have such adapters, the nearest store with such ones was quite far away, and there was simply no patience for delivery.


Of course, we still need some adapters, but we’ll just get them. In particular, the microUSB cable can be taken from the phone a SD adapter on the microSD card from the camera.


In order to connect, I found two ways. The first is on WiFi. All you need to do is configure WiFi and SSH on it. But you need to do this only with the help of an SD card. And since I only had a MacBook from computers, I did not have access to the linux section (I did not consider the option of installing ext4fuse ). There remained only the / boot partition which was in FAT32 and worked wonderfully with MacOS. Therefore, all that we will do will happen in this section.


So the first thing we need is to enable SSH access to the raspberry.
To do this, create an ssh file without any content or extension.


touch /Volumes/boot/ssh 

Secondly, we need to somehow configure the WiFi connection at startup.
To do this, you first need to get a password hash for WiFi. And here I was faced with a new problem, how to do it in MacOS. Since before that it was necessary to configure the connection for the presence of some kind of Linux machine. There it is done like this.


 wpa_passphrase __  

The result of the team looked like this


 network={ ssid="__" psk=656c4700f528aced39b853b3c51b3fdcfc55409faa83a6402e936842237ac6f3 } 

Well, for MacOs generate psk I did not find how. Therefore, we had to temporarily specify the password in the clear. Or set up WiFi later (more on this at the end of the article)


 network={ ssid="__" psk="" } 

Thus, we configure all WiFi networks and save the result to wpa_supplicant.conf


 ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 country=UK ##       Raspbian >= Stretch network={ ssid="__" psk=656c4700f528aced39b853b3c51b3fdcfc55409faa83a6402e936842237ac6f3 } network={ ssid="__2" psk="" } 

Well, that's all. It remains to insert the card into the RaspberryPi, connect the power and wait an average of ~ 90 seconds until it boots up and picks up the WiFi connection.


To find the IP Malinki in the local network, you can use the command


 arp -na | grep -i b8:27:eb 

or see the connected clients at the WiFi router.
Then you just have to connect via SSH to the found IP. (By default, if someone suddenly did not know that for raspbian login and password pi: raspberry )


But there is another way to connect to Raspberry. As many have noticed on the board, there is one more USB connector besides the power supply, and that’s what we need. The only thing I will pay attention to is that the USB cable must be completely unsoldered (and not like I had, only the last two power contacts, which is why I initially resorted to the WiFi connection).


The essence of the second method is to connect the USB cable to another connector (they are signed by USB and PWR_IN on the board), by the way in this case the board will be powered by it.


But first you need to add several parameters to two files in the same / boot section
The first is to add the connection of Ethernet modules after rootwait in cmdline.txt


 modules-load=dwc2,g_ether 

And the second one in config.txt is added to the end of the file.


 dtoverlay=dwc2 

Everything. Insert the card, wait for the download and connect via SSH to Malinka at raspberrypi.local


After gaining access via SSH, you can configure WiFi via wpa_supplicant.conf already through the Malinka itself using wpa_passphrase , just note that the file from the / boot partition is copied to / etc


')

Source: https://habr.com/ru/post/419947/


All Articles