Showing posts with label electronics. Show all posts
Showing posts with label electronics. Show all posts

Wednesday, 14 October 2015

Interstellar Radio Propagation


Proxima Centauri: The Closest Star.
Credit & Copyright:  David Malin, UK Schmidt Telescope, DSS, AAO

It's a staple of Science Fiction, and an unquestioned fact of our modern age, that aliens could be listening to our radio and watching our TV broadcasts, as our signals race across the galaxy at the speed of light.  They could be studying our weaknesses, preparing their attack!  But really, is that possible?
 
I have long been fascinated by the possibility of finding life beyond our solar system, or of aliens finding us.  But rather than wishful thinking, scaremongering or falling for alien abduction tales, I'm far more interested in the realistic prospects of such a discovery.  So when Prof. Brian Cox threw down the gauntlet for listeners to BBC Radio 4's The Infinite Monkey Cage to carry out a fundamental but accessible calculation to illustrate the real likelihood of one form of contact, I was fascinated.
 
Episode 5 of Series 12 was broadcast on 3 August 2015, and I heard it several weeks later via the show's podcast feed.  The previous week's episode focussed on extra-terrestrial life and alien contact, but Episode 5 concentrated on speed, including land speed record attempts as well as the fundamental barrier in physics that is the speed of light.
 
If you want to download and listen to the episode yourself, at 38m 38s, presenter Robin Ince asks about radio signals leaking into space and Professor Danielle George, of University of Manchester, describes broadcast transmissions degrading in power with the inverse square law. Then Robin asks Brian Cox to calculate how far away through space their own radio broadcast would be detectable. Prof. Cox ad lib ponders the problem and then defines the listeners' challenge, which I summarise here:
"Suppose a 200kW transmitter broadcasts for 1 second at 198kHz, find the distance at which there remains one photon per square metre."

Now, we can argue the merits of this threshold, whether one photon per second per square metre is easy or unduly difficult for advanced aliens to detect, (and I shall return to this question).  But for now, let's solve the problem.

First, we need to know how many photons of radio energy are transmitted in one second.  Then we need to find the distance at which all these photons are spread out to one per square metre.
 
So let's do it...  First, let's define some parameters and constants:

Transmitted power,       P = 200kW
Frequency,                    f = 198kHz
Planck's constant,         h = 6.6x10-34Js
 
As Prof. Cox helpfully reminded us, the energy of a photon is given by its frequency multiplied by Planck's constant, so
 
Photon energy,             E = hf
 
So each photon at 198kHz carries 198x103 x 6.6x10-34 = 1.3x10-28J of energy.
 
And since a power of 200kW delivers precisely 200kJ of energy per second, in one second the transmitter delivers 200kJ of energy.
 
So we divide the energy transmitted by the energy per photon to find the number of photons transmitted.
 
Number of photons, N = 200x103 / 1.3x10-28 = 1.25x1033 photons.
 
That's an awful lot of photons!  So now we need to spread these photons out over a sphere to the point where there's one square metre of area on the sphere for each photon.
 
The area of a sphere, A = 4πr2 m2, where r is the radius of the sphere.
 
So, a sphere with an area of 1.25x1033 is given by the equation 1.25x1033 = 4πr2.
 
Rearranging this to find r gives, r = √( 1.25x1033 / 4π ) = 1.0x1016 metres.
 
That's an unfeasibly large distance by human standards, but on the astronomical distance scale, it's almost exactly one light year!
 
So once the Radio 4 long wave signal broadcasting The Infinite Monkey Cage gets to a light year from Earth, it will comprise only one photon per square metre, per second.  And by Brian Cox's criterion, it will have degraded to the point of undetectability.
 
Now bear in mind that the nearest extra-solar star, pictured above, is Proxima Centauri which is 4.2 light years away.  And if that was conducive to intelligent life, which it is not, our signal would not make it a quarter of the way there.  So by this criterion, which is not unreasonable at all, we are to all intents and purposes radio silent to any alien life out there, as far as commercial broadcast transmissions are concerned.
 
=====
 
So now, how reasonable is this as a limit?  Can we find an argument which breaks this?
 
One photon per square metre per second seems like an arbitrary limit, why can't advanced aliens detect those? Well, as advanced as aliens might be, there has to be a signal to receive.  The bandwidth of an audio signal is a few kHz, which means that you'd need at least 5,000 samples per second to reconstruct the transmitted signal.  And that's not a technological limit, which advanced civilizations could surpass, it's a fundamental information limit.  Worse still, one photon carries no amplitude information, so unless the reconstruction is to be distorted beyond use, they would need to detect many photons per sample.  A good signal would use several hundred amplitude levels, but you could get away with perhaps 20 or so.  So now, to reconstruct a useful signal, you'd need 100,000 photons per second.  At just one light year, that would require a receiving antenna with an area of 100,000m2, or a perfect dish with a diameter of 350 metres (1,200 feet).
 
But aliens have limitless capabilities, because... well, aliens! So they could build a 350 metre dish.  Well, perhaps.  But now consider that signal power drops with the square of distance, and dish area increases with the square of diameter.  So double the distance, double the dish diameter.  There are plenty of stars nearby, but to find one which can possibly be inhabited by life which could evolve to sufficient intelligence, we need to look tens of light years away. Say fifty light years.  So now they need a dish fifty times bigger, that's 18km (11 miles) across.  And to search their neighbourhood to a fifty light year radius, they'd need to steer that, and keep it adequately parabolic too.  Consider too that fifty light years is on the extreme edge of optimism for reasonable numbers to plug into the Drake Equation, and the probability of another technologically advanced lifeform existing within 50 light years from us is not zero, but it must be very, very low.
 
So what about higher powered transmitters?  The 200kW BBC Radio 4 long wave transmitter is fairly typical for its waveband.  The Europe 1 transmitter in Germany is about the most powerful long wave transmitter on the planet, pushing out 2000kW at 183kHz.  That'll increase range by about three times, to 3 light years.  In terms of astronomy, that half an order of magnitude  and makes little difference to the feasibility of being heard.  It increases Brian Cox's limit from a light year to three, still well short of Proxima Centauri.
 
How about other wavebands?  Our atmosphere only allows through certain wavebands.  Long wave will get through, short wave will not.  Above that, VHF radio and UHF TV transmissions can get through, but as frequency increases, so does the energy in each photon.  So at higher frequencies, the number of photons for the same power is proportionately less, and so the range to receive sufficient photons to reconstruct the transmitted signal reduces too.  The upshot is, signals at frequencies above long wave will be undetectable closer rather than farther out.
 
You've only considered omni-directional signals, how about directed beams?  Well, yeah.  If you're talking SETI listening to the equivalent of Arecibo, then that's a different question entirely.  What I'm talking about is our routine commercial broadcast transmissions.  Many of those are vaguely directed, particularly the higher frequency transmissions.  And those already suffer from worse propagation issues than long wave.  But it's true that a directed transmission is more powerful than an omni-directional one, (one which transmits equal power in all directions).  And although the power density increases in the transmitted direction, the area of sky covered reduces, reducing the likelihood of any receiver within range detecting the signal.  So directed broadcast transmissions don't help us.
 
=====
 
Finally, let me be clear: I'm not saying that it's impossible for our transmissions to be detected by alien civilisations, if they exist.  But what I am saying is that the above is a reasoned argument supported by calculation that it's very, very improbable that there could be any within receiving range.  It's just not as easy as E.T. sitting on a planet orbiting, say, Tau Ceti with his transistor radio, listening to Hancock's Half Hour or I Love Lucy.  If we're going to make contact with technological civilisations, we'll need a highly funded, planned and directed effort.  Trusting on radio broadcasts leaking into space isn't going to cut it.

Saturday, 3 May 2014

Billysugger Simples: How to measure temperature with a Thermistor

Introduction

Often we have a requirement to measure the temperature of the board, the environment or some process.  Here’s a quick and easy guide to simple temperature measurement using a simple, cheap thermistor.

There are numerous silicon devices on the market which seem to simplify temperature measurement, but it’s difficult to beat a good quality NTC thermistor.  I’ve used them to measure the temperature of things as diverse as engine manifolds to LEDs, and in medical applications have measured patient internal temperatures to accuracies far better than 0.1°C.

Selecting the Thermistor

There are two types of thermistor, defined by whether their resistance increases or decreases as temperature rises.  Temperature is best measured using NTC (negative temperature coefficient) thermistors, whose resistance decreases as temperature rises.

There are two parameters of importance in defining the characteristic: A reference resistance and the Beta value.  The reference resistance is usually specified as the resistance at a temperature of 25°C.  The most common types have a 10k resistance at 25°C.  The Beta value specifies how the resistance varies as temperature deviates from the reference temperature.  The most common types have values in the region of 4000 and have units of Kelvin.

For this example, we will use a Vishay NTCLE100E3103JB0, (Farnell/Newark part 1187031, Digikey part BC2301-ND).  This is a cheap and simple leaded part with a 2.54mm (0.1”) lead spacing, has a 10k resistance at 25°C and a Beta value B=3977K.



There are many, many types of NTC thermistor, some with different case styles including surface mount parts, different reference resistances for nominal temperature ranges other than room temperature, and different tolerances for accuracy.  This one is good for general purpose air temperature measurement.

The Measurement Circuit

The thermistor is connected to the ADC 0V and in series with a reference resistor, forming a potential divider from the ADC reference.  A filter capacitor across the thermistor will reduce any thermal noise, or other pickup.



Now, we can easily calculate the ADC value at 25°C.  And we’ll see that as the temperature increases, the thermistor resistance decreases and the voltage measured at the ADC falls.

Calculating Temperature

We could approximate the thermistor response as a linear function, but beyond a very small range around 25°C, the errors would quickly become unacceptable.  A better approximation is made by using the Beta-curve function:

R = exp[(Beta/Tk) + LN(A)]

Where Tk is the thermistor temperature in Kelvin, not degrees centigrade, and LN(A) is a constant value for the thermistor. (Kelvin is an absolute temperature scale, where Tk = Tc + 273.15).

Solving the above equation for temperature gives

Tk = Beta/(LN(R)-LN(A))

Or

Tc = Beta/(LN(R)-LN(A)) – 273.15

Where

LN(A) = LN(R25)-(Beta/298.15)

But now we need to know the thermistor resistance R.  The ADC value depends of the resistance R as follows:

ADC = ADC_TOP * R / (R + Rref)

Where ADC_TOP is the highest value given by the ADC, (e.g. 4095 for a 12-bit ADC), and Rref is the reference resistor value.

Solving for R gives

R = Rref * ADC / ((ADC_ TOP * Kadc) – ADC)

Implementing in C-code

The following is representative of code which calculates temperature measured using the above method.  The detailed code will need to be adapted depending on your processor, your board and your thermistor.
// Include math library for calculations
#include <math.h> 

// Define ADC parameters
#define ADC_TOP 1023 

// Define thermistor parameters
#define R_NTC 10000
#define BETA 3977
#define LNA (-4.12858298874828)

// Define Reference Resistor
#define R_REF 15000 

float read_temperature(void)
{
  float x = 0; 

  // Calculate thermistor resistance from ADC
  x = (R_REF * adc[0]) / (ADC_TOP – adc[0]; 

  // Calculate Kelvin temperature from resistance
  x = BETA / (log(x) - LNA); 

  // Convert temperature to Celsius
  x = x – 273.15; 

  // Return result
  return(x);
}
 And if you want to play around with different thermistor parameters, I’ve prepared an Excel file with all the calculations included.

Monday, 1 July 2013

Does a computer use more electricity when charging USB devices?

I was introduced to this fascinating question, and its intriguing proposed answer, by David Bradley.

It was suggested that because the efficiency of a power supply increases as it is loaded to its design output power, it is possible to draw 5W of power to charge a USB device, while taking less than 5W of extra power from the wall outlet.  While that sounded reasonable on the face of it, I wondered if the idea represented better use of existing power, or actually getting something for nothing.  So as an electronics engineer with an interest in physics, I did some calculations to find out. Here is the response I posted:


Short Answer:

YES; you'll always pay for the USB power with at least that much more power from the wall. Not only is this required by the laws of thermodynamics, it's also inherent in the way power supplies work.

Longer Answer:

We'll take the whole system of the computer, its internal power supply, its operating circuits and the USB port circuitry to be one big, black box called the Supply. For the purposes of this illustration, the whole computer is one oversized USB charger, with two outputs: the computer operating power, which we will call Pc, and the output USB power, which we will call Pu.
Converting power from one form, (voltage, current, frequency), to another, and conducting power from one part of a circuit to another, are all physical processes which are less than perfect. Even in an ideal world, with superconductors and yet-to-be-invented components, the circuit can be no better than perfect. (The importance of this subtle message will turn out to be the key to this answer). If you want 1W out of a circuit, you must put in at least 1W, and in all practical cases a bit more than 1W. That bit moreis the power lost in the conversion and is called loss. We will call the loss power Pl, and it is directly related to the amount of power delivered by the supply. Loss is almost always evident as heat, and is why electronic circuits which carry large power levels must be ventilated.
There is some mathematical function, (an equation), which describes how the loss varies with output power. This function will involve the square of output voltage or current where power is lost in resistance, a frequency multiplied by output voltage or current where power is lost in switching. But we don't need to dwell on that, we can wrap all that irrelevant detail into one symbol, which we will call f(Po), where Po is the total output power, and is used to relate output power to loss by the equation Pl = f(Pc+Pu).
A power supply is a circuit which requires power to operate, even if it is delivering no output power at all. Electronics engineers call this the quiescent power, and we'll refer to it as Pq. Quiescent power is constant, and is absolutely unaffected by how hard the power supply is working to deliver the output power. In this example, where the computer is performing other functions besides powering the USB charger, we include the operating power of the other computer functions in Pq.
All this power comes from the wall outlet, and we will call the input power, Pw, (Pi looks confusingly likePl, so I switched to Pw for wall-power).
So now we are ready to put the above together and get a description of how these power contributions are related. Well firstly we know that every microwatt of power output, or loss, comes from the wall. So:
Pw = Pq + Pl + Pc + Pu
And we know that Pl = f(Pc+Pu), so:
Pw = Pq + f(Pc+Pu) + Pc + Pu
Now we can test the hypothesis that taking power from the USB output increases then wall power by less than the USB power. We can formalise this hypothesis, see where it leads, and see whether it predicts something absurd, (in which case the hypothesis is false), or predicts something realistic, (in which case the hypotheses remains plausible).
We can write the hypothesis first as:
(Wall power with USB load) - (Wall power without USB load) < (USB power)
and mathematically as:
[ Pq + f(Pc+Pu) + Pc + Pu ] - [ Pq + f(Pc) + Pc ] < Pu
Now we can simplify this by eliminating the same terms on both sides of the minus sign and removing the brackets:
f(Pc+Pu) + Pu - f(Pc) < Pu
then by subtracting Pu from both sides of the inequality (< sign):
f(Pc+Pu) - f(Pc) < 0
Here is our absurdity. What this result means in plain English is:
The extra loss involved in taking more power from the supply is negative
This means negative resistors, negative voltages dropped across semiconductor junctions, or power magically appearing from the cores of inductors. All of this is nonsense, fairy tales, wishful thinking of perpetual-motion machines, and is absolutely impossible.

Conclusion:

It is not physically possibly, theoretically or otherwise, to get power out of a computer USB port, with less than the same amount of extra power coming from the wall outlet.

What did @zakinster miss?

With the greatest respect to @zakinster, he has misunderstood the nature of efficiency. Efficiency is aconsequence of the relationship between input power, loss and output power, and not a physical quantity for which input power, loss and output power are consequences.
To illustrate, let's take the case of a power supply with a maximum output power of 900W, losses given by Pl = APo² + BPo where A = 10^-4 and B = 10^-2, and Pq = 30W. Modelling the efficiency (Po/Pi) of such a power supply in Excel and graphing it on a scale similar to the Anand Tech curve, gives:
enter image description here
This model has a very steep initial curve, like the Anand Tech supply, but is modelled entirely according to the analysis above which makes free power absurd.
Let's take this model and look at the examples @zakinster gives in Case 2 and Case 3. If we change Pq to 50W, and make the supply perfect, with zero loss, then we can get 80% efficiency at 200W load. But even in this perfect situation, the best we can get at 205W is 80.39% efficiency. To reach the 80.5% @zakinster suggests is a practical possibility requires a negative loss function, which is impossible. And achieving 82% efficiency is still more impossible.
For summary, please refer to Short Answer above.