Imagine that you own a restaurant. You sell a specific kind of cuisine and your restaurant is well known for having good customer-service and the food receives good reviews too.
One day, while looking for ways to further improve your customer-service, you notice that other restaurants have started placing a plate with a variety of breads on each table, before any food is ordered. This seems like a nice amenity that you could provide to your own customers, and so you decide to give do the same.
The bread plate is a pretty simple thing; it contains a few different types of breads, and a condiment like a pat of butter, or some olive oil.
After a month of providing free bread to your customers you notice some interesting trends. Some of the customers eat the bread without any hesitation, while other customers ignore it. Because you’ve spent some effort on making sure the bread tastes great, your customers have started to view the free bread as one of the many attractive reasons to visit your restaurant. You also notice that, maybe because you’ve satisfied a few hangry customers, and because the bread has been largely well received, your customer reviews have improved, driving more business to your restaurant and increasing the frequency at which people return to your business.
The small cost of providing the free bread is outweighed by the benefits provided to your business. You still make enough margin on your other meals to keep providing free bread, even if some tables only order a salad and a glass of water.
Imagine that you are the owner of a bakery. Maybe a small shop in the central business district of a city or town. Let’s assume that it is reasonably successful and that you have sufficient regular customers to sustain your business.
As the business owner, you understand your fixed and variable costs quite easily. You know that your ovens, facilities and staff are capable of making a maximum number of loaves per day and you know what that cost is. You also know the quantity of raw ingredients (water, flour, salt, yeast), and of gas and electricity that are used for each loaf.
In this model you can quite easily work out how much to sell each loaf for, to achieve a specific revenue, or profit. In this scenario let’s pretend that you have done the math, and you sell each loaf of bread you bake for about $1.00 (USD).
OK so now we are setup for this story.
I am a bakery-monetisation vendor. I approach you and tell you not to worry about selling the loaves of bread anymore. I tell you that restaurants give bread away for free, and the time for selling bread has come and gone.
I tell you that the right strategy for your business is to give the loaves of bread away for free. It’s what the people want. It is what they deserve! I propose to you that you should instead stamp adverts on the underside of the loaves of bread, and make your money from advertising instead. Or maybe you can hand out a survey with each loaf, that customers can fill in for external advertisers. Perhaps, I even quip, you could ask people for their contact details and sell those to people who want to message your customers about their products.
The only problem, I tell you, is that we can’t get $1 per ad, completed survey, or set of contact details. We can realistically achieve numbers that are about a hundred times lower. But don’t worry, I tell you, you can make up for it with VOLUME!
If you simply make a hundred times more loaves of bread, you can achieve your original revenue, albeit at a much lower profit.
[At this stage, all of us should be clear on the problem here, but let’s continue with the story.]
You agree to the new scheme. You think passing out free bread to anyone who comes past your shop will improve your brand, and will increase your customers and reach. I install the bread advertising stamping machine, and you start handing out the free loaves of bread.
The first month doesn’t go so well.
First of all, your staff and your ovens have now worked overtime to deliver the necessary quantity of bread to feed the crowds gathered at your shop each day. This has caused a dramatic increase in your costs and will likely mean future upgrades and maintenance to your oven and other facilities are required. The quality of the bread has also dropped dramatically since you are now just trying to serve as many loaves as you possibly can with your existing equipment and staff, instead of a making a product people want to buy.
Second, when it comes to the revenue, it turns out that advertisers have become accustomed to things like print adverts, that have colours and a much higher resolution. They aren’t willing to pay the relatively high rates for on-bread advertising, and they complain that the reach of the ads is also too small. Advertising sales are not going well.
Ultimately, I do find you an advertiser, but the sell-through rate on the ads is only about 50% and I could negotiate only half the original price. So you are now only making 0.5c on the dollar, and only about half of the time when I can find advertisers.
As the bakery owner, you have given away an enormous amount of bread, incurred dramatically higher costs, lost your ability to deliver a quality product and your return on investment has been negative. If you continue in this fashion, you will most likely go bankrupt faster than if you simply closed your storefront, and kept paying your staff.
In the next post, I will talk about another business that gives bread away for free, yet remains profitable, and compare it with our bakery.
Modern radio receivers and electronic communications circuits consist of filters, amplifiers and mixers connected in series. Each component contributes to the overall noise performance of the system as noise is added by each stage. This post will discuss how to calculate the contributions of each component to the overall noise performance of a cascaded system. I will also show how system design, and the order that components are placed in can dramatically alter the performance characteristics of a receiver!
A Generalized Cascaded System
First let’s start by considering a generalized cascaded system, shown below with a total of k stages, each denoted by i. Each stage has its own noise performance denoted by its own Noise Factor (Fni) as well as its own Gain (Gi).
The Noise Factor of the system is:
For systems design tasks, using components with known characteristics, it would help if we were able to calculate the total noise performance of the system in terms of the noise performance of each of the components. This leads us to the derivation of the Friis Noise Formulas.
Understanding Pna in terms of Noise Factor
Recall from the previous post that Noise Factor of a system is defined by:
But we also know that:
So we can replace Pno with:
Simplifying the expression yields:
Making Pna the subject of the equation:
Does this equation look familiar? It should, go back and check the equation expressing the effective noise temperature of a system in the previous post!
Noise Factor of a Cascaded System
Consider the cascaded system below, constructed using a series of components, each described by the standard model.
If we look at output Noise Power Pno of the entire system we can see that:
You can multiply this expression out to get:
Looking at the Noise Factor of the entire system:
Let’s break this out:
If we use the expression for Pna in terms of Noise Factor of a stage we can see that:
Noise Temperature of a Cascaded System
We can also express a system’s noise performance in terms of equivalent noise temperature. It makes sense to be able to calculate the equivalent noise temperature of a cascaded system.
Let’s start by looking at the model of a cascaded system with noise performance expressed in terms of equivalent noise temperature:
We know that for the first stage of the system the Noise Temperature of the output Tout is given by:
Recall that this definition allows us to calculate the Noise Density at the output of the first stage as below:
where k is Boltzmann’s constant.
Looking at the expression for Tout of the entire system we can also see that:
The total Equivalent noise temperature for the cascaded system is therefore:
The OS is currently in a default state, I have done nothing except edit some locale/language information and the keyboard layout. I have basically got a bare bones DietPi installation at this point.
I have installed FruityWifi version 2.4. If you are using Kali Linux you can simply use the apt-get service as FruityWifi is included in those repositories. I am running a variant of Debian and so need to actually run the installation script itself. Here is a repeat of the commands on the Wiki that I followed:
After reading through some of the issues, it is apparent that the best way to install any of the modules is via the web interface one by one and not all in one go! You can also install FruityWifi on Android with NetHunter, which is a tempting idea for my Nexus 6… If you want a quick installation tutorial on that platform, check this or this out.
I will keep an updated list of issues I encounter with each new version of FruityWifi on DietPi here on this page for my own reference and perhaps yours. But if you want more details on working with FruityWiFi, I think the best idea is to head over to the Wiki.
Reboot / Start-up
I have found that the FruityWiFi web UI is not automatically available when the ODROID boots up. I had a look at the running processes in my ODROID using top and htop and found that the the web server for FruityWiFi (Nginx) was not running. I have also found that starting NGINX manually is also failing.
First, let’s try starting Nginx:
root@DietPi:~# /etc/init.d/nginx start[....] Starting nginx (via systemctl): nginx.serviceJob for nginx.service failed. See 'systemctl status nginx.service' and 'journalctl -xn' for details.failed!root@DietPi:~#
Err. ok that didn’t work… let’s follow the hint shall we?
root@DietPi:~# systemctl status nginx.service● nginx.service - A high performance web server and a reverse proxy serverLoaded: loaded (/lib/systemd/system/nginx.service; enabled)Active: failed (Result: exit-code) since Mon 2017-08-07 14:19:40 SAST; 1min 51s agoProcess: 2951 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
Aug 07 14:19:40 DietPi nginx: nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (2: No such file or directory)Aug 07 14:19:40 DietPi nginx: 2017/08/07 14:19:40 [emerg] 2951#0: open() "/var/log/nginx/access.log" failed (2: No such file or directory)Aug 07 14:19:40 DietPi nginx: nginx: configuration file /etc/nginx/nginx.conf test failedAug 07 14:19:40 DietPi systemd: nginx.service: control process exited, code=exited status=1Aug 07 14:19:40 DietPi systemd: Failed to start A high performance web server and a reverse proxy server.Aug 07 14:19:40 DietPi systemd: Unit nginx.service entered failed state.root@DietPi:~#
Let’s go and look at exactly what is wrong here, first let’s look for the directory /var/log/nginx which was mentioned explicitly in the errors.
root@DietPi:~# cd /var/log/nginx-bash: cd: /var/log/nginx: No such file or directoryroot@DietPi:~# mkdir /var/log/nginxroot@DietPi:~#
Right, so we have created the directory /var/log/nginx let’s see if that helps?
root@DietPi:~# /etc/init.d/nginx start[ ok ] Starting nginx (via systemctl): nginx.service.root@DietPi:~# systemctl status nginx.service● nginx.service - A high performance web server and a reverse proxy serverLoaded: loaded (/lib/systemd/system/nginx.service; enabled)Active: active (running) since Mon 2017-08-07 14:30:14 SAST; 7s agoProcess: 3212 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)Process: 3209 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS) Main PID: 3213 (nginx)CGroup: /system.slice/nginx.service├─3213 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;├─3214 nginx: worker process├─3215 nginx: worker process├─3216 nginx: worker process└─3217 nginx: worker processAug 07 14:30:14 DietPi systemd: Started A high performance web server and a reverse proxy server.root@DietPi:~#
If you had this problem and followed the steps above, you should be able to browse to the FruityWiFi WEB UI now.
Permanently Add /var/log/nginx
The /var/log directory is a temporary set of files that is recreated on each boot. So even though we have added the /var/log/nginx directory above, if you reboot your SBC, it may disappear and you may have to re-do the steps above to get FruityWiFi working again.
I have tested this and in some reboots, the /var/log/nginx directory disappeared after a reboot. In other tests, it remained. I am not entirely sure WHY there was variability in those results, but if the directory does keep disappearing on you, here is a way to fix that.
This forum post on linksprite helped me a lot! I am going to use nano to edit the rc.local script to add the /var/log/nginx for me at each boot by adding the line:
mkdir -p /var/log/nginx
immediately before ‘exit 0’.
This will get the directory in place, but it is not going to get the service up and running on its own. You will have to run the command to start the nginx service once you have booted up.
Right now, I have removed this command from my /etc/rc.local file and everything seems to be working fine without starting the service manually. I am somewhat bemused by the whole situation, but if I ever run into this problem again I will track back here and update with more details.
Signal filtering plays a fundamental role in electronics and communications. Filters modify specific frequency components of time-domain signals and are used as a tool for signal quality improvement, information recovery and frequency separation . Filters are a fundamental frequency domain tool and as a component in electronic circuits and digital signal processing allow us to:
Isolate circuits from DC (0Hz) currents.
Suppress high and low frequency noise in received signals.
Separate the frequency components of received signals for further processing and analysis.
There are many different analog and digital filter designs, with varying implementations and transfer functions. However, the general idea of a filter is that its transfer function should attenuate the magnitude of specific frequency components of a signal, or introduce a known phase-delay to specific frequency components whilst leaving other frequency components of the signal unchanged. Typically, in the communications industry, we are mostly interested in the amplitude-frequency effects of a filter.
The ideal filter
An ideal filter multiplies the passband frequency components by 1 (i.e does not change them in any way), and attenuates the noise (i.e signal we don’t care about) in the stopband frequencies by an infinite amount. The transition from passband to stopband for an ideal filter is instantaneous. The frequency response of such a filter is shown below, on the left. The corresponding time domain impulse response of the filter is shown on the right.Of course, this description is of an idealised sinc filter, shown below, and is not practically realizable.
There are also some things that even idealized filters cannot do. A filter cannot remove common mode or differential mode disturbances and interference in the passband. That means if someone else is using the same frequencies as you are, there isn’t much that can be done to remove their interference!
Filter Response Types:
A low-pass filter allows all of the frequencies below the cut-off frequency to pass through it and it attenuates the higher frequency components of a signal. As the frequency increases so the amount of attenuation increases. Low pass filters are useful in suppressing high frequency noise, and limiting the bandwidth of analog signals.
High Pass Filters
A high-pass filter allows all of the frequencies above a certain value to pass through it and it attenuates the lower frequency components of a signal. As the frequency decreases towards zero so the amount of attenuation increases. High pass filters are useful for isolating equipment from DC currents and also from low frequency noise sources like AC power signals at 50Hz, or in the case of old telephone systems, the 20Hz ringing signal.
Constructed from the combination of a high-pass filter with a low cutoff frequency, and low-pass filter with a higher cut-off frequency. Band-pass filters find widespread use in the RF front end of telecommunications equipment, predominantly in limiting power of transmissions to a specific frequency band and also in eliminating out-of-band noise from received signals. Another increasingly common use of analog band-pass filters in telecommunications is in co-location or co-existence filters inside radio equipment or handsets. Modern handsets have a slew of different radios simultaneously operating at different frequency bands and access technologies. Ensuring that the radios can peacefully co-exist in such close quarters without degrading each others’ performance is a major design challenge!
Band-Stop / Rejection Filter
Band Stop or Rejection Filters work in exactly the opposite way to band-pass filters. They are constructed by placing a high-pass filter with a high cut off, in series with a low pass filter with a low cut-off frequency. Band Rejection filters are useful for eliminating interference on specific frequencies.
Digital & Analog Filters
Filters can be implemented for analog or digital signals. Digital Filters by comparison are implemented by digital signal processing and operate on digital information.
Analog filters can be implemented in various forms depending on the application:
Passive electronic filters consisting of Resistors, Inductors and Capacitors.
Active electronic filters that use amplifiers which are very common.
Surface Acoustic Wave filters are often used for super heterodyne receivers at the intermediate frequency in digital receivers in radios and in television sets.
Cavity filters are mechanical boxes with a specific geometry that enables high-fidelity filtering of high power microwave signals.
Analog Filters are usually constructed out of a physical circuit and operate on analog, continuous time-domain signals. Analog Filters play an extremely important role in communications, especially as an important step in signal conditioning prior to entering an analog to digital converter. Analog filters also used to have a role to play in pulse shaping for older modulation types such as spread spectrum technologies (that require a high symbol rate).
Digital filters have sever key advantages over analog filters in that they are not affected by tolerances in component values, manufacturing processes, temperature differences and aging. The performance of digital filters is also vastly superior to that of analog filters achieving much higher stop band rejection, smaller transition bands, low passband distortion and linear or even zero phase delay!
Digital filters are useful for processing almost any form of digital information! In communications equipment, digital filtering is used for conditioning digital signals prior to modulation or after being converted from analog to digital values. Digital filters find applications in pulse shaping and can also be used to remove higher frequency noise components from over sampled digital signals. This whitepaper and tutorial details an example of using oversampling and a digital filter for pulse shaping of a transmitted digital signal to enhance spectral efficiency!
Properties of Filters
Pass Band & Stop Band
The pass band is a term that collectively refers to the range of frequencies that a filter allows through it. The stop band is the term used to collectively describe the range of frequencies that are sufficiently attenuated by the filter for us to ignore. The amount of attenuation required in the stop band is called the stop band attenuation. The frequencies at which the passband stops are called the cut-off or edge frequencies. The cut-off frequencies in analog filters are widely accepted to be the frequencies at which the amplitude of the frequency response is attenuated by -3dB. Digital filters are less standardized, the attenuation level that determines the cut-off frequency is usually specified. Common values are 99%, 90%, 70,7% and 50% [reference]
The transition band refers to the range of frequencies between the pass band and stop band that are not sufficiently attenuated by the filter for us to ignore. All practical filters have a finite rate at which they can transition from the passband to the stop band. Some filter implementations are capable of achieving very high frequency roll-off, minimizing the size of the transition band. Some digital filters are capable of roll-off rates as high as -36dB/Hz!
Passband & Stop Band Ripple
Some filter implementations like the Chebyshev and Elliptical filters can introduce a “ripple” in the passband and/or the stop band of the signal, causing the signal to be distorted. The maximum tolerable Passband ripple of a filter is generally specified in the design requirements.
Phase-Delay & Phase-Response
The phase delay measures the amount by which a single frequency component is delayed when traveling through the filter. This short time delay has the effect of delaying the phase of the sinusoidal wave relative to where we were expecting it.
Quick Note: It is important to realize that phase-delay is actually dependent on units of time and is converted to an angular measurement by multiplying by the frequency. Thus, for a constant time delay through a system, as the frequency increases, so the phase-delay angle will increase too! You can prove this in your head by thinking of a wave of 1 Hz going through a system with a time delay of 0.25 seconds. We know that the phase will be shifted back by -90 degrees or π/2 radians. Imagine we had a wave of 2Hz going through the same system. The same time delay results in a phase-delay of -180 degrees or π radians!
The phase-delay as a function of frequency is shown as the phase-response of a filter. Here is an image of a phase response:
Filters can be designed to have zero phase, linear phase or non-linear phase responses. A zero phase response system is one that does not change the phase of the signal at all, which implies that it introduces no delay to the time domain signal at any frequency. A linear phase response system is one that introduces a constant delay to all frequencies, like in the thought experiment above.
Obviously, if designing a control system or time-delay sensitive system, we would prefer zero phase response (zero delay) in our signal, which would imply instantaneous measurement or control, but often we have to settle for a linear phase-response if we are dealing with real-time systems.
Systems with a non-linear phase response have a phase-response that changes with frequency! A non-linear phase response can cause distortion of the time domain signal as different frequency components will now arrive at their peak amplitude at different times relative to each other. This kind of distortion either speeds up or slows down the rate of change of a time domain signal and is referred to as ringing. Non-linear phase response is a concern in systems design where accurate replication of the time domain signal is a key requirement such as digital receivers (another reference here).
Typically, digital filters can be designed with a zero or perfectly linearphase-response and this is not an issue, but unfortunately, physically realizable filters have a much poorer performance in this regard!
Group delay is defined as the derivative of the phase-response with respect to frequency and has units of time. Group delay is also a measure of the non-linearity of the phase-response of a system. A linear phase response system will have a constant group-delay. A highly non-linear phase response will have a rapidly changing group-delay!
To think of group delay, remember the following:
Phase delays are caused by time delays in the system.
Phase-delay is calculated from time-delay by multiplying by the frequency of interest. You could say that phase-delay is measured in frequency seconds (Hz.s) or (rad.s.s-1 = rad)
If everything has the same time delay, then the phase-delay will be linear with respect to frequency, and the gradient of the line will be equal to the time-delay of the system. Negative gradient will indicate a time-delay).
If we take the derivative of phase-delay with respect to frequency, we will simply get the time delay of the system!
So, group-delay is actually just a measure of the time delay of the entire system with respect to frequency. Imagine a square pulse arrives at the input of the system. Group delay describes how each frequency component of that square pulse will be delayed through the system!
Group delay is a useful way to evaluate the normalized response of a filter design. That is the logical way to think about it. Here is a picture of a Chebyshev filter showing frequency-response and group-delay.
Quality-factor is actually not a term used specifically for filter design but for many applications in engineering and physics, including antennas and other forms of resonant systems. The Q factor of a resonator or oscillator is the ratio of its central frequency to the bandwidth over which it works. Example, we build a filter with a central frequency of 1850 Hz and a total bandwidth of 3100Hz. The Q factor of such a filter would be approximately 0.6.
All filters regardless of their type, digital or analog, will introduce some form of loss to the passband signal. Insertion loss in telecommunications refers to the loss incurred by inserting a device into the path of the signal. A good reference discussing the sources of insertion loss can be found here.
You should also be aware that the transducer you are using to create the analog signal itself also has a frequency range of operation and will also filter out frequencies outside of its own range. The picture below is the frequency response chart of a Shure SM57 microphone. As you can see from the chart it is much less sensitive to lower frequencies and much more sensitive to higher frequencies in the audible range. This means that the microphone will distort the original signal by attenuating lower frequencies below 200 Hz and amplifying frequencies above 2kHz. You can read more on microphones and their response charts here.
Loss of Information
Whenever we use a transducer to create an analog signal, or a filter to limite the bandwidth of a signal, we must always accept that we are distorting the original input and losing information. The question however is how much information is an acceptable amount to lose and do we care about the information we are losing? For instance, when capturing the sound of the human voice most of the energy is concentrated within the bands of 200 to 2000 Hz. Band limiting the signal to 3400 Hz will result in a band limited baseband signal that still allows people to communicate clearly over a digital phone. Similarly, audio destined for high quality musical playback can be band limited to 20Hz – 20kHz because we cannot hear any of the higher or lower frequencies and it makes no discernible difference to us! The same can be said of images and the color gamut that can be captured by a camera, supported by a video codec or displayed by a monitor!
Here are some great resources I found on the topic of both Analog and Digital Filters.