5 of 12

Stoppen the blinkenlights

In Linux, pretty much everything is a file: A file is a file, a directory is a file, and devices are files, too. These files are not always readable and writeable, but you can try to use some standard file operations on them. For the LEDs, writing 0 or 1 to certain files in /sys/class/leds/... makes the LEDs go on and off:

Assuming you have an ssh connection to your beaglebone, switch to a "root" session by typing:

sudo -s

You should now see something like "root\@bbb-bob" in the terminal. Be careful in root sessions - the root user has full adminstration rights, and Ubuntu won't ask you safety questions like "Are you sure you want to mess up your system?".

Switch off the first of the four system LEDS

Note: On some newer distributions, these LEDs were renamed slightly. Go into the folder "/sys/class/leds/" and poke around a bit. Mine is now called "/sys/class/leds/beaglebone:green:heartbeat".

By default, the first LED blinks in a heartbeat pattern, which can be quite annoying. Let's switch that off.

Go to the folder of the LED. On an older distribution, it is:

cd /sys/class/leds/beaglebone\:green\:usr0/

On a newer distribution, the path is

cd /sys/class/leds/beaglebone:green:heartbeat/

The blinking is triggered by whatever is set in the file "trigger". Let's have a look at that file. The command "cat" gives us the content of the file "trigger" on the standard output:

cat trigger

For me, the file looks something like

none rc-feedback mmc0 mmc1 timer oneshot [heartbeat] 
backlight gpio cpu0 default-on

The brackets [ ] indicate that it is currently set to "hearbeat". We'll disable the heartbeat pattern by setting the trigger to "none":

echo none > trigger

The command "echo none" means: Repeat the string "none" to the standard output. The ">" redirects the standard output to whatever stands on the right side of ">". You can think of the ">" command as an arrow that points the output of one command to the input of another. The "command" on the right is a file-name, so the "none" is simply written to that file.
The file is, of course, not an actual text file, but a special interface file that tells the BeagleBone to set the trigger of the LED off.

Now you can manually set the LED on and off:

Assuming you are on an older distribution, do:

echo 0 > brightness
echo 1 > brightness

Disable the "blinking" of the LEDs on boot

There are many different ways to do stuff every time the computer starts. I put the command that disables the blinking of the LEDs into the rc.local file by callling the command

sudo nano /etc/rc.local

and inserting the following lines between all the comments and the "exit 0" line:

# Disable the blinking of the LEDs, for older distributions
 echo none > /sys/class/leds/beaglebone\:green\:usr0/trigger
 echo none > /sys/class/leds/beaglebone\:green\:usr1/trigger
 echo none > /sys/class/leds/beaglebone\:green\:usr2/trigger
 echo none > /sys/class/leds/beaglebone\:green\:usr3/trigger

For newer distributions, the lines have to read

# Disable the blinking of the LEDs, for newer distributions
echo none > /sys/class/leds/beaglebone\:green\:heartbeat/trigger
echo none > /sys/class/leds/beaglebone\:green\:mmc0/trigger
echo none > /sys/class/leds/beaglebone\:green\:usr2/trigger
echo none > /sys/class/leds/beaglebone\:green\:usr3/trigger

Now, when I reboot my BeagleBone using

sudo reboot

the lights flash for 10 seconds while the BeagleBone finishes booting, but then go dark as soon as booting is finished.


Essential first steps on a fresh BeagleBone Black

You should complete the following steps in order to make the BeagleBone only accessible to you, and to make Ubuntu a bit friendlier.

Creating a new user and deleting the standard user

Assuming you are connected to the BeagleBone via ssh, you can create a new user by issuing the following command:

sudo adduser bob

Enter a Password and as much personal information as you want. Give the new user adminastration rights by adding him to the sudoers

sudo visudo

If you don't want to be bothered with password questions all the time, append the line

bob All=(ALL) NOPASSWD: ALL

to the file. Alternatively, you can make the line look like

bob ALL=(ALL) ALL

This asks you for the password when you use the sudo command. It is considered more safe.

Save the file by simultaneously pressing CTRL+O. Then exit the editor with the command CTRL+X.
You are back in the terminal. Now switch to the freshly created user by running

su bob

Congratulations! You now have your very own user account.
Try to make a test file to see if you have user rights.

sudo touch test_file

Now check if this file is there:

ls -la

You should see something like

-rw-r--r-- 1 root root 0 Sep 12 11:20 a

The middle part confirms that the file belongs to the user "root" and to the group "root".

Logout of the session as the new user "bob" by typing

exit

and then out of the ssh session as ubuntu by typing

exit

again. Then do a fresh login as the new user bob, using ssh (see above). Now, as the user "bob", do:

ps aux | grep ubuntu

to see if the old user has any processes running. If so, kill them using

sudo pkill <process-name>
# or
sudo pkill -15 <process-id>

Then remove the default user using

sudo userdel ubuntu
sudo rm -r /home/ubuntu

The last command removes the home directory of ubuntu, which is not needed anymore. Caution: It can delete other things, if you don't type it exactly as shown.

Updating the software

Update your system

sudo apt-get update
sudo apt-get upgrade

Press enter whenever it asks if it should proceed

Install the man-pages

Install manual pages

sudo apt-get install man-db

Read your first manual page

man rm

This is the manual page for the "remove" command.

Type /prompt and press ENTER to search for the word "prompt" in this manual page.
Type / and press ENTER to search for the next instance of the word "prompt".
Use the arrow-up and arrow-down, page-up and page-down keys to scroll up and down.
Type q to quit viewing this manual page.

Updating the system time

Update the system time.

sudo ntpdate ptbtime2.ptb.de

Set the correct timezone

sudo dpkg-reconfigure tzdata

Assigning a fixed IP-address and a nicer hostname

For the following procedures, you either need to be logged in on the Beaglebone (via ssh or so), or you can edit the files on the uSD card before you plug it in the BeagleBone. In the latter case, make sure to include the full path to the respective files on the uSD card! I accidentally changed the files on my computer once...

Fixed IP-address

While logged in on the beaglebone, edit the etc/network/interfaces file to make it look something like this (assuming your router is at 192.168.0.1)

# primary network interface
auto eth0
# iface eth0 inet dhcp
iface eth0 inet static
address 192.168.0.123
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
dns-nameservers 192.168.0.1

After a restart, your BeagleBone will have the IP-address 192.168.0.123.

Nice hostname

This is strictly optional. But on some networks, you can talk to a computer via it's hostname. It makes sense to try if your homenetwork supports this.

Edit the hosts file on your BeagleBone:

sudo nano /etc/hosts

and make it look like

127.0.0.1       localhost
127.0.1.1       bbb-bob

Then save, exit, and edit the hostname file as well:

sudo nano /etc/hostname

Put a single line in it, that only contains your hostname:

bbb-bob

Save, exit, and you're done! After a restart, the BeagleBone will have the hostname "bbb-bob". You can try to ping this hostname with a Windows computer:

ping bbb-bob.mshome.net

But usually, this does not work.


Drawing a 3d-Cylinder with Inkscape

positive
cylinder

I needed this drawing for explaning the Van-de-Graaff generator. The way it works is suprisingly complex; neither the Germannor the English Wikipedia article on the Van-de-Graaf generator get it right, in my opinion. But I quite like the nice explanation that Rimstar has.

Here are my notes on how I made the drawing:

Drawing the cylinder:

Drawing a positive charge

Cylindrically distorting the positive charges:

Putting everything together

Now you are done! Here is my finished svg file.


Basic Setup: Booting into Ubuntu from uSD

If you want to create a uSD card so that your Beaglebone Black will boot into Ubuntu from it, you have two options:

  1. Follow the instructions given at elinux (as of July 2014, that would be in section 4.4.1). This is what I used to do, but for some reason, from early 2014 on the installation led to images that did not boot. I got stuck with the first three LEDs ON and no idea how to debug it. (I tried and tried, using various computers, uSD cards, card readers, and beaglebones. Very frustrating!)
  2. Follow the instructions given at armhf. These involve more manual steps, but on the plus side, you learn something. For some reaons, these instructions did not work for me in early 2013, but they do now

These are my notes for following option 2.

Download the files given here in the section Ubuntu. (As of July 2014, it's Ubuntu Trusty 14.04).

Follow the installation instructions for those files. (July 2014: Link here). The instructions assume some familiarity with Linux, such as knowing where to use sudo, and how to unmount stuff. That why I am replicating the instructions below, filling in details on what I had to do to prepare the uSD card using a 64bit Ubuntu 12.04 LTS machine.

Put your uSD into a card reader (I had a USB card reader), and plug the whole thing into a computer running linux (me: 64bit Ubuntu 12.04 LTS). Be sure to use a card that has nothing valuable on it - the following steps will erase everything on it.

Wait a bit until the card is automatically mounted, then see where it is by running

mount

If nothing that looks like your card shows up, do

ls /dev/sd*

For me, the card showed up as sdb, with the partitions sdb1 and sdb2 being mounted. I unmounted those using

sudo umount sdb1
sudo umount sdb2

Partition the uSD card (for me: sdX is /dev/sdb):

sudo fdisk /dev/sdX

Initialize a new partition table by pressing: o.
Make sure that it's empty: p
Create boot partition: n (new), p (primary), 1 (first partition), press enter (default first sector), +16M (last sector).
Change parition type to FAT16: t (type), e (W95 FAT16(LBA)
Make partition bootable: a, then 1 (that's a "one")
Create data parition: n (new), p (primary), 2 (second partition), press enter (default first sector), press enter (defaul last sector).
Check the partition table: p
Commit changes: w

Make sure the command runs through without errors. I had first forgotten to umount the uSD card, and had to run everything again after unmounting it.

Format the partitions

sudo mkfs.vfat /dev/sdX1
sudo mkfs.ext4 /dev/sdX2

The second command will take a few minutes to finish. Afterwards, change to the folder that contains the downloaded u-boot file and Ubuntu tar.xz file. Install u-boot on the first partition by running

mkdir boot
sudo mount /dev/sdX1 boot
tar xJvf bon-uboot.tar.xz -C boot
umount boot

Then install Ubuntu onto the data partition:

mkdir rootfs
sudo mount /dev/sdX2 rootfs
tar xJvf ubuntu-trusty-14.04-rootfs-3.14.4.1-bone-armhf.com.tar.xz -C rootfs
umount rootfs

Now the image is ready to boot. Pop the uSD into the BeagleBone and boot it up. For me this did not work - the BeagleBone displayed 4 solid lights and stopped booting. I had to remove the power, hold down the user/boot button (button on top, near the uSD slot), and apply power again. I kept the button pressed until all LEDs lid up, then let go. Finally the BeagleBone booted and I saw the familiar heartbeat pattern on LED2.

I asked the armhf guy what to change so that I don't have to press the user/boot button every time I start the BeagleBone, and the reply came almost immediately: The trick is to replace (on the first partition of the uSD card) the file uEnv.txt with the following file:

optargs=fixrtc
loadfdt=ext4load mmc ${mmcdev}:2 ${fdtaddr} /boot/dtbs/${fdtfile}
loaduimage=mw.l 4804c134 fe1fffff; if ext4load mmc 0:2 ${loadaddr} /boot/zImage; then mw.l 4804c194 01200000; echo Booting from external microSD...; setenv mmcdev 0; else setenv mmcdev 1; if test $mmc0 = 1; then setenv mmcroot /dev/mmcblk1p2 rw; fi; ext4load mmc 1:2 ${loadaddr} /boot/zImage && mw.l 4804c194 00c00000; echo Booting from internal eMMC...; fi
mmcboot=run mmcargs; bootz ${loadaddr} - ${fdtaddr}
uenvcmd=i2c mw 0x24 1 0x3e; run findfdt; if test $board_name = A335BNLT; then setenv mmcdev 1; mmc dev ${mmcdev}; if mmc rescan; then setenv mmc1 1; else setenv mmc1 0; fi; fi; setenv mmcdev 0; mmc dev ${mmcdev}; if mmc rescan; then setenv mmc0 1; else setenv mmc0 0; fi; run loaduimage && run loadfdt && run mmcboot

The file looks quite different from the original, and I can only guess what goes on inside it. But it works!

I plugged the BeagleBone into my network and checked my router (FritBox) for new IP-adresses. Using PuTTy, I logged in via ssh using username ubuntu, password ubuntu. Success!


3d printing using a RepRap Ormerod

First Installation

Install the latest (stable) Arduino IDE. You won't actually need the IDE itself, but it installs a driver that you need.

Download the latest Pronterface. No installation required, just run the ormerod.cmd file. If you want, rename the "Slic3r-win" folder to "Slic3r", this will enable additional functionality in Pronterface.

Making a 3d Model

There are many different methods, this is just one of them.

Make a model using OpenSCAD and save it as an .STL file.

Convert the .STL to G-code using Slic3r. You should already have Slic3r, because it comes with the reprapppro-Pronterface-package that you downloaded earlier. That package also has default settings for our Ormerod printer.

OpenSCAD

OpenSCAD uses a programming approach to CAD. You define your geometry in the text area, then compile it. All units are in mm (unless you use "Scaling" in Slic3r later.)

Example .SCAD file for a "plug" (just copy/paste this into the text area)

// This is a comment

// This is a "function" definition
// (this function here takes no arguments)
module plug_no_hole() {
    linear_extrude(height=2) circle(17);
    translate([0,0,2]) linear_extrude(height=10) circle(12);
}

// This is the "main" code that is executed. It's just one command.
difference() {
    plug_no_hole();
    translate([0,0,-1.0]) linear_extrude(height=15) circle(5.5);
}

Compile and render this by pressing F6. Click "Design"->"Export as STL" to save the relevant STL file.

Slic3r

Run the Sli3r.exe that came with your Pronterface download.

Verify that the drop-down menus for "Print settings", "Filament", and "Printer" all say something about "Ormerod" or "Ormerod-0.5" or so. These are the default settings for the Ormerod printer.

Drag and drop your file in. You can drop multiple files into the print area, or one file many times, if you want to print several pieces at once!

Important: Under "Printer Settings" -> "Custom G-code", change the line T0; Select extruder to T1; Select extruder!

Click "Plater"->"Export G-code".

Printing

Transferring your files

Important: Open your G-code file with a text editor, and check that there is no line like T0; Select extruder. If there is, change it to T1; Select extruder.

For large files (> 1Mb):
Switch the printer off, take the uSD card out of the printer. (Push on it, it pops out. You might need some plastic object to push on it, if your fingers don't reach.) Using the uSD-to-USB adapter, put your .g-file into the "g-codes" folder on the uSD. Put the uSD card back into the 3d printer.

For small files (< 1Mb):
Use Pronterface (see below), and choose a file in it. Instead of "printing", hit "SD", then "upload".

Turning on the printer

Turn on the power supply and connect the printer's USB cable.

Wait 10s for the printer to boot up, then start Pronterface (ormerod.cmd).

Choose "COM4" (might be different on other PCs) in the drop-down menu and connect to the printer.

Calibrating the printing bed

Make sure the print-bed is clean and sits on the printer with the Kapton tape (yellow stuff) up.

Home the x and y axes by clicking the respective "home"-buttons in the upper left side in Pronterface.

Note: The z-homing does not work. DON'T PRESS THE Z-HOMING BUTTON OR YOUR CALIBRATION WILL BE OFF!

Turn on the heaters (Heat: 200, Bed: 56) and wait for the printer to warm up. The printing bed warps a bit, so you want to calibrate in the hot state.

Automatic bed plane compensation does not work, because it needs a good z-probe. You'll have to do it manually and repeat it for each print.

Send the commands to turn the bed compensation and axis compensation off:

M561; bedplane comp off
M556 S100 X0 Y0 Z0; orth axis comp off

Decide on four points for the calibration. These for points must form a rectangle. The rectangle should be at least as big as your printing aread (but not so big that the print-head collides with the clips on the bed). "0"th point is near the origin, 1st is clockwise from that, ...

The x- and y-axes should have been homed earlier. If they weren't, do it now.

Lift the head to about 5-10 mm above the bed.

Go to first corner:

G1 X30 Y22

By hand, lower the head just above the bed and note the z -position (let's say it's 0.0 because you're close to the origin). Set this as the z=0 point

G92 Z0

Send the calibration point

G30 P0; The current position is the 0th corner of the bedplane-comp rectangle

Move head up by 10 mm. Go to the next corner

G1 X30 Y170

Lower the head by hand and note z-position (somewhere around 0.9mm). Send calibration point

G30 P1

Lift head by 10 mm. Go to the next corner

G1 X190 Y170

Lower the head by hand and note z-position (2.1mm). Send calibration point

G30 P2

Lift head by 10 mm. Go to last point

G1 X190 Y22

Lower the head by hand and note z-position (1.5mm). Send last calibartion point and command the printer to apply this compensation from now on. Don't forget the S.

G30 P3 S

Enable the orthogonal axis compensation again:

M556 S74.5 X0.05 Y-0.3 Z0.1

Final z-Calibration

Lift the head by 10 mm. Go to the middle of the print bed (this is most likely where your print is started, so here the calibration is most important.)

G1 X100 Y100

Lower the head by hand and set this as the new z=0 position

G92 Z0

Lift the head by a few mm, just for safety.

Now you are done with the calibration!

Starting the print

You should always print from the SD card, because sometimes when printing over USB, the commands aren't sent fast enough, and the print will look bad.

Go to "SD" -> "SD Print", select your file and start the print!

Make sure that the first two layers look good

Once the print is done, wait for it to cool down. Otherwise the piece will warp, especiall if it is mostly flat. If it's a pretty solid shape, you don't need to wait.

Remove the finished piece using a thin plastic spatula (a filed-down cable tie works for this). Don't use any metal tools on the Kapton surface.

Turn off the printer by removing the USB connection and switching off the power supply.

Errors


Standby Verbrauch zu Hause II

Bei den folgenden Geräten war ich schon immer skeptisch; deswegen hatte ich sie entweder ausgesteckt oder per ausschaltbarer Steckdosenleiste vom Netz getrennt und in Teil 1 noch nicht gemessen.

Gerät Modell Zustand Verbrauch Anmerkungen
Ventilator Honeywell KAZ HY108E Off / 1 / 8 1.8 W / 23 W / 66 W Schwenken: +7 W
Ventilator Honeywell KAZ HS216E Off / 1 / 2 / 3 0.0 W/ 29 W / 33 W / 40 W Schwenken: +0 W
Xbox Kinect Kinect 1, für XBOX360 Off 0.1 W  
Surround-Verstärker Pioneer VSX-C300 HOff / SOff / Stby 0.2 W / 24 W / 29 W s. unten
DVD-Spieler Pioneer DV 585 Off / Stby 0.7 W / 8.2 W  
XBOX 360 1. Generation? Off / Idle 4.0 W / 100 W  
Apple TV 2. Generation Off / Idle 0.9 W / 2 W  
Bluetooth Audio Adapter Philips AEA 2000/12 Off / On / Streaming 0.1 W / 0.2 W / 0.3 W  
Lichtleiste IKEA Komplement Off / On 0.2 W / 4.4 W  
TV LG 32 LH3000-ZA Off / On 0.4 W / 100 W On = DVB-C

Anmerkung zum Surround Verstärker: Der stattliche Verbrauch im Soft-Off (SOff) scheint ein Fehler des Gerätes zu sein. Schaltet man das Gerät aus dem Hard-Off (HOff) ein, geht es in einen SOff, der nurr 0.9 W verbraucht. Nur wenn man es dann per Fernbedienung ein (On) und wieder aus (SOff) schaltet, verbraucht es die absolut inakzeptablen 22 W.


Recording and Editing Microphone Input using Audacity

This is my first screencast. I say "just" a lot.

https://www.youtube.com/watch?v=r6UCrGguTxk