Saturday, May 23, 2015

Freethought vs Thinking Machines

Artificial intelligence in computing always seems to be beyond the horizon.  The abilities of Google Search, Apple Siri and Microsoft Bing would have looked like successful artificial intelligence to someone in 1980 (I know, because I would have!), but the goal posts keep shifting out. We always expect more.

Artificial intelligence is now used against human dissidents.  The NSA and GCHQ are using enormous computers to troll the networks and sniff out supposed terrorists.  There was even news that Russian systems use social network data to predict who are likely to be future trouble makers.

This is all due to a recent shift in policing from crime prosecution, to crime prevention.

"Cogito, ergo sum"
-- Descartes

In the interest of crime prevention, the bar has been lowered and several people are currently sitting in jail, for crimes of Thinking and Plotting, without actually having Done anything wrong (yet).

It is a fine line that we need to preserve between order and anarchy, dogma and freethought.  Now we also need to give thought to computers, devices with no sense of morality, passing swift judgement on us.

Whereas we used to prosecute criminals
 for things they have done,
We now prosecute people for things they are thinking of, 
but haven't actually done yet,
and soon, 
we may be prosecuting people for things
 they haven't even thought of doing yet.

Maybe one day we will be able to predict life so accurately that we can simply terminate a pregnancy proactively and avoid the whole problem.

"Errare humanum est, 
sed in errare perseverare diabolicum."
-- Seneca the Younger.

Monday, April 6, 2015

RCS Calculations - Puma-EM on Ubuntu Linux

If you need to calculate the Radar Cross Section of something, then this installation guide for Puma-EM may help.

You can get Puma-EM here:

You may also need FreeCAD, to prepare the mesh files:

Note that the mesh size typically needs to be about Lamda/10, which at 10 GHz amounts to about 3 mm.

Puma-EM on Ubuntu Linux


To ensure that you have a fast system, do a minimal install of the Ubuntu server edition and then add LXDE to make it more usable.

Get Ubuntu Server 14.04.2 LTS version here:

Make a virtual machine:

Create a new Virtualbox VDI VM for Ubuntu 64 bit Linux and a 20 GB dynamic disk.

Select the LTS CD image in the Storage section of the VM settings and boot.

Press Enter a few times to accept the defaults

Make a user account: user / 5uper5ecret

Some more Enters

"Guided - use entire disk" will result in a ext4 system

Write changes: Yes

Yet more Enters

If you can figure out how, install 'ssh server' and 'build-essential', otherwise, do it after installing the desktop

Type more Enters

La voila!

Reboot, then update the package lists:

sudo apt-get update

Long wait...

Now install LXDE:

sudo apt-get install lxde


sudo apt-get install --no-install-recommends lubuntu-desktop

(about 900 MB)


sudo apt-get install lubuntu-desktop

(about 1.3 GB)

...depending on how much bloat you want with your desktop.

Install the development tools:

sudo apt-get install build-essential

udo apt-get install cvs subversion git-core mercurial

sudo chown $USER /usr/local/src

sudo chmod u+rwx /usr/local/src

Install Guest Additions

Click Devices insert Guest Additions

Open in file manager

Open a terminal in /media/user/VBOX...

sudo ./

Then reboot

Configure the VM :

Enable the copy and paste buffer sharing and screen resizing features

Go to Power Savings and turn it off

Go to Light Locker and turn it off

Download Puma-EM:

Get it from here

Untar it in the user home directory

cd ~/Puma-EM/installScripts


It asks for a password once or twice and downloads and builds a lot of stuff

Long wait...

...and you should eventually reach the end of the compilation without errors.

Resolving problems:

Which Ubuntu package a missing file is in:

apt-file search missingfilename.pc

Friday, March 6, 2015

Travel with Computers

I used to think that one is safe against search and seizure of computers and phones at Canadian borders, but no more:

When I travel to the USA, I upload my encrypted data to a FTP server and take a Kindle with me.  The border guards can have fun with that all they like.   Now I'll have to do the same when I go home too - ridiculous.

I should be able to enter my own country without being harassed at the border!

I do think that sanity will prevail in the end, but until it does, rather mail/courier your computers and equipment to wherever you are going, or beg/buy/borrow something at your destination and travel light.

It is much the same as travel with medication - take the prescription with you and buy new medicine at your destination - and never, never, never take unidentifiable scary white powders with you.  Years ago, we had huge trouble in Paris because of a few tins of baby formula, so the stupidity is everywhere. Vive la difference....

Saturday, February 21, 2015

The Keys to the Kingdom

Apparently, the NSA stole the keys to the GSM kingdom.  It was already clear that GSM is not secure and two heads of state were annoyed by the Yanks listening in to their calls already, but this is ridiculous:

What is clear, is that the US government doesn't care how much damage the NSA causes to states and corporations the world over.  This is a Dutch/French company, NATO members and the NSA did them in to the tune of half a billion Dollars, with hardly a peep from any politician anywhere.  If your computer system is not secure, then you can lose your business thanks to the US military, whether you are an ally, at peace, at war or neutral.  With such friends, who needs enemies?

The CTO of Lenovo has now proven himself to be just as clueless as a previous CTO of Sony:

They all failed to understand that if you subvert thousands of computers, then the system is weakened and can be misused by anyone else too.  Even the much maligned DHS is on the ball on this one

Where did these guys buy their university degree certificates - maybe here

The only way to combat the spying, is to buy all your computer and networking equipment in bits and pieces from random vendors and assemble it yourself, then load it with an obscure version of UNIX such as OpenBSD.

Whatever comes preinstalled on any machine, not only from the special class at Lenovo, cannot be trusted.

Monday, February 9, 2015

Thermionic Valve Amplifier

I stumbled upon a source for some cool old stuff called Magic Eye tubes.  The shop is in Chelyabinsk Russia, called Tubes Store.

Here is a nice VU meter video:

While browsing there, I decided to make a little audio amplifier to hook to my Mac, get a couple of Magic Eye tubes to use for a VU meter (blah) or robot eyes (yes!) and some Nixie tubes for a clock or digital read-out, or goodness knows what, so I ended up buying a handful of brand new old junk.

Now the problem is getting high voltage transformers and capacitors that can handle >200 Volts.  Everything in my junk box is low voltage and will go pop, just like the weasel of yore.

After a little bit of head scratching, I came up with this cool little thermionic valve audio amplifier design:

It is a pretty standard push-puller, using a miniature 6N21B dual triode valve at the front end and a pair of 6E6PE power tetrode valves at the back end (It is a rough drawing, but it gives the idea.  I didn't want to create a special transformer part in Eagle.).  This circuit should be able to deliver about 20 W RMS and will make a good lead guitar amplifier.

For an output stage made from bipolar transistors, one can use NPN and PNP power transistors, but all valves are the same, so a transformer is required to make a complimentary output.  It is also required to transform the impedance down to drive a low ohmage speaker - about 6000:1.

Due to the high voltages, I used big 2W carbon resistors, except for R5, R8 and R20, which I made 10W wire wound.   The capacitors should all be 250V or higher rated, to keep them from going pop.

Bluetooth Audio

I'd like to have both a wired and wireless interface.  It may be an old fashioned amplifier, but it is the 21st century after all!

Sparkfun sells a Bluetooth Audio interface module

Improvising and Bread Boarding

Now where on earth can I get transformers for the 6.3V heaters and 160 V anodes?  One could use an automotive ignition coil for the audio output transformer and a couple of low voltage transformers back to back for the heater and high voltage power supply, but it turned out that there is a manufacturer of replica guitar amp transformers in Canada, Hammond Manufacturing, eh...

The prototype is built on an olde skool wooden bread board.

The Hammond classic audio output transformer should sound better than a car coil.  Well, I hope - at least it will look better:

and one can get high voltage electrolytic capacitors from Digikey:

Next time I walk past a Pakistani trinket store down town, I'll pick up an old fashioned wooden box to put it in. I saw a replica His Master's Voice wind-up record player the other day - that store will have something.

So, it is no problem to build a new old toy today, but it ain't cheap.  Shipping transformers and high voltage parts halfway around the world is expensive.  I guess my little amplifier will cost about $300 when it is all done.


I finally ordered the transformers.  It turned out to be easiest to get them from Mouser and instead of getting a multi-winding valve amp power transformer, I got separate transformers for the heaters and anodes - easier that way. Mouser does stock a Hammond Fender replica power transformer, but it is 115 V only - while I live in UAE with 240 V mains supply.

Therefore I got a Hammond 185C230 for the anode voltage:

Primary 230 V:
Connect in series
.1, 6 = 230 V mains
2, .5 = Short

Secondary 115 V:
Connect in parallel
12, 8 = Short
.11, .7 = Short

Since the secondary was paralelled and not centre tapped as in the schematic above, I then built a four diode full wave rectifier instead.

A VPS12-2000 is used for the heaters:

Connect in series
.6, 1 = 230 V mains
5, .2 = Short

Connect in parallel
.12, .8 = short
11, 7 = short

The audio transformer I settled on is the Hammond 1750H:

.Blue / Brown = 6600 Ohm
Red = Centre Tap

.Black, Brown = 8 Ohm

Note that you must never run a valve amp without a load - the output transformer will arc and destroy itself.  I mounted a large 10 Ohm 25 Watt resistor on the bread board next to the output transformer to use as a dummy load.

I'll get a 6 inch full range car speaker pair at Lulu or Carrefour and stick it in an old fashioned wooden box from my new found Pakistani friend downtown.

Also, do put a fuse in the mains line.  I used a 150 mA, 600 V polyfuse, 600R150-RBZR and most important, solder a couple of 1M resistors on the outputs of the high voltage PSUs to bleed the capacitors when nothing is connected, else you may be in for a surprise one day.


Both types of valves have 9 pins.  The power valve has a gap between pins 1 and 9 as usual.  Viewed from the bottom pin end, the number sequence runs clockwise.

The old yellowed Rusky data sheets are hilarious.

When I first met my wife (she is Slovak), I had a red hammer and sickle T-shirt (made in Honduras - where else?).  So she asked: "Where you get that shirt? You look like Russian athlete!".  Now I'm building toys from parts really made in ze olde CCCP, decades after everyone else stopped making them.  The commies were good at making things, but sometimes a bit slow in keeping up with advances.

The 6E6PE tetrode valve pin-out is as follows:

1 - k
2 - g1
3 - k
4 - h
5 - h
6 - k
7 - a
9 - g2

The pre-amp miniature dual valve is funny and has a gap between pins 6 and 8, just to be confusing.

The two triodes have a shield between them, so this is a nice, compact, low power design with only three glass tubes, but four valves. Because the double triode is physically small, the operating voltage is lower than normal at 'only' 100 V.  This works fine, since in a simple valve amplifier design, each stage is isolated from the other with a power line RC filter.  

In this design, I drop the voltage from 160 V to 100 V using a 330 Ohm series resistor R8 and stabilize it with the capacitor C4.  This prevents voltage sags caused by the output stage, from feeding back into the input and reduces distortion.

The 6N21B miniature dual valve pin-out is as follows:

1 - k1
2 - s
3 - g1
4 - a1
5 - h
6 - k2
7 - no pin
8 - g2
9 - a2
10 - h


Valve Sockets

One can still buy new octal sockets.  They are manufactured for relays.  However, all the tubes I got have 9 or more pins, so that is no help.  I'll have to make a plan with some D-sub connector sockets - they look like they will fit.  The Tubes Store also has ceramic sockets - they don't cost much.

You have to mount these things on a metal plate - and remember to ground it or you will get zapped sooner or later - likely sooner.  A cookie tin is good, but do get an aluminium one, since steel is awfully hard to work by hand.  To make odd shaped cut outs, I use a Nibble Tool from Digikey:

The advantage of a nibbling tool is that it doesn't deform the sheet metal - it stays straight and flat - and you can cut any shape hole you need.  The disadvantage is that it is slow and painful to use.  Wrap some tape around the handles...

The double triode presented a problem, since it doesn't fit in a socket.  It has long thin wires.

I soldered it into a 1 inch square circuit board, leaving some space for heat dissipation and fashioned the wires into little eyelet loops at the bottom so I can wire it up to the rest of the circuit in the same way as with tube sockets.  Time will tell whether this was a good idea or not.

Terminal Strips and Turret Boards

These old fashioned high voltage solder tag strips are hard to find, but Digikey and Mouser do have them, if you know to search for 'turret boards'.

For hooking the parts up, you need 22 AWG tinned copper wire, which is unhelpfully named 'bus bar wire' by the vendors.  It is available in little 100 foot rolls.  Don't use 'magnet wire' - well, you could if you are a masochist.  Magnet wire is insulated with epoxy or nylon which is very hard to strip.

I'd recommend that you build the PSU first and when you are ready to test it, put a carboard box over it, before turning the power on, to contain the mess if something would blow up.   When I was a teenager, I built a 600 Watt bipolar transistor bass guitar amp and had a very big capacitor blow up in my face - it wasn't much fun - fortunately I was wearing glasses and I've been been rather more careful ever since.

When you wire things up, always use the big capacitors as star points - don't daisy chain.  That keeps the voltage sags and distortion down.

 Getting messy and so much more to wire up!

The missus prolly won't like having a Carrefour breadboard full of hot and sizzling high voltage parts in the living room - so once it is working, then one got to unscrew the terminal strips and valve sockets, lift it off the bread board and re-install the whole rat's nest into a fancy looking box, so make sure that you mount the sockets from the under side, unless you want to re-solder everything...

Once all is working again, clean with alcohol and spray the electronics (not the power resistors and tubes!) with V-66 or similar conformal coating to keep it from corroding and it will keep working and look nice for years.

Friday, February 6, 2015

Windows 10 on Virtualbox

What? Herman uses Windows? Shock, horror...

My first desktop computer - if you could call it that - was a Commodore Vic 20 - ugh.  The second one, was an Apple IIe, which was probably the first desktop computer worthy of the name.  Since then, I have used many, many systems, including Sperry, UNIVAC, Varian, DEC and some that nobody ever heard of.

As far as Microsoft operating systems go - if you can call them that - I have used practically every version of everything O'l Billybob ever made.  I even once received a cheque from Microsoft for one of their infamous lawsuits that they lost.

If it is Free, Take Two!

You can download a Windows 10 ISO file for free here:

Windows 10 Running in a Window on Fedora Linux KDE

You just have to give them your whole pedigree and create an online account, but if you are old enough to do this on your own, then MS already has your whole pedigree and you may even have an account too... 

The Magical Incantation

After downloading the thing (4.9 GB), run Virtualbox and create a "Windows 8.1, 64 bit" disk.  Select the ISO file in the Storage, CDROM widget and boot up.

That trick above is the sole reason I'm writing this, to save you from a Blue Screen of Death Error 5D.


Turn power management off, since your host already does that, install Guest Additions, enable file sharing and once everything is working right, disable the network, since that is the only way to keep a Windows machine secure.

Now please don't blame me for all the usual problems you may get with Windows...

La Voila!


Monday, January 12, 2015

Makefiles Made Easy

The bane of computer programming is the Makefile. As soon as there are more than one source file and a library, a Makefile becomes essential and generating one can be painful.  The Makefile syntax reminds me of a sendmail configuration file, which looks like someone banged his head on a keyboard.

# This rule ensures that all local mail is delivered using the 
# smtp transport, everything else will go via the smart host. 
R$* < @ $* .$m. > $* $#smtp $@ $2.$m. $: $1 < @ $2.$m. > $3 dnl

Obvious, yeah...

Same as with sendmail, you should never edit a Makefile manually.  It is a total waste of time.  There are nice and simple utilities to do it for you!


If you have a very simple project, then gcc can generate the Makefile for you:
$ gcc -MM *.c > Makefile
$ make

Error: cc1plus

If you get the following or similar error regarding cc1plus, then the solution is not at all obvious:
gcc: error trying to exec 'cc1plus': execvp: No such file or directory

The problem is that while gcc is installed, g++ is missing:
# yum install gcc-c++

Also see the previous post for details on installing gcc.


If your project is more complex, then cmake can generate the Makefile for you, but you need to give it a few instructions in the file CMakeLists.txt.  First install cmake and related tools:
# yum install cmake*

Now create the file CMakeLists.txt and tell it which are the output, source and libraries:
add_executable(flasher flasher.c)
find_library(FTDI ftdi)
target_link_libraries(flasher ${FTDI})

Note that gcc assumes that library file names start with lib and end with .so, therefore only specify the base ftdi or whatever, not

The first time you run cmake, you need to specify the compiler:
$ CXX=gcc
$ export CXX

After that, run cmake to generate the makefile complete with all the obscure, head banging, gobbledygook lines:
$ cmake .
-- Configuring done
-- Generating done
-- Build files have been written to: /home/herman/sw/ftdi

Now you should have a very detailed almost 200 line Makefile and can compile your project with:
$ make

La voila!