Learning Python for programmers – video lectures

In my day job I teach students how to program. Recently, I gave three days of review lectures for my CS 1301 (Introduction to Computation – With Python and Robots) class. These three 50 minute lectures brushed over all of the major topics we covered in class very quickly. They would be very useful to somebody who knows how to program another language (such as Java or C), and wants to learn the basics of python in 2 and a half hours.

If you would like to watch more in-depth video lectures on any of the above topics, find the appropriate day in the class calendar and watch that video.

Ebike Solar Charging

My electric bicycle has a motor that draws up to 450 watts (if I drive it over its nominal 250 watt rating), and the batteries have only 5AH (approx 120 watt hours) total capacity. Keeping in mind that I should only discharge the lead acid batteries to 50% (approx 60 watt hours) this indicates that I can only use the motor at full blast for eight minutes.

But, since I only use the motor to help go up hills and provide extra acceleration, and most of the time it is not drawing the full 450 watts, I actually have a much longer run-time. I deliberately chose to put small batteries on the bike both to keep the weight down, and to allow them to be recharged using solar cells (8 watts) in a reasonable amount of time. Under full sun, hypothetically the solar cells will generate 60 watts of power to recharge the batteries from 50% to 100% charge in 7.5 hours. In actual practice, it takes more like 10 hours of sunlight, usually around two days.

How does this work in actual practice? Here are some examples.
Early Saturday morning I biked a 2.8 mile round trip to the post office, using the motor lightly. I left the bike outside all day and it was recharged by 4pm. On Sunday afternoon I rode the bike to a friends house ( a 2.5 mile round trip). Because it was overcast and raining, no charging occurred before I then rode the bike another 0.9 miles to the Marta station (up hill) and left it all day. (At this point the batteries had been used for 3.4 miles of travel without charging.) When I returned at the end of the day and rode the bike home (another 0.9 miles) it was not fully charged (due to the ride home) but the voltage had gone up significantly. After leaving it out in the sun for another day the batteries were fully charged.

In general usage, I typically only use the bike two or three days a week (rain, schedules matching up, etc) so the two day charging time fulfills my needs. If the bike was my only means of transportation, I’d probably have to supplement the solar charging with a grid tied charger, or install much larger solar panels at a fixed location to charge the bike.

Vacuuform motor cover

plastic bag covering motor

Ever since I mounted an electric motor to the front wheel of my
bicycle I have been keeping a plastic bag over the motor with a clothespin whenever the bike is parked. This does a decent job of keeping rain out of the motor, but the process of uncovering and covering the motor takes extra time. In an effort to make a permanent rain cover for the motor, I built a tool (mold form) out of wood and used a vacuuform machine to shape a piece of plastic over it.
Continue reading

Running Ventrilo under Wine in Ubuntu Linux

Wine will install and run the ventrilo VOIP client very well. To get this working, follow these steps:

apt-get install wine wine-dev msttcorefonts

download ventrilo-3.0.5-Windows-i386.exe

run “wincfg” to prepare things

run “wine ventrilo-3.0.5-Windows-i386.exe”
(go through the install, using all the defaults)

Now, everything works with one quirk.
Push to talk works only when the ventrilo window “has focus”
This is somewhat understandable, but annoying, in that you have
to focus the ventrilo window before you can talk.
The other option is to use voice-detection, but that takes up a bit more cpu-time, and you may accidentally broadcast something you don’t want to.

A program that listens for keypreses and directs them to the ventrilo window fixes this problem:

http://np1.pp.fi/ventriloctrl/
http://np1.pp.fi/ventriloctrl/ventriloctrl-0.3.tar.gz

To compile it, you’ll need xorg headers:
sudo apt-get install xorg-dev

Aiptek HyperPen T-6000U tablet with Ubuntu 9.04

Getting the Aiptek T-6000U tablet working with Ubuntu 9.04 was relatively easy, following the directions here.

Summary:
Install the xserver-xorg-input-aiptek package.
Add a file called 10-aiptek.fdi to the /etc/hal/fdi/policy directory containing:

<?xml version="1.0" encoding="UTF-8"?> 
<deviceinfo version="0.2">
  <device>
    <match key="info.product" contains="Aiptek">

      <merge key="input.x11_driver" type="string">aiptek</merge>
      <merge key="input.x11_options.SendCoreEvents" type="string">true </merge>
      <merge key="input.x11_options.USB" type="string">On</merge>
      <merge key="input.x11_options.Type" type="string">stylus</merge>

      <merge key="input.x11_options.Mode" type="string">absolute</merge>
    </match>
  </device>
</deviceinfo>

A Puzzle

Hear my word down to the very letter,
and you shall know our characters better.
Our first and last are two of one,
Found leading nowhere and leading none.
Also the twins sit together, a pair
following everyone and leading everywhere.
Some more of us stay grouped together as ten,
But going the wrong way,
they end where they begin.
Only one remains, and I stand tall.
Can you give the number of us all?

Laser Etched Thinkpad Laptop

Laser Cut Laptop, edge view
I used a laser cutter to decorate my “home” laptop. Using an Epilog Mini 45 watt laser cutter / engraver, I was able to cut out a good 0.5mm from the rubberized plastic coating on my Thinkpad X31’s cover. To get the cut this deep, I used 100% power and 5% laser speed at 300dpi, which took over 70 minutes, but the results are well worth the wait! Compare this to my laptop paint job on the “work” laptop.

Moving NTFS paritions using Ubuntu (Vista, XP)

This guide gives a good step by step procedure for moving a windows partition from one drive to another:
http://ubuntuforums.org/showthread.php?p=7742172

If you get an “autochk.exe not found” error message just after windows XP boots, it probably means that you have the partition type set incorrectly. Using fdisk under linux just use the “T” option to change the partition type to NTFS (hex 0x07 or number 7 in fdisk).

E-bike solar charging rack

Solar EbikeAn electric powered bike makes it easier to go up hills, and can turn a ride to the train station from a workout into a commute. Typically however, the batteries need to be plugged in to charge after your trip. Although electricity is cheap, this does require that you have removable batteries (or wheel your bike into the house or bring a charger outside). I decided to use the sun to recharge my bike, seeing as how I would be parking my bike outside at a train station all day. This way, it can be fully charged and ready for the ride home when I return. Continue reading