Tuesday, June 27, 2023

USB HID RELAY (LCUS_HID_X1) Windows software

HID Tester software for USB relay module.

Friday, June 2, 2023

Could not load file Microsoft.CodeAnalysis in VS Code

Possible fix for "... Could not load file or assembly 'Microsoft.CodeAnalysis, Version ..." 

In Visual Studio Code:
0. Switch to Terminal and go to your project folder.
Type:
1. "dotnet add package Microsoft.CodeAnalysis -v X.X.X" // make sure to add appropriate version
2. Press ctrl+shift+p, and type "OmniSharp: Restart OmniSharp"
3  Type (always like this):
   "dotnet restore <enter>"
   "dotnet build <enter>"

Wednesday, March 29, 2023

Wiring of bildge pump with buzzer and float switch


Buzzer works when pump is activated through float switch.
When pump is manually switched, it does not buzz.
(Components: Power PMOS, Power NMOS, bipolar NPN, resistors)

Link to falsad circuit simulation: http://tinyurl.com/yu6lbmbc

Saturday, May 28, 2022

Monday, March 7, 2022

Brutal chess play by white player


White is short of queen and is making a brutal come back which results in black forfeiting.

Wednesday, October 20, 2021

Coupled inductors MAXIMA code


/* ------------------------------- CUT HERE -------------------------------- */
/* Current in Primary at time t
and coupling coefficient k */

m:float(1/1000);

i1_2nd_order(R1,R2,L1,L2,E,k,t):=block(
[
PrimCurrent:float(0.0),
A:float(0.0),
B:float(0.0),
C:float(0.0),
C1:float(0.0),C2:float(0.0),
Lamda1:float(0.0),Lamda2:float(0.0)],
A:L1*L2-k^2*L1*L2,
B:L1*R2+L2*R1,
C:R1*R2,
Lambda1:(-B+sqrt(B^2-4*A*C))/(2*A),
Lambda2:(-B-sqrt(B^2-4*A*C))/(2*A),
C2: -E*A*L2/((L2*L1-k^2*L1*L2)*sqrt(B^2-4*A*C))-Lambda1*E*A/(R1*sqrt(B^2-4*A*C)),
C1: -C2-E/R1,
PrimCurrent:C1*exp(t*Lambda1)+ C2*exp(t*Lambda2)+E/R1,
return (PrimCurrent)
);

/* example */
i1_2nd_order(0.3,12.5,1.5*m,0.8,12,0.95,1.2*m);

/* ------------------------------- CUT HERE -------------------------------- */

Tuesday, June 8, 2021

Ways to write quality software (to be updated)

- Comments should say what the code does, not how it does it.

- Name your routines so that they are self-evident. The same goes for parameters.
  That way, comments' necessity is reduced.

- Keep the number of parameters small. Try not to go over four. Tree to four is optimal.

- Try not to repeat the code.

- Avoid long routines of code.

- Avoid complex conditional statements with large blocks of code. Reduce the complexity.
 

- Extract methods.
  Change long routines to few/many small ones (ca. 20 lines of code).

- Extract conditional and loop blocks of code as separate routines.

- Move related concepts closer together.
  Physically put similar parts/ideas (code that represent those) closer together.

- Reuse same parts of the code extracted earlier.

- Separate concerns/Modularity.
  Make each module (class/routine/...) do only one thing.
  Don't bloat/clog the code.  Goal is to achieve that one goal:)

- Work in small steps.
  Small changes are less prone to errors.

- When you code,try to refactor your code after every small change. Try to clean it up a bit if you can.

Remember: "Our job as programmers is to solve problems, not to write code":)

##References: 
5 Ways to Improve Your Code, https://www.youtube.com/watch?v=1KeJc6V4Jjk,

Refactoring Legacy Code: STEP BY STEP

Bertrand Meyer:Object-Oriented Software Construction:

Thursday, February 18, 2021

Parametric variables in PSPice

To add parametric variable,use PARAM part from special.olb library.
Place PARAM part. Double click it. 
Below first tab is command button "New Property...". Click it.







































Add parametric variable name and default value, click ok.
Close "Add New Property" window. Click "Apply", which is
next to "New Property...".

Next, in schematic, double click part value you want to make parametric.
I.E. for caps you can double click cap value, and type property name 
inside curly brackets, like {CapVal}.
Now, cap(s) with value {CapVal} will have capacitance you
put under (default) value in "Add New Property" window.

Sweeping is done under menu "Pspice"->New/Edit Simulation profile"->"Analysis", 
under options check "Parametric Sweep". Select "Global Parameter". Under "Parameter name:" type variable name without brackets. Under "Sweep type" select type:linear,logarithmic or value list.





Friday, September 18, 2020

Wednesday, August 26, 2020

Single pole dual throw switch PSpice model

Orcad Capture symbol plus Orcad PSpice model for
SPDT switch.

Thanks goes to HappySeeker from orcad.pe.kr

Tuesday, August 25, 2020

Harmonic Identities

Asin(x) + Bcos(x) ≡ Rsin(x + α)

Asin(x) – Bcos(x) ≡ Rsin(x – α)

Acos(x) + Bsin(x) ≡ Rcos(x – α)

Acos(x) – Bsin(x) ≡ Rcos(x + α)

R=√(A^2+B^2) ; α=arctan(B/A)

Thursday, January 30, 2020

Wallpaper fix for kb4534310

This might work for all of you, with missing wallpaper.
Should work with stretched option as well.
Browse for image in question that you want to use as wallpaper.
Open it using Windows Photo Viewer. 
Right click on the opened image and click on "Set as desktop background".
That's all.

Microsoft released a fix for it, KB4539602 .

Thursday, January 23, 2020

Some Integral Formulas

\[\int\limits_a^b {\frac{{f(x)dx}}{{f(a + b - x) - f(x)}} = \frac{{b - a}}{2}} \]

\[\int {{e^{ - (a + bt)}}} *\sin (wt + c) =\\  - \frac{{{e^{ - (a + bt)}}*\sin (wt + c + \arctan \frac{w}{b})}}{{\sqrt {{b^2} + {w^2}} }}\]

Tuesday, November 12, 2019

Monday, November 11, 2019

Monday, August 19, 2019

How to fix driver installation problem "The system cannot find the file specified"

When installing driver under windows one might get error message
"The system cannot find the file specified".

Note: This comes often when installing ADB drivers. In this case it can
be because  winusb.sys file is missing from %SystemRoot%\system32\drivers
and/or %systemRoot%\INF folder. If you are missing winusb.sys from these
folders,search for this file inside %SystemRoot%\ . In case of multiple hits, take the
one with the latest version and copy it to above folders. (All found files will
probably be the same.)

To find the root of the problem open %SystemRoot%\inf\setupapi.dev.log
or setupapi.dev. Now, search for strings like "error","file",
"The system cannot find the file specified", "0x00000002" (Error code for missing file).

Read thru the .log file carefully and look for errors and path/files
referenced.

Keywords: driver installation, failed, adb, install, file not found, Android
"The system cannot find the file specified"

ADB driver install problem