Wednesday, May 7, 2014

Raspberry Pi Picture Frame Post 5 Intial Setup, Wifi

Step 1 SD Card

Now that the hardware is ready it is time to remake the sd card so I don't have all the extra programs I installed last time while trying to get the system working. Now I am going to assume that you already have rasbian already installed, if you dont there are many different ways to install it onto an sd card but here is how I did it

Step 2 Initial Setup

Once you put the SD card in the raspberry pi it will boot to a screen like below. First I suggest that you expand the filesystem to use the whole SD card. So just choose option 1.  If you mean to change the password you can use; option 2. For my picture frame I am using a command line based viewer so I am going to make it boot to the command line instead of a nice GUI environment.  Make sure you check your keyboard layout. It is under option 4 internationalion option. That's all that is needed for the initial setup. The default username is "pi" and the password is "raspberry"

 Step 3 Wifi

Since the whole point of this project is to have pictures updated without having to do anything to the frame wifi is a must. I happened to have a trendnet wifi adapter just lying around, if you are buying a new adapter the internet suggests that you get one of the ones that are known to work. I guess I got lucky that mine worked without much hassle. Getting the wireless to connect can be a pain and took me about an hour of changing this and that and rebooting alot. anything between {{}} double curly parentheses is what should be typed in. The first thin I did was to check to see that the raspberry pi saw the wifi adapter. To do that {{ifconfig}} will tell you all of your network interfaces. You should see 3 main groups. eth0, lo, and wlan0. If you do not see wlan0, your pi does not recognize your wifi card. Now if you google how to do this you will find a whole bunch of ways to do. Which is the best, I couldnt really tell you but this is what worked for me. Now that we know your card is being detected we need to look at the config file. to do that {{sudo nano /etc/network/interfaces}} for those of you who are new to linux the sudo command gives the current user administrator capabilites. nano on the other hand is a command line based text editor. Below is what your file should look like. I had to add a few things, you may not. (Edit 8/18/2014 Just looked up setup again because I am having network issues and there file was different so your setup may vary pending wireless card)
auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
once you have your file looking the same it is time to exit. at the bottom of the screen you can see an information area. it says {{^X}} is exit so hold control and hit x. Not at the bottom of the screen it is asking if you want to save the changes. Hit the {{y}} key for yes. Then it asks for a file name. Since we dont want to change it just hit Enter. Now you can see the command prompt back at the bottom of the screen again. we have one more file to modify and you should have wifi.

In the last file we modified we referenced /etc/wpa_supplicant/wpa_supplicant.conf so that is the file we are going to change. To do that type {{sudo nano /etc/wpa_supplicant/wpa_supplicant.conf}} When I came into this file it had only the top 2 lines, so I had to add the rest. For your ssid and psk make sure that you leave the quotes("). When I was googling around some did not have the quotes and some did. Also this is extremely important. Make sure you capitalization is correct. This includes your ssid. This is why it took me so long to get the wifi connected. the # is a note for people reading the file, you do not have to type those lines but it may come in useful down the line.
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev 

# Protocol type can be: RSN (for WP2) and WPA (for WPA1) 

# Key management type can be: WPA-PSK or WPA-EAP (Pre-Shared or Enterprise)

 # Pairwise can be CCMP or TKIP (for WPA2 or WPA1)

#Authorization option should be OPEN for both WPA1/WPA2 (in less commonly used are SHARED and LEAP) 

Now to save we need to {{^x}} to exit, then y to save then enter to save as the same file name.  
Now all we have to do is reboot {{sudo reboot}}. Yes you have to use sudo to reboot. If you don't believe me go ahead and try it without it. If you typed everything correctly when it is rebooted you should now be connected to wifi. To test this log back on , the type {{ifconfig}} again to bring up or network interfaces. The line under wlan0 you should see inet .That is your ip address. If you don't you probably miss typed something along the line, just got back and check everything for errors, if you don't find any, Google is your friend. The post that I mostly followed to do this is at

Step 4 SSH

At this point you can now unplug the keyboard if you want and ssh into your project. To do that you need an ssh program. On my computer I use Putty and from my phone I use JuiceSSH. Any program with ssh capability will work though. For the settings for ssh you should use the ip address that we just saw (warning this can change since we have dhcp enabled. some routers will consistently give the same ip address to each device, some will change them. You should be able to log onto your router to find out the ip address if it has changed) the default port number of 22 is what we need and then you just need the username and password that you have been logging onto the pi with.Warning when using putty to place copied text into the terminal all you have to do is right click. control v doesn't do anything

Step 5 Google Drive

Now I highly suggest ussing ssh to send commands to the pi at this point. The reason being is you can copy and past things to the pi instead of having to hand type everything. Could we have done this when setting up the wifi, yes you could have but then you would have had to have it hardwired into the router which some of you may have done when installing raspbian. For those of you willing to spend $15 I would suggest insync. I have no relation to them  but what they have worked flawlessly for me when I was using it. You can try it for 15 days before you buy but it is definetly the easiest way I have found for sync google drive. Now I am in no rush to get this project done and didnt find out until today that insync was only a trial so I am back to trying to get grive to work. When I find a way that works I will be back.

Whats Left to do

Install fbi. This is really easy
Setup tasks in cron to keep everything up to date
Redo my weather information. Plan on having the 5 day weather for 2 locations
Setup IO pins
Sure I am missing something but that's it for now

No comments:

Post a Comment