RaspberryPi Software FM and APRS

Written 2021-03-11

Tags:RaspberryPi Radio FM APRS 

RaspberryPi FM Transmitter

RaspberryPis have a GPIO pin that can be connected internally to a clock divider of a number of source clocks. This isn't a simple divider, rather, it's a dithering fractional divider, with 12 integer bits, and 12 fractional bits. First, this means that the frequency is only correct when averaged. Since it's digital, there will be many harmonics as well.

As an example, a 500MHz PLL clock(from PLLD on the older boards) can be divided by the ratio (22285/4096) to reach 91.9004MHz, this is somewhat of a best-case, since the divider lines up well.

To make broadcast FM, we can change the divider(or have the chip's DMA do it rapidly for us) to generate other tones within the broadcast FM bandwidth, which is 100-150KHz(channel spacing is 200KHz). For our example 91.2MHz station, we can use dividers from (22303/4096) at 91.826MHz to (22266/4096) at 91.978MHz, which is 37 discrete tones at maximum volume(roughly 4kHz spacing between tones). If we switch(modulate) between them rapidly enough, we can generate something like FM audio at the receiver, which low pass filtering in the receiver should help us clean up.

Why RaspberryPi FM will not work for APRS

However, things get more interesting at 144.390MHz, for two reasons. First, since the transmit frequency is higher, a single increment or decrement of the divider moves the transmit frequency further, about 10KHz now. But also, the bandwidth of 2 meter FM voice is only around 12kHz. When we work out the dividers, we get (14184/4096) at 144.388MHz and (14183/4096) at 144.398MHz, which is far enough from 144.390MHz that receivers are likely to filter it out or at least significantly attenuate it.

Cludging it all together

Because square waves have a lot of odd harmonics, with appropriate filtering, we can tune to 144.390MHz/3, or 48.130MHz, and filter out unwanted harmonics like 96.260MHz(2x) and 192.520MHz(4x). It's easiest to use a bandpass filter centered on 144.390MHz, with cuts set between 2x and 3x, and again between 3x and 4x harmonics. We could also tune lower, perhaps to 144.390MHz/5, but this will reduce out transmit power on target frequency more, and make filtering more difficult, as the nearest unwanted harmonics become closer together(4*144.390MHz/5 and 6*144.390MHz/5).

Bandwidth calculation also needs scaled. +/-6KHz at 144.390MHz is only +/-2KHz at 48.130MHz, however, we can fit four tones there, where we could only fit 1 at 144.390MHz, specifically we can divide 500MHz by (42553/4096) to (42550/4096).

When we do this, we can indeed hear some sort of audio, but it's still pretty terrible. Dithering and increasing the sample rate might help, but it's never going to work well.

Velleman VTSS5 vs Weller WE1010

Written 2021-02-03


For a long time, I've had a Velleman VTSS5, open-loop, adjustable soldering station. At work I've used closed-loop Metcal and Weller stations, but I don't often solder at work. I wanted a closed-loop iron at home, but couldn't justify it for the rare soldering I do. This winter though, I found a Weller WE1010 for 1/3 off at CargoLargo, a local consignment and resale shop.

characteristicVelleman VTSS5Weller WE1010
street price$25$110
heating timea few minutes~30 seconds
cord flexstiffermore flexible
cord diameterthickerthinner
iron power50W70W
iron gripfirmersofter
iron weightheavierlighter

The Weller is much more expensive, but only when I had them side by side did I notice just how much nicer it was. Just the lighter iron and more flexible cord is a huge improvement in ergonomics. The cord is more flexible and thinner, yet caries more 40% more power. The increased power and I suspect less metal to heat results in faster heating time. Closed loop control means tips will last longer too.

Slightly more refined curve tracing with a power supply and oscilloscope

Written 2021-01-20


On my quest to characterize a strange LED, I need a curve-tracer. I don't have one but I do have a power supply and an oscilloscope, the ability to spend large periods of time developing complex solutions to things I could bang out with a few multimeter measurements and a spreadsheet. From XCKD:


Can I generate better IV curves using an oscilloscope for measurement rather than a power-supply?


Test Circuit

Unlike a simple power-supply based measurement directly connected to a bare device under test, we need a current limiting resistor to both convert current to voltage for measurement with the oscilloscope and to increase current measurement resolution above that of the power supply. You could also use a current-probe, but I haven't got one.

A picture is worth a thousand words, but I do not have schematic capture software installed, so:

oscilloscope tracer setup

Effectively, by connecting the oscilloscope ground to both the DUT and resistor, and measuring voltage across both at the same time, we can get closely aligned samples of both voltage across the resistor and across the DUT.

Did I mention you need an isolated power supply? If the power supply's negative terminal is grounded to the same potential as the oscilloscope, the test current will bypass the resistor, drastically increasing the current for each voltage step, possibly destroying the DUT, and likely damaging your oscilloscope probe or worse, your scope too!

Here's what mine looks like:

oscilloscope+powersupply circuit

There is another way to wire this, for a non-isolated power supply, but it requires connecting both oscilloscope grounds to the power supply negative terminal and measuring voltage from both the positive positive terminal and between the DUT and resistor, then doing some subtraction. It probably works fine, but I worried the error might be higher for low voltages. But really, this is still a very, very crude curve-tracer.


This mechanism is slightly different(and better) than the power-supply-only approach from a previous post, yet still quite simple. Set the current limit to a reasonable maximum. For a 6A diode I set mine to 1A since I do not have a diode heatsink but we will not reach this unless there is a short. Decide on a maximum voltage for the top range, but set the voltage limit quite low to start, I used 1mV(but power supply error might be several mV at this range). Decide how much time you are willing to wait for results and how many measurement points you will need over voltage. I used To start, adjust the oscilloscope voltage offsets to center and scale to cover the voltage you will be sweeping. Until the maximum voltage is reached:

My Setup, for 6A05 Diode

Challenges & Improvements over power-supply-curve-tracer

We've moved many measurements errors from the power supply meter to the oscilloscope. This means we have different errors. Zero-calibration of the oscilloscope is quite important here. Also, any error in resistor measurement will appear as a scaling error in the current conversion. We also have to manage oscilloscope scale with varying voltages present - I didn't even attempt to do so and just set it wide enough - this means that my low-end voltages will impacted more by quantization error(ratio-wise). I did self-calibrate my oscilloscope before running this test. DUT temperature rise is still an issue.

Current/Voltage sample synchronization

Since we're using an oscilloscope, the two channels are closely synchronized. There may be a slight AC effect caused by resistance and diode junction capacitance forming a filter, but it's not significant for this diode. This means we can take many more samples without settling delay at each IV point. It's still quite slow compared to a curve-tracer though.

Current Resolution

Since we're using a 33ohm resistor, we can vary the power supply voltage by roughly a millivolt each time and step the circuit through no more than a 30 microamp increase.

Possible improvement: autoscale

You could automatically adjust the oscilloscope as needed to optimize sample scaling across the varying range of voltages on each channel, since we are effectively using it as a dual-channel meter.

Results: Great Big 6A05 Diode, up to 3 volts across circuit, up to almost 0.7 volts across diode, up to about 66mA

While not the diode I want to characterize, this is a big, resilient, 6 amp diode, very resistant to sofware development errors.

Scope voltages over time


These are the unconverted voltages from a run with the oscilloscope. At this stage we just need to check that neither trace is clipped. We can also use this graph to estimate possible adjustments to oscilloscope resolution.

Voltage and current over Time


We can clearly see from this plot that the 6A05 starts conducting around sample 25000 when the diode forward voltage starts to be reached near 0.6 volts. Before then, voltage increases without much current increase. After sample 30000, the diode is on, and further increases in drive voltage result in increases in DUT current.

IV Curve


This is what we came here for. For the 6A05, the IV curve is usually only plotted above 10mA and 0.65V, so my trace doesn't overlap enough to compare. I could re-run this over a larget drive voltage range, or use a smaller current measuring resistor, but I think this setup should work for my mystery LED, and I already have a datasheet for the 6A05.

Measurement Error

It should be possible to compute error bars for the oscilloscope measurements, but I have not done so for this graph and it's getting late. The accuracy range of the oscilloscope depends on the actual measurement, the voltage per division settings and a constant base error.


Does it work? It works much better than IV curve tracing with just power supply, and I bet it works well enough to characterize my mystery LED. I certainly have fine enough control over current stepping, which was the main issue with using only the power supply.

Rudimentary curve tracing with a programmable power supply

Written 2021-01-18


I have a mysterious light-emitting diode I'd like to characterize. The right tool for this job is a curve-tracer, but I don't have one. Curve-tracers work by connecting to a bare component, usually a diode or transistor or other semiconductor, and sweeps across different voltages and plots both the voltage and current through the device caused by the voltage on an XY plot, this is also known as an IV-curve.

What I do have though, is a GW-Instek GPD-3303S programmable power supply with integrated current limiting and readout over USB that is controllable through sigrok.

Can I generate IV curves using sigrok and a power-supply? Kind-of.


A simple approach is to set the voltage limit for the device maximum(power limit for a resistor, forward voltage at max forward current for a diode), set the current limit very low, then for each measurement point:



First, I couldn't get sigrok to talk to my supply. This ended up being because I wasn't specifying a baud rate, and sigrok defaulted to a different one than my supply was set to. I patched it to support auto-baud.

Current/Voltage sample synchronization

My power supply doesn't support measuring voltage/current at the same time - the sample-rate is quite slow, and since the samples are interleaved we cannot really say that a certain voltage caused a certain current unless we wait long enough after adjusting the supply for everything to settle, which I have done.


This power supply only supports positive voltages. If I wanted to check reverse biasing I'd have to run it once, swap the leads, run it again, and combine the results.

Power supply meter calibration and sensitivity

For the parts I want to look at, 10mA is an awful lot of current, but I'm going to do it anyways and see what happens. It's important to recognize that if this 10mA were random(and it could be and the instrument would not be malfunctioning), this experiment would produce completely meaningless results. We could also improve it significantly by programming the power supply and measuring current and voltage with a better mechanism.

Also, I do not know how recently this supply was calibrated. I haven't done it as I haven't been able to find a copy of the service manual. It is important to calibrate power supplier regularly if doing anything like this. For example, when current-limited at 1 to 2 milliamps, the power supply would sometimes current-limit it self with no load. This could be caused by changes in output capacitor equivalent parallel resistance(a leakage path) over time since the last calibration.


The IV-relationship of many semiconductor devices varies with temperature. Contemporary curve-tracers can emit a short voltage pulse, conduct their measurement and shut off to cool with a very low duty cycle. Due to the long adjustment time, this isn't really an option - any current through the device under test may impact the measurement.

Results:330ohm resistor

I picked this resistor because it can survive some tens of milliamps over several volts and if I made a mistake programming the supply it wouldn't be a big issue. Of note, it is coded as a 5% 330 ohm resistor, through hole, and measures 322 ohms and 323 ohms on my two office multimeters.


Holy error bars batman! What's going on? The error bars displayed are calculated from the formulas in the power supply manual at each data point, which is hopefully a worst-case limit. I suspect the supply is capable of better than this, at least over short ranges like this one, where the samples all agree to with 1 millivolt or 1 milliamp. At least over this short range, it also appears to be monotonic, which will greatly help. It may also help that I'm only measuring at steady-state current and voltage.

Is the measured resistance from curve-tracer wrong? Yes, by about 9%, which is well within the integrated ammeter tolerance at these current ranges.

Is the curve-tracer directionally correct? Also yes, if you ignore the 1mV/1mA quantization errors or look over a large enough area.

Results: Great Big 6A05 Diode

While not the diode I want to characterize, this is a big, resilient, 6 amp diode, again resistant to sofware development errors.

Measurement: up to 100 milliamps

This plot shows what we would expect for a diode of this type. It turns on aroud 0.6 volts and is conducting quite a bit of current at 0.7 volts.


Measurement: up to 1 amp

This is a similar plot with more milliamps per measurement, but up to 1 ampere


Measurement Error

But, when I overlay the above two IV curves from this diode on top of each other, and zoom in some, notice that they do not align well.


This is likely caused mostly by self-heating inside the diode over time, which will in turn change the IV relationship as the diode temperature changes. How the diode is heating internally has to deal with the currents applied, ambient temperature, location of the test clips on the leads, how long the supply dwelled at each current point, and probably more things, most of which were not controlled, so I wouldn't put much stock into how this two IV-curves differ, just that they do.

It's also possible that the built-in ammeter and voltmeter have some temperature-dependent, voltage-dependent, or current-dependent error, but I don't think it should be too significant at these voltages and currents, according to the manual.


Does it work? It kinda works. It's not great, and I wouldn't rely on it for much other than steady-state operation, which is better measured with a pair of multimeters anyways. You could probably do a lot better with a clock-synchronized triangle wave generator or the actual correct tool for the job.

Was it a fun and engaging Saturday project? Yes.

Does it show expected diode curves? Also yes.

Was it a good introduction to controlling a power supply with sigrok? Yes, that too.

Is it going to be good enough to characterize my mystery diode? Probably not. My mystery LED is likely only capable of 10mA to 15mA maximum, so that's probably not enough points on the current scale to see what I'm looking for. However, if I can measure voltage or current separately, it may work out.

2002 Toyota Highlander Mid Dome Light Access

Written 2021-01-09

Tags:Highlander Toyota DomeLight 

Access to the mid dome light on 2001-2004 Toyota Highlanders is pretty straightforward, but changing is a little tricky. Tools Needed:

Removal of the lens

There's a simple slot to place your lever on the passenger side of the lens. Insert lever into slot and leve until the lens pops down.


Removed lens

Two ends of the lens have tabs holding it in.



Under the lens

The bulb goes horizontally(oriented left-to-right on the vehicle). The bulb is held by two springs with holes in them. If you simply push on the bulb one way or the other, the opposite spring will follow it making it difficult to remove. By using one hand to push the bulb one way to compres one spring and a stubby flathead screwdriver to compress the other spring, you can then rotate the free-end of the bulb past the spring held by the screwdriver. This photo is rotated, and a poor shot, but you can see the springs at the ends of the bulb.


Replacement bulb

Model of bulb: DE3175

Dimensions of one sample of bulb:


Replacement of lens

The lens may be a little tough to get back into place. I suspect it is easier to reinstall if you put it in passenger-side first.