Raspberry PI, headless, RSA, Camera Setup

Hello,

In this tutorial I will be showing you how to get started with a Raspberry Pi Zero W, How you can set it up and get your projects up and running.
In this post I will be covering the following topics :-

  • Run system on Raspberry Pi
  • Turn on SSH
  • Configure network
  • Prepare SSH RSA keys (so you don’t have to provide password each time you are logged in)
  • Turn on  I2C communication
  • Turn on camera

And all of this without connecting mouse,keyboard or display to our Raspberry Pi

 

OK we need to have system image so we can deploy it on RPi, I chose “Raspbian Stretch with Desktop” ( because it already has all the things that we will need) we download it from :

https://www.raspberrypi.org/downloads/raspbian/

lets unzip the downloaded file (Use 7zip program, windows archive may corrupt the files )

And lets write image into our SD card

I’ve used “Win32 Disk Imager

At the left Image file we choose what was unzipped in 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, then turn on Win32 Disk Imager again)

Click Write, after couple minutes we have our SD card almost ready

Firstly we need to turn on ‘ssh’ so we can control Rpi from console

Open SD card directory ( in my case H: ) and place the ssh file here (without any extensions for this tutorial I have used 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 directory

wpa_supplicant.conf content:

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, insert it in the Pi and connect power to it. (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 Raspberry P, 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

 

Click saved so we will have it next time we turn on putty, and click open 

We should see something like that

[spoiler title=’There is an error’ style=’default’ collapse_link=’true’]

lets ping our raspberry pi with cmd  (How to run CMD) using address “raspberrypi.local”

 

if no answer lets try another address

if there is still nothing lets check at WIFI router itself if Raspberry Pi is connected and lets take its IP address

proper pings looks like :

 

[/spoiler]

lets write default password  :

and we got something like:

[spoiler title=’Change password’ style=’default’ collapse_link=’true’]

command

 

[/spoiler]

lets also install mcedit text editor its much simpler then vim or nano

 

 

I recommend to make RSA keys so you don’t have to provide password each time you connect to RPi

[spoiler title=’Create RSA keys ‘ style=’default’ collapse_link=’true’]

didn’t translate yet in comment ping me up 😉

potrzebujemy puttygen

https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

klikamy Generate i na szarym tle poruszamy myszka az progress bar sie wypelni. Klikamy nastepnie

Save public key zapisujemy pod nazwa “cokolwiek.pub”

Save private key “cokolwiek.ppk”

dla utrzymania porządku “cokolwiek” w dwóch plikach powinno być takie samo. Pliki zapisujemy w folderze

w moim przypadku

NIE zamykamy na razie okna puttyGen.

wracamy do podłączonego putty:

tworzymy folder .ssh:

i tworzymy plik authorized_keys

kopiujemy publiczny klucz z puttygen:

a w oknie putty wciskajac [Shift+ insert] wklajamy:

dodajemy enter na koncu linii. i wciskamy [F2] na klawiaturze

[Enter] i [F10] zeby wyjsc

sprawdzmy czy sie dobrze wgralo:

restarujemy puttego

 

w nowym oknie :

wskazuemy plik ktory zapisalismy PuttyGen

 

wracamy do zapisanych sesji

klikamy save i open

tym razem system nie poprosi nas o hasło 🙂

wygenerowane klucze RSA (pub, ppk) możemy użyć do kolejnych raspberryPi do łączenia z tego komputera. Do kolejnych komputerów generujemy pliki RSA jeszcze raz a w RaspberryPi w authorized_keys wklejamy kolejne publiczne klucze – każdy w nowej linii

[/spoiler]

Lets configure camera I2c

in putty:

Interfacing options:

then Camera and change to “Yes”

[Enter][Enter]

the same for Serial and I2C

then “finish” and restart:

lets check our camera

plug in camera (best if RPI is turn off):

putty:

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 assumt that You configure RSA keys if no jsut provide password and skip steps 4 5 6 7

download to disk

and check it

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