Tag: Software

Pololu Python Library

Pololu Micro Serial Servo Controller
Pololu Micro Serial Servo Controller

I started writing a library for controlling the Pololu motor controllers with a computer trough a serial port.

I’m writing this in Python so the code can be cross-platform but I would be very glad to have some feedback about running it on other OSs than Linux. Actually, any feedback would be very welcome.

As of now it can interface with the Pololu Micro Serial Servo Controller that I got form RobotShop.  I am planning to use this code in my upcoming project RobotShop is sponsoring. I will supplement this library as I get newer hardware to work with.

I know there is already a python interface for it but I really wanted to have an object oriented way of managing motors (i.e. they can be instantiated and controlled more easily).

You can download the library here: lib_pololu.py (you will need to change the extension of the file to .py instead of txt).

In order to properly use this library you will require:

  1. Python
  2. Pyserial

If you use a civilized OS you may be able to get all this by typing this in a command prompt:

sudo apt-get install idle python-serial

Here is a sample script that will use the library in order to control a servo: servo_example.py (you will need to change the extension of the file to .py instead of txt).

Note for Redmond OS (aka Window$) users: you will need the Win32 Python extension for pyserial to work.

To WordPress from Blogger

I recently moved my blog from Blogger to an independently hosted WordPress installation and I needed to dynamically redirect the visitors going into the old pages so that the could see the new ones.

There are many tutorials on how to do this on the net but they usually involve fairly complex procedures and require modifying the Blogger HTML code and installing some plug-ins in WordPress. But, what I really wanted was a simple way of redirecting each blog post into its new version.

My solution:

I decided to write a little java script code that will do the job since it is a fairly simple task. All that is required to translate one of my permalinks is to strip the “.blogspot” part, and the “.html” part (see the example below).


Old address:  http://carlitoscontraptions.blogspot.com/2009/03/smoking-cyclops.html

New address: http://carlitoscontraptions.com/2009/03/smoking-cyclops/

The script:

<script type=”text/javascript”>

function redirect()
oldURL = document.URL;
oldURL = oldURL.replace(/.blogspot/, “”);
oldURL = oldURL.replace(/.html/, “/”);


This script consist of two parts: (1) a function that strips the unneeded parts from the current page URL, and (2) a time delay that executes this code after 5 s.

The only thing left to do is to insert this code into an HTML/Java script box in the Blogger layout editor and that’s it. No messy template edition required.

Eee PC 1000 + Ubuntu + KDE 4.1

My computer finally died. After close to ten years of faithful service, my computer catastrophically failed one last time (this doesn’t necessarily mean I won’t try to fix it). Anyways, this pushed me to finally buy another computer after many years of searching around.

I chose to buy an Asus Eee PC 1000; I could not be happier with my buy.

The obligatory Eee PC specs:

  • 1.6 GH Intel Atom CPU
  • 1 GB RAM
  • 40 GB SDD (8 + 32)
  • 10 in LCD
  • SDD card reader
  • Multi-touch touchpad
  • Shiny black body
  • WiFi draft n

The solid storage is great. It gives the peace of mind that I require to be able to take the laptop everywhere on my bike or in my backpack (I jump around a lot). I have currently formatted both disks with ext3 partitions mounted with the realtime option. I know about the life expectancy concerns but I have not found any reference that says that my SDD drives will die prematurely if I use the ext3 filesystem instead of ext2. Also, the ext3 filesystem is more robust and it doesn’t corrupt files if it is not checked often or if the computer is turned off abruptly.

I installed Kubuntu by creating a live USB stick using UNetbootin and then setting the USB stick as the primary device in the BIOS. The Eee PC then boots with the USB key and Kubuntu can be installed normally. For more info about installing Ubuntu please refer to this page.

In order to have the WiFi adapter and the wired Network card working, I used the kernel packages from Array.org.

The battery life is awesome. It is much longer than in conventional laptops, even with the processor working at full speed, the LCD at full brightness and the WiFi adapter enabled. Also, the keyboard is very nice and not too small. It is really easy to get used to it. For more info about the Eee PC performance, please watch the following video:

The touchpad is very good and the multitouch feature works very well. It is hard to go back to normal touchpads. Nevertheless, a mouse is much faster and precise, so I decided to buy a mouse: the Logitech VX Nano.

Needless to say, the VX Nano is wonderful and a perfect match for the Eee PC. They have both been carefully designed with particular attention to detail and quality. They come with carrying cases and are very sturdy and good looking.

It is obvious that I’m happy with my two new toys.

Finally, KDE 4.1 is simply perfect. It is beautiful, fast, and very well thought. In short: the perfect software for the perfect hardware.