## LCR-T4 transistor tester original firmware

Bought cheap transistor tester from eBay and currently experimenting with firmware updates.

I was able to program it with this version of Markus transistor tester firmware:

https://github.com/svn2github/transistortester/tree/master/Software/trunk/mega328_T4_v2_st7565

To build, use a WinAVR programmers notepad, open Makefile and select Tools->Make all.

At first, was getting weir errors, but after adding msys-1.0.dll to \WinAVR-20100110\utils\bin everything built ok.

Before doing firmware experiments, I have made backup of original firmware, if somebody needs it, you can download it here:

Code

Data

Config

I tried to reflash original firmware and it worked fine.

For programming I use my MiniPro programmer.

## Modify Arduino 5v relay module to work from 3.3v

I am implementing a power-off function for my Ender 3 using OctoPi. For that, I need a relay and I happened to have one.

Unfortunately, after connection relay to Raspberry Pi GPIO pin, the relay was always on and not listening to any commands from OctoPi.

It appears this module was designed for 5v logic levels and Raspberry Pi works with 3.3v logic levels.

After investigating relay one can see that its circuit is:

For JC817C forward voltage Vf=1.2V and forward current If=20mA

For Raspberry Pi output high (when VDD is 3.3V) is VO=2.3V 17mA

So, it seems that the output of Raspberry Pi is not enough to drive JC817C.

To solve this I decided to remove optocoupler from the module and connect the input pin directly to Q1 transistors base.

To connect the output pin to a transistor you should limit output to appropriate current. You can do that by choosing the appropriate resistor value.

I calculated it like that.

From S8050 (J3Y) transistors datasheet:  DC current gain hfe ~ 120

From relay datasheet: Rrelay=70Ohm Vrelay=5V so calculated Irelay=Vrelay/Rrelay=5/70=71mA

Let’s choose Ic=100mA

To turn it on, we must have ~ Ib=Ic/120=100mA/120=833uA ~800uA

Vbe usually is ~0.7V

R9 voltage would be Vr9=Vinput-Vbe=3.3V-0.7V=2.6V

R9=Vr9/Ib=2.6V/800uA~3.2K

So I chose 3K resistor.

## Learning the Art of Electronics, Week 2

2L1.1

Ok, I  form a simple low pass filter using unknown RC values.

Then I measure time constant using scope and 500Hz square wave. Time constant is a time it takes for a voltage to reach ~63% of its total value.

Measured time constant using RIGOL DS1054z is 0.268ms

( measured using manual cursors: I set Percent for Vert. Units, then Set range of the wave with vertical cursors and then measure time to rise to ~63% (bx-by) )

Measured time constant using Tektronix 2221A is 0.270ms

( I position the wave from 0 to 100% and then using cursors get ▲T for ▲V to reach 63.2% )

t = RC

Now I need to find R. And task is to measure R without removing C.

We can do that by imagining that RC is just R, but we have to eliminate XC. We can do that by increasing frequency unti we get no phase shift. The higher the frequency the less XC there is. We can see that XC is not effective anymore when we see no more phase shift.

I add a known 1K resistor in front of RC filter.

Apply sine wave and increase frequency to such that there is not phase shift – it means we are now observing R and not Xc ( Xc ~ 0 ).

In scope I see input 5.12v and output 4.12v.

Using Ohms law: we loose 1V on R1 so current is 0.001A.

Knowing the current I calculate R2 and it is R2=Vout/I=4/0.001=4K

So R2 is ~4k

0.270ms = 4k x C

C = t / R = 0.270ms / 4k ~ 68nF

Actual values were 3.7K resistor and 683 capacitor (68nF).

2L1.2 Differentiator

Yellow input, blue output. Differentiator shows rate of change. We can examine it by applying sine, square and triangular waves to the input.

Especially it is seen by applying square wave. On rising edge or falling edge rate of change is very high.

On triangular wave rate of change is constant, just different directions so on the output we get square wave.

Its a high pass filter, so at f=0 impedance should be infinite, and at infinite f there should be no impedance, or impedance should be minimal.

2L1.3 Integrator

2L2 Frequency domain view

2L2.1 Low pass filter

I made such low pass filter:

By changing frequancy I found when the output voltage is attenuated by 3db i.e. is 0.7 of its original value. That frequency was 160Hz

Calculation confirms that f3db = 1 / (2×π×10k×0.1uF) = 159Hz

Result at 10 x f3db

Result at 20 x f3db:

Result at 2 x f3db:

Result at 4 x f3db:

Voltage vs f, the higher frequency the bigger attenuation.

2L2.2 High pass filter

f3db should be the same: f3db = 1 / (2×π×10k×0.1uF) = 159Hz