Video Overview of Raspberry Pi hardware:
What you will need:
1) Raspberry Pi
2) Power Supply (usually not supplied)
3) Micro SD Card (4 GB min) (Raspberry Pi 2 Model B supposedly goes to 64 GB) (I use 16 GB)
4) A PC/Mac to download the image and write it to the SD card
To use the Raspberry Pi after setup:
1) USB Keyboard
2) HDMI capable monitor
3) Network Cable
4) USB Mouse
Next, we need to get the Raspberry Pi OS in image form (.img) from the internet so we can write it to our Micro SD card.
——— DO NOT DOWNLOAD RASPBIAN JESSIE LITE IT IS BROKEN ! ! ! ! ————
I just love new upgrades!!! (Luckily I checked the page today 4/10/2017)
The lite version does not have pkexec which you will need to make it so you can run commands on the Raspberry Pi from your phone!
———- DO DOWNLOAD THE FULL VERSION ! ! ! ! ————–
Maybe my download was corrupt, if so I will update this page later, just didn’t want you to waste your time ! ! !
Just verified that process still works with FULL BLOWN JESSIE VERSION ! ! !
www-data ALL=(ALL) NOPASSWD: ALL
Looked like it might have changed, but it did not, it is still correct.
!!!!!!!! ADDED PICTURES OF ENTIRE PROCESS BELOW !!!!!!!
Go to : Raspberry Pi .org Downloads Page
Or if you need an older version – http://downloads.raspberrypi.org/raspbian/images/
Here is a good video that shows you what I am about to tell you:
Getting Started with Raspberry Pi
And click on Raspbian and it will take you to another page with different OS versions on it for downloading. Get Raspbian Jessie version for this tutorial. Click on the download zip button. When I downloaded it, it gave me the unzipped .img version, not sure if that is a Apple thing that makes it automatically unzip, but you may have to unzip it so that you end up with a 2016-05-27-raspbian-jessie.img file. It does take a while to download.
NEW! Windows Image Creation Process – when done, skip down to – DO NOT PLUG THE POWER IN FIRST!!!
So, when using a Mac first you want to put the Micro SD card into a SD card adapter and put it in the SD card slot.
Next, when you insert the card into the computer the computer will mount it and begin reading from it. When this happens you will not be able to write the Raspian image to the disk so we need to do some preparation first.
On a Mac go to Launchpad (Icon with a rocketship), click on Other icon, you will get a window with multiple programs (looks kind of like control panel on PC’s) and click on Terminal.
This will give you a command line terminal (like a dos window) that we can type commands on.
When that window comes up type in:
This will give you a list of disks you have attached to your Mac. The SD card should show up at the bottom, but it will be the one that matches the size of your memory card and it should be FAT_32. What we need is the disk number, mine was disk2.
Next we need to go to Launchpad again, then other, then disk utility.
You should see your SD Card in the list on the left and it will have a couple images that look like SD cards indented and underneath it. One will probably say boot, click on that one and up above the unmount button should become active. Click on unmount and the boot label should turn light grey to show that it is unmounted. Now we are ready to write our image to the SD card.
I move the image from downloads to my desktop, but you can put it anywhere you know how to get to from the terminal command window.
By default when you run the terminal program it puts you in your home directory. If you do a list command ( ls ) it will show you all the files and directories where your are at in the directory structure. If you are in you home directory you should see a Desktop directory. I go there ( cd desktop ) and do another ls command.
I should see the 2016-05-27-raspbian-jessie.img file there.
Next we need the command that we will run to move the .img to the SD card. That is on Raspberry Pi’s webpage also.
On the same page you downloaded the .img from there is a link towards the top that says:
Click on it and it takes you to another page.
Scroll down and there is a list of different OS types to click on, I click on Mac OS.
That will take you to another page and you can scroll down and you will find.
sudo dd bs=1m if=path_of_your_image.img of=/dev/rdiskn
Copy that line, go to your terminal window, hopefully you are in the directory where the image is, if not make sure you go there first. Then paste the line in the terminal window.
Now we need to edit the line before you press enter. we need to replace rdiskn with the label for our SD card, mine was disk2. Then you need to arrow over to just after path_of_your_image.img and start backspacing to remove it. Then you can type in 2016-05-27-raspbian-jessie.img, or highlight it in your file list and drag and drop it and it will populate the command for you.
So when the command is ready to be executed it will look something like:
sudo dd bs=1m if=2016-05-27-raspbian-jessie.img of=/dev/disk2
I have not researched yet what all the options mean, but sudo is the admin account used for this Linux system that allows you to break….. do things that can really mess things up. You will use this account many times in this tutorial.
After you hit enter, it will ask you for your password (Mac admin password you set up when you first got it) and then it should begin to transfer the .img to the SD Card, it doesn’t give you any info to tell you it’s doing anything, your computer just usually get’s really slow, and it will take awhile.(if you have a PC using it is WAY faster)
If you get a message that says the disk is in use, that means you unmounted the wrong one or didn’t do what I said, so you will need to go back and do that first.
When it’s done the command line will come back and it should give you some info about all the data that was transferred.
After that you need to tell the computer to eject the SD card, this can be done from the Disk Utility program or from Finder.
Now you can take the SD card out of the computer, take the Micro SD card out of the adapter and put it in the Raspberry Pi in the disk slot underneath on the bottom of the motherboard.
Now we are ready to work on the Raspberry Pi itself.
DO NOT PLUG THE POWER IN FIRST!!!
You can use the Raspberry Pi with just a power cord and a network connection, but you must know the IP Address to do anything and that requires a HDMI capable monitor. You also need a USB Keyboard and Mouse. So after you have the Network cable, HDMI cable, Keyboard and Mouse plugged in, plug in the power.
Things should begin to fly across the screen.
Then towards the end it will show your IP Address you need, but then it will instantly start the windows like interface and you won’t have time to read the Address, that’s fine, we will get it in a minute.
When it is done booting you can click on the Terminal app in the top left (looks like a monitor with a black screen). Once in there you can type ifconfig and it will give you your IP address(inet addr: in the eth0 section if you are using a network cable).
With this information you will be able to log into the Raspberry Pi remotely so you will only need a power cord and a network connection to the Raspberry Pi to administer it via SSH.
To log in to the Raspberry Pi via SSH on a Mac you go to the terminal program and type:
ssh 192.168.1.132 -l pi
replace my ip address with the ip address for your Raspberry Pi, -l means log in I suppose and pi is the user account you want to log in with. It will ask you for the pi accounts password, then you are in! It will put you in the pi accounts home directory.
Even though we downloaded the latest version of the OS there might be some updates available to install.
To check for these type:
sudo apt-get update
after that type:
sudo apt-get upgrade
That should get you all up to date and ready to use the Raspberry Pi without issues.
Next post we will write some python code which is what you use to turn on and off gpio pins which are what make relays (switches) turn on and off and that’s where the real magic begins when you use the Raspberry Pi for home automation.
Wait til done
Unzip image using 7zip
Select downloaded zip file
when you have a .img file
Use disk imager on windows machine
write image to micro sd card
when write is complete, eject micro sd card from PC and put in Raspberry Pi
Open terminal app
Upgrade can take a while, so watch some TV or do something else for a half hour.
Install Apache Server
Open file to set permissions
Scroll to end of file and add permission line
ctrl-o to save
ctrl-x to exit
Make a GIT directory in /home/pi (you should already be there)
Go into GIT directory:
Get my files from GIT:
Get my files from GIT
Go into new directory with my files:
Enter into dangerous admin mode:
Copy PHP files:
cp *.php /var/www/html
Copy Python files:
cp *.py /home/pi
EXIT OUT OF ADMIN MODE!
DONE! You can make sure the files are where they need to be if you want: