At last! An electronics page is now added to my collection ofweb pages. There is a certain irony here, since electronics wasone of my first loves (preceded only by meccano and trains), yetis the last to be added. As a teenager, I dismantled countlessradio sets to find out how they worked, and to rebuild them inall sorts of other guises. These were vacuum tube jobs, and inmy repertoire I made radios, amplifiers, signal generators,oscilloscopes, power supplies, etc., etc.. Not many (none?) ofthese have survived, but amongst my personal effects I have alab book with the results of an experiment to measure the speedof sound using (one of) my oscilloscopes.

My interest in electronics paid off in that I was awarded thePhilips Industries prize for electronics in my final year, theresult of which was a cheque for $100 and a trip to the Philipsfactory in Adelaide, where they made radios, TVs and otherconsumer items, together with blowing their own vacuum tubes.Now that was fascinating! I have had a soft spot forPhilips ever since.

Anyway, enough blurb. Now for some real stuff.


You cannot do electronics without components, so here's a listof suppliers that I use:

Centre Com

Current needs shown at TOBUY


Confused over the different sorts of USB cables? They seem tomultiply without limit, and I have foundthis pageuseful in sorting them out.


It is a moot point as to whether this should be in myelectronics page, or in mycomputing page.Given how much it relates to hardware, I decided to put ithere.

I have reinstated a BeagleBone as thegeneral house automation server (as opposed to the house server,a much bigger system!), which runs continously, and manages thevarious house automation operations. Currently, this is onlythe chookdoor system,but will expand to include many of the things previously done bythe old system, decommissioned in the house renovations.

One very useful webpage I found was that byDerek Molloyon how to useGPIOs and Device Trees.I refer to this page frequently.

Model Railway Control

I have a long standing love affair with Trains and Railways. That, together with a lifelongfascination with computers, and an adolescent dalliance withelectronics, means that a three-way marriage of computers,electronics and trains was pretty much a given for my retirementinterests. This section describes the consummation of thatmarriage.

Point Motors

Any model railway will have more points than it knows how todeal with, and mine is no exception. Although not large bymodel railway standards, it still has close on 100 point motorsto control. My first attempt at this was the classic schematic,together with push buttons to set the route via each point.Somewhere I still have the schematic, I must dig it out.

But as outlined above, the real challenge is to marry my loveof computers, electronics and trains. This started withfamiliar territory, i.e., the software to drive it all. Youcan see what I have done in my Railway Pages.

First, a caveat for American readers. I am usingAustralian/British terminology to describe my system, andhence I talk about "points" rather than the Americanequivalent of "turnouts". Of course, I also refer tothe system as a "Model Railway", rather than a"Model Railroad". I hope you will bear with me.

single level drivers

The next stage of development was to build an eight waysolid state driver. This uses a single NPN power transistorto drive each point motor, and the transistors are drivenfrom an I2C bus through a PCF8574 I/O expander.Here's the circuit for a single stage of the system. Theother end of the point motor solenoid goes to +16v.

The base of the BC557 is driven from the data line outputsof the PCF8574. There are 8 such outputs, and 8 suchtransistor stages, thus giving the capacity to drive 4points, since each point motor has two solenoids, one forstraight ahead, and one for diverging.

A big disadvantage of this circuit is that it needs adriver circuit for every solenoid in the system. With over50 points in my layout, that's over 100 drivers! Just thethought of wiring all these up and testing them made methink about other ways to do the same job.

crossbar switching

The crossbar switch is a strategy to reduce the number ofpoint motor drivers from order(n) to order(n1/2),i.e., square root of n. In other words, instead of needing64 drivers to drive 32 points, we only need 8+8=16, a 4-foldreduction (the formula is actually 2*n1/2), sinceswitches are needed for both sides of the crossbar. Here'sthe circuit for a 16-point system (32 solenoids).

It needs 12 driver (high power) transistors, because oneside of the crossbar is only 4 switches long, and thus isnot optimum. On the other hand, if this were implemented asa single level driver system, it would require 32 drivertransistors, and thus still has a significant advantage overthe single level design. I settled on this design however,because no section of my railway has more than 16 points toa region, and using a single design for each region makesthe point motor circuitry interchangeable. If you want alarger or smaller design, you can easily adapt this circuit.

The top transistors are actually N-channel MOSFETs, sincethese were more readily available. The circuit could alsobe implemented with PNP transistors in common emitter mode(a mirror image of the NPN side), but I have not testedthis. The diodes are need to stop pseudo back paths throughother solenoids. For example, when solenoid b2 is selected,without the diodes, current could also flow through b0-d0-d2(as well as other similar paths) thus creating potentialfalse switching. Although these would draw less current andbe less likely to throw, they drain the power available forswitching, and this needs to be avoided. More to the point,you don't want other points being thrown falsely!

The Arduino Controller

The Arduino that I am using is theDuemilanove. Analog pins 4 and 5 are the SDA and SCLlines to the I2C bus, going to pins 15 and 14 respectivelyon the PCF8574 I/O expander.

Useful Links

This page is copyright, and maintained byJohn Hurst.250 accesses since
19 Jul 2020
My PhotoMy PhotoTrain Photo

Local servers:LocalhostNewportBurnleyEvertonKerangOuyenSpencerTerang(accessible only on local network.)
Public Web Servers:HurstServerHomeServer1HomeServer2InternodeServer(not all may be active.)
Dynamically generated at20210122:2344from an XML file modified on20200816:1326.

--> -->
Python 3.6.9: /home/ajh/binln/python3
Fri Jan 22 23:44:30 2021

A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.

 /home/ajh/public_html/cgi-bin/index.py in <module>()
    646     print("<a href='mailto:ajh@csse.monash.edu.au'>John Hurst</a>")
    647   else:
=>  648     logfiled.write("%s: %s: NO ERRORS IN %s\n" % (tsstring,clientIP,requestedFile))
    649   logfiled.close()
logfiled = <_io.TextIOWrapper name='/home/ajh/local/ajh.co/xmlerror.log' mode='a' encoding='ANSI_X3.4-1968'>, logfiled.write = <built-in method write of _io.TextIOWrapper object>, tsstring = '20210122:2344', clientIP undefined, requestedFile = '/home/ajh/www/electronics/index.xml'

NameError: name 'clientIP' is not defined
      args = ("name 'clientIP' is not defined",)
      with_traceback = <built-in method with_traceback of NameError object>