Saturday, August 31, 2013

Raspberry Pi Journal #16

Installing Abiword

Leafpad is fine, if what you're doing is some light word-processor, without any fancy things. If you want to have graphics, though, you need something better. There's open office or Libre office. There's also Abiword and Gnumeric. Let's do the easy way first. Install Abiword!

The first thing I check is to see whether or not Abiword is installed:

which abiword

Not installed. Okay, so let's download the package

sudo apt-get install abiword

It'll go through the installation process, and will put a link on the desktop under Office. I decided to type something and add some graphic to it.

As you can see, AbiWord has multiple fonts, and the ability to add graphic. That's not all. It also has various capabilities, such as HTML markings, and epub export. I have book making ambition, remember? So, this capability is a big deal to me.

I don't have a scanner attached to my Raspberry Pi, yet, and there's no instruction on it. So, I don't plan to add some anytime, soon. I'm happy with my current set up of taking pictures with my 3DS and transfer it via SD card. I do batch transfer, though, so it's not like it's an everyday occurrence.

The printer setup is quite flexible. I'm not sure whether to credit AbiWord for it, or maybe CUPS printer driver. There is an option to print 2 or even 4 pages on one page, and it looks to be quite robust, with various options. I'm pretty happy with it.

And there it is, the double page print. It's quite charming to have, and I like it very much! I think AbiWord should be in everyone's toolbox, assuming you're not running it headless. If you install GUI for work, then you should definitely get AbiWord.

By the way, I eventually did installed Open Office, also known as Libre Office.

which libreoffice

Installing it:

  1. sudo apt-get install
  2. sudo apt-get install libreoffice

I always know it by the openoffice moniker, so imagine my surprise when it installed libre office! Ah, the constant march of progress!

Friday, August 30, 2013

Raspberry Pi Journal #15

Changing Desktop Background

I found that the default raspberry pi logo on a white background is too bright for my taste. So, I decide to change it a bit. The background or wallpaper can be easily changed by doing right click on the background itself. A set of menu will come up.

Choose Desktop Preferences. You can load any picture that you have and have it as your wallpaper.

Desktop Grub is darker color, but I've since replaced it with Saber Dollfie.

And if perchance you have a different menu, try this from command line:

pcmanfm --desktop-pref
pcmanfm -w file

Type "man pcmanfm" will tell you all the different options, and I can tell you it works!

And should you want a script to randomly pick a PNG picture to use as wallpaper, I managed to cobble this line:

PIC=$(ls *.png | shuf -n1);pcmanfm -w $PIC

And finally, here is my final script. Notice, I end the script with a specific image.


for ((walltick=100;$walltick;walltick=$walltick-1))
  PIC=$(ls wallpaper/*.jpg | shuf -n1)
  pcmanfm -w $PIC
  sleep 100
pcmanfm -w saber.png
sleep 5
exit 0

Thursday, August 29, 2013

Raspberry Pi Journal #14

Adding a Temperature Widget

Go to the bottom bar on the GUI Desktop. Hit the right mouse button, and a menu will pop up. One of the option is Add/Remove panel item. Among them is a Temperature sensor.

Select that to add it to the bar. You can move it up and down for proper placement. The temperature reading is in Celcius, and anything below 70 degree is fine. My usual temperature reading is about 54 degree.

There is an exception. When I was connecting my Kindle to it, it sometimes goes to 84 degree for a second or two. I wonder why? My guess is that there is a voltage drain that somehow causes the calibration to be off. Otherwise, no harm.

Wednesday, August 28, 2013

Raspberry Pi Journal #13

Installing CUPS for Printer

So, I have an old Samsung ML-2525W laser printer laying around. Naturally, since I'm looking for more gadgets to be connected to my Raspberry Pi, it got the job. The first shock of the day is that there is no standard printing spool. It took some digging to come up with lpr, and lp. Both of these program are old. The new one, after much digging, is CUPS (Common Unix Printing System). That one threw me out for a loop, because Apple made it.

Anyway, having CUPS makes life tremendously easy. There is a gotcha with permission, though. Let's go through the process.

The first thing you do is to install CUPS:

sudo apt-get install cups

After some heavy duty downloading, everything is set up. The installation starts cups daemon server automatically. You can check it out by opening your web browser to localhost port 631

If all goes well, you will see the browser showing CUPS Administration page.

Everything is browser-based, so it's really easy. Just add a new printer and you're home free.

You need to login and enter your password. The browser interface allows you to administer the printer completely, including moving printing jobs, or even cancelling them. You don't want just anybody to be able to do so.

Did I say adding a new printer is easy? Well, there's a gotcha. You cannot add a new printer without proper permission. Didn't you just entered your password? Yes, you did. So, what's going on?

This instruction should be with all printer installation instruction, but some missed it. You need to add yourself to printing administration group. Do this:

sudo usermod -aG lpadmin username

where if you're the default user, that should be "pi".

Success! I see my printer name there. After selecting it, would you believe I still have to choose my printer from a long list of names? Anyway, set up your defaults here. I set my page size to "US Letter".

That's it! Do a test print and see if it works! Congratulations, you just added a new printer!

Book Review #2

Programming the Raspberry Pi

Getting Started with Python
Simon Monk

The problem with Getting Started series is the extremely limited amount of information that the author can pack into such a short space. However, I think Simon Monk does an admirable job doing it. The book is divided into two parts. The first part deals with Python as a language and all the idiosyncracies the language has. The second part deals with communicating with various modules available on the market.

I really wish that Simon Monk would write two books: One deals with Python language, and the other deals with hardware projects. As it is, there is quite a bit cut out of the book. There's a lot of dependence upon internet resources. It's not that the information presented is lacking. It's just that it's such a bare bones that you have to read the book extremely carefully, as to not miss anything, or worse, misunderstanding the information presented.

There is an obligatory chapter dealing with installing the program, or in this case, setting up the Raspberry Pi. I wonder if you need that much details, but it's actually a compact form to setting up and installing Raspberry Pi, while still providing more details than what the Foundation provide. This isn't good or bad. It's just a design decision that we should be aware of.

The "do-what-I-do" teaching technique is not what I think a good way to teach. Sure, it will cause the students to get results very quickly, but can they expand the knowledge? Most of the time, they won't. I think it's a pity that the book is so short, because the information is presented rather well. It's just that the real foundation is not explained. Woe befall readers who did not do his homework! 

I'm used to read condensed text, and this text is not the most condensed. However, there is a judgement call here. Do you want to condense the text so much that it takes effort to read, even though there's more material? Or do you want to sacrifice detailed info in an effort to make it readable? I think the author did a great job balancing information and readability. If only more authors write like this, I will be happy!

I was pleasantly surprised to see Hangman game in there. In truth, the game is so easy, it is easily implemented in just about any language in one hour. For some reason, most book authors didn't do that. They simply choose a simplistic (and useless) program to make a point. So, I'm glad to see a good game in here.

I'm not so happy that the function list is rather short. I'd like to see a few pages of it, outlining the most common usage. It's a judgement call, but I'd say I can use a few more convenient functions and their relevant modules in one place.

I'm not too happy about drawing section, either. Perhaps it's just me, but the author never answered the question, "How do you put a dot on screen?" 

As far as I'm concerned, if I can put a dot on screen, I can do anything, albeit slowly. I don't have that information. I do have lines, ellipse, and rectangles. I guess, I can make a 1 pixel rectangle, but then it'll be even slower. I know SDL does allow surface, but I don't see it there. There is a discussion about writing an arcade game, but I think the game falls into the simplistic side, and not the sophisticated side. 

The rest of the short pages deals with hardware. There is a good project selection here, including roving robots. There is enough subject to please most people. This is where I think the format is at fault. I'd like to see more pages on this subject! Thus, I think it would be helpful if the author would write 2 books, instead of one.

All in all, it's a good effort by Simon Monk, marred only by the small number of pages inherent in "Getting Started" series. I can recommend this book to any Raspberry Pi user interested in getting started in Python.

Tuesday, August 27, 2013

Raspberry Pi Journal #12

Installing NOOBS

NOOBS is a one gigabyte download from It contains several operating systems that you can install. I'm installing the default Raspbian here. Even though the process is straightforward, there's quite a bit of steps to go through. I've been taking pictures, and I'm sharing them with you so you can see what's going on.

Take care to set up your regions, and keyboard. The first time I installed, I didn't set the keyboard to US keyboard. Needless to say, what I type and what I see on screen are two different things!

You download NOOBS into a fresh SD card (running FAT32), a minimum of 4GB size. Then simply insert the card into Raspberry Pi and turn it on.

Wow, there sure is a lot of pictures here.

I'm installing the default Raspbian system. If this is your first time doing Pi, there's no reason not to do so. Raspbian is based on Debian OS, so it's a pretty solid choice.

Make some tea. It's going to take a while. The process is done automatically, but it takes time to write to the SD card. I didn't time it, but I'd say it's about 10-15 minutes.

Installation is complete. Now it's time to reboot!

Raspi config is started automatically

I enable boot to Desktop. The reason is that I'll have an easier time setting up things. However, there's some magic behind the scene. There's automatic password entry, so the system is less secure overall. Furthermore, all those graphic drawing on screen does make it slower overall.

I decided to trade speed and safety for ease-of-use and convenience. If you don't like it, you'll want to enable the short cut to stop the windowing system.

Set your Time zone!

Unless you're British, set your keyboard!

Ugh. The keyboard installation is pretty involved, doesn't it? I'm using wireless keyboard with USB dongle, so I'm treating it like any other USB keyboard. I'm setting it to just boring old keyboard. No fancy key mapping for me!

If you want to set up your Raspberry Pi to run headless, you want to set this up. Once you download all the necessary drivers and packages, then you want to re-run raspi-config and disable booting into GUI.

Advance options? Good stuff here!

Overscan setting, just in case you don't like black borders. Mine works perfectly out-of-box. Sometimes, though, I didn't turn on the monitor when the Pi boots, so I would be treated to different resolution and I see black bands.

Hostname for the network.

I set it to 256 MB. Half my main memory.

If you want to run headless, set it lower!

Done setting up? I think I forget something. In my installation, I went into the boot configuration file
  • hdmi_force_hotplug=1
  • hdmi_drive=2

If you missed it, you can go to /boot/config.txt to change it. This will force HDMI output, which is my TV.

Now reboot, and open up Leaf Pad, and type in all the punctuation marks and all to see if your keyboard is set up right. 

Well done! You have just installed an operating system from scratch!

My network connection works right off the bat. There's an icon Wifi Config where you need to put in your password. You know the network connection works because the time will automatically be set to local time. That's why it's important for you to set your locality.

Monday, August 26, 2013

Raspberry Pi Journal #11

The Making of Cigar Box Computer

It was a long time ago where I saw a smallish motherboard computer that somebody suggest would make a great cigar box computer. I passed on that kit, but I always wondered if I should have it someday. Computer processing power is just such a tremendous amount, that most of it is wasted. I've always wanted a small, cheap and rather underpowered computer to do my daily web surfing and working.

For a time, I use a Kindle Fire HD with bluetooth keyboard. It's just such a neat little device, and I've used that successfully for my Nanowrimo activities. Enter the Raspberry Pi. After waiting for a great while, I finally managed to locate a Raspberry Pi and proceeded to go to the local thriftshop and look for some empty boxes.

I picked up a wooden cigar box for $1.49. It comes complete with wax paper and a square wooden rod. Perfect! Well, not really. I needed some holes for cables on the back. Out comes the drill. I drilled a series of holes in the approximate shape, followed by some shavings with my trusty swiss army knife. Done.

I got my Raspberry Pi from element14. This was before sparkfun got a massive dose of Raspberry Pi. As I write this, I saw some kit, along with the new camera at Microcenter. I will have to revisit the store and get another one. I'll be running headless on that one. 

You can see the cigar box in the back, along with my $250 32inch HDMI flat screen.

You can see the holes on the back. A big one for USB cables on the left, and a small round one on the right. At one time, the drill slipped and I drilled my hand. Ouchie. That's when I decided pulling out my knife would be better. The sharp swiss army knife turned out to be an easy way to make holes.

I'm using Gigaware USB 2.0 Desktop Hub. I also have a USB 3 Hub, but that one didn't work. I routed the power cable through the small hole. That power cable comes from my old multi switch device. I connected it on the "computer" switch.

I connected one of the USB output from the hub into the micro USB to power the Raspberry Pi. It's okay to do this because the power micro USB connector does not contain data pin. Only power pins. This way, whenever I turn on the USB hub, I turn on the Pi. Very convenient.

For data, I still need to connect the USB data cable from Raspberry Pi to the hub. I used the bottom USB connector and into the hub.

I use Logitech n400 Wireless keyboard with Pad. It's really light and convenient. It takes some practice, though. Took me two weeks to get comfortable with it. The dongle has some kind of USB extension. I simply put it in. It has quite a nice range. I'm really happy with it, especially since it works right out of the box.

I plugged in male to female USB cable. I knew I will put the box in out of the way place, so in order to conveniently plug in memory card/flash drive, I use this extension.

This is Belkin n150 USB Wifi Adapter. I simply pick one off the shelf, the cheapest kind I could find. I probably should have visited microcenter store, because the last time I was there, I saw some really tiny ones that would not crowd the USB plug.

And there it is, the final box incarnation. Everything fits in perfectly, with the wooden rod placed so that the Pi does not shift in the box. Plenty of space to wound the cables in. The micro USB power connector eventually broke off, leaving just a bare wire. I managed to squeeze the plastic together, but I will have to watch out for it. It happens every time I replace the SD card.

This is my SD card to USB converter. It's very convenient to use. I also have USB flash drive with lots of capacity. I don't know about the transfer rate, but for medium movie files, it works great.

Speaking of movie files, I have an old Flip video recorder. Remember those? It was a cute way to record movies. I plugged in the Flip into USB connector, and the Pi autodetect the device. For a time, I use this:

lxterminal -e omxplayer -o hdmi filename

but later on, the sound went all out. I never did managed to fix it without it blanking the screen, and I don't want to have to reset the frame buffer every time. So, eventually, I gave up and used media player instead. mplayer works great with framedrop feature. I'm pretty happy with it.

So there you have it: My very own cigar box computer. I love it so much, especially considering that the Pi does not draw much power, and neither does the TV. The TV was rated to cost $6 per year. Interesting, eh? I wonder how they come up with that?

Sunday, August 25, 2013

Cooking Journal #1

Cooking with Rice Cooker

If I am what I eat, then I'm cheap, fast, and easy! - Anonymous

As a simpleton, I really like simple food. This one here is a staple of mine. Easy to make, easy to clean.

  1. Put 1 cup of rice in pan
  2. Put 1.5 cup of water in pan
  3. Put 2 sausage links in steamer basket
  4. Press start on "White Rice"

Ummm... That's it.

1 cup of rice

1.5 cup of water

2 sausage links

Push Start

Saturday, August 24, 2013

Raspberry Pi Journal #10

Book Making with Thermal Binder

Last Journal, I showed you how I made some books with laser printer, stapler, and a roll of duck tape. This time, I showed you how I do the same thing, but with a thermal binder.

The model I use is Fellowes Helios 60, which as I understand it, a step up from the cheapest model. This model is more solidly built, and I'm glad I have it. First you turn on the device from the power switch in the back. Then, when you're ready to bind, you push the power button on the front. When the status light turns green, you're ready to bind.

The device has a springy clamp to it. It automatically adjust to the thickness of the binder. It's all very easy and convenient to use.

The device has a chart printed to tell you how long the thermal process should take. It also has a stair-case ruler that lets you slide the binder to see which of the setting should be used. I hardly ever do that since it has automatic sensor on the device.

The binder has 3 strips of glue. Strange that they are along the spine. I thought it would be crisscrossing the spine. But it works fine. I don't have the really thick spine, but I think the thicker the spine, the wider the glue strip in the middle.

The paper must be perfectly aligned! Once I square them, I like to run my finger along the paper to make sure that the paper is one solid block. Then I slip the cover, and run my finger again to make sure. I can't emphasize this enough. Everything must be square. There isn't much glue to bind the paper if a few sheets are misaligned, even by a millimeter.

Once the binder is in place, just hit the OK button. The timer is set automatically. Sometimes, I manually adjust the timer to one level more. It adds 10 seconds to the time.

There's cooling rack in the back of the device. It's really very convenient to use. Sometimes, though, the paper would bend, so it's a good idea to put some solid backing on it. The binding is really tight, and unless the papers are misaligned, it's pretty solid.

I printed a few bound book this way. Mostly some instructional pages. The cover is transparent, so I can print out a cover sheet no problem. Did I say it's convenient? It's very convenient!