Category: Electronics

Radio Waves (by )

I really love learning things, and recently I've finally been removing a long-standing thorn in my side - the fact that I don't really understand radio frequency electronics and the propagation of radio waves.

I've tried to fix this a few times in the past, but the resources I'd read never seemed to quite explain the whole picture - and I couldn't see how to piece the things they explained together into one coherent understanding of the electromagnetic world; they were clearly only shedding light on little corners of a totality that still remained mysterious to me.

Well, there are still gaps in my understanding... but I've made some progress, and in the hope that I can help others struggling with the same confusions as I was, I'd like to share my way of understanding it all.

One thing that bothered me was that explanations of transmission-line behaviour seemed to flip between talking about instantaneous voltages and currents at some point in the line, sampling the analogue signal travelling down the line - or talking about an RMS average voltage or current, and thereby causing me to struggle to make sense of what they were saying. But I think I now get transmission lines to some extent (although I'm still hazy on waveguides, because I've not gotten around to looking into them yet). And I was never quite sure what the impedance of a whole transmission line really meant, regardless of its length. If I had a transmission line and put a resistor over the end of it, and hooked it up to a battery and an ammeter, I knew that the current flowing would depend on the total resistance of the line and the resistor at the end - which would depend on the length of the line, as its resistance would be in ohms per meter. So what the heck was this impedance thing about? How did impedance mismatches cause reflections?

So, here's how I think about transmission lines now. The "DC model" of hooking a battery up to one end of a line and reading the current that flows into it is, of course, perfectly true - we can set the circuit up and test it; the reason it doesn't contradict with this weird parallel world of impedances is that the DC model is a steady state model of the system. When you first connect that battery to the line, current is going to start flowing into it, crawling along at a sizeable fraction of the speed of light; but until that current has reached the end, flowed through the terminating resistor, and flowed all the way back, it can't possibly have communicated any information about the total resistance of the line and its terminating resistor... So how much current initially flows from the battery, and why? Of course, the line can be thought of as two series of tiny inductors (with resistors in series, if we assume the inductors are perfect) with tiny capacitors connecting the two conductors, due to the inherent inductance of the wire and the inherent capacitance of the gap between them; you can imagine that the current from the battery has to charge the capacitors through the inductors for the voltage/current surge to propagate down the line. But what made "impedance" really click for me was going back to the basics of Ohm's Law and seeing it as a ratio of voltage to current. At any point along that transmission line, a certain instantaneous current will be flowing - and there will be a certain instantaneous voltage between the two conductors at that point; and the voltage divided by the current is the impedance.

So, if a 12 volt voltage source is connected suddenly to a 50 ohm impedance cable, an instantaneous current of 0.24 amps (12̣̣̣̣÷50) will flow. Now, as Kirchoff's current law tells us, the currents flowing into a node must sum to zero; so with the imaginary node at any point on the transmission line connecting two halves of it, the input current must equal the output current (although some current may be lost to resistive heating or leakage, that's not relevant in this case). So what happens when there's a change in impedance at some point in the transmission line? The current must remain the same, but the impedance changes - so the voltage must change, to make Ohm's Law still hold. If my 50 ohm cable is connected to a 75 ohm cable, that 0.24 amps flows into it and changes into a voltage of 18 volts (0.24×75). Which is why high impedance transmission lines are less lossy; a transmitter putting a watt of power down such a line (with proper impedance matching) will push out a higher voltage with less current that one putting a watt of power into a low impedance line - and resistive losses in the cable are worse for higher currents.

How about the reflections when impedance changes? I'm still a little hazy on this, but I think it's something along the lines of this: imagine a point just where the impedance changes in our example of moving from a 50 ohm cable to a 75 ohm one. A current is flowing into that point, but the voltage is higher after that point than before - which is going to create a current travelling back the other way. Where I'm hazy on is how this happens at junctions where the impedance falls (is it to do with the fact that the current flows alternately backwards and forwards, so the junction is traversed by current in both directions anyway, and the phases where the current travels from low to high impedance are what create the reflections? If so, isn't that a kind of rectifying action, that will create harmonics and intermodulation? But what is the "direction" of a signal travelling along a line, anyway? If we froze the signal in time, we'd just see a sine wave of voltage and a sine wave of current along the transmission line - if we restart time, how does it "know" what direction to propagate in? Something to do with the relative phase of the voltage and current waves?) So, yeah, I've a little more to learn there.

But this model of impedance does explain a lot. I wondered why the angles of the radials of a ground-plane monopole antenna affected impedance, but now it makes sense - the end of the transmission line basically spreads out to become a dipole, or a monopole and its ground plane; the electrical field of the travelling signal has to cross a larger region of space, so it makes sense that the voltage required to do so might vary depending on the amount of space crossed. All the mysterious constants, like the fact that a dipole trimmed to 0.48 times the wavelength has an impedance of 70 ohms are really down to the electromagnetic stretchiness of space: the impedance is the voltage required to push one amp along a transmission line (a dipole antenna just being an oddly-shaped transmission line, handing the signal over to the even weirder transmission line that is free space itself), and that is a function of the permittivity and permeability of that space.

This model also explains how impedance matching transformers work. A 1:2 transformer will transform X volts and Y amps on the "left" into 2X volts and Y/2 amps on the "right"; as the impedance is V/I, that means it converts R ohms on the left into R4 ohms on the right, simply through changing the voltages and currents. A 1:N transformer makes a 1:N^2 change in impedance.

Antennas with multiple elements are confusing, but I'm not sure anybody really understands them - as far as I can tell, the design process is almost always to mock it up in a finite-element computer simulation or build a prototype and tweak the design until the desired parameters are obtained experimentally; the mutual interactions between the elements (not to mention ground, support structures, and the transmission line feeding the antenna) are just too complicated to analyse.

I really don't get why there's a near field and a far field (or that funny one inbetween that, I think, is just a mixture of the two). Does the antenna both far and near fields at once, and the near field is stronger but doesn't spread out far, so the far field is negligible when close to the antenna? Or does the antenna create a near fields, which "decays into" the far field as it spreads out? Nothing I've found seems to explain.

I'm not very clear on why a balanced transmission line that's shorted at one end and open at the other end has varying impedance along its length, and can be used for impedance matching, but it doesn't create reflections from the ends.

But, I can understand how to run a cable to a dipole or monopole antenna, manage the impedance transitions, and make it radiate efficiently. That's progress!

The Hackspace Grand Opening (by )

Those of you who follow me on various social media will have seen the photos of Cheltenham Hackspace new premises being spruced up and that is because tomorrow (well today now!) is the grand opening 😀

Sunday 4th of December - if you are local then please pop along - hackspaces or createspaces are made by and for the community and we'd love to meet you 🙂

I'll be taking along steam punk and textile stuff to be working on and have plenty of spare so others can have a go! There is plenty to see and people to talk to and skill share with 🙂

Also I have been making craft videos for Advent as it turns out it is the tenth Christmas of Salaric Crafts How To Blog!!!

Of course I only have 2 vids up and it is now technically day 4 - annoyingly obsolete laptop is obsolete and is being a pain in the backside but I shall continue limping along with it and hopefully get the other two vids to you some time tomorrow!

I also have a craft fayre Monday at the Costa Coffee on Metz Way in Gloucester 🙂 Mainly taking Wiggly Pet Press stuff with a bit of Steam Punk etc...

Towards the Family Mainframe (by )

Last September, I posted progress on the construction of our domestic mainframe. To recap, the intent is to build a dedicated home server that's as awesome as possible - meaning it's reliable, safe, and easy to maintain. That rules out "desktop tower PC in a cupboard" (accumulates dust bunnies, gets too hot, easily stolen, prone to children poking it); "put a 19" rack somewhere in your house" is better, but consumes a lot of floor footprint and doesn't fix the dust bunny problem. So I've made my own custom steel chassis; fed cold air at pressure via a filter, incorporating a dedicated battery backup system, locked and anchored to the wall, and with lots of room inside for expansion and maintenance.

Since that blog post, I've finished the metalwork, painted it with automotive paint using a spray gun (which was a massive job in itself!), fixed it to the wall, and fitted nearly all of the electronics into it.

A significant delay was caused by the motherboard not working. I sent it back to the shop, and they said it was fine; so I sent the CPU back, and they said THAT was fine; so I sent both back together and it turned out that the two of them weren't compatible in some way that was solved by the motherboard manufacturer re-flashing my BIOS. That's now up and running; I was able to use the HDMI and USB ports on the outside of the chassis to connect up and install NetBSD from a USB stick, then connected it to the network and installed Xen so I can run all my services in virtual machines. It's now running fine and everything else can be done via SSH, but the HDMI and USB ports are there so I can do console administration in future without having to open the case (unless I need to press the reset button, which is inside).

The one thing it's lacking is the management microprocessor. I've prototype this thing on a breadboard and written the software, but need to finish off the PCB and cabling: but it will have an AVR controlling three 10mm RGB LEDs on the front panel, and three temperature/humidity sensors in the inlet and outlet air (and one spare for more advanced air management in future). But the idea is that the three LEDs on the front panel will display useful system status, and the environment sensor data will be logged.

Here's what it looks like from the outside; note the air inlet hose at the top left:

Family mainframe

The socket panel on the left hand side worked out pretty well - 240v inlet at the bottom, then on the aluminium panel, three Ethernets, HDMI, and USB (my console cable is still plugged into the HDMI and USB in the photo, which won't usually be the case):

I/O sockets panel and the power inlet

And here's the inside, with lots of space for more disks or other extra hardware; the big black box at the bottom is the battery backup system:

Innards of the family mainframe

Now I have Xen installed, I'm working on a means of building VMs from scripts, so any VM's disk image can be rebuilt on demand. This will make it easy for me to upgrade; any data that needs keeping will be mounted from a separate disk partition, so the boot disk images of the VMs themselves are "disposable" and entirely created by the script (the one slightly tricky thing being the password file in /etc/). This will make upgrades safe and easy - I can tinker with a build script for a new version of a VM, testing it out and destroying the VMs when I'm done, and then when it's good, remount the live data partition onto it and then point the relevant IP address at it. If the upgrade goes bad, I can roll it back by resurrecting the old VM, which I'll only delete when I'm happy with its replacement. This is the kind of thing NixOS does; but that's for Linux rather than NetBSD, so I'm rolling my own that's a little more basic (in that it builds entire VM filesystems from a script, rather than individual packages, with all the complexities of coupling them together nicely).

I'm using NetBSD's excellent logical volume manager to make it easy to manage those partitions across the four disks. There are two volume groups, each containing two physical disks, so I can arrange for important data to be mirrored across different physical disks (not in the RAID sense, which the LVM can do for me, but in the sense of having a live nightly snapshot of things on separate disks, ready to be hot-swapped in if required). I still have SATA ports and physical bays free for more disks, and the LVM will allow me to add them to the volume groups as required, so I can expand the disk space without major downtime.

So for now it's just a matter of making VMs and migrating existing services onto them, then I can take down the noisy, struggling, cranky old servers in the lounge! This project has been a lot of work - but when I ssh into it from inside the house (over the cabling I put in between the house and the workshop) and see all that disk space free in the LVM and all the RAM waiting to be assigned to domU VMs that I can migrate my current services to, it's all worth it!

Learning things (by )

I love learning new things. I'm usually struggling to find new things to learn; the last fun bit of computer science I learnt about was Bloom filters, and they didn't hold my attention for long. The last really fun bit of computer science I learnt about would be content-addressed storage, and I'm still having fun with that, but I can't find any more to learn about it. I'm having to make stuff up myself, which is rewarding in its own way, but much harder work.

Of course, this past week I've been learning TIG welding, which has been awesome. It's been a while since a whole new field of things to learn has opened up to me, and it's nice to work on a new class of physical skills. My routine physical learning is my weekly Krav Maga training, but I crave variety. My lust for learning benefits more from intensive two-week courses than an hour a week for years. I'd love to go and take a proper welding course at a college, but I can't spare the time; I have to practice when I can in the evenings and weekends. I'm getting good at horizontal/flat welds, but I'd like to master vertical and overhead (because if I work on anything large, such as the festival trolley, in my cramped workshop, I often can't rotate everything around to be nice and flat). Also, suspecting that the trouble I was hitting with stick welding is at least partly to do with the limitations of my old cheap AC welder, I want to use my new welder's capability to do nicely regulated DC stick welding and see if I can learn to do good stick welds. And I'd like to get some practice in welding aluminium and stainless steel, as I have applications for both of those.

So that's physical skills sorted, for now. Mentally, I've been learning how antennas work. There's no particular reason for this; it's something that's always puzzled me somewhat, but what's triggered the recent interest was a birthday gift from an old friend, of the ARRL handbook, which goes into some detail; and then meeting an interesting guy at a Cheltenham Hackspace Open Evening who turns out to design broadcast transmission antennas for a living, who answered a load of questions left open by the books. I still want to get a better intuitive grasp of the quantities involved - how many volts and amps appear on an antenna feeder line? What field strengths in volts per meter would you expect to find at what distance from an antenna? Does that relate to a corresponding magnetic field strength in tesla?

I've also been learning Morse code. This is quite interesting. I thought I'd memorise that table of dots and dashes and that'd be that, but it turns out that this technique tends to maroon people at slow morse speeds, as they mentally record a sequence of dots and dashes then mentally look it up in the table to find the letter. To get fast Morse skills, which tend to tend towards one or two characters per second, you need to learn to recognise the sound - "di di dah" - as a letter directly. So I've been using a combination of the Farnsworth and Koch methods to learn Morse; growing my "vocabulary" a letter at a time, and using an enlarged inter-character spacing. The latter is because I was tending to find that I'd hear a character, and write it down, but while I was writing it another would have been and gone, which was confusing. I want to reduce that inter-character gap, but I might wait until I've learnt the entire alphabet via the Koch method, so I can mentally be writing entire words rather than concentrating on a letter at a time - with a reduced alphabet, Morse training tends to involve writing down random gibberish (so far, I know M, K, R, U, S and O; at least the old Nokia SMS beep now makes sense to me... di-di-dit dah-dah di-di-dit!). Again, I have no particular reason to learn Morse - I learnt it as a child, but then forgot it through not using it, which had always faintly irritated me. I've often wondered about using it as a crude interface to tiny embedded computers, although it'd be frustratingly slow for most uses. The usual reason to learn Morse is to do CW amateur radio; that's an idea I've toyed with in the past, but being able to talk to random people over radio holds little appeal (I can talk to random people over the Internet much more cheaply and easily). However, I'd be interested in getting an amateur radio licence as a mental challenge, or as a means to some other project that requires radio communications capabilities, so I might go for a course if one comes up at a good time. I'd like to be able to operate a radio transmitter in an emergency situation, too.

I love to learn things, but I feel sad about not using the skills I pick up. Ok, I don't want to use my Krav skills - they tend to involve hurting people, and are only useful when already under danger of harm coming to me or people I'm protecting, which is nothing to be happy about. But I practice welding because want to make metal things. But by no means do I only learn things when I have a need for them; I learn stuff because it looks interesting and the opportunity arises, then I try and find applications. I've already been excitedly thinking about how aluminium welding will simplify the construction of one of my old back-burner projects - making a hiking staff out of aluminium tubing, that has a stack of lithium-ion batteries inside it at the base, a computer with a keyer in the middle so I can interact with it, and a high-brightness LED lantern on the top so I can have a variety of illumination options (white all around, white forwards only, red all around, etc). I had been working out complex systems of brackets and bolts to hold it all together, but TIG welding it would be much easier, neater, lighter, and stronger. Now, I had considered having a button that could be used to strobe the lights for Morse emergency signalling - and the logical next step was to include a co-axial semiconductor laser in the top that could shine a bright beam for signalling in Morse (and, at a pinch, be used to light fires; you can get 2W laser modules off the shelf these days, and all those lithium ion batteries are going to be able to source a lot of power...). So perhaps I should get a ham licence, and make the staff in sections joined together with insulators, and make it be a two-meter band dipole antenna (which is one meter long) with a CW transceiver inside, so it can also send and receive Morse by radio? That might be fun, and not much extra hardware as it'll already have a decent ARM microprocessor inside.

For now, though, I'd better focus on finishing off my server chassis (which I'm building my welding skills up towards), and make a new welding bench (mine is curved, and wobbles because the floor is uneven and the legs are too weak), and do some metalwork that's needed around the house... I'd like to do some more focussed Lojban study, too; right now I'm just picking up vocabulary by looking for words for things I don't know yet when I need them, but re-reading the reference grammar to remind myself of bits I rarely use would be good!

The School Holidays Begin (by )

It is that time of year again when there are no school runs and I have no completely free child time - Jean however is almost ten so I can work whilst she is around now. In fact at the moment she is helping me!

So we let Jean plan the first day of the holiday - it was without Mary for most of it as it was a pre-school day and they continue during the holidays.

We constructed a plan based on the sorts of things she wanted to do - namely Home School which she loves and I initially came up with when we were snowed in at The Bakery back in her infant school days.

Home School Monday

We started with an American breakfast - Jean's school had done an Independance Day breakfast but the last term we have kept missing dates and time changing and the such like, probably due to my concussion. Jean was quiet upset about this so we investigated the sorts of things Americans eat for breakfast and decided it was a combo of a Canadian and Full English and set about creating our own probably very wrong breakfast!

Jean's American Breakfast

This of course started with us grubbing up potatoes from the garden - I used the bags we had for moving (from Essex which then got used for lots of things but all had busted zips or handles etc...), to grow potatoes in - I am phasing this out as most of the bags have reached the end of their life, and we now have an allotment!

Grubbing up the tatties

We were after the "new" white potatoes rather than the bigger potatoes and the pink/red potatoes so Jean kept checking with me she'd gotten the right type until I pointed out I was just grubbing up all useful potatoes as I needed to make a casserole with the turnips and beetroot from the allotment anyway.

Jean asking if freshly gubbed up potatoes are big enough

We harvested an entire pot of tatties which Jean then selected the ones we wanted for breakfast - we went with sauteed potatoes rather than the chips we'd seen in some of the breakfasts as we just couldn't cope with the idea of chips for breakfast.

Jean and her colindar full of potatoes

She then scrubbed them and chopped them whilst I started on the rest. Once that was done she mixed up the pancake mix, got plates out and general reminded me what I was doing! She also went to the shop to get three missing ingredients.

We used the flat bed sandwich toaster to cook the pancakes, this was the first time either of us had cooked this thicker type of pancake. It was fun and I put the coffee perculator on for me. Jean poured us juice.

Jean putting the maple syrup on pancakes

She took a stack of ten pancakes so it would look like the photos! And she doesn't normally eat maple syrup but she poured it on. She made up a granola and home made yogurt mix too.

Jean tucking into her American Breakfast

It was a HUGE breakfast - fresh sliced tomato, suateed potatoes, baked beans, 2 rashers bacon, 2 suasages, a fried egg, and 2 slices of toast! She basically ate the bacon and cereal and then nibbled on the pancakes all day. The rest did me and Mary for a meal each. 😀

We then learnt Latin, she did some at a language day at school and come home obsessed. She had a piece of paper she had already made notes on (mainly she observed that the Harry Potter series had used latin for the spells). When I say we learnt Latin, what actually happened was that I found a series on Youtube of which I followed the first lesson and then left her to it, she was on lesson 9 at the end with pages of notes.

I found her on google translate trying to check her own translation before she restated the vid to find out if she was right. Her translation was closer than google translates. I discovered I know random bits of latin - I assume from my Classical Civilization A'level. Later on I corrected Alaric's pronounciation as well coughs.

Then it was time for the first ever Stubby Marathon!

The Stubby Marathon Supplies!

I am still struggling with reading and writing, I am using voice tech or just going really really slowly in short bursts. But it is easier for me to do long hand rather than typing and it is a writing challenge month so I looked around and thought "you know what I have a ream or two of lined paper and lots of pencils that haven't even been sharpened!" - BAM!!!

The idea?

It is a writing marathon that will last at least the summer holidays - me and Jean sit for at least an hour writing trying to wear the lead out in the freshly sharpened pencil. Each day we see who has used their lead the most - we re-sharpen the next day so the points are the same so there is a day to day winner and an over all winner (you can write outside of the allotted time and I can't write for very long at all and have to make coffee in the middle etc...). Jean has written 2 stories and twice as many pages as me so far. I am designing a medal for her 🙂

This summer is our marathon summer but more on that later.

I think we then mixed things up a bit by having our outside time and snack before we started on our hour of art. This was basically us working our way through various kits Jean's had for birthdays etc... WHY OH WHY are the instructions in kids craft kits so dire? I mean they really are bad and I think most people think it's the kids just not getting it but it really isn't - it's the instructions :/

trying to work out the instructions to craft kits

It took me most of the hour and a very bad keyring, to remember some basic stuff that I could do before the concussion and have been doing since before I was Jean's age 🙁 This hour was frustrating for both of us but we decided to see it too the end and not jump kits and she at least made a lovely bracelet though with improvisation and not the technique that the kit was designed for!

Jean's shoe lace bracelet

She then played outside on the trampoline whilst I rested my brain, she then set herself up with her maths - these are GCSE level maths but with the questions in accessible easy comprehension which were ones my mum had for teaching those who had failed or not sat GCSE's the first time round. Some of them my mum had made herself and some were from packs provided by the college - the course was cut leaving my mum with all the teaching stuff and no one to teach 🙁

Then Al and Mary came home and we wizzed off to pick up some garden fairy lights which the girls put together whilst Daddy made dinner - they are bees and ladybirds and hopefully there will be a blog post on what we've done with the garden soon!

Jean and Mary putting together the bee and ladybird garden lights

Mary went to bed and then Jean and Alaric played with the electronic kits and only got shouted at once by me for making the radio they'd just built too loud (issue was they couldn't work out how to control the sound level - or so they say!).

Jean doing electronics with Alaric

We forgot to practice the recorder which Jean was going to attempt at 9:30 but I banned!!!

So I think that was an epic start to the holidays - since I started writing this blog post she has been writing schedules and naming each day - this was Home School Monday. But we have also had:

Tidying Tuesday, Wet Wednesday, Friend Thursday and today which was going to be Allotment Friday but then got turned into Cinema Friday has actually been named Freedom Friday as she decided to go home with her friend for a sleep over instead and pointed out that me and Al (Who has a day off of work) do not have either kid with us today.

WordPress Themes

Creative Commons Attribution-NonCommercial-ShareAlike 2.0 UK: England & Wales
Creative Commons Attribution-NonCommercial-ShareAlike 2.0 UK: England & Wales