Homebrew

A horn for the bicycle

I’ve been riding on the road now for some years, and while I normally try to avoid it, I do sometimes find myself riding on the road itself rather than on the footpath or bicycle path.

Most of the time, the traffic is fine.  I’m mindful of where everyone is, and there aren’t any problems, but I have had a couple of close calls from time to time.  Close calls that have me saying “ode for a horn”.

By law we’re required to have a bell on our bikes.  No problem there, I have a mechanical one which is there purely for legal purposes.  If I get pulled over by police, and they ask, I can point it out and demonstrate it.  Requirement met?  Tick to that.

It’s of minimal use with pedestrians, and utterly useless in traffic.

Early on with my riding I developed a lighting system which included indicators.  Initially this was silent, I figured I’d see the lights flashing, but after a few occasions forgetting to turn indicators off, I fitted a piezo buzzer.  This was an idea inspired by the motorcycles ridden by Australia Post contractors, which have a very audible buzzer.  Jaycar sell a 85dB buzzer that’s waterproof, overkill in the audio department but fit for purpose.  It lets me know I have indicators on and alerts people to my presence.

That is, if they equate the loud beep to a bicycle.  Some do not.  And of course, it’s still utterly useless on the road.

I figured a louder alert system was in order.  Something that I could adjust the volume on, but loud enough to give a pedestrian a good 30 seconds warning.  That way they’ve got plenty of time to take evasive action while I also start reducing speed.  It’s not that I’m impatient, I’ll happily give way, but I don’t want to surprise people either.  Drivers on the other hand, if they do something stupid it’d be nice to let them know you’re there!

My workplace looks after a number of defence bases in South-East Queensland, one of which has a railway crossing for driver training.  This particular boom gate assembly copped a whack from a lightning strike, which damaged several items of equipment, including the electronic “bells” on the boom gate itself.  These “bells” consisted of a horn speaker with a small potted PCB mounted to the back which contained an amplifier and bell sound generator.  Apply +12V and the units would make a very loud dinging noise.  That’s in theory; in practise, all that happened was a TO-220 transistor got hot.  Either the board or the speaker (or both) was faulty.

It was decided these were a write-off, and after disassembly I soon discovered why: the voice coils in the horn speakers had been burnt out.  A little investigation, and I figured I could replace the blown out compression drivers and get the speakers themselves working again, building my own horn.

A concept formed: the horn would have two modes, a “bell” mode with a sound similar to a bicycle bell, and a “horn” mode for use in traffic.  I’d build the circuit in parts, the first being the power amplifier then interface to it the sound effect generator.

To make life easier testing, I also decided to add a line-in/microphone-in feature which would serve to debug construction issues in the power amplifier and add a megaphone function.  (Who knows, might be handy with WICEN events.)

Replacing the compression drivers

Obviously it’d be ideal to replace it with the correct part, but looking around, I couldn’t see anything that would fit the housing.  That, and what I did see, was more expensive than buying a whole new horn speaker.

There was a small aperture in the back about 40mm in diameter.  The original drivers were 8ohms, and probably rated at 30W and had a convex diaphragm which matched the concave geometry in the back of the horn assembly.

Looking around, I saw these 2W mylar cone speakers.  Not as good as a compression driver, but maybe good enough?  It was cheap enough to experiment.  I bought two to try it out.

I got them home, tacked some wires onto one of them and plugged it into a radio.  On its own, not very loud, but when I held it against the back of a horn assembly, the amplification was quite apparent.  Good enough to go further.  I did some experiments with how to mount the speakers to the assembly, which required some modifications to be made.

I soon settled on mounting the assembly to an aluminium case with some tapped holes for clamping the speaker in place.  There was ample room for a small amplifier which would be housed inside the new case, which would also serve as a means of mounting the whole lot to the bike.

Bell generator

I wasn’t sure what to use for this, I had two options: build an analogue circuit to make the effect, or program a microcontroller.  I did some experiments with an ATMega8L, did manage to get some sound out of it using the PWM output, but 8kB of flash just wasn’t enough for decent audio.

A Freetronics LeoStick proved to be the ticket.  32kB flash, USB device support, small form factor, what’s not to like?  I ignored the Arduino-compatible aspect and programmed the device directly.  Behind the novice-friendly pin names, they’re an ATMega32U4 with a 16MHz crystal.  I knocked up a quick prototype that just played a sound repeatedly.  It sounded a bit like a crowbar being dropped, but who cares, it was sufficient.

Experimenting with low-pass filters I soon discovered that a buffer-amp would be needed, as any significant load on the filter would render it useless.

A 2W power amplifier

Initially I was thinking along the lines of a LM386, but after reading the datasheet I soon learned that this would not cut it.  They are okay for 500mW, but not 2W.  I didn’t have any transistors on hand that would do it and still fit in the case, then I stumbled on the TDA 1905.  These ICs are actually capable of 5W into 4 ohms if you feed them with a 14V supply.  With 9V they produce 2.5W, which is about what I’m after.

I bought a couple then set to work with the breadboard.  A little tinkering and I soon had one of the horn speakers working with this new amplifier.  Plugged into my laptop, I found the audio output to be quite acceptable, in fact turned up half-way, it was uncomfortable to sit in front of.

I re-built the circuit to try and make use of the muting feature.  For whatever reason, I couldn’t get this to work, but the alternate circuit provided a volume control which was useful in itself.

The pre-amplifier

For the line-level audio, there’s no need for anything more fancy than a couple of resistors to act as a passive summation of the left and right channels, however for a microphone and for the LeoStick, I’d need a preamp.  I grabbed a LM358 and plugged that into my breadboard alongside the TDA1905.

Before long, I had a working microphone preamp working using one half of the LM358, based on a circuit I found.  I experimented with some resistor values and found I got reasonable amplification if I upped some of the resistor values to dial the gain back a little.  Otherwise I got feedback.

For the LeoStick, it already puts out 5V TTL, so a unity-gain voltage follower was all that was needed.  The second half of the LM358 provided this.  A passive summation network consisting of two resistors and DC-blocking capacitor allowed me to combine these outputs for the TDA1905.

One thing I found necessary, the TDA1905 and LM358 misbehave badly unless there’s a decent size capacitor on the 9V rail.  I found a 330uF electrolytic helped in addition to the datasheet-prescribed 100nF ceramics.

Power supply

Since I’m running on batteries with no means of generating power, it’s important that the circuit does not draw power when idle.  Ideally, the circuit should power on when either I:

  • plug the USB cable in (for firmware update/USB audio)
  • toggle the external source switch
  • press the bell button

We also need two power rails: a 9V one for the analogue electronics, and a 5V one for the LeoStick.  A LM7809 and LM7805 proved to be the easiest way to achieve this.

To allow software control of the power, a IRF9540N MOSFET was connected to the 12V input and supplies the LM7809.  The gate pin is connected to a wired-OR bus.  The bell button and external source switch connect to this bus with signal diodes that pull down on the gate.

Two BC547s also have collectors wired up to this bus, one driven from the USB +5V supply, and the other from a pin on the LeoStick.  Pressing the Bell button would power the entire circuit up, at which point the LeoStick would assert its power on signal (turning on one of the BC547s) then sample the state of the bell button and start playing sound.  When it detects the button has been released, it finishes its playback and turns itself off by releasing the power on signal.

Sound effect generator

Earlier I had prototyped a bell generator, however it wasn’t much use as it just repeatedly made a bell noise regardless of the inputs.  To add insult to injury, I had lost the source code I used.  I had a closer look at the MCU datasheet, deciding to start from a clean slate.

The LeoStick provides its audio on pin D11, which is wired up to Port B Pin 7.  Within the chip, two possible timers hook up: Timer 0, which is an 8-bit timer, and Timer 1, which is 16-bits.  Both are fed from the 16MHz system clock.  The bit depth affects the PWM carrier frequency we can generate, the higher the resolution, the slower the PWM runs.  You want the PWM frequency as high as possible, ideally well above 20kHz so that it’s not audible in the audio output, and obviously well above the audio sampling rate.

At 16MHz, a 16-bit timer would barely exceed 240Hz, which is utterly useless for audio.  A 10-bit timer fares better, with 15kHz, older people may not hear it but I certainly can hear 15kHz.  That leaves us with 8-bits which gets us up to 62kHz.  So no point in using Timer 1 if we’re only going to be using 8-bits of it, we might as well use Timer 0.

Some of you familiar with this chip may know of Timer 4, which is a high-speed 10-bit timer fed by a separate 64MHz PLL.  It’s possible to do better quality audio from here, either running at 10-bits with a 62kHz carrier, or dropping to 8-bits and ramping the frequency to 250kHz.  Obviously it’d have been nice, but I had already wired things up by this stage, so it was too late to choose another pin.

Producing the output voltage is only half the equation though: once started, the PWM pin will just output a steady stream of pulses, which when low-passed, produces a DC offset.  In order to play sound, we need to continually update the timer’s Capture Compare register with each new sample at a steady rate.

The most accurate way to do this, is to use another timer.  Timer 3 is another 16-bit timer unit, with just one capture compare output available on Port C pin 3.  It is an ideal candidate for a timer that has no external influence, so it gets the job of updating the PWM capture compare value with new samples.

Timer 1 is connected to pins that drive two of the three LEDs on the LeoStick, with Timer 4 driving the remaining one, so if I wanted, I could have LEDs fade in and out with it instead of just blinking.  However, my needs are basic, and I need something to debounce switches and visibly blink LEDs.  So I use that with a nice long period to give me a 10Hz timer.

Here is the source code.  I’ll add schematics and other notes to it with time, but the particular bits of interest for those wanting to incorporate PWM-generated sound in their AVR projects are the interrupt routine and the sound control functions.

To permit gapless playback, I define two buffers which I alternate between, so while one is being played back, the other can be filled up with samples.  I define these on line 139 with the functions starting at line 190.  The interrupt routine that orchestrates the playback is at line 469.

When sound is to be played, the first thing that needs to happen is for the initial buffer to be loaded with samples using the write_audio function.  This can either read from a separate buffer in RAM (e.g. from USB) or from program memory.  One of the options permits looping of audio.  Having loaded some initial data in, we can then call start_audio to set up the two timers and get audio playback rolling.  start_audio needs the sample rate to configure the sample rate timer, and can accept any sample rate that is a factor of 16MHz (so 8kHz, 16kHz up to 32kHz).

The audio in this application is statically compiled in, taking the form of an array of uint8_t‘s in PROGMEM.

Creating the sounds

I initially had a look around to see if I could get a suitable sound effect.  This proved futile, I was ideally looking around for a simple openly-licensed audio file.  Lots of places offered something, but then wanted you to sign up or pay money.  Fine, I can understand the need to make a quid, and if I were doing this a lot, I’d pay up, but this is a once-off.

Eventually, I found some recordings which were sort of what I was after, but not quite.  So I downloaded these then fired up Audacity to have a closer look.

The bicycle bell

Bicycle bells have a very distinctive sound to them, and are surprisingly complicated.  I initially tried to model it as an exponentially decaying sinusoid of different frequencies, but nothing sounded quite right.

The recording I had told me that the fundamental frequency was just over 2kHz.  Moreover though, the envelope was amplitude-modulated by a second sinusoid: this one about 15Hz.  Soon as I plugged this second term in, things sounded better.  This script, was the end result.  The resulting bell sounds like this:

So somewhat bell-like.  To reduce the space, I use a sample rate of 6.4kHz.  I did try a 4kHz sample rate but was momentarily miffed at the result until I realised what was going on: the bell was above the Nyquist frequency at 4kHz, 6.4kHz is the minimum practical rate that reproduces the audio.

I used Audacity to pick a point in the waveform for looping purposes, to make it sound like a bell being repeatedly struck.

The horn

I wanted something that sounded a little gutsy.  Like an air-horn on a truck.  Once again, I hit the web, and found a recording of a train horn.  Close enough, but not long enough, and a bit noisy.  However opening it up in Audacity and doing a spectrum analysis, I saw there were about 5 tones involved.  I plugged these straight into a Python script and decided to generate those directly.  Using a raised cosine filter to shape the envelope at the start and end, and I soon had my horn effect.  This script generates the horn.  The audio sounds like this:

Using other sound files

If you really wanted, you could use your own sound recordings.  Just keep in mind the constraints of the ATMega32U4, namely, 32kB of flash has to hold both code and recordings.  An ATMega64 would do better.  The audio should be mono, 8-bits and unsigned with as lower sample rate as you can get away with.  (6.4kHz proved to be sufficient for my needs.)

Your easiest bet would be to either figure out how to read WAV files (in Python: wave module), or alternatively, convert to raw headerless audio files, then code up a script that reads the file one byte at a time. The Python scripts I’ve provided might be a useful starting point for generating the C files.

Alternatively, you can try interfacing a SDCard and embedding a filesystem driver and audio file parser (not sure about WAVE but Sun Audio is easily parsed), this is left as an exercise for the adventurous.

Finishing up

I’ll put schematics and pictures up soonish.  I’m yet to try mounting the whole set up, but so far the amplifier is performing fine on the bench.

ATMega8L Experiments with PWM

Earlier this week I had an idea.  We’ve got an old clock radio that picks up interference from the fridge when it turns on and the buttons on it are starting to fail with age.

I thought: “Why not build a new one?”

So the requirements are simple.  We need a real-time clock, display driver, and of course, a receiver.  The unit we have spends most of its time tuned to 792kHz AM (4QG or “ABC Radio National”), so a simple direct conversion receiver was what I was thinking of.  But what about the LO?

Now I do have some clock radio ICs that implement the timing circuitry, alarm function and LED panel driver somewhere in a junk box.  You feed them with the 50Hz or 60Hz waveform that comes out of the transformer and they use that as the timing source.  Easy to use a 555 timer for the time source, and I’d make a traditional receiver.  Another option is to use a AVR microcontroller, I have a few ATMega8Ls in the junk box with a NXP I2C RTC chip which I also have a few of.

The ATMega8L has a couple of PWM channels one 16-bit and one 8-bit: could they be used as an LO?

So: after digging around and locating my bought-years-ago and not-yet-used AVR programmer, and dusting off a breadboard that had an ATMega8L on it from a previous experiment I set to work.

This page explains in good detail how the PWM channels work. I started with those examples as a guide and tweaked from there.

For the PWM channel to work as a receiver LO, I want it to cover 540kHz to ~2MHz, with reasonable granularity. Question is, how far can I crank this? I have a 4MHz crystal, not the fastest I can use with this chip, but the absolute top of the range for the ATMegas isn’t much higher: 16MHz or maybe 20MHz. So if you’ve got a 16MHz crystal, you can expect to quadruple what I do here.

I started off with some blink code. If you take out all the delays, you get the following code:

#include <avr/io.h>
int main(void)
{
        DDRB |= (1 << DDB1);
        while (1)
        {
                PORTB ^= (1 << DDB1);
        }
}

and the following waveform:

Waveform done in software with GPIOs

Waveform done in software with GPIOs

The yellow waveform there is off one of the crystal pins. The cyan one is the PWM pin output, which in this case is a software driven GPIO. Even if this one worked, you wouldn’t want to do it this way unless your chip was doing only this task, and who’d use a programmable chip like an ATMega8L for that?

So, after reading through the documentation and examples, I loaded in the following code:

#include <avr/io.h>

#define TCCR1_COM1A     1
#define TCCR1_COM1B     0
#define TCCR1_FOC1A     0
#define TCCR1_FOC1B     0
#define TCCR1_WGM1      0xf
#define TCCR1_ICNC1     0
#define TCCR1_ICES1     0
#define TCCR1_CS1       1
#define TCCR1A_VAL      (                       \
                        (TCCR1_COM1A    << 6)   \
                |       (TCCR1_COM1B    << 4)   \
                |       (TCCR1_FOC1A    << 3)   \
                |       (TCCR1_FOC1B    << 2)   \
                |       (TCCR1_WGM1 & 0x3)      )
#define TCCR1B_VAL      (                       \
                        (TCCR1_ICNC1    << 7)   \
                |       (TCCR1_ICES1    << 6)   \
                |       (((TCCR1_WGM1 & 0xc) >> 2) << 3) \
                |       TCCR1_CS1)

int main (void)
{
        DDRB |= (1 << DDB1);
        OCR1A = 0x001;
        TCCR1A = TCCR1A_VAL;
        TCCR1B = TCCR1B_VAL;
        while(1);
}

The frequency can be adjusted by playing with OCR1A. If I leave it at 1 (basically as fast as the PWM can go) I get the following:

Waveform from AVR PWM

Waveform from AVR PWM

Bump it up one, and it sinks to 600kHz. Way too coarse for what I want sadly. I guess I was hopeful, but maybe the above might serve as a useful spring-off point for experiments with PWM.

“Donnybrook Special” 2m groundplane vertical

This is a simple vertical groundplane antenna intended for mounting atop a 10m Squid Pole. These can be made to nearly any frequency you desire, and can be self-supporting if needed. The main limitation is the stiffness of the wire used.

The antenna gets its name as the original was one I quickly knocked up just prior to a horse endurence ride event that took place at Donnybrook in 2011. I was assisting Brisbane Area WICEN with the emergency communications at this event, and this antenna, worked very well. 10W was more than sufficient to get back to base on 2m FM.

The design is very simple. You’ll need some stiff copper wire, and a panel-mount BNC connector. I used some strands from a thick mains cable: this was being tossed out at a ham radio meeting some years back. The cable had a black plastic coating and inside were 7 strands of solid copper, each about 2mm thick. Perfect for small antennas.

Similar wire can be found in non-stranded house mains cable.

First step is to work out what length to cut the elements. They should all be roughly the same length. This can be calculated by the simple formula:

v=f\lambda

which if you take v as being the velocity of light in a vacuum (~3\times10^8 m/s; radio will travel a little slower through air, but who’s counting?) and f as being 147.050\times10^6 and solve for \lambda you get 2.04m as the wavelength.  We want ¼ of this, so I’ve aimed for 51cm long elements.

Don’t worry about them being perfectly straight when measuring, extra length is good at this point, you’ll want a good 2cm extra.  You can make a wire shorter, you can’t make it longer.

Measuring the elements

Measuring the elements

Measure and cut the 4 elements. 3 will become your groundplane, and the 4th the radiating element. Also cut off about 10cm or so, give or take, which will be the ground wire used to hook the groundplane elements to the BNC connector. Also add to your parts list, some small velcro strips: you’ll find these handy to strap the coax to the squid pole.

Procured parts

Procured parts

Start with the short piece of wire. You’ll want to bend it into a rough triangle shape, with loops of wire at the corners. The groundplane radials will loop through these holes. The excess wire should be coiled up to one side: this is the loop the squid pole will pass through. The BNC connector will be fitted in between the 3 small loops.

Ground wire

donnybrook-03-ground-wire Ground wire

Be sure you can still put the nut back on.

Take 3 of the four elements, and make a hook at one end. Pass this hook through each of the small loops in the triangle. Try to make them sit roughly straight out from the centre of the triangle, then solder each hook into the loop.

Hooking the radials

Soldering the radialsAttaching the radials

Having done this, put the BNC connector in and do the nut up tight. You can do away with the eyelet with the solder tag. To finish off, take your remaining element, make a hook just big enough to go around the centre pin of the BNC connector, then solder into place.

Preparing radiating element

Hooking radiating elementSoldering the radiating element Attaching the radiating element

To finish off, bend this until it is vertical. The antenna is now ready for tuning.

Completed untuned antenna

Completed untuned antenna

Double check the length is about right. It should be around the 51~52cm mark.

Checking length

Checking length (close) Checking length

To check the tuning, use a SWR meter or antenna analyser if you have one. Here, I used the built-in SWR meter on my Yaesu FT-857D. When using a SWR meter, ensure you’re running minimum power. The following are some results from my set.  It is at this point, you do any trimming of your antenna.  The following are without trimming the antenna, you’ll note that in most examples, the SWR is very low, just a point or so showing up on the left side of the screen.

On 2m:

donnybrook-13-test-144500 donnybrook-13-test-145500 donnybrook-13-test-146500 donnybrook-13-test-147500

On 70cm:

donnybrook-13-test-432100 donnybrook-13-test-433100 donnybrook-13-test-434100 donnybrook-13-test-438100 donnybrook-13-test-439100 donnybrook-13-test-440100

To mount the antenna on your squid pole, feed the tip of the squid pole through the remaining loop.  Bend the tip of the antenna around the tip of the squid pole.  Hook your coaxial cable to the BNC connector and use velcro straps at regular points to hold the coax to the side of the squid pole.

Mounted antenna

Mounted antenna

Recommended coax for this purpose is RG-195.  RG-58 will work, but is lossy, RG-213 and LMR400 are too heavy to use on a squid pole and will cause it to bend or collapse.

Update: This antenna performed quite well.  Saturday, we used it for 2m packet, providing a digipeater for the stations in our area in case they couldn’t reach the main node (at “the pineapple farm” just outside Imbil).  We had stable packet communications all day.  Since the stations around us found they could work the main node directly, we swapped antennas around and used it instead for a VHF/UHF cross-band voice repeater.  Signal reports were good through the Imbil state forest.

Build Log: 60W 2m Linear: Day 2

This post may also be read here.

Well, today I did some more work on the 2m linear.  Earlier this week I ordered some SMA connectors and some 1N5711 diodes for the project.

Two 1N5711 diodes will be used to make a voltage peak detector, to detect when the amplifier is subjected to power above 60mW.  The SMA connectors will be the interconnects between the modules.  This afternoon’s effort was spent soldering the SMA connectors onto two of the boards, and mounting the 2m amplifier module onto the heatsink.

The EME157B2 preamplifier kit was originally intended to be mounted in a masthead box, with BNC connectors soldered to the PCB, and stuck up a pole near the antenna.  In my application, I wanted it to be in the same enclosure (with suitable shielding) as the power amp, so that I could use its RF detection to automatically switch the power amplifier on.  I will also be using different relays, mounted on a separate board.

Instead of mounting the SPDT relays for the kit on the EME157B2 board, I’ve instead left these off.  I also omitted the 2N7000 MOSFET which turns on the relays, and L4, an RF-blocking choke which permits the preamp to run from a 12V source supplied up the coax.  I instead will power the preamp directly.

Since the relays will be on a separate board, the plan is to run wires from the gate and source connections where the 2N7000 belongs, and run those out to a controller board.  With the relays gone, the RF detection and the preamp are essentially two distinct circuits.  So 3 SMA connectors will be needed.  Here is the completed board with the SMA connectors fitted, and suitable jumpers installed, ready for tuning.

Completed 2m preamplifier

Completed 2m preamplifier. Connectors going left-to-right: Antenna input, Amplifier output, RF detector input.

Next, I finished off the power amplifier board, mounting it to the heatsink.  I have left one EMC filter disconnected for now, as the instructions say to power it up first with it disconnected to set the trim pot for 4.5V bias.  Rather than mounting the board flat on the heatsink, I have instead opted to mount the PCB at 90? to the module.  I had to make the supplied eyelets a fraction longer to accommodate this.  I also mounted SMA connectors on this board.

Completed 2m power amplifier

Completed 2m power amplifier. RF input is on the left.

The plan is, I’ll route RG195 coax on the left side to a small module which will contain the overload detection circuit and two SMAs for an external attenuator module.  On the right, a low-pass filter will be connected.  I also had a stab at tapping holes into the sides of the heatsink for mounting a bracket.  This bracket would hold the fans on top, and would bolt onto the main enclosure.  In doing this, I managed to bugger up two of the 8 holes, and thus what I’ll probably do, is buy a M4 tap tomorrow, drill them all out to 3mm and tap them to 4mm.  These are structural holes, so bigger is probably better anyway.

Much of today though was spent designing the controller.  I’m still finalising the design, but a rough schematic is below.

2m amplfier controller

2m amplfier controller

So, not yet going, but big parts are built now.

Build Log: 60W 2m Linear: Introduction and Day 1

This build log is also viewable here.

Background

A few months back, I grabbed the trusty FT-290R II ready to do my weekly run from The Gap to Tarragindi.  Quick test to check everything’s okay… the power meter swings to full scale, but strange, I’m not hitting any repeaters.

Okay, grabbed the FT-897D instead, and I just did my weekly radio duties with that instead.  When I came home that evening, I had a closer look.  The FT-290R II was emitting a signal, the hand-held was picking that up.  It was also receiving just fine.  On a hunch I took off the FL-2025 linear, and hooked the antenna up directly to the radio.  Bingo… the radio works, the linear does not.

So, the linear had died, and thus I was in need of a new one.  Hand helds really don’t have much punch for mobile use, in fact, the FT-290 has been brilliant on the bike.  Not menu driven, so it’s real easy to drive while riding, simple, no frills, and sufficient grunt to get out of a bad area.  It also does SSB (and CW, but I’ll leave that to LY2KW).

I could buy a new set, in fact, I may get a FT-857D, as the 897D is a heavy lump of a radio to lug around, and there are times when HF capability is useful.  It is less than ideal on the bike however due to its size and weight.  There was nothing wrong with the FT-290, just its linear was dead, thus I was limited to its barefoot transmit power of 2.5W, even less than most handhelds.

So, I decided I’d try my hand at a semi-homebrew linear amplifier.

The concept

I wanted an amplifier that could achieve at least 25W of transmit power using SSB.  As I’d likely use it for things like WIA broadcasts, I wanted one that would also handle transmitting for a long period of time.

Designing a full blown amplifier on 2m is a bit beyond me with my limited homebrew experience.  It is also an issue sourcing the PCB material needed for VHF projects.  A lot out there call for FR4 grade fibreglass PCBs.  I have no idea what Jaycar sell.  So this was going to be a potential minefield.  Thus, I opted for a kit.

Minikits sell one based on the Mitsubishi RA30H1317M.  The same kit, can also take the 60W module, which sounded good to me.  Most of the time I’d be running it at 30W, but having 60W capability sounded good.  I purchased this, along with the 30W module as well just in case.

I also thought a pre-amp would be nice.  The same supplier sells this preamp kit.  The kit also offers RF sensing, which would allow the amplifier to auto-detect the radio transmitting, and switch into transmit mode automatically.  This also allows for filtering, to prevent reception of pagers (not fun copping an earful of one of those when you’re wearing a helmet-embedded headset riding a bicycle).

Cooling

Minikits recommends using a Pentium 4 heatsink for 30W modules, however it wasn’t clear if this would be sufficient for 60W modules.

I wanted the amplifier module to stay below 100?C while operating with ambient temperatures at 40?C.  Pretty sure I don’t want to operate a radio under such conditions, so it should work fine in all conditions that I’m likely to encounter.

The amplifier module is about 45% efficient, thus about 135W is dissipated when operating at full power.  By my calculations, I was looking for cooling that can provide 0.22?C/W.

A quick search revealed that I could get one via Conrad which in the open air achieves 0.84?C/W.  Combined with a fan, it can achieve 0.24?C/W.  Jaycar sell this fan, which is quite capable.  In fact, two of them will fit across the back of the heatsink, so with dual fans, I should be well and truly within limits.

I placed the order for the heatsink a fortnight ago.  Due to a mix-up, I didn’t get it until Wednesday, but that’s fine, I wasn’t in any hurry.  With the heatsink now in my possession, I today headded to Jaycar to pick up some of the bits and pieces I’d need for this project, starting with the enclosure.

One thing I did neglect to procure today, were the fans… but no biggie, I’ll get those later.

Prior work

Well, technically day one was some time ago.  I had already mostly built the amplifier kit, and the preamp.  The preamp got built way back when I first obtained the kits.

The power amp was built later, however the instructions suggested that I wait until I have the amplifier module mounted on the heatsink before I go soldering it to the PCB.

Amplifier kit and 60W module

Amplifier kit and 60W module

Day 1

Having got the heatsink, enclosure and tools, I set to work.  Initially I positioned, drilled and tapped the two M3 holes for mounting the amplifier module.  I haven’t tried putting the amplifier in place yet, but it looks like the holes are positioned pretty well.

Amplifier module on heatsink

Amplifier module on heatsink

My plan, is to bend the pins on the module at 90? and mount the PCB horizontally.  Both module and PCB would be passed through the side wall of the enclosure, with the heatsink outside.  I originally wanted the heatsink inside the case (with vent holes), but of course, Jaycar are not good at providing internal dimensions, and I soon discovered it’d be awkward to fit.

It took a bit of experimentation to cut the hole in the side.  No, I won’t be winning any prizes for my metal work, in fact, it never was one of my best subjects.

Heatsink and empty enclosureHeatsink and empty enclosure (side view)

Heatsink and empty enclosure

Next steps:

My immediate next step will be to mount the amplifier module, solder it to the PCB, and mount the PCB inside the case.  Then I mount the heatsink and fans to the case.

I have a controller that I have designed at digital logic level, however I’ll need to do some further design work to make sure it’ll do what I intend, before procuring the parts and building it.

VK4MSL/BM: Stationary test on 15m

Well, this afternoon I decided to fix a couple of problems with the bicycle mobile… firstly, the mounting of one noisy headlamp.  I’ve re-done the mount using a more solid piece of plastic this time, so we shall see how it goes.  No noise on HF so things are looking up there.  I also fixed the headset connection which was causing speakers to drop out… the problem turned out to be in the headset connection on the bike, rather than in the helmet.

It was approaching 2PM and thus nearly time for the daily Travellers net on 21.185MHz USB.  I’ve never made a contact on 15m before, but knew the antenna did tune up there, so I gave it a shot.  Ross VK5KMH popped up with a 58 signal out of Adelaide listening… after a prolonged silence, I decided to throw a call out.  Ross responded, reporting my signal into his station was also a 58 signal.

This was from the driveway at my home location, using 100W transmit power (not far from where I reached VK100WIA on 20m with a CB whip).  So evidently this home brew whip works quite well on 15m.  I have since brought the FT-897D inside and plugged it into my G5RV-like antenna, and after moving off frequency to tune, I notice Ross is still a 58 signal, so evidently my HF antenna doesn’t do much better than the whip does.

VK4MSL/BM: HF contact on 80m

Well, the antenna I tuned up in my last post, I can say, while it doesn’t work that great on 80m, it did get a contact into Victoria this evening on the AWNOI net.  Terry VK2TEZ near Coffs Harbour gave me a 4-3 signal report, so still lots of room for improvement… part of that was due to static crashes from storms in NSW, but I think with a better tuned antenna, we should be able to get towards having a workable antenna.  At the moment the autotransformer I use has ~95 turns, with output taps at 0, 25, 50 and 75 turns.  I think one somewhere between 0 and 25, and/or some extra turns might help… so I might wind a new one and see where that gets us.

The headlight still continues to give me grief.  An interesting discovery though this evening.  Since the battery is no good, I’ve permanently mounted it to the bicycle frame.  This was achieved by removing the plastic bracket which is used to mount the headlight on the handlebars or on the helmet mount (using a rubber O-ring), and replacing this with a bracket bent out of a short piece of aluminium.  It fastens to the bicycle frame at the front right above the front wheel, using a bolt hole normally used for mounting rim brakes (my bike has disc brakes).

The upshot is that the headlight’s casing has a pretty good electrical connection to the bicycle frame.  Turns out this is a big no no with these lights.  Kiss goodbye HF if you do… you’ll get crap everywhere from 400kHz right up into the VHF.  I’ll have to do some further investigation, but I found that if I insulated the case from the frame, it helped on the 400kHz and HF emissions.  I think something parasitic is causing the 2m grief as this continues (that, or it’s less critical on the case being earthed).

For a while I thought it might’ve been something lurking around 415kHz… the standard IF frequency of most superhetrodyne receivers, but alas, can’t see anything there.  Otherwise it’d explain why it appears to be everywhere.  I definitely suspect it’s not supposed to be oscillating there though, so I think parasitic oscillations are the cause here.  I’m slowly researching my own power supply for the LED in this headlamp, so its days are numbered.

The insulation was achieved by breaking a cheap plastic picnic knife, drilling a couple of mounting holes, and mounting the headlight on that.  That quelled the HF interference quite a bit, and I was able to listen to the HF bands on my way into Brisbane.  At least it was nice to listen to something other than that sodding wedding in the UK.  (C’mon fellas, yes, great and all but can’t we just confine it to one station?)

I was concerned about the longevity of this arrangement however.  And as it turned out, I was right to be concerned.  It broke as I approached the Normanby Fiveways.  I went over a bump, heard a crack, and noticed the headlight dangling by the power lead.  I pulled over, threw it in the basket and grabbed the backup headlight.  At least there was one on the helmet, a 1W LED, so I still complied with local laws for night riding.  I didn’t have a mounting for the backup light, I just pointed it forward sitting in the bottom of the front basket, with it on flash as a warning to drivers.

Once at the destination, I reverted the headlight back to being directly mounted on the bicycle frame.  Interference was intermittent, but when it was acting up, it did wipe out 80m with S6 noise.  Not good when most stations are barely making S6 as it is.  I wound up turning off the main headlamp as for the most part I could see where I was going, and I knew the route.  As I got out of town this was less of an issue due to the lack of traffic, and of course I was on bicycle paths or the footpath for 90% of it.  That at least allowed me to hear what was going on with the net.

The other flaw I had was that the helmet’s speaker connections were acting up… wound up unplugging the earpiece side of the headset adaptor and using the internal speaker.  Thankfully I could still use the helmet’s microphone and the rest of the wiring harness… just not the speakers in the helmet.  I noticed this as I pulled out of my street, in fact I was aware there was a problem, but now I know where the problem is now.  I’ll get onto it tomorrow.  And I’ll look at a better way to mount this headlamp in an insulated fashion as an interim solution to a power supply replacement.

VK4MSL/BM: New HF antenna

Well, I figured I better post up pics and notes on the improved antenna design for my HF bicycle mobile station.  I spent some time tuning it up today, and without resorting to the autotuner, I’ve successfully managed to tune up all bands available to me from 40m through to 6m.  80m still remains ellusive however.

The new design incorporates a version of the autotransformer used in the earlier attempt, using more turns of wire on the same size former, and multiple output tap points.  This allows me to accomodate a very wide turns ratio to match the antenna to various bands.

VK4MSL/BM HF: The autotransformer

VK4MSL/BM HF: The autotransformer

 

Band Test Frequency Primary turns Secondary turns Approximate SWR Comments
80m 3.590MHz 1 90 Too high to measure This seems to get the strongest signals. Autotuner is able to tune from here.
40m 7.120MHz 26 48 ~2:1 +/- a turn on the secondary to cover the entire 40m band.
20m 14.210MHz 26 1 ~1.2:1
15m 21.200MHz 26 27 ~1.4:1 Slightly out, there is probably a better one.
10m 29.200MHz 26 27 ~1.1:1
6m 53.000MHz 26 52 ~1.2:1 +/- a turn on the secondary, able to hit VK4RBX with 10W from the driveway

 

On the top of the autotransformer are for selecting the secondary tap; one of 0 turns, 25 turns, 50 turns or 75 turns (caveat; I might be slightly out with my counts here).  Having done this I think in hindsight I’d have been better off moving the 0t one down to maybe 10t instead, as there aren’t too many bands that seem to work on the 0t setting.  The primary side is selected by means of a wire soldered on to a thumbtac.  The wire wraps around the tube with a piece of balsa wood for the pin to stick into.  You select the turn by piercing the insulation as you push the thumbtac through the wire and into the balsa wood behind.  Crude, but it works.

VK4MSL/BM HF: Primary tap

VK4MSL/BM HF: Primary tap

In place of the CB whip, I have taken a fibreglass whip and cut it down, stripped the winding, and used it as a support with a base-load spring to take any shock loads.  In place of the original antenna winding, is two sections of brass tubing which telescope out.  This allows for an antenna that can be partially dismantled and reassembled on the run, unlike the other antenna which was permanently fixed at 6′ length.

VK4MSL/BM HF: Mark II

VK4MSL/BM HF: Mark II

I have a third solid section I can insert in there too, which would further extend the antenna to 2.5m, but it becomes very top heavy when I do this.  The antenna can extend to 1.6m length, or for portable use I can throw a wire up into a tree, or support it using a squid pole and connect that wire to the autotransformer output taps.

I didn’t make any contacts while tuning the thing up, although I was hearing New Zealand on 20m quite strongly, and on 10m I could hear the VK8 (Northern Territory) beacon going quite well.  I tried a few calls on 28.390MHz, but had no contacts.

 

I’ve also re-inforced the antenna bracket.  Prior to doing this the antenna would sway wildly from side to side.  Yes, it meant the cars gave me a wide birth (something I greatly appreciate) but I fear had adverse affects on the signal, and probably was asking for trouble in the long run.  Putting a brace between the two brackets seems to steady things up just a little bit, and now I can rock the bike side-to-side quite violently without the antenna swinging too far.

I’m yet to go mobile with the new improved station.  Weather permitting, I shall give it a try Monday evening.  I have a meeting with Brisbane area WICEN.  Due to headlight QRM I may or may not be active while mobile, we’ll give it a shot, but I should be able to work portable once I get there.

New antenna

For a little bit I’ve been struggling with poor performance on my bicycle mobile station.  It was an intermittent fault.  Sometimes it’d work great, other days the FT-290R II would complain bitterly about a SWR issue, and receive performance would be abysmal.  But then I’d set off anyway, get a block away, and the problems just disappeared.  Or the thing would be working perfect, and I’d get down the road and it’d stop working.

Damn frustrating.  Intermittent faults such as these are the worst kind to try and locate.  I thought of all kinds of possibilities, but the one thing I hadn’t considered was the antenna.

Performance had been pretty patchy ever since the weekend before LCA.  It was on the Saturday that somewhere between Annerley and Milton, I lost the ¼ wavelength stainless-steel whip that I had been using.  So I spent that evening rigging up a SO-239 socket so that I could use the commercial antenna I had; a Nagoya NL-77BH that I bought at BARCfest in 2008.

I rigged that up, and on the Monday I did successfully make a contact from the bicycle on my way to LCA, but it was patchy.  I did find a few glitches, so fixed those, and Friday I made a contact in the afternoon, but it was still pretty hit-and-miss.  Not the consistent behaviour I got out of my ¼ wave at all.  Okay, maybe the coax is damaged.  Tried different leads, no dice.  Recently I bought a front basket for the bicycle, and so I could put the FT-290RII in there.  Ran coax back to the antenna, last Wednesday afternoon and Thursday morning it worked beautiful.  However Monday it gave me no end of grief.

Suspecting that the weight of the radio pressing down on the BNC terminations may have damaged that section of coax, I grabbed a length of RG195 and terminated it with BNC connectors.  Still no good.  Using the SWR meter in the FT-897D, the impedance match was out by miles.

Today I had another look.  I took the antenna off the bicycle and placed it on a mag-mount antenna base, and placed the base in the centre of an open garage door.  So big ground plane, not much different to most cars.  Checked SWR, still through the roof.  Tuned to the Mt. Cotton repeater on the FT-897D, no signal.  Pulled out a hand-held, perfectly clear 5/8 signal on its original rubber-ducky antenna.  As I was unplugging the antenna base, I watched the signal strength suddenly shoot up and the radio crackle to life when the shield was disconnected (leaving just the centre pin).  I had noticed a dead short before, but thought it was the antenna mount on the bike… something was up.

So, I grabbed a bit of solid copper wire, a PL-259 plug, and some offcut insulation.  I made a new ¼ wavelength antenna, cutting it initially at 60cm.  Swapped it for the NL-77BH and the performance was beautiful.  Check SWR, and yes, it’s high, but then again, 60cm is waay too long.  I estimated about 51cm and folded the wire over at that point, twisting the excess around the body of the antenna.  Signal strength immediately went up two S points, and on checking SWR, it was significantly reduced.  I moved it back to the bicycle where I tweaked it further.

Once happy, I cut off the excess, used pliers to fold the end sharply and soldered the folded end to the body of the antenna to prevent it hooking anything.  Then used some heat-shrink tubing to finish it off so there were no sharp ends to poke eyes out with.  The antenna provides a good match from 144 right through until 148 MHz at 30W using FM.

I haven’t tried a contact on the bike yet, nor have I got any pics to share, but the radios seem happy with it, and it appears to be hitting repeaters in the area once again, including Ipswich.  Given it’s a good 30km between The Gap and Marburg (as the crow flies) with some decent hills to boot, that’s not bad going.

It would appear the additional complexity of these high-gain commercial antennas comes at a significant cost, they don’t like getting shaken to bits on the back of a bicycle.  I’m not sure how repairable the commercial antenna I have is, it may be a case of throw the thing out, at which case I think any love affair I had with commercial mobile whips might be over.  At least my ¼ wave antennas can be made for <$20 in about 10 minutes from parts I can buy in town, versus spending >$50 and having to wait for it to arrive in the post.

New toy

I picked up a few new toys recently.  I’ve been looking around for a small microcontroller based device to act as a combined remote face / DTMF generator for my FT897D.  The idea is that this device could interface with the FT897D via its CAT port, and allow me to adjust the frequency and mode, recalling the information from internal flash or an SD card.

The remote face would then be mounted on the front of the bicycle, and connect to the radio at the rear to allow easy bicycle mobile operation.  An extension of this would be control of a separate 2m radio, and a GPS to allow APRS from the bicycle.

The idea was to have the memory work like a relational database.  Rather than just recalling memory channels, and having a big long list, I could scroll through the repeaters by callsign, location (service area), or combined with GPS, proximity.  Modern flash technology would make this easily doable.

Likewise, for DTMF, rather than having to carry around a cheat sheet or remember IRLP node numbers, wouldn’t it be nice to just be able to scroll through a node list by country/region/callsign, select one, hit the “Call” button, put your callsign across and have it automatically dial the moment you raised the PTT?

I don’t have the ability to manufacture PCBs of the standard required for ICs such as most 32-bit microcontrollers.  SOIC is about as fine as I can muster, and prototyping services are expensive.  Thus I was looking for a stamp module or premade board.

Luminary Micro (now TI) make a few nice ones, and during my work at Laidley, I got to use the LM3S8962 Ethernet/CAN evaluation board.  One nice feature was that it had the JTAG built-in via a FTDI USB-serial chip.  However, the licensing for the board support package irks me — despite their code being useless on anything other than one of their chips, they still see it necessary to modify the BSD license adding a clause that prohibits its use on non-TI microcontrollers.  I had a crack at writing my own “free-software” Stellaris library, but haven’t gotten that far with it.

I happened to stumble on this board based around the STM32F103VET.  They were being sold on eBay for about $60 at the time, so I decided at that price I’d buy three.  ST’s driver library appears to be very liberal in its licensing (in fact they claim there is “no license”, I don’t know if this means “public domain”, or whether I treat it like BSD).

The LCD panel uses the Ilitek ILI9320 display controller with internal graphics RAM, and is capable of 18-bit colour.  The board also features a RTC backup battery, Texas Instruments TSC2046 touchscreen controller and on-board RS232 level converter.  The STM32 also functions as a USB peripheral, and can be programmed using the stm32loader bootloader script via RS232.

Interestingly, the LCD controller documentation states that no part of that documentation may be reproduced without written permission.  I’m not sure if writing an open-source driver classes as “reproducing” the documentation (as I’d be making documented #define statements in C).

The devices come with example source and have a pre-loaded µC-GUI demonstration on them.  So far I’ve managed to distill enough out of these sources to get working touchscreen, LCD and UART.  I’ll probably start looking at FreeRTOS next and seeing if I can get a workable device going.

STM32F103 board

STM32F103 board running a simple "Hello World" app

Hello world application for STM32

Hello world application for STM32

Guess now I had better start planning my application. 🙂