Homebrew, open source, repurposed, hacked, software defined, open hardware

Sunday, 16 December 2012

JTAG firmware updates on the HPSDR

This guide is really just a set of cheat notes to go along with


First of all, a clean installation of Windows XP SP2

Windows XP also needs:

Windows Imaging Components
Windows Installer 3.1
.NET Framework 1.1

.NET 2.0 SP1
.NET 4.0

for the PowerSDR 2.2.5 (W5WC) installer to be able to proceed

USBIO.exe is also needed

The first time an HPSDR is upgraded, the JTAG programming firmware is loaded into the Ozy board. This only needs to be done once.

After this, Ozy is put in the 2nd slot from the power connector, and the Mercury and Penelope boards are upgraded one after the other in the slot between the power connector and Ozy.

This picture shows where the JTAG jumper (a tan colour) goes on the Mercury-EU receiver:

This photo shows where the jumper goes on Penelope, the 0.5watt exciter:

The batch files for programming need modifying as follows, to accommodate the new version of the Quartus software, which is v12.1

For Program-Penelope-EPCS4.bat the following three blocks of text need to be added:

ECHO  C. Quartus v12.1

IF /I '%Choice%'=='C' GOTO Q121

SET DIRECTORY=c:\altera\12.1\qprogrammer\bin\quartus_pgm

Similarly, for the Program-Mercury-EPCS16.bat the following six additions are needed:

ECHO  C. Quartus v12.1

IF /I '%Choice%'=='C' GOTO Q121

SET DIRECTORY=c:\altera\12.1\qprogrammer\bin\quartus_pgm

ECHO Oeu. Program using Mercury_eu_v3.3

IF /I '%Choice%'=='Oeu' GOTO ItemOEU

%DIRECTORY% -c USB-Blaster mercury_EU_v3.3.cdf

Finally, the Mercury programming batch file expects a .cdf file for the Mercury EU board, and this can be easily created by modifying the TAPR Mercury .cdf file in a text editor to contain the file name for the Mercury EU firmware.

These files should be updated in due course on the svn, eliminating the need for modifications.

Saturday, 8 December 2012

A gEDA PCB pad without a solder mask - HOWTO

While designing with the OSS gEDA toolsuite for pcb design, I found myself with a pcb with an AVR micro destined to have an Arduino serial bootloader installed.

I needed to figure out a simple way to create a row of six pogo pin pads on the PCB to allow in circuit programming.

The difficulty arises when trying to create what is effectively a row of pads without a solder mask in gEDA.

Normally, the only way to have a soldermask clearance around a pin or pad is for it to be an element itself, or part of an element.

Despite multiple attempts, based on mailing list hints found with google, I could not turn a polygon or track into an element via the "select", "cut to buffer", "convert buffer to element" process one can use for a via.

A simpler solution was found in the document "Footprint creation for the
open­source layout program 'PCB' " by Stephen Meier and Stuart Brorson:

Currently found at:


The solution was to create a footprint comprising a row of six pads, in which the clearances could be easily specified.

The example provided for an 0805 SMT resistor:

Element["" "" "" "" 1000 1000 -1000 -1000 0 60 ""]
Pad[-3000 0 -3000 0 4000 1200 4600 "" "1" "square"]
Pad[3000 0 3000 0 4000 1200 4600 "" "2" "square,edge2"]
ElementLine [-5000 -3750 6250 -3750 600]
ElementLine [6250 -3750 6250 3750 600]
ElementLine [6250 3750 -5000 3750 600]
ElementLine [-5000 3750 -6250 2500 600]
ElementLine [-6250 2500 -6250 -2500 600]
ElementLine [-5000 -3750 -6250 -2500 600]

was modified to the following, based on my 40mil wide tracks and 100mil track spacing:

Element["" "" "" "" 1000 1000 -1000 -1000 0 60 ""]
Pad[-3000 0 -3000 0 8000 1200 10000 "" "1" "square"]
Pad[7000 0 7000 0 8000 1200 10000 "" "2" "square"]
Pad[17000 0 17000 0 8000 1200 10000 "" "3" "square"]
Pad[27000 0 27000 0 8000 1200 10000 "" "4" "square"]
Pad[47000 0 47000 0 8000 1200 10000 "" "5" "square"]
Pad[57000 0 57000 0 8000 1200 10000 "" "6" "square,edge2"]


and then saved as "PogoPads.pcb"

Then, in PCB, one can use "File" -> "Load element data to paste buffer"

and proceed to load and place the saved pogopad footprint over the 100mil spaced trackwork where the row of six pogo pin pads was desired (after using the TAB key to flip the PCB over, allowing the pogo pads to be placed on the solder side of the board):

In this case I have made the 6 pogo pin footprint seven pads in length, to keep the +5V centred on the row of pads, in an effort to avoid possibly expensive reverse polarity mistakes in the event of a hand held pogo pin programming tool being used the wrong way round.

I then added a via in the gap between the 4th and 5th pogo pads to act as an alignment aid for the pogo pin tool/jig, in case I find that it is required or useful.

The keen eyed will see the nearby, six pin, in circuit programming header which will be the alternative means of programming the board, and the row of pins for the AVR and decoupling cap just below the newly placed pogo pin pads.

And here's a top side view of the same bit of the board:

The pogo pads are just visible on the bottom side.

For those wondering what pogo pins are, they are spring loaded pins held in a jig that can be pressed against pads on a target PCB, allowing testing or in circuit programming to be done without a bulky or expensive programming header being needed.

This technique should also work for transmission lines.

UPDATE: here are some pictures of the final result. The PCBs were done by Mitch, at Hackvana. You can compare the final product with the gEDA screenshots above. Note also that by doing lands this way gEDA will generate a solder stencil containing the lands. You can ditch the solder stencil gerber if you do not need a solder stencil. Alternatively, generate your required solder stencil gerber file before adding the lands. 

Tuesday, 27 November 2012

Final implementation of the OZroll roller shutter battery replacement

Just as an epilogue to the OZroll roller NiMH battery pack replacement with 12V SLA batteries, I thought I'd upload the photos of the final approach taken.

I ultimately decided against DC barrel connectors for the power feed to the OZroll roller shutter controller, as they are

1) ugly
2) supposedly rated at only 3 Amps
3) have only two conductors, making remote up/down button signalling difficult in future
4) flimsy

I opted for 4 pin microphone connectors. They are rated at 10 Amps per pin, are nice and shiny (improving wife acceptance factor), and have a screw collar for positive and secure engagement. I went with white sheathed 6 core cable. One pair carrying 12V DC, one pair carrying Ground, and the remaining pair kept spare for later used in remote signalling of roller shutter up/down commands.

Here is a front and rear view of the connector mounted in a blank wall plate

It turns out that they have 0.2 inch pin spacing, making a breakout board easy with veroboard and terminal blocks:

And here's the breakout board soldered into position:

Labelling is always good, in case you don't remember what you did in 5 years time. See also the jumbo Clipsal wallplate to cover the SLA battery compartment:

And here's the hole in the wall with custom sheet metal glued into position, drilled and tapped for screws to accept the clipsal wall plate (I couldn't find suitable mounting brackets from the electrical supplier).

The drilled out tongue depressors were invaluable in maintaining alignment of the sheet metal while being glued and clamped.

In summary, the nominal 12V, 3.3AHr, SLA batteries I have installed to replace the OZroll NiMH batteries last a few weeks before needing charging again. This charging will be automated in due course. The batteries have very low demands placed on them and should last many years, unlike the OZroll NiMH battery packs, all of which among my six roller shutter controllers have long since died.

IKEA mounting hole dimensions - In case you need to make a custom cabinet

I needed to build kitchen cabinets to fit within a fairly constrained set of dimensions and to match the oven profile at the front.

Why build rather than use a standard module?

There is a saying I first heard from a software developer named Frank Falco: "You can have it done properly, cheaply, or quickly. Pick two!"

The depth of the cabinet needed next to the oven would exceed the standard depth of a cupboard module, plus, the kickboard and profile of the oven needed to be matched, plus, there was plumbing that had to be worked around at the back of the cabinet for the espresso machine drip tray, plus, granite or concrete benchtops need very sturdy framing.

The benchtop would be granite, or cast and polished concrete, and could be made to match the front edge of the oven's range in terms of thickness and depth.

Framing and benchtops aren't too hard to make with routine woodworking tools, but making and finishing flat panel doors and panels can be difficult to do well (I think painting rots the brain), and then you have to select the (often expensive) drawer slides and hinges, and then learn what their mounting requirements are, tool up and do it properly.

I wanted it done properly and cheaply.

So, the solution was to use IKEA doors and drawers, including their mounting hardware in custom enclosures and framing. IKEA hardware also has nice adjustment features, to fine tune alignment.

The only problem was, what were the dimensions of the drawer slides, what was the minimum depth needed for the drawers, what mounting holes were needed, and at what spacing, and what thickness were the doors and drawer fronts?

I couldn't find anything on the net other than references to the standard 32mm European cabinetry system, which appeared to be different to IKEA's mounting hole dimensions.

In the end, I went ahead and bought some bits and pieces from IKEA, hoping for the best, and things worked out.

So, to

1) avoid having to find and decipher my scribbles at some point in the future if I need to do some more cupboards, and

2) help others trying to fit a custom cupboard into somewhere awkward in deciding if IKEA hardware will work in their situation

I have documented what I learnt and put it on the web.

Those planning to build something should glean all that they need to know from the photos. Don't blame me if something doesn't work out for you - IKEA might change things tomorrow, rendering my descriptions obsolete, or I might have made a few typos.

In summary, IKEA uses vertical rows of 32mm spaced 5mm mounting holes, about 26mm from the front face of the cupboard enclosure, and starting 44mm above the bottom surface of the cupboard enclosure. There is a second vertical row 300mm behind the first row, for mounting the drawer slides, also starting 44mm above the bottom surface of the cupboard enclosure.

Inside dimensions of the various cabinets are about 364mm, 464mm, and 564mm, to give overall outside dimensions of about 400mm, 500mm, and 600mm for the modules.

Minimum cabinet depth for drawers is 550mm, if soft closers are not used. Cabinet walls are 18mm thick, and door/drawer faces are 16mm thick, made of MDF in my case.

On to the photos.

First of all, for anyone contemplating construction of cupboards and drawers with IKEA kitchen hardware, there are some critical dimensions that need to be known.

1) Distance from the rear face of the door to the vertical mounting holes. I found 26mm to be a pretty good spacing. The hinges allow some adjustment. It should not be less than 25mm.

2) Distance from the bottom of the door to the hinge mounting holes. 44mm and 76mm (Given the 32mm spacing).

3) Minimum depth needed for an IKEA drawer is about 550mm. A bit more is needed if soft closers are attached to the rear of the drawer slides:

4) Distance to the drawer slide mounting hole. 26mm is about right.

5) The thickness of the drawer/door fronts = 16mm:

Overall, the most critical dimension is the height to the first 5mm mounting hole, from the bottom surface of the cupboard. I settled on 44mm. The vertical row of 32mm spaced holes should be no less than 25mm from the front face of the cupboard enclosure, against which the doors and drawers close. 26mm is better, as it gives you more leeway with door hinge adjustments. 27mm may be OK.

I bought a "CMT Universal Boring Jig" from www.carbatec.com.au to make the 5mm holes easier to drill at 32mm spacing, and because I had a lot of them to do. Nothing stops you doing it manually without a jig if you're careful, or if you only plan to do just enough holes for your specific door hardware.

It just so happened that a reversed pin placed (shown above in the photo as it would fall out due to gravity otherwise) under the jig in a 52mm door hinge hole gave a 44mm spacing for the first hole along the 32mm spaced holes, simplifying setup.

The jig has been designed with 25mm between the front face and the centre of the 32mm holes. I think 26mm works out a bit better with IKEA door hardware.

The boring attachment is then used with a 5mm wood drill.

Once a few 5mm holes have been drilled initially,

the clamp is augmented with the provided pins to ensure ongoing alignment while drilling.

Hmm, so far so good.:

The next step is to mark out the rear set of 32mm spaced mounting holes. These are used for drawer slides and are 300mm back from the front set:

Marked out and ready for the boring jig once more:

Rear set of holes done:

Door and drawer hardware test fitted:

Hmm, so far so good.

Here's a view of the panel. Note the use of dimensional lumbar, random scrap bits of wood, and flooring chipboard.

Here's the opposite panel which has had the same treatment

The top, sides and bottom ready for assembly:

Although the kickboard/base and custom woodwork still need painting, and the benchtop to match the adjacent oven is a work in progress, coffee was needed, so the IKEA door and drawer was fitted, and the espresso machine put into position: 

Whether you are refitting a kitchen, or fitting out your amateur radio operating room or hackerpsace, I hope this has been useful

Tuesday, 23 October 2012

Circuit bending with a kit built antenna analyser - or - maths meets chiptunes

For those of you wondering what that trigonometry you learnt in school has to do with circuit bending, read on....

Amplitude Modulation, as in AM radio, is a real world application of trigonometry, and AM radio has been with us for over 100 years.

Some of you may recall the trigonometric identity for multiplying two sinewaves.

Here is how this trigonometric identity can be used to modulate a hypothetical radio frequency carrier signal (a sine wave) with an audio tone (the information signal - also a sine wave):

So, we have shown mathematically how to amplitude modulate a radio wave carrier signal of amplitude A with an audio signal.

This results in the final equation with upper and lower sidebands of amplitude +1/2 and -1/2, and the carrier sine wave of amplitude A.

If we were to look at the results on a spectrum analyser, we would see something like this:

(Thanks to Wikipedia for the graphics)

From this diagram, it becomes obvious how the three terms of the equation arising from the original trigonometric identity relate to the lower sideband, upper sideband, and carrier in an AM broadcast.

In case you don't believe the mathematics, here's a sneak preview of what comes later... note the upper and lower sidebands (the vertical bars) on the spectrum scope and the central carrier shown on the kit built SDR cube receiver receiving a single AM audio tone centred on 1230.20kHz....

As an aside, if you have heard the term "lower sideband", "upper sideband", or perhaps "double sideband" transmission in amateur radio, these modes should make a bit more sense now - they are transmissions missing one or two of the above three terms to save on transmitter power.

So, how do we use this theory for circuit bending?

Simple, we use an existing LC oscillator generating a radio frequency (RF) carrier, and we then feed an audio tone into the early stages of the RF output amplifier, to modulate the amplitude of the final RF output.

A kit built VK5JST antenna analyser will serve nicely as a source of RF (from http://ahars.com.au/htm/jst_aerial_analyser_kit.html ) that can then be heard on an old school AM radio.

This VK5JST antenna analyser is a handy piece of test equipment which can serve as a source of RF from 1.3MHz to 31MHz (and sometimes more, i.e. 200khz to 50MHz, if you do the necessary mods...), usually used to tune antennas to resonance for your desired frequency range (a.k.a. band) of radio activities.

So, how do we circuit bend this source of RF into an AM chiptune transmitter?

Well, the antenna analyser uses a PicAXE microcontroller for frequency and SWR readout on an LCD display.

The software driving the frequency counter and analyser circuit is easily modified and uploaded to the analyser, making it an eminently hackable piece of benchtop test equipment...

It also just so happens that 28X1 and newer PicAXE chips can squirt an audio tone out, including RTTTL music formats, on a spare pin if asked nicely.

So, we have access to the software, which we can modify to add chiptune audio outputs, and we have a soldering iron, which we used to build the analyser in the first place, and we have access to the circuit diagram, so....

First, we install the optional serial port header, so that we can install cabling from the PCB to a stereo 3.5mm audio jack. This is done in keeping with the standard PicAXE convention of ground (tip), PicAXE serial data in (ring), and PicAXE serial out (shaft).

Having done so, we now have the ability to upload modified code to the analyser....

Next, we need to pick a spare pin on the pickaxe that we can use for the chiptune output. From perusal of the circuit diagram, found on the designer's website

( http://www.users.on.net/~endsodds/analsr.htm ):

We see that pin 21 is unused. It'll do.

Next, we need to decide which bit of the circuit to squirt the audio into, to amplitude modulate the RF signal generation portion of the analyser.

Perusal of the LC oscillator and subsequent buffer and amplifier portions of the circuit, we find a control loop feeding back to the Q5 transistor base connected to a 680 ohm resistor controlling oscillator output amplitude:

Somewhere around here should do.

First, we try jumpering a lead from pin 21 to the base of Q5, via a 1uF DC blocking capacitor and a current limiting resistor. Remember, this is a quick and dirty hack... but most circuit bending is. Although the hack is likely to affect phase and frequency stability a little, it shouldn't be noticeable with AM reception.

We start with an test audio tone of around 800 hertz, using a squarewave to mimic what the PicAXE will be providing in due course.

Here are pictures of a dual trace CRO (oscilloscope) showing the audio tone on the lower trace, and the AM modulated RF waveform on the upper trace.

Each picture shows the increasing modulation and increasing waveform distortion arising from reductions in the value of the series resistor going to Q5.

In the last CRO picture, we see over-modulation, and the RF waveform goes to zero for a proportion of each cycle. This confused the frequency counter in the antenna analyser and it reads low, so it's best to use a higher value resistor and to not overmodulate.

The modulation also appeared to be subject to the increasing correction by the AGC loop, and although the tone could be heard on a nearby radio, cleaner modulation was desirable in order to reduce "splatter" and harmonic generation.

To fix this, another approach was needed, and after contemplating various schemes, one requiring minimal modification of the PCB was chosen.

Here's the circuit:

The audio transformer had been gutted from a radio many years ago, as had the33nF capacitor, and these were used in conjunction with a 10k multi-turn potentiometer.

The effect of the potentiometer and capacitor was to form a voltage divider that directed current into the transformer at lower frequencies, but shunted higher frequencies straight to ground through the capacitor. This is also known as a low pass audio filter. This circuit could be interposed between ground and the 680 ohm resistor (also shown in the circuit diagram).

Here's the prototype:

The modulation improved a lot. See how it is much less "jagged":

And here's the circuit being patched into the analyser more permanently.
Note the red wire going to pin 21 of the PicAXE, and the shielded lead interposed between the groundplane and the "earthy" end of the 680 ohm resistor on the PCB. The keen eyed will also note the additional RF chokes added to the rotary switch during analyser kit construction giving extended frequency ranges to the analyser:

And finally, to complete the hack, additional code was added to the antenna analyser's PicAXE micro to make it play ring tone music, squirting the audio out on pin 21.

The resulting AM can be listened to on any old AM radio, in this case an FT817 which happened to be nearby:


In summary, we have used trigonometry to circuit bend a kit built antenna analyser into an AM radio transmitter, and we have even managed to Rickroll it while we were at it.

Here's the subroutine code. It expects a 16MHz clock, and may need slowing down for slower processors. Feel free to use it to rickroll anything with a PicAXE:


b1=1        'clear display
gosub wrins

lookup b0,("A RICKROLLED"),b1
gosub wrchr
if b0<12 then loop11
pause 3000        'display initial words for 1 second

b1=192        'LINE 2
gosub wrins

lookup b0,("VK5JST ANALYSER!"),b1
gosub wrchr
if b0<16 then loop12
pause 4000        'display initial words for 1 second

'Rickrolling  - uses B.0 which is pin 21 on the PicAXE, 16 is the speed
tune B.0,16,($47,$49,$50,$49,$14,$4C,$14,$4C,$02,$42,$0C,$4C,$47,$49,$50,$49,$12,$4C,$12,$4C,$10,$4B,$09,$49,$47,$49,$50,$49,$D0,$12,$0B,$09,$07,$47,$4C,$07,$D2,$C0,$00,$0C,$47,$49,$50,$49,$14,$4C,$14,$4C,$02,$42,$0C,$4C,$47,$49,$50,$49,$12,$4C,$12,$4C,$10,$4B,$09,$49)

PAUSE 6000
goto playitagainsam

It just goes to show, if you can't modify the software in the box, you don't own it....

And in case you think this is a pointless hack, we are just a few lines of code away from turning the antenna analyser into a Morse practice beacon, and just some pullup resistors on some remaining spare PicAXE pins from being able to use a Morse paddle to practice Morse code on any AM radio.....

For the AVR fans, there is nothing to stop similar mischief being perpetrated with an Arduino....