Archive

Archive for the ‘KnowHow’ Category

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.

Fixing a Hand Remote Control that doesn’t work!

December 4th, 2011 No comments
    It is hard to imagine a television or a multimedia system without remote control now a days. Broken remote control units is an eternal problem. Thanks to China for dumping remote control units, which makes the cost of them affordable between 60-75Rs for television units. But, finding a replacement for multimedia systems is still a problem as no vendor is holding such stocks for its lower sales.
     I have been hit for the same problem when my Altec Lansing 5.1 multimedia system’s remote control broke. In the sense, the remote was functional intermittently. And some time, the key pad mapping got goofed up with + working as – and so on. When I visited my local electronics stores guy, he said the general problem for intermittent remote operation is a conked up crystal that is found inside the remote control unit. 

    Remote control units work with Infrared light communication between the hand-unit and the multimedia system’s base unit.  Commands from the keypad are converted to IR signals, which are received and decoded by the base unit to perform appropriate function.  Since IR light is not visible to human eye, one should use a Camera eye to see the IR light.  The easiest way is to observe the LED mounted in the front of the hand unit through a mobile camera or any camera that’s in working condition.  The cameras bandwidth covers IR and UV apart from the visible spectrum.  You will find that the IR led blinks (carrier frequency is 22khz), when you press any button on the remote control unit.  If you observe that for some keys the IR led is not flashing or intermittently flashing, you may associate the problem to a faulty crystal in the remote control PCB.

    When the remote is opened, you will see a PCB like the one in the picture.  The PCB could be plucked out from the casing by hand.  You will also see a rubber like buttons which are the actual buttons that you press.  The rubber button is placed on the PCB, where the button presses are converted to switching action.  Remember, the buttons will have a conducting coating under it, which indeed closes the circuit when the button touches the PCB. 

    The crystal that comes as a part of the circuitry is shown in the picture.  It is otherwise called a ceramic resonator, which is the crucial component of an oscillator circuitry.  Crystals are typically used against LC, RC tank circuits for its very high stability feature against temperature and humidity. My remote uses a 455Khz crystal named CRB455E (http://dalincom.ru/datasheet/CRB455E.pdf). The cost of this crystal as on today is Rs 2 in Chennai/India.  After replacing the crystal, my remote is working perfectly so far.

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.

kDevelop Editing Freezes Problem

August 20th, 2011 No comments
While working with KDevelop 4.2, I was quite disturbed by suddenly freezing of editing window. In the sense, the opening file is uneditable, “find” strings does not work and literally kDevelop becomes unusable. I had to restart kDevelop 4.2 to resume editing the code. I believed that kDevelop is going into Vi mode and was trying to undo that. But that’s not the problem.

When kDevelop loses focus, somehow the editing capability is disabled temporarily. When you switch context a couple of time by Alt-Tab and land is kDevelop again, the editing capability is resumed. I don’t know whether this is a bug, but context-switching has been my breather for now.

Solar Battery Charger Cutoff Circuit

August 7th, 2011 No comments

Using very few components, I have built a solar battery charger cutoff circuitry that would enable automatic cutoff of battery charging when the potential across the battery terminals reached a voltage level chosen by the preset setting in the circuit.  Medium power transistor is operated in Cutoff mode most of the time, so the quotient current of the circuit is fairly low in the order of few mA.  It should be noted that the Vopen-circuit of the solar panel is few volts higher than the voltage when the panel is connected across a load.  So, don’t adjust the preset without connecting the battery. When the circuit is turned on, the battery is directly connected with the solar panel, and hence the voltage perceived by the voltage divider is the load voltage.  When the voltage across the load goes beyond the set point, zener conducts to turn the transistor on, which would pull the relay down and break the charging circuit.  After the battery is disconnected, the voltage perceived by the potential divider circuit is the open-circuit voltage of the panel, which eventually creates a latch effect for the battery charger off condition.  The relay will be ON, till there is sun light and when in the dusk, the input voltage should drop below the threshold voltage to turn off the transistor.

There is a flaw in this circuit. :)

When the sun light drops, the relay turns off as the transistor is turned off.  But now, the battery potential will be again available across the potential divider circuit.   There is a potential, oscillation condition here!!

PROXIM ORINOCO 802.11 a/b/g/n

June 30th, 2011 No comments

Did you try this page for the driver?
http://list.driverguide.com/list/company861/LINUX/

Procedure for setting up proxim driver is given here:-
http://questier.com/howto.html#Proxim

If you want to try an alternate device, use this list linux compatible devices:-
http://www.cyberciti.biz/tips/linux-usb-wireless-compatibility-adapter-list.html

How to on Wireless networking:-
http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch13_:_Linux_Wireless_Networking

If there is a windows driver, you can use “ndiswrapper” to setup a Linux module atop the windows driver sys and inf files. Try this as well.

Oil Cooler Assembly for Royal Enfield Thunderbird 350 AVL

May 9th, 2011 No comments
The performance of a IC engine is directly dependent on the difference between the ambient temperature and the exhaust temperature.  If you had learned about IC engines, it is apparent that the power generated is proportional to the temperature difference between the inlet and the outlet feed for the engine.  So, it is critical to operate the engine under low temperature such that maximum power is generated by the engine.  To keep the engine cool, engine oil is used, which also serves as the lubricant for the moving parts.  Engine oil is the blood for an engine and it’s circulation is crucial for maintaining the temperature and low frictional loses.  There is no oil cooler assembly for TB, or for that matter any RE bikes in India. 

Chinmay Dhangre from Pune generously offered to supply a modified oil cooler.  I was excited to read a blog post by Chinmay at http://www.indiancarsbikes.in/automotive-technology/royal-enfield-avl-engine-oil-cooler-update-real-world-data-4175/. When I contacted Chinmay at macasp@gmail.com, he was readily helping me to get the necessary fitments and hardware.

The reason for keep the inlet at a higher position than the outlet is to ensure that some oil is pre-stored in the oil cooler compartment all the time.  When the engine is started, it takes >10 seconds for the oil to reach the rocker, tappet assembly through the Y pipe.  If I had put the oil cooler in the middle, it would take more time to fill the oil cooler and then reach the rocker assembly.  Having this inverted connection helps the oil start its circulation faster.

The oil cooler assembly and the Y pipes are connect via a nylon coated reinforced rubber tube.  While fitting so, care should be taken for keep the pipes away from the silencer tube.  Also, it is to be ensured the the joints don’t leak after they are secured by clamps.  In the above picture, one clamp is missing!

I had used one clamp to offset the nylon pipe from the silencer tube.  I will have to use some other method for this offseting, as I am indeed wasting a good clamp!

While draining the oil during oil replacement, one has to take care of removing the oil in the oil-cooler compartment by opening the bottom vent.  Otherwise, sludge can start to accumulate inside the oil cooler assembly, which could eventually block the oil flow later.  So, it should be practice that the oil cooler assembly is cleaned every time the engine is serviced.

The completed bike is able to keep the engine oil temperature lower by allowing the natural air flow cooling off the oil through the oil-cooler fins.  Do mind that while the bike is stationery, the oil cooler cannot provide any help as it needs air flow for cooling.

Windows Server 2008 R2 Itatic font problem

May 5th, 2011 1 comment
    While doing some automatic windows updates, the default font for Windows 2008 R2 Server changed to Italics.  After getting perplexed about this problem and few hours of Internet searching, the solution was found at http://www.techsupportforum.com/forums/f217/problem-with-italic-fonts-everywhere-arial-233328.html.  Basically, it recommended a registry fix (see below), which seemed working perfectly. The replacement font prescribed in the registry fix sounded weird to me, so checked the name in http://en.wikipedia.org/wiki/Segoe and found that it belongs to the Sans-serif font category.
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes]
"MS Shell Dlg 2"="Segoe UI"
"MS Shell Dlg"="Segoe UI"
"Helv"="Segoe UI"
"MS Sans Serif 8,10,12,14,18,24"="Segoe UI"
"MS Serif 8,10,12,14,18,24"="Segoe UI"
"MS Sans Serif"="Segoe UI"
"System"="Segoe UI"
"Microsoft Sans Serif"="Segoe UI"
"Tahoma"="Segoe UI"
"MS Serif"="Segoe UI"
"Times New Roman"="Segoe UI"
"Times"="Segoe UI"
"Small Fonts"="Segoe UI"
"Tms Rmn"="Segoe UI"
"Arial"="Segoe UI"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts]
"Arial (TrueType)"="segoeui.ttf"
"Arial Italic (TrueType)"="segoeuii.ttf"
"Arial Bold (TrueType)"="segoeuib.ttf"
"Arial Bold Italic (TrueType)"="segoeuiz.ttf"
"Times New Roman (TrueType)"="segoeui.ttf"
"Times New Roman Italic (TrueType)"="segoeuii.ttf"
"Times New Roman Bold (TrueType)"="segoeuib.ttf"
"Times New Roman Bold Italic (TrueType)"="segoeuiz.ttf"
"Tahoma (TrueType)"="segoeui.ttf"
"Tahoma Bold (TrueType)"="segoeuib.ttf"
"Microsoft Sans Serif (TrueType)"="segoeui.ttf"
"MS Sans Serif 8,10,12,14,18,24 (VGA res)"="segoeui.ttf"
"MS Serif 8,10,12,14,18,24 (VGA res)"="segoeui.ttf"

[HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\Shell\MuiCache]
"@themeui.dll,-2037"="{Segoe UI, 8 pt}"
"@themeui.dll,-2038"="{Segoe UI, 8 pt}"
"@themeui.dll,-2039"="{Segoe UI, 8 pt}"
"@themeui.dll,-2040"="{Segoe UI, 8 pt}"
"@themeui.dll,-2041"="{Segoe UI, 8 pt}"
"@themeui.dll,-2042"="{Segoe UI, 8 pt}"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontMapper\FamilyDefaults]
"Swiss"="Segoe UI"
"Roman"="Segoe UI"

HT12E & HT12D Rosc values

May 1st, 2011 No comments

Choosing a appropriate value of ROSC is critical for the functioning of HT12E and HT12D pair during Muxing and DeMuxing.  The following are the value pairs that are found to be working correctly at 5V power supply for both the ICs.  Although, they support variety of voltages, it is always better to keep them at the same voltage to avoid confusion on the internal oscillator frequency.  If the data sheet is seen, it becomes apparent that the internal oscillator frequency is function of (Vdd, Rosc).

HT12E ROSC HT12D ROSC
1M 47K
1.1M 51K
750K 33K