I have, for some reason, always had a problem setting up my pi’s. It takes me hours to figure out what the problem is. Recently i wanted to get a pi zero up and running so this post is mainly to keep instructions of how i setup my pi, so i don’t waste hours next time, and hopefully it might also help someone else overcome similar problems.
Things you’ll need:
- Raspberry Pi
- 8GB MicroSD card (or bigger)
- Micro SD Card reader
- Power Supply for the Pi
Before you do anything else, you should make sure you have Bonjour downloaded, and VNC viewer so that can remote desktop into the pi. Also make sure you have your WIFI dongle plugged into the correct pi USB port, and also have a power USB plugged in.
To start with, i followed Adafruits tutorial: https://learn.adafruit.com/raspberry-pi-zero-creation/overview
which got Raspbian (the pi operating system) downloaded, and then made a few alterations to the files.
I used Etcher to burn Raspbian onto the pi. It actually takes the .zip file directly, so you don’t have to extract anything.
Now i couldn’t get the Wifi to work for some reason. My computer and router were not showing any other devices, so i couldn’t get hold of the IP address i needed for connecting remotely, so i ended up following another tutorial on a headless setup i.e. a setup that does not require a keyboard, mouse, or screen… although having a screen actually helped me circumvent my ip problem. I ended following a bunch of tutorials on how to find your IP address, and how to setup a SSH connection. This was a standard one: https://www.thepolyglotdeveloper.com/2016/06/connect-raspberry-pi-zero-usb-cable-ssh/ if you area having similar problems.
What i now do is:
In the config.txt add the below text to the end
In the cmdline.txt add the below text after rootwait
Create a new file and call it ssh, and remove the file extension (i.e. the .txt of similar extension), then save this to the sd card (same directory as the above 2 files). This enables ssh so we can remote log into the pi.
I also need to make sure my wifi was setup, as shown in this tutorial, which essential made me create a wpa_supplicant.conf file and add the following to it:
ssid="Your Wifi Name/ssid"
psk="Your Wifi password"
Change the ssid and psk to your wifi’s name and password. This file goes in the same directory as the cmdline.txt file. However, when you boot up your pi, this file will be moved somewhere else, so don’t worry if you can’t find the wpa_supplicant.conf file later on. Please note that the speech marks are important around your SSID and PSK, i have found without them it will not work.
In the end my problem was finding out the pi’s IP address. For some reason it just wouldn’t work, and i tried loads of things… i actually had a screen hooked up to my pi so that i could see what was going on, and i also had a mouse, so i could check settings… BUT WHAT I REALLY NEEDED WAS A KEYBOARD, and i just didn’t have a USB keyboard in the house… aah, that would have saved me hours. As I could have simply used the pi console and extracted the info, or if i had a USB hub, i could have had the mouse and the WIFI working and then just had the mouse hover over the wifi connection to get the IP address… wow, that is frustrating. In the end, i found out that sometimes on startup, the pi shows a window in the top left hand corner of the screen (image below) that holds the ip address, its only there for less than 1sec, so i restarted the pi a couple of times, took out my phone and recorded the ip address.
Then typed it into the VNC Viewer, added the default user name = pi, and password = raspberry when the next window popped up, and it all worked.
Well it sort of all worked. I could remotely access my Pi from the computer, but for some reason i could not access the internet through the pi. Which i only noticed when i started to setup openCV. Hence, if you have a similar issue, carry on reading my next post: Setting up OpenCv on Pi zero
VNC issues? At some point my VNC wouldn’t let me log in to my pi, and was greying out the username. I found that starting a putty connection first, then starting up the VNC server using command vncserver, then allowed my VNC client to connect correctly and ask for a username and password.