Presentation is loading. Please wait.

Presentation is loading. Please wait.

CIS 191: Linux and Unix Class 9 April 1, 2015 Hardware, Project, and Devices.

Similar presentations


Presentation on theme: "CIS 191: Linux and Unix Class 9 April 1, 2015 Hardware, Project, and Devices."— Presentation transcript:

1 CIS 191: Linux and Unix Class 9 April 1, 2015 Hardware, Project, and Devices

2 Outline Final Project Overview Amazingly Short Hardware Brief rm –rf / Part Handout

3 Raspberry PI For the final project, you’ll be working with a raspberry pi project to make something cool using your unix skills There are plenty of projects out there that can run on pis We’ll be giving you the pis, and you already have access to the internet

4 Raspberry PI For the final project, you’ll be working with a raspberry pi project to make something cool using your unix skills There are plenty of projects out there that can run on pis We’ll be giving you the pis, and you already have access to the internet We just want you to make something cool And sufficiently difficult…

5 Due Date The final project will be due on our last day of class, which is April 29 th. So you have 4 weeks – Which should honestly be more than enough time to make something great

6 Raspberry PIs are… A full multipurpose computer on a chip Strong enough to run an Xbox media center emulation! fully equipped with general purpose I/O pins – We’ll go over how to use these a bit next week unable to handle anything more than 5 volts – so don’t try to output more than that or you’ll break it – In fact, don’t try to output more than 3.3V really cool

7 Running the raspberry pi You’ll have to load up an image We’re not going to force you to use any in particular – The official distribution is “raspbian”, which should also be fine It’s also a derivative of debian, after all This means apt-get is a-go

8 Raspberry PI project ideas… Let’s just look at youtube!look at youtube!

9 Outline Final Project Overview Amazingly Short Hardware Brief rm –rf / Part Handout

10 Ohm’s Law V = IR http://www.electrical4u.com/wp-content/uploads/2013/03/ohm-law-2.jpg

11 Vary Resistance You can vary resistance to modify the behavior of a circuit For example, in this fart detector project linked to on piazza, the circuit is modified to the ambient gas environment using a resistor ladderthis fart detector projectresistor ladder – This prevents false fart positives

12 Breadboards http://www.mikroe.com/img/development-tools/compontents/breadboard-400/breadboard_400.png

13 How to strip a wire https://www.youtube.com/watch?v=TZFTKbT4XFs

14 Color Coding your Circuit Red should come from source Black should go to ground Inner colors aren’t important

15 Polarized Parts Current can flow from the anode (the + terminal) to the cathode (the – terminal). BUT NOT THE OTHER WAY AROUND! Damage the parts and (maybe) even yourself See this sparkfun link to learn morethis sparkfun link Polarized LED

16 How to make a basic LED circuit https://www.youtube.com/watch?v=k9jcHB9tWko

17 Raspberry Pi GPIO GPIO on the Raspberry Pi can be controlled pretty easily GPIO on the Raspberry Pi To write to output, you can either write to a few files through the terminal, use the gpio utility, or use a python interface.python interface To read from the input, you can use the gpio utility or use the python interface. – Note that this can be a little iffy… they are digital input pins after all – Anyone see how this might be a problem? How to work around it?

18 Outline Amazingly Short Hardware Brief A Little More About /dev rm –rf / Part Handout

19 Remember /dev? /dev contains system device files Linux systems accomplish tons of magic by treating devices as special files – And by pretending that certain non-device objects are files… – Linux employs devices to provide lightweight “system services” The contents of /dev have odd permissions if you check with ls -l

20 Device Files are “Pseudofiles” When you read from or write to a device “file”, the operating system silently intercepts your request and feeds it to a driver The driver knows how to interact with the device Drivers are typically written in C – Can anyone tell me why that might be?

21 Device File Permissions If you took the liberty of running ls –l on the files, you might see something like this The “b” means that this is a “block” device You could also see a “c”, which would mean it is a “character” device The size field has been replaced by a csv field where – The first value represents the major device number – The second value represents the minor device number

22 Types of Devices Character Devices – Denoted by “c” character at start of permissions – Provide direct, unbuffered access to the hardware – Examples: Serial ports, keyboards, sound cards, modems Block Devices – Denoted by “b” character at start of permissions – Provide buffered access to the hardware – Always allowed to read/write any sized block – Buffered => We don’t know when the data will be written Pseudo Devices – Fake devices that are useful

23 Some Pseudo Devices /dev/null – Accepts all data written to it and does nothing – http://devnull-as-a-service.com/ http://devnull-as-a-service.com/ /dev/full – Always full; returns a continuous stream of NULL bytes when read and returns “disk full” error when written to /dev/zero – Produces endless string of zero bits when read /dev/random and /dev/urandom – Contains a stream of random bytes

24 Hard Disk Partitions Each computer may have several hard drives attached, and each hard drive can be divided into several partitions – Windows assigns each partition its own drive letter (like C:) – Linux allows you to specify where the data on a given partition should appear in the filesystem Every hard drive is assigned a name in /dev – Like /dev/sda for the first drive, or /dev/sdb for the second – Naming starts at sd followed by a letter The n th partition of the drive sdb is sdb(n) – So sdb3 is the third partition on the second hard disk

25 Mounting and Unmounting To use a partition, you can use the mount command – The usage is mount device location – For example, mount /dev/sda2 /media/windows The mounted filesystems and devices are tracked in /etc/mtab. You’ll probably need to be root to access it. umount unmounts a directory – Note the absence of the ‘n’ in umount

26 fstab Non-changing filesystem information is written in /etc/fstab – According to the man page, “it is the duty of the system administrator to properly create and maintain this file” – At boot, fstab tells the system which filesystems should be loaded – Afterwards, fstab is used (by mount/umount) to describe how to mount and unmount filesystems fstab entries contain the filesystem location, the mount point, the file system type, options, and information about core dumping and checking the filesystem

27 Outline Amazingly Short Hardware Brief A Little More About /dev rm –rf / Project Help

28 https://www.youtube.com/watch?v=D4fzInlyYQo https://www.youtube.com/watch?v=I1KrsEBzJO8

29 Outline Amazingly Short Hardware Brief A Little More About /dev rm –rf / Part Handout


Download ppt "CIS 191: Linux and Unix Class 9 April 1, 2015 Hardware, Project, and Devices."

Similar presentations


Ads by Google