Above is the HC-SR04 ultrasonic ranging sensor, it was purchased for around $6 from a local eBay seller and delivered within days. Note that there are somewhat similar looking things with a second board on the back and a different interface, the basic HC-SR04 as pictured suits this project.

The basic operation is that a short pulse is sent on the TRIG pin and a short while later, a pulse occurs on the ECHO pin of duration equal to the round trip time. The speed of sound is about 340m/s @ 20°, and so the distance to the water can be calculated. Because the speed of sound is a little dependent on air temperature, the project incorporates a DS18B20 one wire temperature sensor to feed a compensation calculation.

The project incorporates a means of calculating the volume of water from depth.

For simple tanks with vertical sides, the volume per increment of depth is uniform, but for more general shapes, eg a natural earth dam, that is not so.

Agricultural agencies have published lots of guides on estimating dam volume from surveys of the form during or after dam construction. For the purpose of testing of the software, a simple ‘sperical cap’ form is assumed. This example is that of a spherical bowl of radius 100m and maximum depth of 5m, giving a maximum capacity of 7.7Ml.

The dam profile is characterised by a small set of points from which a cubic spline interpolation provides a stepless response.

Above is the dam characteristic, volume in m^3 vs height in m.

To make things easier for the system, the dam characterisation is formatted in a file dam.xy in a way that makes interpretation quicker / easier for the lua system.

Entry{0.000,0.000} Entry{1.000,313.112} Entry{2.100,1375.744} Entry{3.000,2799.159} Entry{4.000,4959.528} Entry{5.000,7723.082}

Above is the table of depth,volume pairs characterising our dam.

Above is a plot of the dam characterisation and a plot of the cubic spline interpolation.

In fact the sensor measures the height above the water, so depth must be calculated from that. The code incorporates a linear interpolation function that deals with the negative slope of the function to convert measured distance to depth, and provides also for an intercept to correct for offset.

The calculated depth is then used to calculate the volume using the cubic spline interpolation.

A test was performed indoors over a fixed distance of 0.75m to assess measurement noise (or jitter) and validate the temperature compensation.

Above is a chart of calculated volume and environment temperature. It looks pretty good, lets expand the scales.

The plots suggest that long term, the temperature compensation is good, though there might be some very small dynamic variations due to sensor lag and air currents. To put it in perspective, the standard deviation of volume over the 100 measurements is 0.074%, that is quite good.

A work in progress…

]]>Starting with some basic magnetism…

The inductance of an inductor is given by \(L=N\frac{\phi}{I}\).

For a closed magnetic circuit of high permeability such as a ferrite cored toroid, the flux is almost entirely contained in the core and the relationship is \(\mathcal{F}=\phi \mathcal{R}\) where \(\mathcal{F}\) is the magnetomotive force, \(\phi\) is the flux, and \(\mathcal{R}\) is the magnetic reluctance. (Note the similarity to Ohm’s law.)

Rearranging that we have \(\phi=\frac{\mathcal{F}}{\mathcal{R}}\).

Permeance \(\mathcal{P}=\frac1{\mathcal{R}}\) we can rewrite the above as \(\phi=\mathcal{F} \mathcal{P}\). Permeances of parallel magnetic paths add, so if we stack two cores sharing the same winding, the total permeance is the sum of that of each core \(\mathcal{P}_t=\mathcal{P}_1+\mathcal{P}_2+…\).

So, returning to the inductance of the toroidal ferrite cored inductor, we can write that \(L=N \frac{\mathcal{F} \mathcal{P}}{I}\) and since \(\mathcal{F}=N I\), \(L=N \frac{N I \mathcal{P}}{I}\) which simplifies to \(L=N^2 \mathcal{P}\).

Now for a toroid \(\mathcal{P}=\mu\frac{A}{2 \pi r}\) and so \(L=N^2\mu\frac{A}{2 \pi r}\). Since A=f(r), we must integrate A over r. (Note that \(\mu=\mu_0 \mu_r=4e-7 \pi\mu_r\).)

Inductance of a toroidal ferrite cored inductor then is given by \(L=\mu N^2 \int \frac{A}{2 \pi r}dr\) (noting that µ is a complex quantity and frequency dependent). More properly, the ‘inductor’ is a resonator and as you approach its self resonant frequency, inductance alone is not an adequate model… nevertheless consideration of the simpler inductance calculation gives valuable insight.

If we stack two cores of the same physical size side by side, then µ is not uniform across the cross section, so we must capture µ in the integral \(L=N^2 \int \frac{\mu A}{2 \pi r}dr\).

In the simple case where we stack n1 cores of µ1 and n2 cores of µ2, then the expression can be simplified to \(L=(n_1 \mu_1 + n_2 \mu_2) N^2 \int \frac{A}{2 \pi r}dr\) where \(\frac{A}{2 \pi r}\) is the geometry of the consituent cores.

Readers will see that stacking one #61 mix core with one #43 mix core of the same sizes is roughly equivalent to a core of the combined cross section area with µ characteristic an average of the two mixes.

This is not equivalent to series connection of two separate inductors with each core type and same number of turns, the effects around self resonances will differ. Since to some extent, common mode chokes rely upon self resonance (albeit low Q) for their operation, this difference in response is quite relevant. Dissipation capacity is likely to be different.

In the light of that understanding, put your thinking cap on when you see magic properties ascribed to this configuration.

Note, this analysis does not address the behavior near or above the self resonant frequency.

]]>Firstly lets set the context, a small loop means less than λ/10 perimeter, and untuned is to mean that the loop is loaded directly, in this case by a receiver which we will assume has an input impedance of 50+j0Ω.

Let’s look at the two cases. The key difference is in the connection at the gap:

- the first has a short circuit coaxial stub of half the perimeter between the inner conductor at the right side of the gap and the outer surface of the outer conductor at the right side of the gap; and
- The second directly connects the inner conductor at the right side of the gap and the outer surface of the outer conductor at the right side of the gap.

Above is a diagram of the loop.

The second case appears in the article Small untuned loop for receiving – it’s not rocket science.

Above is the detail of a simple shielded loop using 50Ω coaxial cable to a 50Ω receiver at the loop terminals.

The additional coaxial stub inserts an impedance is series with the inner conductor at the gap, the impedance is frequency dependent, and its effect in this scenario is mainly in the inductive reactance of the short circuit stub. The influence of that reactance on the recovered power at the load will depend also on the reactance of the loop itself… which is sensitive to the diameter of the conductor.

In other respects, like depth of nulls, symmetry etc, there should be no difference.

Lets compare the two loop connections for two cases, a 1m diameter loop of RG58A/U another of RG213.

Above is a plot of power out for the two scenarios to 10MHz (where perimeter is just over λ/10. The second configuration with the series stub is the lower output.

Above is a plot of power out for the two scenarios to 10MHz (where perimeter is just over λ/10. The second configuration with the series stub is the lower output.

The difference in this case is slightly more than for the previous case as the main loop inductance is lower by virtue of the larger conductor diameter.

]]>This project is based on ESP8266 IoT DHT22 temperature and humidity – evolution 3, but uses the Bosch BME280 temperature, humidity and pressure sensor. The BME280 has been around for a couple of years, though recently, modules using the chip have become more expensive on eBay, around $10. If you find BME280s listed for much less than that, it is probably Chinese cheats doing a bait and switch… delivering BMP280 (pressure only).

Above is a screenshot of recent data displayed on Thingspeak.

Code is at https://github.com/owenduffy/bme280r .

The MQTT version is also under active development, the code as it evolves is available online https://github.com/owenduffy/bme280m/ .

]]>Boxing is underway, and the code has been revised to use a BME280 sensor replacing the DHT sensor. The BME280 is a better sensor (less jitter), and is also capable of barometric pressure if that is of interest.

Experience has been that 18650 cells do not last when exposed to extreme temperatures in solar powered modules like this, so a single cell pouch 2000mAh LiPo will be used (as in the battery trials).

The code has been refactored to make measurements before starting the WiFi as WiFi activity injects noise into the ESP8266 ADC.

The nodemcu core was updated as part of this process.

The system is easy to calibrate in terms of stored water volume for containers with vertical sides where the change in volume with level is uniform… but there are lots of applications where that is not true, natural dams for example.

Above is a plot of volume versus depth of water for a container like a spherical bowl. The interpolation line is a cubic spline interpolation based on the six input data points, it is of course a very good fit to those points but would appear to be a good estimator of the regions between.

The code now contains a facility to perform a cubic spline interpolation of a small number of data points over the expected range of depths.

Above, a set of six points (as in the chart) in the format required of the code in a file named dam.xy.

The code calculates and stores an intermediate data file <name>.cstable if it does not exist for more rapid calculation. If the .xy file is updated, the corresponding .cstable file needs to be deleted.

The init.lua file is augmented to call a transform function from the httpreq function which customises the HTTP request.

function transform() dofile("csinterp.lua") if level<0 then level=0 end volume=csinterpolate("dam",level)/1000 volume=string.format(meas_fmt,volume) print("Volume: ",volume) end function httpreq() -- req=rest_url.."?api_key="..apikey.."&field1="..level.."&field2="..temperature.."&field3="..humidity transform() req=rest_url.."?api_key="..apikey.."&field1="..volume.."&field2="..temperature.."&field3="..humidity body="" print("req:"..req.."\nbody:"..body) return req,body end

Above, the transform function fetches the function definitions for the cubic spline interpolation, and calculates an interpolated volume from the measured level (or depth) value.

Above is a trial run using a calibration generator for the level input, and its conversion to current volume of the storage.

One of the possible paths this project might follow was to use LoraWan… but experience with LoraWan has not been positive, particularly issues with the Laird gateway.

Above is the enclosure, an electrical box with transparent lid. The PV array is mounted inside the lid, the cheap Chinese ones tend to degrade too quickly when exposed to the elements. There is room in the box for a 2000mAh 1S Lipo battery. The switching circuit for the 24V DC-DC converter is mostly on the Veroboard under the (red) DC-DC converter (powers the 4-20mA loop). The module at lower left is a 1S battery management / protection board.

The resistor diagonally across the Wemos module is the 4-20mA sense resistor wired from A0 to ground. Experience is that locating the resistor on-board reduces the errors due to variable contact resistance through the module header pins.

If temperature / humidity monitoring is desired, a BME280 module plugs into the header near the antenna, but it needs to be remote from the box which gets quite hot in the direct sun.

The implementation supports easy development and update, if the battery and solar cell are disconnected, plugging a computer into the USB port on the Wemos board allows update and normal operation / testing.

]]>Thinking there would be a simple trick to this, I consulted Youtube. It turns out that reassembling these has proved a challenge for many people, and their online posts informed as to what approaches don’t work well, describing the many hours spent trying to reassemble. One online expert advised buy another, they are so cheap.

Above is a clutch of the type I will discuss, mine is from a 45-58cc Chinese chainsaw. There are variants, and the technique may be adaptable to them.

For this procedure, you will need a worm drive hose clamp just larger than the outside diameter of the clutch, and three packings to be described later to perform this two minute procedure.

So, there three clutch sectors (1), the spring (3) and the Y hub (4).

Steps:

- Assemble the sectors and hub on a flat surface and using some drills or the like, work out a circular packing piece to insert (2) between each sector so that when clamped by the hose clamp, you can still easily lift the hub out. Making these packings larger diameter than necessary makes fitting the spring harder.
- Insert the packings (in my case, 3 x 6.5mm diameter rod 12mm long) and clamp the sectors tightly with the hose clamp.
- Fit the spring, it is hard but not too hard.
- Drop the hub into the assembly.
- Clamp the hub to sectors in a vice, and drive the packing pieces through.
- Remove the hose clamp.
- Take more care to not drop the thing!

Some designs might need flat packers rather than round ones.

This might assist people trying to reassemble these things.

]]>Above is the transformer with 100pF compensation capacitor across the input, and two resistors to make up a 3300Ω load in combination with the VNA port.

The transformer is an autotransformer of 16t tapped at 2t, so the nominal turns ratio is 1:8, or impedance 1:64.

Looking into the 2t tap with the transformer loaded with 3250+50=3300Ω, Luis measured s11, s21 parameters from 1-45MHz with a nanoVNA. (Nominally this should be a 3200Ω load, but the error is very small, VSWR equivalent of 1.03.)

Above is my analysis of this data for InsertionVSWR and ReturnLoss. It gets a bit shabby above 15MHz.

Above is a plot of InsertionLoss and Loss (or TransmissionLoss). See On Insertion Loss for explanation of the terms.

Compensation of the transformer with 100pF in shunt with the input improves the broadband response.

Above is InsertionVSWR and ReturnLoss. It is not too bad over all of HF (3-30MHz).

Above is a plot of InsertionLoss and Loss (or TransmissionLoss). See On Insertion Loss for explanation of the terms.

Almost all of the Loss is in core loss, and it gives us a good indicator of core heating. The worst case is at 30MHz where the Loss is 0.7dB, so about 15% of input power is converted to heat.

The tests here were using a dummy load on the transformer, and that did allow confirmation of the design.

Real end fed antennas operated harmonically do not present a constant impedance, not even in harmonically related bands. Note that the resonances do not necessarily line up harmonically, there is commonly some enharmonic effect.

Being a more efficient design that some, it might result is a wider VSWR excursion that those others as transformer loss can serve to mask the variations in the radiator itself.

Hats off to Luis, CT2FZI for his work in building and measuring the transformer, and to have the flexibility to consider more than FTxxx-43 cores.

]]>Pictured is a dual UnUn. I made this for experimenting. It’s both a 49 and 64 to 1 UnUn.

The 49 to 1 tap uses the SS eye bolt for the feed through electrical connection and the SS machine screw on the top is the 64 to 1 connection. If I want to use the 49 to 1 ratio, there’s a jumper on the eye bolt that connects to the top machine screw where the antenna wire is attached. The jumper shorts out the last two turns of the UnUn. Disconnect the jumper from the top connection and now you have a 64 to 1 ratio.

The advice to short the section of the winding (the white wire in the pic) is really bad advice.

Tapping an air cored solenoid can be effective and with low loss… can be… but not unconditionally. Tapping a ferrite cored inductor almost always has quite high Insertion Loss, it is akin to shorted turns in an iron cored transformer, … so if you try it, measure it to see if the outcome is acceptable.

Keep in mind that flux leakage degrades broadband performance, so conductors wound loosely around the core (as in the pic) and wide spaced single layer windings (as in the core) tend to have higher flux leakage and poorer broadband performance. Measure what you make to verify that it did what you think.

An S parameter file from a two port sweep over HF would be informative.

I offer this analysis without measurement evidence to prove the case, but sometimes an understanding of basic circuit analysis allows one to avoid wasting time on poor designs.

]]>The original LCD display was white on blue, but was very difficult to read at some viewing angles, so it had to go. Unfortunately I could not find more displays with that hole pattern, it seems to have been discarded for a newer hole pattern as almost everything I looked at had the same newer patter.

So, the box front needed rework, and there would be visible spare holes… so a dress escutcheon was designed in Freecad and cut on a CNC router.

The escutcheon was designed to be cut from some 3mm black acrylic sheet that was on hand, and it would cover the reworked panel.

One of the nuisances of the ‘modern standard’ pattern LCD1602 is that the edge connector is often very close to a mounting screw hole, too close to comfortably accommodate a piggyback I2C adapter.

Above, relieving the corner with a 8mm diamond cylinder in a Dremel tool allows nut driver access to the mounting screw hole. These are a terrible configuration, as you see the piggyback board is made to require 20mm of space at the side of the module for the i2c plug. In this case, they were bent almost 180° to allow zero clearance at the side.

Above is the reworked rfpm2 with a newer black on yellow LCD which works very well over a wider viewing angle, indoors and outdoors. Some button head screws are on a slow boat from China.

]]>Above is the model topology. D1 is a daemon block which essentially, calculates key values for the other blocks based on exposed parameters and the named ferrite material complex permeability data file. The prototype used a Fair-rite 2643625002 (#43) core.

D1 code:

//Misc //Updates Tfmr, CoreLoss, and Cse. $data=file[]; // core mu aol; np; ratio; cse; cores; k; $u1=$data.R; $u2=$data.X; //u1=$u1; //u2=$u2; $ns=np*ratio; Ym=(2*Pi*G.MHz*1e6*(4*Pi*1e-7*$u1*aol*cores*1e9)*np^2*1e-9*(1j+$u2/$u1))^-1; Cse.F=cse; CoreLoss.ohms=1/Ym.R; $l1=1/(2*Pi*G.MHz*1e6*-Ym.I); $l2=$l1*(($ns-np)/np)^2; $lm=k*($l1*$l2)^0.5; Tfmr.L1_=$l1+$lm; Tfmr.L2_=$l2+$lm; Tfmr.L3_=-$lm;

L is the load block.

Cse models the self resonance of the transformer at lowish frequencies, Cse is an equivalent shunt capacitance.

Tfmr is a coupled coils model (above) of a (nearly) lossless autotransformer (core loss will come later). Wire loss is usually insignificant in these type of transformers and is ignored. (It seems that Simsmith will not simulate a pure inductance, in this cases the loss of the ‘lossless transformer is of the order of 5e-6dB, so satisfactory.) It is possible to simplify declaration of this component by using Simsmith’s coupled coils in a RUSE block, I have chosen to take full control and solve the mutual inductance effects explicitly.

(The model assumes that k is independent of frequency which is not strictly correct, but for medium to high µ cores, measurement suggests it is a fairly good assumption.)

Coreloss brings the ferrite core loss to book.

Ccomp models a compensation capacitor used to improve broadband InsertionVSWR.

The G block provides the source and plot definitions.

Plots code:

//Plots //check lossless Tfmr behavior //tfmrloss_dB=10*Log10(Tfmr.P/(Tfmr.P-Tfmr.p)); //Plot("TfmrLoss",tfmrloss_dB,"LossdB",y1); coreloss_dB=10*Log10(CoreLoss.P/(CoreLoss.P-CoreLoss.p)); loss_dB=10*Log10(G.P/L.P); mismatchloss_dB=10*Log10(1/G.P); Plot("CoreLoss",coreloss_dB,"LossdB",y1); Plot("Loss",loss_dB,"LossdB",y1);;

The model was calibrated to measurement of the prototype, and the fit is quite good given tolerances on components.

The model allows convenient interactive sensitivity analysis where parameters can be dialed up and down with the mouse wheel and the response changes observed.

- FT82-43 matching transformer for an EFHW
- Find |Z|,R,|X| from VSWR,|Z|,R,Ro
- A new impedance calculator for RF inductors on ferrite cores
- Calculate ferrite cored inductor (from Al)
- Calculate VSWR and Return Loss from Zload (or Yload) and Zo
- Duffy, O. 2015. A method for estimating the impedance of a ferrite cored toroidal inductor at RF. https://owenduffy.net/files/EstimateZFerriteToroidInductor.pdf.
- ———. 2006. A method for estimating the impedance of a ferrite cored toroidal inductor at RF. VK1OD.net (offline).