Install Raspbian Jessie Lite on to your micro SD card
download Raspbian Jessie Lite from https://www.raspberrypi.org/downloads/raspbian/
format your micro SD card into fat32
use the SDFormatter program
enable 'format size adjustment' in options will delete any partitions previous distros had on the micro SD card
extract the .zip of Raspbian Jessie Lite
install the .img file onto your clean micro SD card
use Win32DiskImager
you can now use the micro SD card to boot into Raspbian
Configure and update Raspbian and your kernel
log in with the username 'pi' and password 'raspberry'
(OPTIONAL)- gain access to root and create a new user replacing the default 'pi' user
sudo passwd root
enables logging in to root and lets you choose a password for root
exit
log in with username 'root' and the password you just made
deluser -remove-home pi
delete the default pi user
adduser username
replace username with what you would like your account to be called
remember to not use capital letters; feel free to enter information like your name
visudo
underneath the line
%sudo ALL=(ALL:ALL) ALL
type
username ALL=(ALL:ALL) ALL
this gives the account you made root privileges after entering the user password
you can let the user execute root commands without a password by instead typing
username ALL=(ALL) NOPASSWD: ALL
delete the last line pi ALL=(ALL) NOPASSWD: ALL since we removed user 'pi'
type 'reboot' and login in with your new user account
sudo raspi-config
navigate with the arrow keys and press enter to select an option
press enter to expand the file system
this will configure Raspbian to use all the space on our micro SD card
enter into 'Internationalization Options'
press enter to change locale
locales are used to correctly display text from your region
the format used is [language][_TERRITORY][.CODESET][@modifier]
for example if you're an english speaking american you will probably only need to have en_US.UTF-8 UTF-8 selected
scroll through the list with the arrow keys and select locales with 'Spacebar'
press enter and select the default system language/locale; you can choose one of the locales you have previously selected
return to 'Internationalization Options' and now select Change Timezone
select a nearby city/region in your timezone to configure the clock
(OPTIONAL)- return to 'Internationalization Options' once again and select 'Change Keyboard Layout'
generic 105-key (Intl) PC should work for mosty keyboards; see if you can find the keyboard you're using among the other options
select the layout
select the location of your function key if you have one
select the location of your compose key if you have one
go to 'Advanced Options' and select 'Hostname' to change what your raspberry pi will be called
feel free to change any other options; the options involving the default user will not work if you deleted the user 'pi'
use the right arrow key to select 'Finish' and arrow over to reboot now
sudo apt-get update && sudo apt-get upgrade && reboot
just press 'Enter' when asked if you would like to continue
this update/upgrade the system and kernel and reboot
(OPTIONAL)- Check your firmware and raspbian version
uname -r
tells the kernel version you are using
cat /etc/issue
tells the raspbian version you are using
shutdown using the command 'sudo shutdown -h -P now'
RPi2 Doc
I was gifted a Raspberry Pi 2 Model B, I'm documenting some of my progress here.
Friday, 27 November 2015
Saturday, 15 August 2015
RPi2 First Look
Installation
I managed to find a generic 2gb micro sd card and I started by downloading SD Formatter, enabling Format Size Adjustment and formatting the micro SD to make sure I am working with a clean drive with only one partition. Next I downloaded Win32DiskImager so I can write the RPi OSes .img files to the micro SD; for more info go here.I began with writing NOOBS onto the micro SD as it is a good spot for beginners like me to start; unfortunately 2gb was not big enough to install any OSes via NOOBS.
OpenELEC, A Linux Based Media Centre
I installed OpenELEC (Open Embedded Linux Entertainment Centre) and took a look; the micro SD I found seems to be pretty slow, it took a little over an hour for the installation to complete.I was greeted with a media center GUI where I could consume media, install add-ons like Youtube, Free (and probably illegal) movie streaming services, etc. After the initial setup process I feel like this has a strong potential as a solid HD living room media centre, some minor things i noticed was that the audio jack didn't work off the bat (it didn't work in my minimal raspbian install either however you can probably get it working using terminal), there was some lag and freezing but this was likely due to the Micro SD ( you can try to run your main OS from a USB to yield a more responsive experience, Google it).
Raspbian
A media centre was not what I was aiming so I moved on from OpenELEC and decided to try out Raspbian, the full version of Raspbian was too big for my SD card so instead I installed a minimal version of raspbian (username is 'root' and the password is 'raspbian' by the way) that did not include a GUI or any programs. It took about an hour to configure itself. Next I decided to try and install a GUI, I chose to use XFCE because it was a simple and lightweight GUI that won't take up too much space, if I remember correctly XFCE was less than 1GB compared to a GUI like GNOME3 which was a bit over 3GB.Follow this forum post to set up XFCE. After i installed an internet browser and IDE for programming the entire OS ended being about 1.1GB, pretty good.
Internet browser and Programming Environment
XFCE came with very few programs, no internet browser so I installed 'iceweasel' (type apt-get install iceweasel in terminal) because I remember it from SteamOS, not sure how good it is for the RPi2 but it seems to be working fine, running about 6 tabs with little lag besides the initial webpage loading taking about 8 seconds or so, Youtube was quite slow as I expected but it didn't use it anyways.I looked about and read that full Raspbian comes with IDLE3 an IDE (Integrated Development Environment, basically a program made for programming); using apt-get install (idle3) in terminal as usual I got myself a programming environment. IDLE seems to be a good environment for programming in python (Python3 to be specific), a good language to learn for the Pi. If you don't want to deal with Python you can look into WiringPi, a GPIO access library written in C which lets you use other languages like C, C++ and many other languages with suitable wrappers.
Look at my separate post on Arch Linux on the RPi2
RPi2 Arch Linux
These are my notes right now on how to install Arch Linux on the Raspberry Pi 2 as well as set up a GUI
Install:
SD Card Set Up:
follow installation instructions here(Linux, you can make a bootable usb and follow this, i will try to release a plain .img of RPi2Arch in the future)
Set up Arch: Update Arch, Create User, Change Time, Video Driver:
walk through initial installation here, we didn't mount any extra partitions, ignore swap as the constant read/write damages your sd card.
if you are planning on using a window manager/desktop environment install
xf86-video-fbturbo (experimental rpi video driver) or xf-video-fbdev (ordinary driver)
Xorg:
sudo pacman -S xorg-xinit (automatically start the window manager after login) xorg-server
Window Manager:
- Openbox(similar to windows, light and configurable(look into obconf))
- mkdir -p .config/openbox (makes directory for your openbox config files)
- sudo pacman -S openbox (install openbox itself)
- cp /etc/xdg/openbox/* .config/openbox/ (copy files to your openbox config directory)
- sudo pacman -S (proograms you want to install like a panel ie Tint2)
- nano /config/openbox/autostart (edit what programs start with openbox)
- scroll down and add tint2 & to the bottom, Ctrl+X to quit, press Y to save and enter to overwrite the file
- i3(another window manager, ignore this if you already installed openbox):
- sudo pacman -S i3-wm dmenu(as a light application launcher, use Mod+d to use)
- nano ~/.config/i3/config, scroll down and delete the last part about starting i3status
- sudo pacman -S i3-wm dmenu(as a light application launcher, use Mod+d to use)
- nano ~/.config/i3/config, scroll down and delete the last part about starting i3status
- cp /etc/X11/xinit/xinitrc .xinitrc (copy the original xinitrc to .xinitrc folder)
- nano .xinitrc (configure 'startx' to run the window manager)
- scroll to the bottom, delete everything starting at twm & as we didn't install them,
- then add exec openbox-session or i3 depending on what you chose, Ctrl+X, Y, enter.
- press startx to start the window manager
Programs
Here is a helpful list of the packages installed in the default raspbian environment
- Install Yaourt for easy access to AUR (Arch Linux User Repository) files
- install base-devel
- look up the directory of package-query
- curl -O http://mir.archlinux.fr/~tuxce/releases/package-query/package-query-1.6.2.tar.gz(paste the url under sources)
tar zxvf package-query-1.6.2.tar.gz
cd package-query-1.6.2
inside the new folder make a file call PKGBUILD and copy the pkgbuild into it
makepkg -si
- nano /etc/pacman.conf
[archlinuxfr] SigLevel = Never Server = http://repo.archlinux.fr/arm
pacman -Sy yaourt
- Terminal Emulator - Xterm(default), rxvt-unicode(if you're looking for a bit more)
- IDE/Text Editor - Geany
- Image Viewer & Background Manager - Feh
- Player - omxplayer (requires xorg-xset and xorg-xrefresh, VLC is too laggy)
- no gui, run in terminal with: omxplayer -o (type hdmi or local for jack audio) (directory of video file)
- System Panel - Tint2
- File Manager - PCManFM, or ranger for a terminal experience (you can enable previews too)
- Web Browser - Firefox(laggy), Midori(has no youtube), iceweasel(not as laggy as Firefox), i have yet to try pale moon and epiphany browsers, apparently Minimal Kiosk Browser works well with YouTube but i can only find it on Debian at the moment.
- Audio Driver - alsa-utils alsa-firmware alsa-lib alsa-plugins
- adjust audio with alsamixer and change input with amixer cset numid=3 x
- where x = 0 for auto, 1 for analog, 3 for HDMI
desktop uses about 34mb of ram in i3
edit tint2GPIO
https://aur.archlinux.org/packages/python-raspberry-gpio/ for more infodownload the tar.gz file
extract the file
open the folder and create text file PKGBUILD
paste this into PKGBUILD:
Now open up geany and go to
[Build] - [Set Build Commands] - [Execute commands]
Change 'python "%f"' to ' sudo python "%f" '
now you have RPi.GPIO working and your scripts in Geany will run with root privledge (be careful)
notes:
follow this for openbox install (no need for python2-xdg just add programs into startup file) optimize boots
Sunday, 9 August 2015
Raspberry Pi 2
RPi2 Doc
Backstory
My uncle from California came to visit us up in Canada on August 2, when he asked what I would like as a present I suggested a Raspberry Pi 2 Model B and here it is! My plan is to see what the Pi can do; I'll be mostly focusing on programming, GPIO, and remote access.
Programming
I took programming 11 last semester, we mostly worked in Ruby and then some Java at the end of the year. I found Python to be similar to Ruby and transferred a lot of knowledge over. Making a new script by going to File>New Window I started with the classic 'Hello World!' script that says 'Hello World!' in console, the code looks like this:
print ('Hello World!')Yup, it's that simple, now go to Run>Run Module and you will see you script running in the original IDLE3 window!
Comments, Importing, and Variables
Now lets make a code that ask the user for their name, waits one second, then greets the user. I added comments by typing '##' before typing what I want. Comments are important so you (and other people) will know for example, what this specific line is for, comments are not read when the program is running and are purely made to supply information to the person looking at the script. As you can see through the code I explain how time is imported at the beginning to make 'time.sleep(amount of seconds)' work. You can also see I have a variable called 'name' in this script, 'name' says 'What is you name?' in console then waits for user input, it then stores this user input in the variable as a string (ie text so you can't use it in a math calculation, I'll get to variable types in the next section), you can see I can access this variable later and I used it in the last line where the program greets you with your personal 'name' you typed in beforehand.The code looks a little weird on the blog (I'll try to figure out how to fix it) but if you copy and paste the text into an IDE or something like Notepad++ (regular notepad is terrible as it doesn't keep formatting like tabs or enters).
import time ##imports the time asset which it required for the sleep functionprint ('Greetings, my name is Raspberry Pi the Second of Model B')name = input('What is your name?') ##this is the variable 'name' it equals input from the user and prints whatever is in the brackets into consoletime.sleep(1) ##this is why we imported time at the start of the program, this line here lets the program sleep (wait) for a second before moving to the next lineprint ('Nice to meet you ' + name + ', have a wonderful day') ##this prints the preset quotes plus whatever the variable 'name' has in between
Variable Types and Converting Between Them
Lets learn a bit about variable types, the 4 you need to know right now are:
- String, a string is used when collecting or printing out text, you can't use a string in a math equation, you can change a (float or int) variable to a string by typing 'str(variableName)'
- Float, a variable that holds numbers with decimals, you can use a float in a math equation, for example a line of code to multiply the float by 2 looks like 'variableName*2', you can change a (string or int) variable into a float by typing 'float(variableName)'
- Integer, similar float but it doesn't hold decimals, use this if you know you will not be dealing with decimals because it's faster or something, you can change a (string or float) variable to an integer by typing 'int(variableName)'
- Boolean, a True/False variable used often in IF and While statements (we will get to these later), when converting if your variable is empty or contains '0' it will be false, if not it's true, you can change a (string, float or int) variable to a boolean by typing 'bool(variableName)'
GPIO Specific
To start programming your RPi GPIO you need to to 'apt-get -y install python3-rpi.gpio' this allows you to use 'import RPi.GPIO' in your python scripts, this is needed for your scripts to communicate with the RPi GPIO.
Take a look at this quality tutorial on Sparkfun, it's for the original RPi but it still applies to the RPi2 since (most) tutorials transfer seamlessly to the updated model.
*This blog will be updated/edited whenever I have the time so bookmark to keep updated :)
Subscribe to:
Posts (Atom)