Building Python on Debian or Ubuntu

01/20/2010 0:05

I had to compile python with debugging information in it and had to find out a few packages to install, which were not well documented. What you basically get is:

[pera@humppa Python-2.6.4]$ ./configure --enable-shared --with-pydebug
...
Failed to find the necessary bits to build these modules:
_hashlib _sqlite3 _ssl
bsddb185 bz2 gdbm
sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.

Well, that’s not much said. Here’s what to do on debian or ubuntu (this is likely to work with at least python 2.5 and 2.6) (the patch is from [1]):


$ apt-get build-dep python2.5
$ wget http://celer.oni.biz/~celeron55/random/2010-01/python2.6-disable-old-modules.patch
$ patch -p1 < python2.6-disable-old-modules.patch
$ make
...etc

References:
[1] http://www.lysium.de/blog/index.php?/archives/229-Installing-Python-2.6-on-Ubuntu-8.04.html
[2] http://old.nabble.com/how-to-compile-python3.0-td23213995.html


Categories:Uncategorized

Laptop battery discharge-charge cycle plotted

01/6/2010 1:39

Here’s a nice graph i generated. It shows the discharge-charge cycle (capacity-time) of my old HP Omnibook XE-3 laptop with a fairly new (6 months old) cheap battery from ebay:

Omnibook XE-3 discharge-charge graph

Omnibook XE-3 discharge-charge graph

Charging seems to be a bit slow by today’s standards at more than two hours. The battery is actually a “11.1V 7200mAH 80WH” model, but as you can see, ACPI shows it as being 5400mAh. (I collected the data by reading /proc/acpi/battery/BAT0/state.)

I’m not sure whether the battery really is more like 5400 or 7200. If it’s 5400mAh, the power consumption would be about 15W, and for 7200mAh, it’d be more like 20W. I recall measuring it sucking about 15W from the wall adapter, so it just might be 5400mAh.


Tags:, , ,
Categories:Uncategorized

A fix for the Co/Tech MultiTool tool holder

11/10/2009 16:34

I now got a replacement Co/Tech MultiTool (a cheap dremel-like thing) for free for the one that I broke some time ago. I found out that the build quality is a bit worse. It vibrates more, and the tool holder holds tools a bit tilted. I can’t do much for the vibration, but the tool holder was a real issue for me, as I’m going to try to mill PCBs with it, with tools smaller in diameter than the amount of how much it tilted the tool.

The problem was in the part that you turn to tighten the collet. It had the hole in the end significantly misaligned. Well, not any more. It seemed that the hole in the tool holder could be enlargened enough to make the hole well aligned in relation to the turning axis. And I happen to have an another dremel copy too, so…

I secured the tools head-to-head on a table (which was easy with the adapters I have made for attaching them to the router) and used a few mm’s thick grinding tool in the other one, and rotated the spindle of the other one manually.

And after 10 minutes of rotating it little by little, the tool holder works well:

istukankorjaus

istukankorjaus3

istukankorjaus4


Categories:Uncategorized

A diode thermometer with 1N4153, LM324

10/31/2009 20:55

My mom had long had problems finding a thermometer for measuring the temperature of the water when dyeing threads (with plants and mushrooms). The required temperature range is up to 100°C and I thought i surely could make a simple thermometer circuit for doing that.

First I was thinking of using an ATTINY25, as it has a built-in thermometer, but i quickly abandoned the idea. Now i had the idea to make it completely analog, using a diode, probably because I earlier had problems with diodes changing their forward voltages in varying temperature. Also, I thought I’d need a simple circuit to feed an analog panel meter.

Well, I took an 1N4153, which cost 2 cents a piece in the local shop, soldered wires to it, wrapped it in insulating tape and put some heat shrink tubing on it. Then I measured the forward voltage (with a 330k resistor from a 9V battery) in room temperature, in boiled water and outside, in a frozen rain water container. That’s 0°C, 23°C and 100°C, roughly the range to be measured. 0.296V, 0.455V and 0.510V, respectively.

The 1N4153 Temperature Probe

The 1N4153 Temperature Probe

Well, that’s, unsurprisingly, roughly linear, so we could easily use it with an MCU, too, or easily calculate a threshold value for an overtemperature sensing circuit or something like that, but that’s not what we’re doing this time. We need a circuit, wich will convert the 0.296…0.510V of the diode to the 0.00…0.33V of the analog meter. Also, it needs to be inverted to get the values to increase when going from left to right on the meter. On my favorite electronics channel on IRC, we ended up with this design:

The schematic of the diode thermometer

The schematic of the diode thermometer

The operational amplifier is an LM324 (of which i ordered a lot of 50 pieces or so some time ago, from ebay, very cheaply… plenty of them to use!), and, additionally to the schematic, it’s operating voltage is supplied from the 5V output of the regulator. The LED at the bottom of the drawing is to bias the voltages a bit, because LM324 isn’t able to sink enough current at the low voltages used otherwise.

Calibrating it was quite trivial: Take three measurements and utilize the regression feature of a pocket calculator, to make something like f(x) = Ax^2 + Bx, x being the temperature and f(x) being the position of the meter. It’s precise enough for this usage, at least.

Here’s the completed thing:

The diode thermometer

The diode thermometer

The back side of the diode thermometer

The back side of the diode thermometer


Categories:Uncategorized

I made a line following robot!

10/29/2009 12:48

And it works very nicely. Here it is:

The line following robot

The line following robot


The robot in action

The robot in action

It uses a circuit like this (which i thought up and improvised myself):

The schematic of the line following robot

The schematic of the line following robot

The circuit uses a LM324 op-amp. The setup trimmer is a 10k one, with a 100 ohm resistor in series. When supplied from a 3.6V battery, The series resistor for the leds can be, for example, 100 ohms. The resistors in parallel to the photodiodes are 330k. The final transistors can be anything capable of handling the current. This time, BD681 was used. The IR LEDs and the photodiodes were disassembled from an old mouse.

The leds, photodiodes and the operational amplifier (LM324) were just glued to the cardboard, the power transistors soldered to the servo motors and then everything was soldered to them. The robot uses a tiny 50mAh 1S LiPo.


Categories:Uncategorized