Electronics > Projects, Designs, and Technical Stuff
Current sense circuit customisation
<< < (3/4) > >>
danners430:
Doing a little more research, I had an idea (dangerous, I know. The fire brigade have been informed  ;) )

If I were to use a cheap and cheerful 1:50 toiroidal transformer (for example RS Components 173-0041), and fitted a 50k potentiometer across the secondary winding, then I'd get 1V out at 1mA, which I believe is a common "idle" current draw for a stationary locomotive with no functions activated. Coupling this to a MOSFET with a suitable threshold voltage, I'd have a simple logic output for my microcontroller. Adjusting the pot would adjust the sensitivity.

Obviously, I'd still keep the clamping diodes to prevent the voltage falling below -0.3V or above 5V to protect the FET.

In theory, and in my mind (which almost in itself invalidates the theory...  ;) ), this should work equally well, but use a minimum of components. Would you agree that this would work, or have I made a flaw somewhere? (not uncommon for me!)
fourtytwo42:
Your maths work fine BUT you must consider what will happen when the track is short circuited! I believe some DCC equipment will deliver 2 amps or more making the secondary current >=80mA and that must be dealt with by the overvoltage device protecting the FET gate (e.g. Zener). IMOP you don't really need the fet, just connect the PROTECTED output of the CT directly to the microcontroller!

The second problem comes from your very high sensitivity of just 1mA to operate the detector, it is likely at that sensitivity just the track and wiring capacitance will cause a phantom signal especially at the edges of the square wave so some filtering may be required. It might be an idea to try measuring the idle loco current yourself :)

Finally due to the switching nature of the DCC current the signal to the microcontroller will not be continuous, as the detector is unipolar but DCC is bipolar the signal will be a 50% duty cycle square wave. Again filtering could resolve this problem depending on the response time you require or you could rectify the output of the current transformer.
t1d:

--- Quote from: fourtytwo42 on November 06, 2018, 05:27:20 pm ---Finally due to the switching nature of the DCC current the signal to the microcontroller will not be continuous, as the detector is unipolar but DCC is bipolar the signal will be a 50% duty cycle square wave. Again filtering could resolve this problem depending on the response time you require or you could rectify the output of the current transformer.

--- End quote ---
You might be able to work-around this issue, by programming the MCU to test the signal, by taking samples over a period of time? I am new to programming...
rs20:
Yeah, that's a good idea danners, definitely worth breadboarding. I also agree with fourtytwo42 that the MOSFET isn't contributing much; I'd start by feeding the protected signal directly into the MCU. If you're scared of hurting your MCU and want a visual or oscilloscope output, or don't want to code yet, just use some similar logic-level input (buffer, inverter, NAND gate) as a subsitute.

So referring to the circuit diagram, I'd have R1, R2, D1, D3 and R11 in place. Then, the MCU's digital (or analog) input can go directly where U1A is. To add adjustability, I'd add P1 in series with R2, or add it in parallel to D1. Just make sure that D1 and D2 can handle the worst case current (as pointed out by fourtytwo42), build it up on a breadboard, and try it out!

Be wary of this though: D3 will allow a certain amount of charge to flow up to the +5V rail every cycle of the DCC, in other words, it will be pumping a certain current up into the +5V rail. This means that C3 is essential for a start, but it also means that if the other circuitry running off that 5V rail isn't consuming a large amount of current, and if the 5V PSU doesn't support sinking the excess current away, the 5V rail could start rising out of control. This might be a non-issue, or might be something that deserve further protection circuitry (which could be a simple as a big ol' resistor from 5V to ground); only time and/or details calculations will tell. To be fair, this might be an issue with the original circuit, so  :-//

By the way, what I'm suggesting is basically exactly the same as what you're suggesting, just to be clear. Your 50k pot would be R2, and R1 + R11 are both just current limiting resistors that can be 10 - 100kiloohms each. You can also try adding a tiny capacitor where C1 is, which would keep noise under control.
danners430:
That seems like a sensible idea - I suppose to get around the bipolar nature of the signal, I could run both feed wires to the track through the transformer?

Sent from my ONEPLUS A3003 using Tapatalk

Navigation
Message Index
Next page
Previous page
There was an error while thanking
Thanking...

Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod