Monday, October 31, 2016

Slow internet connection because of windows 10 update

I had faced for some days very slow internet connection (my internet speed is 1 Mb/sec) and I discovered that it is slow because of Windows 10 updates (Windows update download speed was 0.9 Mb/sec). In Windows 10 you cannot stop updates at all even using the task manager, but there is an alternative way just in 3 steps:

[1] Open the start menu and search for "WiFi" and open "Change WiFi settings" to get the following window.

[2] Select "Manage known networks" (highlighted in red box in the image above). A list of networks will be displayed as follows.

[3] Select the network you want and click "Properties" button to get a window like the shown below. Finally, turn on "Set as metered connection" button (shown in the red box below). Now, you will not have slow internet connection anymore (for this network only) because of windows 10 update.


Problem: Windows 10 slow internet connection

Window 10 slow internet speed because of Windows update

Windows 10 force stop Windows update

Windows 10 force stop delivery optimization service

Windows 10 cannot stop Windows update

Sunday, October 30, 2016

Excel VBA parallel timers

Excel VBA does not support multi-threading or running parallel loops. For this reason, if you want to run stop watches or timers at the same time, then you have to run them in the same loop.

You can run/stop each stopwatch individually by pressing the button below each stopwatch counter as seen in the picture below.

The button "All" is used to run/stop all stopwatches at the same time, so you can see if there is any delay between stopwatches or not.

The following is Excel VBA code for the previous demo of 4 stop watches:

Option Explicit
Private Declare Function GetTickCount Lib "kernel32" () As Long
Dim StopWatch1, StopWatch2, StopWatch3, StopWatch4, TimerLoopStatus, AllTimersOn As Boolean
Dim t1start, t2start, t3start, t4start, t5start As Long
Private Sub UserForm_Initialize()
' The following are the default values at userform start
StopWatch1 = False
StopWatch2 = False
StopWatch3 = False
StopWatch4 = False
AllTimersOn = False
TimerLoopStatus = False
End Sub
Private Sub StopWatchAllBtn_Click()
AllTimersOn = True
MultipleTimers     'Run timers loop
End Sub
Private Sub StopWatch1Btn_Click()
t1start = GetTickCount
If StopWatch1 = False Then      'If stop watch is off, then turn it on
StopWatch1 = True
StopWatch1Btn.Caption = "Stop"
StopWatch1Btn.BackColor = &HFF&
ElseIf StopWatch1 = True Then
StopWatch1 = False
StopWatch1Btn.Caption = "Start"
StopWatch1Btn.BackColor = &HC000&
End If
If TimerLoopStatus = False And AllTimersOn = False Then
MultipleTimers     'Run timers loop
End If
End Sub
Private Sub StopWatch2Btn_Click()
t2start = GetTickCount
If StopWatch2 = False Then      'If stop watch is off, then turn it on
StopWatch2 = True
StopWatch2Btn.Caption = "Stop"
StopWatch2Btn.BackColor = &HFF&
ElseIf StopWatch2 = True Then
StopWatch2 = False
StopWatch2Btn.Caption = "Start"
StopWatch2Btn.BackColor = &HC000&
End If
If TimerLoopStatus = False And AllTimersOn = False Then
End If
End Sub
Private Sub StopWatch3Btn_Click()
t3start = GetTickCount
If StopWatch3 = False Then      'If stop watch is off, then turn it on
StopWatch3 = True
StopWatch3Btn.Caption = "Stop"
StopWatch3Btn.BackColor = &HFF&
ElseIf StopWatch3 = True Then
StopWatch3 = False
StopWatch3Btn.Caption = "Start"
StopWatch3Btn.BackColor = &HC000&
End If
If TimerLoopStatus = False And AllTimersOn = False Then
End If
End Sub
Private Sub StopWatch4Btn_Click()
t4start = GetTickCount
If StopWatch4 = False Then      'If stop watch is off, then turn it on
StopWatch4 = True
StopWatch4Btn.Caption = "Stop"
StopWatch4Btn.BackColor = &HFF&
ElseIf StopWatch4 = True Then
StopWatch4 = False
StopWatch4Btn.Caption = "Start"
StopWatch4Btn.BackColor = &HC000&
End If
If TimerLoopStatus = False And AllTimersOn = False Then
End If
End Sub
Private Sub MultipleTimers()
Do While StopWatch1 = True Or StopWatch2 = True Or StopWatch3 = True Or StopWatch4 = True
If StopWatch1 = True Then
Label1.Caption = Round((GetTickCount - t1start) / 1000, 3)
End If
If StopWatch2 = True Then
Label2.Caption = Round((GetTickCount - t2start) / 1000, 3)
End If
If StopWatch3 = True Then
Label3.Caption = Round((GetTickCount - t3start) / 1000, 3)
End If
If StopWatch4 = True Then
Label4.Caption = Round((GetTickCount - t4start) / 1000, 3)
End If
TimerLoopStatus = False     'When the loop finishes, then the multiple timer status will be "False" (off)
AllTimersOn = False
End Sub


Tuesday, October 25, 2016

Cascaded thermoelectric (Peltier) modules

A lot of engineers are impressed with thermoelectric (Peltier) coolers and most of them thought about getting ultimate freezing (negative) temperatures. Thermoelectric cooler -conceptually- is a heat pump, so it takes electric power and pump heat from one side (source) to the other side (sink).

To get ultimate negative temperatures, you have to cascade Peltier module on the top of another, but how this will work. The first principle is: the dissipated heat of thermoelectric module from the hot side is the summation of the input electric power and the absorbed heat from the cold side. Therefore, the dissipated heat is always large and around 3 times the absorbed heat.

So... when stacking Peltier modules on top of another, you have to make sure that the dissipated heat of the top one is less than or equal the cooling power of the lower one. You can stack different Peltier modules of different sizes in pyramid layout from largest size in the bottom to smallest size on the top.

Also, you can stack Peltier modules of different cooling powers but with the same size. The following is a list of Peltier modules that have the same size, but different cooling powers:

If there are no more options for Peltier modules in your country (one model only is available in your country), then you can use array layout for cascading them like the image below:


Cascaded thermoelectric (Peltier) modules|elments|tiles

Thermoelectric (Peltier) cooler on the top of another

Thermoelectric (Peltier) stacking

Minimum thermoelectric (Peltier) cooler temperature

Ultimate cooling|freezing temperature in thermoelectric (Peltier) cooler

Dissipated heat of thermoelectric (Peltier) modules|elments|tiles

Heat sink power of thermoelectric (Peltier) modules|elments|tiles

Thermoelectric (Peltier) modules|elments|tiles in Egypt

Tuesday, October 18, 2016

Refrigerator electricity cut out during long holdiay

If you will have a long holiday or vacation and you are going to travel or leave your home, then here you are this nice trick. During this long holiday, the electricity may cut out for long time and this may affect the food staff in your fridge and make it rotten. When you come back, you may eat this rotten food and get sick because of it.

So, the idea simply is to freeze a cup of water in your freezer, then place a metal coin on top of ice before you leave home. When you come back you may find one of the following probabilities as show in the picture below:


Sunday, October 16, 2016

Prioritization, prioritization matrix, and weighting

Assume that you want to buy a car and assume that there is a website that has search filters for your required specifications. Assume that you want a car with specific values for the following features:
[1] Horse power
[2] Center lock
[3] Fuel consumption
[4] Front speakers
[5] Maximum speed
[6] Driver airbag
The normal situation is that the search engine will treat all the parameters as they have the same importance (priority) to you and this may lead to results that are not logic. So, what if the search is not based on true or false, what if it is based on a total score, that meets your requirements.
How this will go?
First of all, the website will list all the features (attributes) the cars have, then you have to select the important features you are interested in to look for. The next step will be a survey to sort your priorities like the following image sequence below:

Assuming number of features is M, then the number of survey questions  N depends on the number of features M and it is the sum of the arithmetic series:

Or it can be simply calculated using this simple formula:
The survey may be a little bit long, but it really sets the right priorities in a scientific mistake-proof approach
At any time during the survey you can exit the survey and save your priorities which will be saved in what I call the "prioritization matrix" which is a square matrix that defines the relationship between each feature and looks like the following:

In the previous matrix, we count the number of "TRUE" in each row. The higher "TRUE" count, the higher priority.

Based on the previous matrix, these features are sorted in descending order based on my needs like that:
[1] Driver airbag
[2] Fuel consumption
[3] Maximum speed
[4] Horse power
[5] Center lock
[6] Front speakers

This way of prioritization can help setting weight factors for project management, risk management, time management, budget allocation, ... etc.
In this next post I will explain how set the weights and generate the score.

Friday, October 7, 2016

Digital input data acquisition by PC keyboard and Excel VBA


PC keyboard for data acquisition

Computer keyboard to piano keyboard

PC keyboard to piano keyboard

PC keyboard to arcade keyboard

Computer keyboard maximum number of simultaneous keys pressed together

Computer keyboard as digital input

Keyboard ghosting

One day my friend asked me if we can use a computer keyboard as a data acquisition DAQ module to monitor large number of digital inputs coming from proximity switches on Excel. The answer is below:

On the hardware level, the keyboard should be dismantled to get its encoder PCB. This why we should use a standalone keyboard.

Keyboard encoder board
On software level, to do this, we have to create an ActiveX control in a work sheet or in a user-form. Then we have to write our macro code in the event handler of keyboard event.

First of all, the user should keep the
Excel application maximized the whole time.

Once we will use the event handler of certain ActiveX control. Then, the user should not change focus of the control the whole time. The focus may be changed for some controls using mouse move, mouse key-press, or keyboard "TAB" key-press.

This means that the keyboard and mouse can no more be used for any user input in
Excel and it is not possible to interact with the software anymore.

If the digital signals are generated at high speeds (switched speed is higher than 30 Hz), then it is not possible to use the PC keyboard for this purpose since the keyboard -under Microsoft windows- has maximum input (repeat) rate of approximately 30 characters per second (30 Hz)

If the digital inputs are momentary, then there is a chance to use the keyboard as digital input module and the key-press event handler will be used. But, if the digital inputs are latching, then the key-down and key-up event handlers should be used taking in consideration that the keyboard does not support more than certain number of keys to be pressed simultaneously (this is called keyboard ghosting). The maximum number of keys to be pressed together is due to a hardware limitation and may differ from one keyboard to another because it depends on the internal circuitry of the keyboard. From ergonomics point of view, I don't expect more than 10 keys can be pressed together since the human hands has a total of 10 fingers.

Theoretically, the maximum number of keyboard keys that can be pressed together depends on the number of keyboard keys. For 101-keys keyboard with encoder having minimal number of pins, the maximum possible number of keys to be pressed together is 15 keys. This combination can be known by:

- Checking the circuit board of the keyboard
- Massive number of trials and errors. For 101 keyboard, you need to make 297,525,414,027,312,240 trials!!!

To better understand, I developed a an interactive test module to know the capability of pressing different keys together (alphabets and numbers). By trial, I figured out that the number of simultaneous keys to be pressed together depends on the keys and the order of pressing them.

In the picture shown below I could press 7 keys together (A,S,D,F,J,K,L)

In the picture below, I could achieve with assistance of my wife to press 10 keys simultaneously (she pressed only Y and U :D)

This also is an online keyboard ghosting demonstration tool from Microsoft:

Considering the keyboard a 2Dmatrix, most keyboard encoders have number of pins for columns and fewer number of pins for rows. In this case, the maximum number of combinations is almost the number of columns.

Excel VBA does not support multi-threading (parallel loops) and this means that the whole program code should be written within the event handler code.

It is preferred to set focus to non-writable or locked control, so the key press event will be tracked and no change to the user form will take place

Userfrom 3D view representation

Wednesday, October 5, 2016

Bosch cordless screw driver IXO


Bosch cordless screw driver IXO breakdown

Bosch cordless screw driver IXO battery specifications

Bosch cordless screw driver IXO DC motor specifications

Bosch cordless screw driver 3.6 V uses the following internal electrical components:
Samsung INR18650-13P battery with the following specs:

3.6 V
Charging voltage
4.2 V
1300 mA.h
Maximum current
10 A
Diameter: 18mm Length: 65 mm
45 gm

Pollin LS-380S-302 DC motor with the following specs:
Nominal voltage
3.6 V
Operating voltage
1.5-4.5 V
12.8 Watt
Stall current
5.5 A
No-load speed
11,000 rpm
11 mN.m
Motor diameter: 29 mm
Motor length (without shaft):43 mm
Motor length (with shaft):50 mm
Shaft diameter: 2.3 mm
DC motor driver IXO-Version 2 (2 609 120 260)