Linux on Compact Flash

Recently I bought an used odd Thinkpad X40 in Ebay, it has a French keyboard (ugh!) and a DIY touchscreen, Bluetooth but no WLAN. Since its hard disk was starting to fail I decided to try out and insert a Compact Flash as hard disk. I ordered a 8GB super fast x133 online, but this weekend I could not wait and since 4GB SanDisk's Ultra II were at 24€, I decided to try it now!
I already had a 1.8 inch IDE to compact flash adapter (bought earlier here), in hardware terms it is really plug and play! The BIOS and the computer think that they have a normal (although not hitachi) 4GB hard drive.

I managed to install Suse 10.3 and perform all the updates, it had to be a small install to fit in 4GB but enough to run the familiar KDE and OpenOffice. The installation goes slower than with the normal hard drive, but once you get to the Network update speed is about the same.
Then I edited the file /etc/fstab as according to this page.
Here's what I did:

vi /etc/fstab

Then edited the line with the line

xxxdisk-idxxxxx / ext3 relatime,errors=remount-ro 0 1

adding the noatime option. Normally every time you read a file, the time is written back to the drive. The noatime option disables this.

xxxdisk-idxxxxx / ext3 relatime,errors=remount-ro 0 1

Then added the following lines. They move most temporary files to a ram disk.

tmpfs /tmp tmpfs defaults,noatime 0 0
tmpfs /var/run tmpfs defaults,noatime 0 0
tmpfs /var/log tmpfs defaults,noatime 0 0
tmpfs /var/lock tmpfs defaults,noatime 0 0
tmpfs /var/tmp tmpfs defaults,noatime 0 0
tmpfs /var/lib/dhcp3 tmpfs defaults,noatime 0 0

I did not write the line for Mozilla Firefox because I am not sure if Novell/Suse whatever have changed the temporary directory. Another site that looks like having good information is this one.
After the installation and configuration I tested the hard drives for read speed, and the Compact Flash does not come very far behind! But the big test is endurance rather than speed. Here are the screenshots, the top one reports on the current X40 (with magnetic hard drive), the bottom one the test on the compact flash and the listing of the /etc/fstab.

As SU you must run the command:
# hdparm -t /dev/sda1

Timing buffered disk reads: 56 MB in 3.08 seconds = 18.21 MB/sec
The CF disk reported 14 MB/s, which is 22% less... I still think it is not a big gap as with a bigger investment €€€ one could get better transfer rates (there are 8GB cards on the market advertising 30MB/s and more).

I think a good idea would be to have a mixed system on the same card, a compact flash on one side and a 1Gb dram on the other (for temp files, var, log, etc). One of the adapters that I found has a second connector on the back of the card, maybe it could be used with a small microcontroller, FPGA or CPLD to connect to a cheap SDRAM and provide a second volatile disk for all the changing data.

S620 fan "repair"

Some years ago (2004) I bought my second computer, at the time I wanted a very small desktop computer with parallel and serial port (for my electronics projects), a reasonable number of USB ports (3), audio line in/out and phones/mic, DVD-CDRW, good amount of RAM 768MB and a Celeron D.

I found the S620, it was small computer with acceptable performance, just what I wanted! The computer is now Ana's computer, she uses it to browse the web, store and edit her photos, update her blog and working from home. The computer has two shortcomings, one is that I have to reboot after a save to BIOS (the computer locks), the other is the fan noise. The really noticeable problem of the computer is the fan noise, maybe if I could fit a bit more RAM and a slower processor this could be solved. After a full day of work one could really feel that casing was warm and the Fan working hard.

When we came back from our Christmas holidays I noticed that the computer's Fan stopped working. Ana reported that the computer would start (very silently) but would never completely boot Windows. I tried booting linux and then the over temperature event was sent to the console and the computer stopped booting, after this "hint" I placed my hand on the Fan exit and noticed that no air was flowing! Surely it is a fan fault!! or so I thought... I rushed to buy one only and waited... After placing the new fan the system still did not work!!

I removed the Fan and examined it, and tried it with an external power supply... it worked!! Tried the old fan and it also worked! Then I measured the fan's output pins on the Motherboard, and the power pin had a voltage increase as temperature of the processor was increasing (checked using the BIOS monitor). When the fan was connected this voltage would drop and the fan would not start.
I suspected that "somehow" the output driver to the fan entered shutdown thinking it had a heavy load.
I decided to create a NPN(BDX33) emitter follower (a.k.a voltage follower), using the hard drive's power supply to supply more current and about the same voltage to the fan. The transistor was "fused" to the fan case using the soldering iron going through the case and the hole in the transistors plate.


Kronan lighting

My Kronan is a simple bike with simple "extras", the headlamp is a filament bulb powered a dynamo, a simple LED tail light and a Kronan bycicle bell.

Since I installed the front cargo fork I had to reroute the power from the dynamo to the alternative location of the headlamp (on the other fork arm).

I noticed that there is a light sensor and when I leave the bike in a shed or I stop the tail light turns off after some time. But my current problem is that sometimes during a long route the light turns permanently off. I had to open the box and see!!

Apparently there's a transistor, a light sensor (top, back of the PCB), a red LED (transparent), a capacitor (bottom, back of the PCB) and an embedded IC. The IC has a blob of plastic (next to the capacitor) over it so no chance of knowing what it is. My current possible culprits are:
the battery connection that has oxidized or the light sensor is not correctly placed and the sensor is influenced by the LED.
Currently I just opened the box, cleaned the contacts and straightened the sensor but I doubt that was the last time I had this problem.

I also had some time so I decided to check if I had any noticeable chain stretch, I folded a new one over the current one while breaking and checked for any big difference after 10 links... so far, everything looks similar (i.e. no noticeable stretch).
I found more sites (here, here, and even in Wikipedia) giving instructions on how to check for chain stretch.

Pea Soup (Erweten soep)

We tried out "the famous Dutch pea soup" at one of the few really good places in the Hague "'t Hof van Eten", a small place but excellent food for brunches and breakfasts and a kindness of service that you're just not used to in Holland, then we also found another fantastic place "Le Gourmet" serving homemade pea soup, old style Dutch bistro where they serve the pea soup with two slices of rye bread and ham....
We decided to give it a go and do it ourselves... I found a really simple recipe on the net and we were off...
The ingredients are (for about 5 litres of soup):
- 750g-1kg of dried split peas;
- 1 leek;
- 250g of Bacon;
- a couple of carrots;
- one onion;
- a big "Rookwurst";
- one Celeriac root and some celery leaves;

Get a kilo of dried split peas and soak them in water.

Cut the Celeriac root, carrots and bacon into small cubes. Put the bacon in the pan, add some olive oil and let the bacon cook for 2 minutes. Then put the peas, Celeriac and carrots in a big pan with arround 3 litres of water (yep, soup for a week...), and let it boil for about an hour.

Then add the leek in small pieces, the rookwurst and let cook for about 20 minutes... Et voila... Dutch pea soup.


gEDA, Spice and small circuit simulation

In my "quest" for a suitable Electronic Design Automation set of tools in Linux, I wanted to test the ngspice in gEDA. I started by reading this tutorial.
I designed a simple single transistor amplifier and draw the basic circuit in gschem. The circuit is a commonly called fixed bias circuit with emitter resistor, for transistor I used a general purpose BC548B.
For drawing the schematic one should use the symbols in the spice library and draw the circuit as usual with the following cares:
- you must remember to place a ground in one of the nodes.
- if you want you can (and should) give numbers to nodes you want to keep track, this is done by editing the netname of node, later it is easy to find and plot the voltages of each node.
- it is better to create a separate file with the models of the semiconductors you use, to use it in gschem edit the model attribute and add a file attribute with the library path and name. I found out that using a big library of models and using only one model is not efficient and prone to errors, and most of the libraries need some adjustment regarding the model parameters. It is better to create a specific library file in the current directory (like models.lib) with only the models needed for the simulation.

For converting the schematic into a spice netlist, one must resort to some trickery. I created the following bash script to create it for me, it does a design rule check and then converts the schematic to a spice netlist, then immediately runs ngspice.
gnetlist -g drc2 $1.sch -o $1.drc
gnetlist -g spice-sdb $1.sch -o $1.net
ngspice $1.net
My bash scripting talent isn't great, but it should give an idea of what you need to do. This script expects one argument, the schematic file name without the extension (.sch).
Once in ngspice you can run the circuit interactively with :
tran 10u 10m
plot v(1),v(103)
I didn't found out how to save a plot, so I used a screen snapshot and cut the edges of the picture in GIMP, but here is the final result.

There is some delay and some distortion in one part of the wave and the gain is quite small. The base appears to saturate during the high side and then appears to take its time coming out of saturation. The delay is introduced by the decoupling capacitors (input and output) and the voltage gain is limited by the Rc/Re to 5, but then further divided by Rc parallel with RL, for a total voltage gain of about 2.5.
The charging of the decoupling capacitors is responsible for the apparent lack of gain in the first half wave.


Porto Free Wi-Fi...

During this Christmas and New Year's break I went back to Oporto, my home town. I needed to keep connected to the internet in a quasi-regular mode. I found some free-WiFi hotspots that I can recommend, they are located mostly in the city center close to the old universities.
Here is a list of caffees and places were Free Wi-Fi is available:
I know for sure that there are many more, if you read this and know of one, please tell me and give me a link(google-location or website) and I'll update the list.
Another thing when it rains in Porto it really RAINS, beware...