EEVblog Electronics Community Forum

Electronics => Projects, Designs, and Technical Stuff => Topic started by: Justin_ on March 30, 2022, 02:42:59 pm

Title: Why is this 3901 transistor not always triggering (o-scope photo)
Post by: Justin_ on March 30, 2022, 02:42:59 pm
Hey guys, im helping somebody out with an '01 Miata. The anti-theft they have is starting to die and they need a replacement to keep the car going. Fortunately the anti-theft is not that hard to emulate and somebody had already done the research https://forum.miata.net/vb/showthread.php?t=504294 . Ive been following the work from Alcantor with the circuit as follows, my issue is with Q1

 * DATA Line
 * Bus = Line between Immobilizer and PCM (Red/Black wire).
 *
 *  Bus              RX_INV_PIN
 *   |                     | c
 *   |      R1          /
 *   +----/\/\/\----| b  Q1
 *   |                    \
 *   |                      | e
 *   | c                 GND
 *    \         R2
 * Q2  | b ---/\/\/\--- TX_INV_PIN
 *    /
 *   | e
 *  GND
 *
 * R1 = 150kohm
 * R2 = 1.5kohm
 * Q1/2 = Any NPN Transistor (BC547)
 *
 * It's a bus with 1200 bits/s, 1 start bit followed with 8 data bit.
 * Need 7.5 mA to pull down the bus. (40 mA on ATtiny)

I ended up using 3901 transistors as that is what was on hand.
I also used 100K and 1K resistors respectively.

The Problem:
    When I start the car as normal things work fine.
    When I start the car while it is on a battery charger things don't work (o-scope)
    There are also some other conditions that I haven't nailed down that will make the car not start.

[attachimg=1]

I've tried scoping out the micros power line (regulated down to 5V) and it seems to remain stable when starting the car. Still, I also tried adding a capacitor, and that made no difference.

When the charger is connected there is a bit of AC noise on the line, but the line still comes down to ground and remains there.


Im really not sure what is going on here and I am hoping somebody can take a look at the photo and recognise "Oh, that's the such and such effect". While I have done a few projects with arduinos and such im not well versed in the actual operation of components like this.
Title: Re: Why is this 3901 transistor not always triggering (o-scope photo)
Post by: moffy on March 30, 2022, 03:12:49 pm
Couple of thoughts:
1. Do you have a pull up resistor connected to RX_INV_PIN, say 10k. You might be picking up noise.
2. The base resistor looks a little large, noise susceptible, perhaps if you place a small capacitor between the base and emitter of Q1, say 47pf, it might solve the problem.
Title: Re: Why is this 3901 transistor not always triggering (o-scope photo)
Post by: strawberry on March 30, 2022, 04:00:22 pm
DTC114
Title: Re: Why is this 3901 transistor not always triggering (o-scope photo)
Post by: inse on March 30, 2022, 05:28:17 pm
The bus voltage is not going down to 0, possibly the voltage is sufficient to keep Q1 on.
Add a pull-down from base to GND.
Title: Re: Why is this 3901 transistor not always triggering (o-scope photo)
Post by: T3sl4co1l on March 30, 2022, 05:35:52 pm
Try a B-E resistor, say 10 to 100k, on Q1.  A problem is, if the bus pulls down to ~0.5V when low, Q1 will only barely turn off, and quite slowly at that (not nearly slow enough to matter at this baud (~20us), but something to keep in mind for other applications).  If the bus is driven by other weak drivers, or say Darlingtons that hardly pull below 0.7V anyway, you'll get a poor logic threshold this way.  Or if there's significant voltage drop between your circuit and whatever's driving the bus; which doesn't need to be much (~0.5V), especially under starting conditions (100s A flowing through the steel chassis).

The B-E resistor ensures two things:
- The B-E junction stores some charge; if left floating, it does eventually turn off, but it takes a while (~20us).  Same is true for a high resistance to a marginal "low" voltage.  There is also more leakage current with it floating (but this shouldn't matter with a modest value pull-up on its collector).
- Driving the base from a resistor divider like this, shifts the voltage threshold up, from ~0.6V to somewhere closer in the middle of the bus voltage range, say 3-6V.  So, using a 1:4 to 1:9 ratio would seem ideal here.

This does reduce base "on" current slightly, but the "forced" or "saturated" hFE should be more than low enough not to matter (i.e. Ic/Ib ~ 10, even 50 is likely fine).

Note that the MCU pin drives low pretty solidly (CMOS switch) -- effectively Q2 already has a ~1.05k B-E resistor.  Which isn't ideal for the (5V?) drive it's given, but it's absolutely still going to work for this. :)

Tim
Title: Re: Why is this 3901 transistor not always triggering (o-scope photo)
Post by: moffy on March 30, 2022, 06:33:15 pm
T3sl4co1l with a B-E resistor makes more sense, and would explain why when the battery charger is on you have problems, the battery charger raises the overall battery voltage at start.