Simple block detector - zero loss

Post Reply
Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

Simple block detector - zero loss

Post by Richard-TX » 13.02.2014, 15:25

I finally had a chance to get back to prototyping and discovered something quite interesting about current transformers.

- Not all current transformers are the same.
- When used as a current -> voltage transformer, the load impedance has to be quite high.

To raise the signal to TTL levels takes a fair amount of amplification. Since I am using a ADC to read the levels, a simple diode and a capacitor is all that is required.

Since the ADC is a high impedance device, the voltage levels can be quite high so the output has to be clamped to prevent damage to the ADC.

The interesting part is that with a little programming, it can be determined with a fair degree of precision, how many cars are in a given block. When a loco is also in a block that nullifies that car count due to the load being rather large and also variable. To get a good ADC value with a 10k ohm load, a simple LED takes the levels to almost full scale. To prevent damage to the ADC, the input levels have to be clamped. I chose a zener diode as a solution.

For those that want to experiment on their own, here is the parts list and approximate cost in USD for a 4 block device. I did not include prices for the passive components because the prices vary so widely based on quantity purchased.

1 - PCF8591 - $2 Either chip or board
4 - Murata 56100C transformers - $1.60 each
4 - 1N4148 diodes
4 - 1.0M ohm resistors
4 - .1 - .47 bypass caps.
4 - 3 volt zener diodes
2 - 10k ohm resistors (I2C pullups)


The circuit is so simple it it almost stunning.

The output of the transformer is half wave rectified and filtered by the bypass cap. The 1 meg ohm resistor provides a minor load so that the voltage produced by the diode will fall off in a reasonable amount of time. Without the resistor, the leakage is so small that it takes at least 5 seconds for a modest amount of detected voltage to drop to zero.

Since the current is so small, a plain zener clamps the voltage to just below maximum for the ADC.

To lower the sensitivity, decrease the value of the 1.0m resistor. To increase, raise to 2.0m or wrap another turn through the transformer.

Since the PCF8591 has a DAC on-board, the clever experimenter could use that to make the circuit auto-ranging. Not unlike a DVM.

There may be other issues that arise when placed in a layout such as induced noise, so the addition of a .001 filtering cap may be needed.

I will post a schematic later.

Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

Post by Richard-TX » 13.02.2014, 15:59

Here is the schematic.

As a note use only the Murata transformer specified.

A 50:1 transformer could be used but the sensitivity will be 1/2 of the 100:1 transformer that is specified.

All tests were with one turn of wire as the primary side of the transformer.
You do not have the required permissions to view the files attached to this post.

Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

Post by Richard-TX » 14.02.2014, 04:30

The amount of precision when calculating cars goes beyond the range of the 8 bit ADC quickly so it winds up being accurate for up to about 6 cars.

The zener voltage rating should be about 9 volts due to the zener knee effect. I will come up with a part number. If you have some 3 or 3.3 volts zeners around, 2 or 3 in series seems to work great.

Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

Post by Richard-TX » 15.02.2014, 00:57

For those that want to use Dip chips, the PCF8591 chips are about $0.75 each in lots of 20 on ebay.

rjversluis
Site Admin
Posts: 42363
Joined: 10.04.2006, 08:48
Location: Speyer, Germany
Contact:

Re: Simple block detector - zero loss

Post by rjversluis » 16.02.2014, 12:45

Hi Rich,

I suggest to use a micro processor with analog and digital I/O which you can program to scan the analog inputs and report it on the digital output.
This board can be directly connected to a Pi02.

Detecting how many cars seems to me impossible because you never can tell how much the loco engine, lights and steam generator is drawing from current.

The fact is that the DCC signal will generate spikes in the coils and therefor the analog inputs must be scanned continuously to be able to detect anything. This is no go on the I2C bus.

Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

Re: Simple block detector - zero loss

Post by Richard-TX » 16.02.2014, 15:27

I could detect no spikes on my Tektronix scope likely due to the bandwidth of the current sensor-transformer. If a single spike were to get through , the cap will shunt it to ground.

Polling the devices just like you do with the MCP23017 ports is acceptable. If an interrupt driven solution is needed, then I might as well clone the NCE BD20, use MCP23S17 and use the interrupt capabilities of the chips.

I will be testing it under the layout later today. If all looks good, then it will be time for the Pepsi Challenge. :D

If just cars were in the block and just a few, then a count is possible, As soon as a loco is involved, a car count is impossible due to the heavy and varying load of the loco.

Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

Re: Simple block detector - zero loss

Post by Richard-TX » 16.02.2014, 16:00

Here is what NCE used to do for their BD-20. Note that when the base and collector of a transistor are tied together, that effectively converts a transistor into a diode.

The reason NCE dropped this design is cost. The MPQ2222 is now about $2.50 - $3 each in lots of 500pcs.

Image

I have no idea why NCE went with a MPQ2222 other than for ease of assembly at the factory. I could likely clone this circuit with a 2N2222 and a few 1N4148 diodes. The relay connection is not needed.

Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

Re: Simple block detector - zero loss

Post by Richard-TX » 16.02.2014, 16:31

The second reason why I am not concerned about voltage spikes is that this is a current transformer. Unless current is flowing through the primary, little to nothing gets to the secondary thus there is nothing to rectify (in theory). High frequency noise would be minimal due to the relatively high inductance of the transformer's secondary which is 100 turns. Since there is an air gap between the DCC rails and the ADC, opto-isolation is not needed. The Zener diode should shunt any potential damaging voltages to ground.

I am going to the laboratory/hobby room to do some more experiments... :twisted:


Richard

rjversluis
Site Admin
Posts: 42363
Joined: 10.04.2006, 08:48
Location: Speyer, Germany
Contact:

Re: Simple block detector - zero loss

Post by rjversluis » 20.02.2014, 15:07

Hi Rich,

Peter will also experiment with this solution; We'll keep you informed.

Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

Re: Simple block detector - zero loss

Post by Richard-TX » 20.02.2014, 15:49

I am coming up with a TTL compatable version for use with a MCP23017 I-O port.

I should have a working prototype soon.

There are many zero-loss designs out there, the trick is to make a circuit that is reliable, easy to build, and requires a minimal amount of parts.

Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

Re: Simple block detector - zero loss

Post by Richard-TX » 20.02.2014, 17:03

Here is a ttl version. I made this as simple as possible for the hobbyist.

The transistor is a 2N3904
You do not have the required permissions to view the files attached to this post.

Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

Re: Simple block detector - zero loss

Post by Richard-TX » 20.02.2014, 17:19

It may be possible to drop the zener diode in the TTL version. I am concerned that the base voltage of the transistor would be exceeded thus destroying the transistor. That simple diode rectifier can produce some rather high voltages depending on the amount of current flowing through the primary of the transformer. I have seen over 6 volts being generated with about 60ma of current.

The MCP23017 input impedance is pretty high which is a good thing.

I might be able to drop the 1m resistor as well due to the input impedance of the transistor.

Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

Re: Simple block detector - zero loss

Post by Richard-TX » 21.02.2014, 04:13

A possible substitute for the 2N3904 would be a 2N7000 MOSFET.

Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

Re: Simple block detector - zero loss

Post by Richard-TX » 21.02.2014, 18:30

The question has been raised which is "Why use an ADC?" There are two reasons.

1 - When all of the I-O port expanders have been used, this allows a person to add more detectors.
2 - It adds the possibility of differentiating between cars or locos occupying a block.

I think that by using the onboard DAC, a sensitivity adjustment (threshold adjustment) via software is a possibility for the TTL version. That way detecting very low current levels would be possible.

The way that the circuit works is that the transistor gets turned on when the base voltage reaches .6 VDC. If the rectified voltage from the current transformer does not reach that level due to a small current load, then a little bit of biasing is needed to make the transistor trigger threshold a little lower. The software would be a little more complicated as each biasing level could be different for each ADC input.
You do not have the required permissions to view the files attached to this post.

Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

Re: Simple block detector - zero loss

Post by Richard-TX » 22.02.2014, 14:33

Here is a manual adjust version for the TTL zero-loss detector.

A 10 turn potentiometer (Bourns Trimpot) is recommended.
You do not have the required permissions to view the files attached to this post.

Post Reply

Return to “DIY Hardware”