Archive

Archive for the ‘Help’ Category

Kubuntu 15.04 Playback Control Media Keys not working

July 24th, 2015 No comments

For some reason, while the other 2nd functions keys were working fine, the Play/Pause, Previous & Next keys stopped working in Kubuntu 15.04 since the clean installation. Volume buttons were working fine.  Upon lot of digging, finally the solution was just a workaround by using MPRIS-remote.

sudo apt-get install mpris-remote

Goto System Settings->Shortcuts->Custom Shortcuts

Edit -> New Group -> “Media Player”

Edit -> New -> Global Shortcut -> Command/URL

Enter “Media Play” for the command name.

On the right pane, Click on “Trigger” -> Set the shortcut key;

Click on “Action”-> “/usr/bin/mpris-remote pause”.

Likewise create commands “Media Next” : “/usr/bin/mpris-remote next”

and “Media Previous” : “/usr/bin/mpris-remote previous”.

Clementine is a MPRIS compatible player, which means this hack solves the problem!

 

RAID Mayhem in Linux Mint 17.1 and Kubuntu 14

March 11th, 2015 No comments

I have a Quad-core machine that has 2+2 1TB disks configured in RAID 1+0 mode (mirror + stripe).  I am having a 64Gb SSD, on which I have the operating systems installed.  Recently, I wanted to install Linux Mint 17.1 on the SSD.  The installation went fine, but after rebooting the RAID device was not visible at all.  To overcome this problem, I had to do “dmraid -ay” to activate the RAID device in my machine.

Ok, now my RAID device is visible.  Went ahead to create /home and /data partitions, followed by updating the same in /etc/fstab for auto-mounting during boot-up.

To my surprise, the reboot failed saying /home is not ready.  Checked into recovery mode by punching in the root password and found that the RAID device has gone missing now.   Ran “dmraid -ay” again to activate the device; following by running “mount -a” make /home and /data partitions come alive.  Exited the recovery mode to complete the full booting.

Did some internet search for how to activate the RAID device on booting automatically.  It was awful that there are no direct methods to do so.   Infact, some people have advised about not rebooting the machine at all..  Funny!

Later, found a workaround, where the /etc/fstab entries were made “noauto”.  And RAID activation happening in /etc/rc.local.

/etc/rc.local

dmraid -ay
mount /home
mount /data

/etc/fstab

/dev/mapper/pdc_cjcdcdeide6    /home ext4    defaults,noauto     0   2
/dev/mapper/pdc_cjcdcdeide5    /data ext4    defaults,noauto     0   2

Moral: Never install the Operating System on a RAID device, as majority of the distributions don’t recognize them by default.  Interestingly, Fedora 21 recognized RAID during installation itself, but I ended up hating it, when I found “yum update” not working out of the box.

How to make Kate remember last opened files

October 22nd, 2014 No comments

Kate allows document editing to be grouped under separate sessions.  Although there is no direct configuration setting to make Kate auto-open last opened files during startup, the Sessions features come handy.  The workaround is; given that Kate remembers last opened file paths in the File -> Open Recent menu item, you may select files one by one to continue editing.  But, this is so boring.

The procedure is the following:

  1. Open all the files that you want to be remembered by Kate for reopening during next restart of Kate.
  2. Click on Sessions->Save Session As->[give a session name here to save the session]
  3. Close your Kate application.
  4. Open it again, you would see no files reopened automatically, Don’t Panic!
  5. Click on Sessions->Quick Open Session->[session name].
  6. Aha… all the files that you had put into the session will reappear.

Understanding a Fan Motor

August 28th, 2012 4 comments
Have you opened up a fan motor before?  It is a simple brush less A/C induction motor, where the armature remains as the stator.  Look at the exploded image of a typical fan motor. The important parts are C: Ball Bearing, D: Stator, E: Armature/Stator, G: Capacitor, H: Connector. 

Also, look at the other image that shows the cross section of a motor.  You would notice that there are 4 wires coming out the motor.  Two pairs of wire, with one pair as the starting coil and the another pair for the running coil.  In general, all single phases induction motors have two coils (starting coil, running coil).  Using a capacitor, an artificial phase difference is created between the fields created by the starting and running coils.  The phase difference triggers movement of the armature.  When the armature reaches a particular speed, using a centrifugal switch, the connection to the starting coil is disconnected and the entire fans runs with just one coil.

Although there are four terminals, you would notice 3 terminals are emitted out, with the starting and running coils connected back-to-back.  Let’s say S1,S2 are the terminals of starting coil and R1,R2 are the terminals of the running coil.  To get 3 terminals out of the fan motor, S2 and R2 are shorted. 

Now, you just see 3 terminals; how do you find which terminal is starting, which one is ending and which one is shorted?  Easy.  Using a simple multimeter, you can find it out.

Let’s say you see terminals A, B, C. Our aim is to find which one of these are S1, R1, S2R2.  Now, let’s measure the resistance between A-B, call it X.  Likewise measure the resistance B-C as Y and A-C as Z.  If you would notice X < Y < Z, you would also notice that Z = Y+X.  Which mean, A-C is action A-B+B-C, that’s why the resistance was additive, also the terminal B is S2R2.  The challenge now is to find what is A and what is C.   As we’d notice A-B=X < B-C=Y, we can confirm that terminal A is starting coil S1 and terminal C is running coil R1.  The reasoning is that; starting coil resistance will be less than running coil resistance.

Hope, this article helped.

Calculating Ampere-Hour AH requirement

May 20th, 2012 No comments
We are in a sorry state of erratic and long power cuts, due to shortage of power production by the nation against the increasing load conditions.  To add fuel to this fire, a wholesome of abled people putting their hard earned money on to power backup solutions, where they store the power during power availability and consume the stored power during outage.  On the whole, this looks simple and elegant, but this is not doing any good to the state, which shed’s power at different locations to balance against shortage in power production.  So theoretically, in a place where a family consumed 1kW per hour, would consume 2.5kW per hour during power availability and generate 1kW during power outage.  Yes, you are right. The equation is not balanced, because atleast 30-50% of power is wasted during the backup-retrieve cycle.

Ok, coming to the point.  What is the solution? Go for harvesting solar power, availability in abundance and omni present.  And most interestingly, rationed to perfection based on the amount of un-shadowed free space a family has.  I will just limit this article to calculating the battery provisioning when you go for a solar-inverter solution.  Let’s say I want to have a power backup for 2 hours and my load is 1kW. What would be the ideal inverter solution for this load condition?

Normal Power 1000 Watts
Power Factor 80 %
Inverter Rating 1000W/80% = 1250 VA
Number of Backup Hours 2 Hours
Energy To be Stored 1000×2=2000Wh
Inverter Battery Voltage 24VDC
Battery Amp-Hours 2000/24=83AH
Add @30% AH Margin 83*1.3=108AH~100AH

So, for this configuration you need a 1250VA Inverter with 2x12v 100Ah battery bank.  Let me explain the calculation,

  1. Power Factor: In AC (alternating current), Power = Voltage x Current x Power factor unlike in DC, Wattage = Voltage x Current.  Power factor is measure as the cosine of the phase angle between voltage waveform and current waveform.  For home use, the power factor will be 0>PF<1.  When PF is lower, the efficiency of the system suffers a lot.
  2. Battery Voltage: For 1250VA inverter system, the choice of battery bank is 24V instead of 12V.  The rationale for this choice is to limit the current from the battery to the inverter unit.  If you use a 12V battery bank, at full load there will be a current of 1250/12=104A flowing from the battery to the inverter.  You may have noticed the thickness of the battery wire be very high.  Despite that the power loss on those wires when the current is 100A, would be much higher than it is with 50A on a 24V system.  For a 24V system, the peak current shall be 1250/24=52A.  Also, at 100A, with 1m cable between battery and inverter, the impedance should be 0.00001 ohms.
  3. AH Margin: Although battery AH rating considers absolutely draining of the battery, we will not be able to do that for normal SMF battery.  Meaning, we should not discharge below 10V and likewise should not charge beyond 13.6V per 12V battery.  In order for the AH rating to work, we have to apply atleast 20-30% margin.

Hash Overflow due to 64 bit upcasting

October 28th, 2011 No comments
    Lately, I had to debug the following piece of code, where it caused overflow on the hash bucket design.  The code worked perfectly on a Windows machine while compiled for Win32, but failed to work on a Linux Mint x64 machine.  The code is listed below, which basically calculates hash value of an input 32 bit unsigned number, limiting the hash value to 2^10 (1Meg).

hash = ( fpArray*2654404609 )>>12; // Calculate the hash and limit the value to 2^20 (1 Meg)

   When the input value for fpArray was 1724463449 (0x66C93959), the hash value generated was 1779068547 (0x6A0A6E83), which is more than (0x000FFFFF) to cause the hash bucket overflow.

unsigned hash = fpArray * 2654404609;
hash = hash >> 12;

    When I rewrote the code like the above, the value of hash was 2800236889 (0xA6E83959).  Upon shifting right by 12 yields 638651 (0x0009BEBB), which is the correct and expected hash value.

    Overall, the first snippet of code appears to be correct.  Do you see a problem there?  I couldn’t find the issue, until I recalled the 32bit vs 64bit difference.  If you carefully look at the multiplier 2654404609 (0x9E370001), although appears to be a valid 32 bit number, what is the default assignment of type to this number by the compiler?  If it was assigned 64bits, what would happen to the results?  To validate this, I changed the 2nd snippet as the following.

unsigned long hash = (unsigned long)fpArray * 2654404609;
hash = hash >> 12;
unsigned h2 = (unsigned)hash;

    Now, when the input is the same 1724463449 (0x66C93959), the value of hash becomes 4577423727077636441 (0x3F8646A0A6E83959) and upon right shifting by 12 bits yields 1117535089618563 (0x0003F8646A0A6E83). Followed by downcasting to unsigned yield 1779068547 (0x6A0A6E83). Bingo!

    So, what is happening here? While performing (fpArray * 2654404609), the computation is upcasted to 64bit computation by the 64 bit compiler.  So, what is the solution? Just put a “U” at the end of the constant.

hash = ( fpArray*2654404609U )>>12; // Calculate the hash and limit the value to 2^20 (1 Meg)
(or)
const unsigned multipler = 2654404609; // here U suffix is not needed as the constant is explicitly made unsigned
hash = ( fpArray * multiplier ) >> 12;

    Now, the computation will happen with 32 bit numbers to get the expected outputs.

Lessons Learned here:

  1. While using constants, beware of the upcasting and downcasting. So use proper suffixes like U, L, F etc.
  2. Instead of using constants directly in expressions, use them as constant variables.
  3. Be conscious about the compiler type and the assumptions made by the compiler in different build modes.

How to Remove The headlamp – Getz Prime

September 24th, 2011 No comments

Removing the headlamp from Getz Prime is pretty trivial and requires just only one tool and probably 5 minutes of time.  Let’s see how to go about that.

1. The Headlamp Assembly: It appears very dull ey? Yes, I was going to remove it and replace the frontal glass.

2. The Tool: All the bolts that attach the assembly to the chassis are 10mm and you would need a bit rod for disassembling the headlamp unit.

3. Remove Bolts: Use the 10mm bit rod to remove the bolts.  Remove the first bolt visible from the top.

4. Remove the other 3 bolts visible from the front side.

5. Remove the hidden bolt.  Now that you have removed the front side 3 bolts, you will be able to pull that plastic to expose the hidden lamp assembly bolt fastened to the chassis.

6. Shake and pull the the headlamp assembly.  Remember to remove three wiring harnesses connected to the headlamp assembly; a) The Bulb supply b) Motor, Parking lamp, Main Bulb supply c)  Indicator supply.

That’s it.  It takes just 5 minutes and 1 tool to remove the head lamp assembly from Getz Prime.

AWG Vs Current Flow Capacity

September 13th, 2011 No comments

This write up is taken from http://www.engineeringtoolbox.com/wire-gauges-d_419.html

The AWG – American Wire Gauge – is used as a standard method of denoting wire diameter, measuring the diameter of the conductor (the bare wire) with the insulation removed. AWG is sometimes also known as Brown and Sharpe (B&S) Wire Gauge.

The AWG table below is for a single, solid, round conductor. Because of the small gaps between the strands in a stranded wire, a stranded wire with the same current-carrying capacity and electrical resistance as a solid wire, always have a slightly larger overall diameter. The higher the number – the thinner the wire. Typical household wiring is AWG number 12 or 14. For telephone wires there are common with AWG 22, 24, or 26.

AWG Diameter
(mm)
Diameter
(in)
Square
(mm2)
Resistance
(ohm/1000m)
40 0.08 . 0.0050 3420
39 0.09 . 0.0064 2700
38 0.10 0.0040 0.0078 2190
37 0.11 0.0045 0.0095 1810
36 0.13 0.005 0.013 1300
35 0.14 0.0056 0.015 1120
34 0.16 0.0063 0.020 844
33 0.18 0.0071 0.026 676
32 0.20 0.008 0.031 547
30 0.25 0.01 0.049 351
28 0.33 0.013 0.08 232.0
27 0.36 0.018 0.096 178
26 0.41 0.016 0.13 137
25 0.45 0.018 0.16 108
24 0.51 0.02 0.20 87.5
22 0.64 0.025 0.33 51.7
20 0.81 0.032 0.50 34.1
18 1.02 0.04 0.82 21.9
16 1.29 0.051 1.3 13.0
14 1.63 0.064 2.0 8.54
13 1.80 0.072 2.6 6.76
12 2.05 0.081 3.3 5.4
10 2.59 0.10 5.26 3.4
8 3.25 0.13 8.30 2.2
6 4.115 0.17 13.30 1.5
4 5.189 0.20 21.15 0.8
2 6.543 0.26 33.62 0.5
1 7.348 0.29 42.41 0.4
0 8.252 0.33 53.49 0.31
00 (2/0) 9.266 0.37 67.43 0.25
000 (3/0) 10.40 0.41 85.01 0.2
0000 (4/0) 11.684 0.46 107.22 0.16

The higher the gauge number, the smaller the diameter, and the thinner the wire.  Because of less electrical resistance a thick wire will carry more current with less voltage drop than a thin wire. For a long distance it may be necessary to increase the wire diameter – reducing the gauge – to limit the voltage drop.

American Wire Gauge (AWG)
Length
(feet)
Current (amps)
5 10 15 20 25 30 40 50 60 70
15 16 12 10 10 8 8 6 6 4 4
20 14 12 10 8 8 6 6 4 4 4
25 14 10 8 8 6 6 4 4 2 2
30 12 10 8 6 6 4 4 2 2 2
40 12 8 6 6 4 4 2 2 1 1/0
50 10 8 6 4 4 2 2 1 1/0 1/0
60 10 6 6 4 2 2 1 1/0 2/0 2/0
70 10 6 4 2 2 2 1/0 2/0 2/0 3/0
80 8 6 4 2 2 1 1/0 2/0 3/0 3/0
90 8 4 4 2 1 1/0 2/0 3/0 3/0 4/0
Standard Wire Gauge (SWG)

SWG inches mm
7/0 0.500 12.700
6/0 0.464 11.786
5/0 0.432 10.973
4/0 0.400 10.160
3/0 0.372 9.449
2/0 0.348 8.839
1/0 0.324 8.236
1 0.300 7.620
2 0.276 7.010
3 0.252 6.401
4 0.232 5.893
5 0.212 5.385
6 0.192 4.877
7 0.176 4.470
8 0.160 4.064
9 0.144 3.658
10 0.128 3.251
11 0.116 2.946
12 0.104 2.642
13 0.092 2.337
14 0.080 2.032
15 0.072 1.829
16 0.064 1.626
17 0.056 1.422
18 0.048 1.219
19 0.040 1.016
20 0.036 0.914
21 0.032 0.813
22 0.028 0.711
23 0.024 0.610
24 0.022 0.559
25 0.020 0.508
26 0.018 0.457
27 0.0164 0.417
28 0.0148 0.376
29 0.0136 0.345
30 0.0124 0.315
31 0.0116 0.295
32 0.0108 0.274
33 0.0100 0.254
34 0.0092 0.234
35 0.0084 0.213
36 0.0076 0.193
37 0.0068 0.173
38 0.006 0.152
39 0.0052 0.132
40 0.0048 0.122
41 0.0044 0.112
42 0.004 0.102
43 0.0036 0.091
44 0.0032 0.081
45 0.0028 0.071
46 0.0024 0.061
47 0.002 0.051
48 0.0016 0.041
49 0.0012 0.030
50 0.001 0.025

Solar Panel Structure Design

July 17th, 2011 No comments

This was the original design of the solar panel mounting structure.  Later, I had simplified the design and fabricated them at the local metal fabricators.  Please click on the images to open the big sized drawing.

Pole that would hold the weight of a heavy solar panel over a base structure (not shown).

Hinge design that would transfer the weight from the base structure to the pole, with one degree of freedom.

Know to Say No

June 1st, 2011 No comments
மனிதன் தன்னுடைய கர்மத்தினால் ஏற்படுத்திக்கொள்ளக்கூடிய துயரத்தைவிட பிரதிகர்மத்தினாலேயே அதிக துயரை சம்பாதிக்கிறான். ஆங்கிலத்தில் ஒரு பழமொழி உண்டு, “You should know to say no”. அதாவது, இயலாது என்று சொல்லவேண்டிய இடத்தில் இயலாது என்றுரைக்க தெரிந்திருக்கவேண்டும். இதில் சிக்கல் என்னவென்றால், எங்கு இயலாது என்று கூறுவது, அதை எப்படிக்கூறுவது என்பதில் தான். அதில் தேர்ந்துவிட்டால், தேவைக்கு ஏற்ப வாழ்க்கையை அமைத்துகொள்வது எளிது.

“I am not obligated” என்று விட்டேத்தியாக இருந்துவிடுவது எளிது, ஆனால் இந்த குணத்தால் நண்பர்களை இழக்க நேரிடலாம். இருப்பினும், பொறுப்புகளுக்கும்(responsibilities) வேண்டுகோள்களை ஏற்பதற்கும்(being obligated) வேறுபாடு உண்டு என்பதை உணர்ந்து நடந்தால், திறமையாக நிலைமையை சமாளிக்கமுடியும் என்பதில் ஐயமில்லை.