In this post i sill show step by step how to install system and prepare RaspberryPi Zero W, to match our needs, so in few steps I will show how to:
-
- run system on RPi
- turn on ssh
- configure network
- prepare ssh RSA keys (so you don’t have to provide password each time u are logged into RPi)
- turn on I2C communication
- turn on camera
And all of this without connecting mouse,keyboard or display to our RaspberryPi
Prepare SD card
OK we need to have system image so we can deploy it on RPi, I chose “Raspbian Stretch with Desktop” ( because it already have thinks that we will need) we download it from :
lets unpack zip (using 7zip program, windows archive is not so good for this kind of files }
And lets write image into our SD card
I’ve used “Win32 Disk Imager”
At the left Image file we choose what was unpacked at previous step, at the right we choose SD card itself ( If you don’t have anything in devices combobox turn off program and insert SD card again then turn on Win32 Disk Imager)
Click Write, after couple minutes we have our SD card almost ready
Turning On SSH and setting wireless network
Firstly we need to turn on ‘ssh’ so we can connect our Rpi from console
Open SD card directory ( in my case H: ) and place the ssh file here (without any extensions I’ve used for this total commander, You can do the same in Windows explorer but then you have to remove file extension)
and we have:
As you see there is no extension there is just single name “ssh”
Ok, now we have to configure network so Rpi will know where and how to connect. We need to create and edit “wpa_supplicant.conf” file, we placed in at the same place as previous ssh file so in main SD card dir
wpa_supplicant.conf content:
1 2 3 4 5 6 7 8 9 10 |
country=US ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="network name" scan_ssid=1 psk="network password" key_mgmt=WPA-PSK } |
I’ve assume that your WiFi has WPA-PSK encryption (most popular option)
Ofcourse you have to change networkName and networkPassword ( but you can leave there question marks)
SD card is ready lets connect power source to our RPi (remember to connect power cable with USB labeled as PWR IN)
Green diode will blink for a while then it will be solid green indicating successful boot.
Now lets connect our RaspberryPi I’ve used putty
https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
Lets fill fields in order to mark at printscreen, in Saved Session You can provide any name You want I’ve put raspberry pi 2 because its my second RPi
1 2 3 |
HostName: pi@raspberrypi.local port: 22 Saved Session: anything |
Click saved so we will have it next time we turn on putty, and click open
We should see something like that
lets write default password :
raspberry
and we got something like:
lets also install mcedit text editor its much simpler then vim or nano
sudo apt install mc
I recommend to make RSA keys so you don’t have to provide password each time you connect to RPi
Create RSA keys (optional)
After this step You dont ahve to put passwrod each time u are logged to You RasbperryPi
We need puttygen
https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
we click Generate and move the mouse on a gray background and the progress bar will fill. Click next
Save the public key under the name “whatever.pub”
Save private key “whatever.ppk”
to keep order “anything” in two files should be the same. Files are saved in the folder
userDir\.ssh\
in my case
c:\Users\Admin\.ssh\
We are NOT closing the puttyGen window yet.
we’re going back to the connected putty:
create the .ssh folder:
mkdir .ssh
and create the authorized_keys file
mcedit .ssh/authorized_keys
we copy the public key from puttygen:
and in the putty window, by pressing [Shift insert] paste:
we add enter at the end of the line. and press [F2] on the keyboard
cat ~/.ssh/authorized_keys
restart putty
in a new window:
we will indicate the file that we saved PuttyGen
we’re back to saved sessions
we click save and open
this time the system will not ask you for a password 🙂
generated RSA keys (pub, ppk) can be used for subsequent raspberryPi to connect from this computer. For others computers we generate RSA files again and in RaspberryPi in authorized_keys, we paste next public keys – each in a new line
Configuring camera and I2C
in putty:
sudo raspi-config
Interfacing options:
then Camera and change to “Yes”
the same for Serial and I2C
then “finish” and restart:
Checking Camera
plug in camera (best if RPI is turn off):
putty:
raspistill -o kotek.jpg
camera diode wil be red for a while then “kotek.jpg” will be created
lets download foto and check if we have nice photo I’ve used WinSCP https://winscp.net/eng/download.php
and configure WinSCP to connect my RPi
I’ve assume that You configure RSA keys if no just provide password and skip steps 4 5 6 7
download to disk
and check if there is a correct photo
Thats all,
we have our RPI installed, configured Wifi, connected I2C, serial, and working camera, And we know how to connect putty into our RPi