Setup Vino Server over SSH on Xubuntu 16.04/18.04

Server Setup

In the terminal, install the following packages:

$ sudo apt install vino dconf-editor ssh

Next configure the vino installation by running:

$ dconf-editor

and navigating to the path: /org/gnome/desktop/remove-access

dconf-editor screenshot

set the following properties:

Property Value Description
prompt-enabled false This allows one to connect remotely without manually having to accept the connection on the server
require-encryption false The connection will be tunneled through ssh
network-interface lo Since ssh tunneling is used, one does not want to expose the port to the network

There are a number ways of launching the vino server on startup but the simplest is probably to use the "Session and Startup" application which can be found in the task menu as follows:

Session and Startup in Task Menu

Once one has launched "Session and Startup" from menu, select the "Application Autostart" tab, then click "Add".
Enter the following:

Vino Server Autostart

Save the changes and finally reboot the server. The vino server should now be started automatically every time the server boots up.

Setup of the Xubuntu client

Install the following packages:

$ sudo apt install remmina openssh-client

Use ssh to port forward the vino server port to localhost:

$ ssh -L 5900:localhost:5900 [username]@[server]

Open remmina, and create new profile for connecting to the server as follows:

Create a new Remmina profile

Provided the ssh port forwarding connection is up, one should able to double click on the profile it will connect to the remote machine.

Posted in General, Software | Comments Off on Setup Vino Server over SSH on Xubuntu 16.04/18.04

Lua 5.2 and Luna Five Example

This post covers a basic C++ example using Luna Five with Lua 5.2. The example implements an account class in C++ and binds the class to the Lua environment using Luna Five and was inspired by the example in [3].

If one starts with C++ Account class header, seen below, one can see that the methods take the lua_State as a parameter. This allows these functions to push and pop parameters on and off the Lua stack. When a function pushes elements onto the stack, it returns the number of parameters it pushed onto the Lua stack.
The class also contains the following public static variables:

  • className - The name used to address the class type in a Lua script
  • properties - An array of all the properties and each of their accessor and mutator methods.
  • methods - An array of methods provided by the class.
//account.h file
class Account {
  public:
    Account(lua_State *L);
    ~Account(void);

    int Deposit(lua_State *L);
    int Withdraw(lua_State *L);
    int Balance(lua_State *L);

    //Class Constants
    static const char className[];
    static const Luna<Account>::PropertyType properties[];
    static const Luna<Account>::FunctionType methods[];

  private:
    int m_balance; //Account balance
};

Below is the implementation of the account header:

//account.cpp file
#include "account.h"

#define method(class, name) {#name, &class::name}

//Name to use to address the class in Lua
const char Account::className[] = "Account";

//List of class properties that one can set/get from Lua
const Luna::PropertyType Account::properties[] = {
  {0,0}
};

//List of class methods to make available in Lua
const Luna::FunctionType Account::methods[] = {
  method(Account, Deposit),
  method(Account, Withdraw),
  method(Account, Balance),
  {0,0}
};

/**
Constructor
@param L The Lua state
*/
Account::Account(lua_State *L) {
  m_balance = lua_tointeger(L, 1);
}

/**
Destructor
*/
Account::~Account() {
  printf("C++: Deleted Account (%p)\n", this);
}

/**
Deposits an amount into the account
@param L The Lua state
@return The number of returned variables pushed on to the Lua stack.
*/
int Account::Deposit(lua_State *L) {
  m_balance += lua_tointeger(L, 1);
  return 0;
}

/**
Withdraws an amount from the account
@param L The Lua state
@return The number of returned variables pushed on to the Lua stack.
*/
int Account::Withdraw(lua_State *L) {
  m_balance -= lua_tointeger(L, 1);
  return 0;
}

/**
Accessor Method
Get the balance for the account
@param L The Lua state
@return The number of returned variables pushed on to the Lua stack.
*/
int Account::Balance(lua_State *L) {
  lua_pushnumber(L, m_balance);
  return 1;
}

lua_tointeger is used to get C++ integer values from the Lua stack and lua_pushnumber is used to push an integer onto the Lua stack such that it can be accessed from within the Lua script.
Below is the main function used to create the Lua state, register the account class with the Lua start and run a Lua script:

//main.cpp
#include "account.h"

int main(int argc, char *argv[])
{
  //Check if a Lua Script was specified
  if(argc != 2){
    printf("Error! No Lua script or too many scripts were specified.\n");
    printf("Usage: %s <file>.lua\n", argv[0]);
    return -1;
  }

  //Create a new Lua state
  lua_State *L = luaL_newstate(); 

  //Load Lua base library
  luaopen_base(L);

  //Register "Account" Class with Lua
  Luna<Account>::Register(L);

  //Execute the Lua script
  printf("C++: Executing Lua Script: %s\n",argv[1]);
  if(luaL_dofile(L, argv[1]) != 0){
    printf("Lua Error: %s\n", lua_tostring(L,-1));
  }

  //Close Lua state
  lua_close(L);
  return 0;
}

Here one can see how simple Luna makes it to register C++ classes with Lua. Below is a script to demonstrate the interaction between Lua and C++:

//account.lua Script
-- Override Lua Print()
local print = function (x)
  print("Lua: "..x)
end

local a1 = Account(100)
print("Created Account 1 with $"..a1:Balance().." balance")

cash = 50
a1.Deposit(cash)
print("Account 1: Depositing $"..cash)

print("Account 1: New Balance is $"..a1:Balance())

cash = 25
a1.Withdraw(cash)
print("Account 1: Withdrawing $"..cash)

print("Account 1: New Balance is $"..a1:Balance())

-- Open a 2nd Account
local a2 = Account(1000)
print("Created Account 2 with $"..a2:Balance().." balance")

cash = 500
a2.Deposit(cash)
print("Account 2: Depositing $"..cash)

print("Account 2: New Balance is $"..a2:Balance())

cash = 250
a2.Withdraw(cash)
print("Account 2: Withdrawing $"..cash)

print("Account 2: New Balance is $"..a2:Balance())

-- Check the 1st Account Again
print("Account 1: New Balance is $"..a1:Balance())
cash = 25
a1.Withdraw(cash)
print("Account 1: Withdrawing $"..cash)

print("Account 1: New Balance is $"..a1:Balance())

print("End of Script")

One is able to create multiple instances of the class and manipulate the balance variable within each of these instances easily. All the files can be downloaded used the download link provided below.

Program Output
$ ./account account.lua
C++: Executing Lua Script: account.lua
Lua: Created Account 1 with $100 balance
Lua: Account 1: Depositing $50
Lua: Account 1: New Balance is $150
Lua: Account 1: Withdrawing $25
Lua: Account 1: New Balance is $125
Lua: Created Account 2 with $1000 balance
Lua: Account 2: Depositing $500
Lua: Account 2: New Balance is $1500
Lua: Account 2: Withdrawing $250
Lua: Account 2: New Balance is $1250
Lua: Account 1: New Balance is $125
Lua: Account 1: Withdrawing $25
Lua: Account 1: New Balance is $100
Lua: End of Script
C++: Deleted Account (0x97059f0)
C++: Deleted Account (0x97053a0)

Download
Download Lua 5.2 and Luna Five Account Example

References
[1] Lua 5.2 Reference Manual, http://www.lua.org/manual/5.2/
[2] Luna Five, http://lua-users.org/wiki/LunaFive, Viewed 15 May 2013
[3] Cpp Binding with Lunar, http://lua-users.org/wiki/CppBindingWithLunar

Posted in C++, General, Lua | Tagged , , | Comments Off on Lua 5.2 and Luna Five Example

Dielectric Materials for Microwave/High Frequency Applications

This post provides a list of different dielectric materials that can be used in microwave applications. It is hoped more dielectric materials will be added to the list over time. The links along with each material link to more information for each material.

Substrates & Laminates

Material Relative Permitivity Loss Tangent Links
RT/Duroid® 5870 2.33 @ 1 MHz
2.33±0.02 @ 10 GHz
0.0005 @ 1 MHz
0.0012 @ 10 GHz
[1]
RT/Duroid® 5880 2.2 @ 1 MHz
2.2±0.02 @ 10 GHz
0.0004 @ 1 MHz
0.0009 @ 10 GHz
[1]
RT/Duroid® 5880LZ 1.96±0.04
(8 GHz - 40 GHz)
<0.0027 @ 10 GHz [1]
Rogers® RO4003C 3.55
(8 GHz - 40 GHz)
0.0021 @ 2.5 GHz
0.0027 @ 10 GHz
[1]
Rogers® RO4350B 3.66
(8 GHz - 40 GHz)
0.0031 @ 2.5 GHz
0.0037 @ 10 GHz
[1]
Polyflon CuFlon® 2.05±0.05 @ 18 GHz 0.00045 @ 18 GHz [2]
Polyflon NorCLAD™ 2.55±0.05 @ 3 GHz 0.0011 @ 3 GHz [2]
Polyflon POLYGUIDE™ 2.32±0.005 @ 10 GHz 0.0005 @ 10 GHz [2]
Polyflon Copper
Clad ULTEM™
3.05 @ 3 GHz 0.003 @ 10 GHz [2]
Rexolite® 1422 2.53
(1 MHz - 500 GHz)
0.00012 @ 1 MHz
0.00025 @ 10 MHz
0.00066 @ 10 GHz
[3][4]
Rexolite® 2200 2.62
(1 MHz to 500 GHz)
0.0004 @ 1 MHz
0.0005 @ 10 MHz
0.0014 @ 10 GHz
[3][4]
Rohacell® 31 HF 1.05 @ 2.5 GHz
1.04 @ 5 GHz
1.04 @ 10 GHz
1.04 @ 26.5 GHz
<0.0002 @ 2.5 GHz
0.0016 @ 5 GHz
0.0017 @ 10 GHz
0.0106 @ 26.5 GHz
[5]
Rohacell® 51 HF 1.06 @ 2.5 GHz
1.06 @ 5 GHz
1.07 @ 10 GHz
1.05 @ 26.5 GHz
<0.0002 @ 2.5 GHz
0.0008 @ 5 GHz
0.0041 @ 10 GHz
0.0135 @ 26.5 GHz
[5]
Rohacell® 71 HF 1.07 @ 2.5 GHz
1.106 @ 5 GHz
1.09 @ 10 GHz
1.09 @ 26.5 GHz
<0.0002 @ 2.5 GHz
0.0016 @ 5 GHz
0.0038 @ 10 GHz
0.0155 @ 26.5 GHz
[5]
P10 Foam™ 48 kg/m3 1.04-1.10 @ 10 GHz <0.00062 @ 10 GHz [6]
P10 Foam™ 128 kg/m3 ? @ 10 GHz <0.00196 @ 10 GHz [6]
P10 Foam™ 225 kg/m3 1.25-1.36 @ 10 GHz <0.00282 @ 10 GHz [6]
P10 Foam™ 380 kg/m3 1.40-1.73 @ 10 GHz <0.0039 @ 10 GHz [6]
Teflon® AF 1600 ~1.93
(1 MHz to 10 GHz)
0.0001 - 0.0002
(1 MHz to 10 GHz)
[7][8][9]
Teflon® AF 2400 ~1.9
(1 MHz to 10 GHz)
0.0001 - 0.0003
(1 MHz to 10 GHz)
[7][8][9]
Eccostock® LoK 2 1.7
(60 Hz - 10 GHz)
0.004
(60 Hz - 10 GHz)
[10]
Eccostock® PP-2 2 1.03
(60 Hz - 10 GHz)
0.0001
(60 Hz - 10 GHz)
[10]
Eccostock® PP-4 2 1.06
(60 Hz - 10 GHz)
0.0001
(60 Hz - 10 GHz)
[10]
Eccostock® 0005 2 2.53
(60 Hz - 12 GHz)
0.0005
(60 Hz - 12 GHz)
[10]
Eccostock® HIK 500F 2 3 - 16 ± 3% 1
16 - 30 ± 10% 1
2.54
< 0.002
(1 GHz - 10 GHz)
0.0005
(1 GHz - 40 GHz)
[10]
Eccostock® CK 2 1.7 - 15 ± 3% 1
(2 GHz - 18 GHz)
<0.002
(2 GHz - 18 GHz)
[10]
Taconic RF-35TC 3.5±0.05 @ 10 GHz 0.0011 @ 10 GHz [11]
Taconic RF-35A2 3.5±0.05 @ 1.9 GHz
3.5±0.05 @ 10 GHz
0.0011 @ 1.9 GHz
0.0015 @ 10 GHz
[11]
Taconic RF-35 3.5±0.1 @ 1.9 GHz 0.0018 @ 1.9 GHz [11]
Taconic RF-35P 3.5±0.1 @ 1.9 GHz
3.5±0.1 @ 10 GHz
0.0025 @ 1.9 GHz
0.0034 @ 10 GHz
[11]
Taconic RF-301 2.97±0.07 @ 1 MHz
2.97±0.07 @ 1.9 GHz
0.0012 @ 1.9 GHz [11]
Taconic RF-30 3.0±0.1 @ 1.9 GHz 0.0014 @ 1.9 GHz [11]
Taconic TLF-34 3.4±0.07 @ 1.9 GHz 0.0016 @ 1.9 GHz
0.002 @ 10 GHz
[11]
Taconic TLF-35 3.5±0.07 @ 1.9 GHz 0.0016 @ 1.9 GHz
0.002 @ 10 GHz
[11]
Taconic TLA-6 2.62±0.05
(1 MHz - 12 GHz)
0.0012-0.0021
(1 MHz - 12 GHz)
[11]
Taconic TLC-27 2.75±0.05 @ 10 GHz 0.0022 @ 10 GHz [11]
Taconic TLC-30 3±0.05 @ 10 GHz 0.0028 @ 10 GHz [11]
Taconic TLC-32 3.2±0.07 @ 10 GHz 0.003 @ 10 GHz [11]
GIL GML1000 0.020" 3.05±0.05 @ 2.5 GHz
3.05±0.05 @ 10 GHz
0.003 @ 2.5 GHz
0.005 @ 10 GHz
[12]
GIL GML1000 0.030" 3.2±0.05 @ 2.5 GHz
3.2±0.05 @ 10 GHz
0.003 @ 2.5 GHz
0.004 @ 10 GHz
[12]
C-STOCK AK/AK-500 3-15±5%1
15-25±10%1
<0.002 [13]
C-STOCK Low K-34 1.7 <0.004 [13]
C-STOCK Low K-39 1.9 <0.004 [13]
C-STOCK .0005 2.54±0.01 0.0005 [13]
C-STOCK 265 2.5-5 @ 10 GHz 1 0.01-0.04 @ 10 GHz [13]
C-STOCK HCN 3.5 @ 10 GHz 0.015 @ 10 GHz [13]
C-STOCK RH-5 1.09
(2 GHz - 20 GHz)
0.0004 @ 5 GHz [13]
C-STOCK RH-7 1.11
(2 GHz - 20 GHz)
0.0007 @ 5 GHz [13]
C-STOCK RH-10 1.14
(2 GHz - 20 GHz)
0.0009 @ 5 GHz [13]
C-FOAM PK-2 1.04 @ 10 GHz 0.001 @ 10 GHz [13]
C-FOAM PK-5 1.06 @ 10 GHz 0.001 @ 10 GHz [13]
C-FOAM PF-2 1.03 0.0001 [13]
C-FOAM PF-4 1.06 0.0001 [13]

1 Controlled Dielectric Constant
2 May have previously been known as Stycast®. Some patents refer to Stycast® materials with the same properties [14][15][16][17]

More dielectric materials from Nelco, Arlon, Taconic and Rogers coming soon...

Adhesives & Bonding Films

Material Relative Permitivity Loss Tangent Links
Polyflon Bonding Film 2.34 @ 9.5 GHz 0.002 @ 9.5 GHz [2]
Eccostock® HIK Cement 3, 4, 6, 10, 15 0.01 [10]
Rogers® 3001 Bonding Film 2.28
(X Band)
0.003
(X Band)
[1]

Here is a list of other sites who have also compiled a list of dielectric materials and their constants:

Posted in Antennas, Electromagnetics, Electronics, RF Electronics | Comments Off on Dielectric Materials for Microwave/High Frequency Applications

Antenna Diagnostics - Back Projection Using Planar Near-Field Measurement Data

This post discusses planar near-field antenna measurements with focus on performing antenna diagnostics using back projection. An example of the back projection procedure is implemented in Matlab where near-field planar measurements of a standard gain horn are back projected.

Typically measurements are made using using a near-field spherical or planar antenna measurement setup, in this case planar,  where there is a distance z0 between the probe and the antenna under test (AUT). Back projection allows one to transform the measured tangential E-fields to the fields across the aperture of the AUT. This is useful as it often allows one to detect antenna defects and faults. However one is limited to a resolution of λ/2.

Back projection makes use of the Fourier transform, to transform the measured tangential fields on a plane in front of an AUT into a spectrum of plane waves, translating it a distance z0 towards the AUT and then using the inverse Fourier transform to find the field at the aperture of an antenna. One can also use the far field data of an antenna, as the far-field is proportional to the plane wave spectrum as follows:

where,

      is the far-field E-field
       is the plane wave spectrum
r        is the distance from the AUT to the observation point
k       is the free space wave number.

This will hopefully be discussed in another post.

Planar Antenna Measurement Setup & Process
An AUT is mounted extended from a wall of electromagnetic absorbing material, where a probe opposite to the AUT, normally an open ended waveguide can scan a plane parallel to the aperture of the AUT with an offset of at least two wave lengths, to reduce electric and magnetic coupling between the AUT and the probe. The scanning of the probe is controlled by two actuators which allow precision steps in the x and y-axis, in this case on the order of 1 mm. The probe can normally measure vertical and horizontal polarization at each point on scanned plane. A vector network analyser can be used to measure S21 for both polarizations for each point over and entire scan plane and saved to a file on a computer.

In the example below this file, is loaded into Matlab and back projection is performed to find the fields at the aperture of the AUT.

Probe Correction
One wants to measure the tangential E-field at each point in a planar measurement, however the probe most often used in planar measurements is an open ended waveguide which must be corrected for. This is not discussed here.

Example: Standard Gain Horn
As an example measurements were conducted using Standard Gain Horn from Scientific Atlanta with the following specifications:

  • Frequency: 3.95-5.85 GHz
  • Model: SA12-3.9
  • Nominal Gain: 18 dB
  • a: 47.6 mm
  • b: 22.1 mm
  • a1: 216.1 mm
  • b1: 160 mm
  • e: 33.1°
  • h: 39.9°
  • ρe: 281 mm
  • ρh: 316.5 mm

Planar measurements were conducted with the following parameters:

  • Frequency: 5.3 GHz
  • X-Axis Scan Plane, 0 - 1.5 m
  • Y-Axis Scan Plane, 0 - 0.8 m
  • X-axis step size, Δx = 0.022 m
  • Y-axis step size, Δy = 0.022 m
  • Distance between the apertures of the probe and AUT, z0 = 0.088 m
  • The origin is placed at the center of the AUT's aperture.
  • All samples are taken relative to the defined origin, and not the boundaries of the planar scanner.
  • The AUT is horizontally polarized, parallel to the x-axis

What does one expect to see?
Making the following assumptions:

  • TE10 mode is excited.
  • The aperture is surrounded by an infinite ground plane.
  • Quadratic phase variation across the aperture.
  • No effects due to conductor thickness or diffraction are taken into account.

Balanis [1, pg. 769] derives the following formula for the E-field in the aperture of the horn:

            Balanis Eq. (13-43a )

where:

E0              is a constant.
a1               the length of the longest side of the horn, parallel to the x-axis.
x & y         are coordinates on the plane of the aperture
ρ1 & ρ2     the shortest line from the aperture of the horn to apex of the horn,
ρ1 for the side with length b1 and ρ2 for the side with length a1
k                is the free space wave number in this case.

From this one could expect to see after back projection an aperture field with a cosine variation, assuming the origin is placed at the center of the aperture.

Results from the Processed Data
The horns aperture Ex, Ey, Ez fields are found from the measured planar near-field data using back projection and plotted below. A link to the Matlab code and data that was used can be found in the next section.

Figure 1. Ex of Standard Gain Horn Aperture Field found using Back Projection

Figure 2. Ey of Standard Gain Horn Aperture Field found using Back Projection

Figure 3. Ez of Standard Gain Horn Aperture Field found using Back Projection

Figure 4. Ex Side View of Standard Gain Horn Aperture Field found using Back Projection.
One can see the cosine like variation over the aperture.

Downloads

Download  Planar Near-Field Back Projection M-file v1.0

Download  Example Implementation - Standard Gain Horn M-File v1.0

Download  Example Standard Gain Horn Near-Field Planar Measurement Data

References

[1] Balanis, C. A., 2005, Antenna Theory: Analysis and Design, 3rd Edition, John Wiley & Sons

[2] Van Caekenberghe K., Logan J., Mynster A.P., Pelk M.J., Ponder C., http://www.mathworks.com/matlabcentral/fileexchange/23385-nf2ff/content/NF2FF.m, Viewed: 24 Jan 2012

Posted in Antennas, Electromagnetics, General, RF Electronics | Comments Off on Antenna Diagnostics - Back Projection Using Planar Near-Field Measurement Data

Beagleboard Rev C3 USB EHCI Controller Trouble

If you are the owner of a BeagleBoard Revision C3, you might have noticed your USB devices disappear when there is sudden load of heavy traffic on the USB bus. Error messages along the lines of the following appear:

phy0 -> rt2x00usb_vendor_request: Error - Vendor Request 0x06 failed for offset 0x3090 with error -19.
usb 1-2.3: USB disconnect, address X
ehci-omap ehci-omap.0: port X reset error -110
hub 1-0:1.0: hub_port_status failed (err = -32)
hub 1-0:1.0: Cannot enable port X.  Maybe the USB cable is bad?

To restore the system so that the USB devices can be found again, one has perform a complete reboot of system. One might think the problem to be software related, but it turns out the error is actually a hardware problem, due to noise on the 1.8 V VDD2 power rail. When there is heavy traffic on the USB bus, this can cause voltage drops on the VDD2 power rail sending the USB host controller into panic [1].

The recommended solution is to increase the decoupling capacitance of the power rail by adding an additional capacitor in parallel to the C97 capacitor [1-3] or replacing it entirely. In this case a 22 uF 25V electrolytic capacitor was soldered across the C97 capacitor, as seen in the photo below. This solved USB EHCI controller problem nicely.

If you plan repeat this mod using an electrolytic capacitor, please note that these capacitors are polarised.

Zoomed BeagleBoard with 22uF 25V Electrolytic Capacitor Mod

BeagleBoard with 22uF 25V Electrolytic Capacitor Mod

 

References
[1] Beagleboard stable USB EHCI hack, Linus Åkesson, 13 May 2010,
http://www.linusakesson.net/hardware/beagleboard/ehci.php
[2] USB EHCI Problems, BeagleBoard Google Group, May 2009,
http://groups.google.com/group/beagleboard/browse_thread/thread/5b8385f0bb1f63da
[3] BeagleBoard, Embedded Linux Wiki,
http://elinux.org/BeagleBoard#USB

Posted in Beagleboard, Electronics | Comments Off on Beagleboard Rev C3 USB EHCI Controller Trouble

Welcome!

Just got the blog working :).

Keep watching this space, hopefully more posts coming soon ;).

Posted in General | Comments Off on Welcome!