Linux on Chromebooks and Light Emitting Diodes


Linux on Chromebooks and Light Emitting Diodes

Can a $200 Chromebook run linux? Darren finds out with a Crouton! Plus - The ins and outs on LED - Shannon explains. All that and more, this time on Hak5!

Linux Your Chromebook

All this talk about KVM and OpenVZ had me looking into a project I had previously shelved - and that's running a Ubuntu Linux in a Chrooted environment on a Chromebook.

Chromebooks are awesome because they're light and cheap and run Chrome and SSH - but that's where it ends.

It's nice being able to hit CTRL+ALT+T and get a Crosh terminal, but really aside from SSH and Ping, there isn't much of use.

Which is where Crouton comes in. Crouton stands for Chromium OS Universal Chroot Environment. It's a set of scripts that make it easy to setup Ubuntu or Debian on a Chromebook in a chroot environment.

Chroot is a unix tool that allows for isolated filesystems. It's used by the OpenVZ project, and then some, to create independent environments on top of a single kernel. What that means is that applications running within a chrooted environment typically can't see outside their own container. It's sort of like a sandbox. What we end up with are both Chrome OS and Ubuntu, in this case, utilizing the same system resources like RAM and CPU simultaneously - but each with their own independent file systems.

For this demo I'm going to be using the HP Chromebook 11, but most every Chromebook is supported. The HP Chromebook 11 is about a year old and it's not lightning fast or anything. Under the hood it's sports a dual core 1.7 GHz ARM chip, 2 gigs of RAM and a 16 GB SSD. Nothing brilliant, but enough to run the basic Linux stuff I miss - especially all the Bash utilities. Best of all it's 2 Lbs, cheap, and runs off Micro USB so it'll power off my Pineapple Juice.

To get started you'll need to put the Chromebook in developer mode. Older models have a hardware switch. Newer ones you can set in software by holding ESC, Refresh and Power. It's not mentioned on the scary boot screen, but press CTRL+D to prep developer mode. This will take about 10 minutes and it'll wipe the disk.

Now back into Chrome OS in Dev Mode, download the latest Crouton installer from then open Crosh with CTRL+ALT+T and issue shell.

List releases and desktops

sudo sh ~/Downloads/crouton -t list -r list

Install Ubuntu 14.04 with xfce and

sudo sh ~/Downloads/crouton -e -r trusty -t xiwi,extension,xfce

# -t core or -t cli-extra for just CLI in Crosh

Install Chrome Crouton Integration Extension

sudo enter-chroot
sudo startxfce4

LED's are FUN!

LED's are light emitting diodes, found everywhere.

Popular type of Diode, which is a little device that makes current flow from one positive side (anode) to a negative side (cathode) and not vice versa. The positive side (anode) of an LED is the longer leg. The shorter one is the negative side (cathode). If you plug an LED in backwards, it just won't work because no power can swoop up into the cathode side. It always has to come through from the anode side. Diodes transmit energy and that energy turns into heat if it is released, but in the case of LED's, the energy is released as light.

LEDS drain current the brighter they are. So if you are running off a battery, a super bright LED will drain it faster than a lower power LED. LED's are measured for a certain amount of power. If you let it have too much power, it can blow up or burn out. You know it's dead jim, if the LED blinks then turns off, smokes, pops, or doesn't light up whatsoever. Try turning it around if the power consumtion is backwards. Adding a resistor can keep your LED from eating up too much power. Some sites recommend starting around 330ohms for your resistor, or you can also do the math we learned in the Resistance episode of Hak5. Either way, if your LED isn't as bright as it should be, or the resistor is hot to the touch, you're probably resisting too much power, so lower the resistor value.

Not sure if a LED works? Take a CR2032 battery (one of those little circular ones that powers stuff like watches, etc - you can find them at all the stores), and stick it between the two legs with the + side of the battery touching the anode leg, and the - side touching the cathode side. It should light up!

To choose your LEDs, it's a good idea to take a look at the datasheet that comes with it.

LED's come in tons of sizes, shapes, and colors. You can have RGB ones, that havae 4 legs instead of just 2, one for each color. Mixing intensities can change the colors. There are also flashing LED's that have an integrated circuit inside them to make them flash, SMD LED's which are tiny surface mounted ones with pads instead of legs, High-power LED's like what you find in fancy headlights and flashlights. And there are also IR LED's (for remotes) and UV LEDs'.

Lastly, it's time for math. I have a board that gives me 5V of power. Anything else on my board has to share that voltage for my whole circuit to work. So say, I have two LED's and both of those are 2.4 volt max for their Forward Voltage. I would want to add a resistor with 0.2V being absorbed through it to equal the power because that's the difference. This is called Kirchhoff's Law.

For my violet LED, i'd need a 280oHm resistor. 5V / 0.018 = 277 (I just rounded up). It gets a little more complicated if you want to limit the current to a certain degree.

Let's take that violet LED again, and this time with a 9V battery. Forward voltage is 3.0 Volts. I want to limit the current of electricity to this LED to 16mA. I would take 9 - 3.0 / 0.016 = my resistor ohms. I would want a resistor araound 375Ohms. That's pretty darn close to the average of 330Ohms.

Do you need a resistor?

The safe answer is yes. I didn't use one for my previous example, because I didn't need one. A quote directly from the Arduino site specified ""An Atmega pin can only supply about 40 milliamps which is not enough current to damage stndard LED's. A better choice would be a series resistor with a value of between 100 ohms and 1k, connected between the LED and ground."" So, knowing your output of power is important when messing around with LEDs."