Jump to content

Banner.jpg.b83b14cd4142fe10848741bb2a14c66b.jpg

Could someone help me with some electronics please?


JamesF

Recommended Posts

Related to another current thread of mine, though it's probably not necessary to read it:

I'm trying to understand how the electronics work so I can determine whether the reed switch is normally open or normally closed and replace it with the correct type.  Whichever type it is, it is used to generate pulses as a magnet passes it on a random basis.

I've spent a happy few hours chasing stuff around the circuit board and I think the relevant bit of the circuit is this (in proper engineering fashion, it is genuinely on the back of an envelope):

rain-gauge-08-rotated.jpg

"OUT" goes to the input of a 1-wire counter that counts hi-to-low transitions of the input.  I think the capacitor is just because 1-wire uses parasitic power.  That is, the supply voltage is actually taken from the data line (which may be connected to ground during signalling) and the capacitor just acts as a rechargeable battery when required.

So I'm thinking that if Vin is 3V and S₁ is open, the transistor's base is at 3V, and OUT is also connected to 3V.  If S₁ is closed then 3V is divided across the two resistors, leaving the base at about 0.64V.  That's probably not enough to cause the transistor to conduct though I don't imagine it's that far short, meaning OUT is 0V.  Which in turn means that closing and re-opening a normally open switch will generate the required hi-to-low leading edge transition for the counter.  Regarding the voltage, there is a 3-pin SMD package on the circuit board that I think may be one or more zener diodes.  The package is labelled L43 and there are no other clues, but perhaps they might be working as a voltage regulator to make sure Vin is not greater than 3V?  And perhaps even if the transistor does conduct a little, it may not cause a sufficient change in voltage to register as high at the counter input?

Opening and then closing a normally closed switch would generate a hi-to-low transition on the trailing edge of the pulse I guess, the difference being that the input would float low rather than float high.  Perhaps there's something about that in the DS2423 datasheet.

Does that sound sane?

James

Link to comment
Share on other sites

That's a wierd circuit. However, your transistor logic is the wrong way round - it's a pnp. With S1 open, the base is held at 3V (supply) via 10k, so it does not conduct. Hence the output is at 0V via the 1-meg resistor (strangely high value?). If S1 is closed, the base drops to (47/(10+47))*3=2.47V. That leaves 0.53V across the base-emitter junction, hardly going to turn it into full conduction to give 3V at "out"? Are you sure the bias resistor values aren't the other way around?

Unless I'm missing something! (It's late being my excuse).

Edited by wulfrun
  • Like 1
Link to comment
Share on other sites

It's entirely possible I have it wrong as it's not at all clear where some tracks go.  I'll have another look.  I'm fairly sure about the 1M resistor though.  It's an SMD resistor with "105" printed on top.  That's 10x10⁵ ohms, isn't it?

James

Link to comment
Share on other sites

Ahhh, I wonder if there's something more complex going on here that I'd not got my head around.

I'm assuming 3V because there was a 3V battery used, but I wonder if that isn't sufficient to trigger the transistor, yet is sufficient to keep the counters valid in the counter chip.  So should there be a long-term loss of power from the data bus, no more pulses could be counted, but those already counted would not be forgotten.  Perhaps given that 3V button cells are easy to fit into small spaces the designers decided that not losing historical data was desirable whilst not missing data during a power outage was too much of a pain to do.

If the data bus/Vin were at 5V (which may be possible), then with the switch open the base would be at 5V and the transistor would not conduct, so the output would be 0V.  With the switch closed the base voltage would be about 0.88V, I think.

Thanks for pointing out that I'd forgotten how PNP transistors work, btw.  I'd completely missed that :)

James

  • Like 1
Link to comment
Share on other sites

9 hours ago, JamesF said:

Thanks for pointing out that I'd forgotten how PNP transistors work, btw.  I'd completely missed that :)

I often find it difficult to visualise. Mentally, I turn the circuit upside-down, so that "ground" is the real positive supply and now I have an imaginary negative "power rail".

Link to comment
Share on other sites

Going back to your original question, I'd say the reed switch is normally open as that would consume less power. When the bucket tips, the reed switch will be activated and then immediately de-activated when it empties, so you will get both a high going edge then a low going edge (which will be counted) at the output. The circuit will work with either a normally open or a normally closed reed switch but normally open will consume less power.

The most common issues with reed switches are mechanical, so whether they are positioned just right to be activated by the magnet, and activated reliably (there may be play in the mechanical arrangement that means the reed is sometimes not activated).

What surprises me is that they didn't just put the reed switch where the transistor is and then dispense with the rest of the circuit apart from the 1M resistor!

 

 

Edited by PeterC65
typo
  • Like 1
Link to comment
Share on other sites

8 minutes ago, PeterC65 said:

What surprises me is that they didn't just put the reed switch where the transistor is and then dispense with the rest of the circuit apart from the 1M resistor!

That's pretty much what the Dallas version of the same unit does.  I don't understand why there's the additional complexity for this one either.

James

Link to comment
Share on other sites

I've had a fun evening playing with KiCad, and this is what I've come up with for the full circuit diagram of the board.  I can't deny that it's something of a mystery as to why there's a resistor labelled "R4" when I can only find three of them.

TAI-8575.png

I should have designed the DS2423 part so that pin 1 was on the bottom, pin 2 on the top and pin 4 moved to the left side.  It would have looked neater.  Never mind...

The connections on the left are data and ground on the 1-wire bus.  Those on the right are just a couple of pads on the PCB that would allow a second switch to be added for testing I think.

I've realised that the reason the 3V battery only keeps the memory in the DS2423 alive and doesn't allow the counter inputs to work is because the power for the counter input circuitry is taken parasitically from the Data line inside the chip, so if the 1-wire bus loses power then there can be no power for the input circuitry.

James

Link to comment
Share on other sites

The resistor may be labelled R4 because in an earlier version of this design there may have been an additional resistor that has since been removed. It's normal not to renumber components so that the references remain valid across circuit revisions.

The 1-wire interface and unique ID ROM sections of the DS2423 are powered parasitically from the data line anyway (inside the chip). The dual Schottky diode on the left of the circuit is intended I think to parasitically power both the DS2423 (the rest of its internal circuitry) and the input circuit in preference to the battery so as to preserve battery power. The idea I think is that the data signal charges C1 to above 3V which reverse biases the lower Schottky diode and means that power to the DS2423 and the input circuit is provided by C1 rather than the battery. The battery just provides power when there is no activity on the data line. It should provide enough power for both the DS2423 and the input circuit and if that isn't the case then something is wrong (the battery may be on its last legs).

 

Link to comment
Share on other sites

I think I may have had my original description of how I think the circuit works back to front (well it was late after a long day !)

The transistor is switched on when NO CURRENT is seen on its BASE.  With the reed switch open (as most are made that way) CURRENT is not flowing as the voltage through R4 has no path to GND.  With the transistor turned on a circuit is formed using the  Emitter / Collector (in reverse BIAS action so the transistor acts as a switch rather than amplifier) and 1M ohm resistor, so inputs A/B are both held HIGH.   When  the reed switch is closed a circuit is made as CURRENT flows through R4 and R3, which in this arrangement form a voltage divider to GND.  With CURRENT detected on the BASE of the transmitter the transistor being PNP is turned OFF, and inputs A/B are tied LOW via the 1M resistor.  When the reed switch opens once more, the lack of current on the base once again turns the transistor on, and the inputs are taken HIGH once again.  This would comply with the DS2423 data sheet where a count is registered by falling triggers, ie from HIGH to LOW.

Now if the reed switch is one of those N/C type the reverse would happen,

But whether the reed switch is normally open or normally closed  us irrelevant as you would still get a change of state on the inputs A/B, they would still see a HIGH to LOW transition. 

Link to comment
Share on other sites

I think that's consistent with my understanding at this point, Malc.  Hopefully I should have some new reed switches arriving today and with a bit of luck I might find the time to reassemble everything and test it over the weekend.

James

Link to comment
Share on other sites

Used as switches, NPN transistors allow current to pass from the collector to the emitter when around +0.6V is applied to the base relative to the emitter, and PNP transistors allow current to pass from the emitter to the collector when around -0.6V is applied to the base relative to the emitter. What matters in switching applications is the voltage at the base.

In the circuit above, when the reed switch is open, the base and emitter are both at the supply voltage, the transistor is switched off, and the collector and DS2423 count inputs are pulled to ground by the 1M resistor. When the reed switch is closed the base voltage is pulled down to 10 / (10 + 47) of the supply voltage. When power is supplied from the battery this is about 0.5V which is not enough to switch on the transistor so the count inputs stay at ground. When power is supplied parasitically from the data signal it will be 0.6V, the transistor will switch on, pulling its collector and the DS2423 count inputs to the supply voltage which gives a rising edge that is counted.

As I mentioned previously, when the circuit is supplied with power parasitically from the data signal the supply voltage must be higher than the battery voltage in order to reverse bias the Schottky diode connected to the battery. So the transistors base-emitter voltage is just enough to switch it on when the circuit is powered parasitically but not when it is powered by the battery. In either case the supply power is enough for the DS2324 to function and this explains why the DS2423 continues to store data but doesn't count when it is supplied only from the battery.

So now we know why the transistor is in the circuit. The battery is permanently connected (I assume) so when the circuit is inactive you want it to consume as little power as possible. It's inactive when there is no data signal. When that's the case the DS2324 will consume only minimal power as it isn't doing anything, but you don't want it to receive any input edge transitions either as counting them will cause it to consume power. The transistor ensures there will be no edge transitions even if the reed switch is triggered, because it will only switch when the circuit is powered from the data signal and is therefore active. The 1M pull down resistor is also that large in order to minimise the current flowing through the DS2324 inputs and therefore minimise its power consumption.

I love circuits like this! They look simple but when you really analyse them they are very cleverly put together, with the absolute minimum of components all very carefully specified.

Link to comment
Share on other sites

1 hour ago, PeterC65 said:

In the circuit above, when the reed switch is open, the base and emitter are both at the supply voltage, the transistor is switched off, and the collector and DS2423 count inputs are pulled to ground by the 1M resistor. When the reed switch is closed the base voltage is pulled down to 10 / (10 + 47) of the supply voltage. When power is supplied from the battery this is about 0.5V which is not enough to switch on the transistor so the count inputs stay at ground. When power is supplied parasitically from the data signal it will be 0.6V, the transistor will switch on, pulling its collector and the DS2423 count inputs to the supply voltage which gives a rising edge that is counted.

 

That's really interesting, and effectively the reverse of how I thought the circuit worked.  The confusing thing for me was that the datasheet stated that the counter would trigger with a negative edge, and the transistor was current sensitive rather than voltage, which threw me.  But what you describe makes sense as you would want to have a device that is as frugal on power as possible so it makes sense to have the transistor turned off in its wait state rather than powered and wasting battery..

Link to comment
Share on other sites

17 minutes ago, malc-c said:

The confusing thing for me was that the datasheet stated that the counter would trigger with a negative edge, and the transistor was current sensitive rather than voltage, which threw me. 

Which edge the counter triggers on doesn't matter as it sees short pulses which have both rising and falling edges.

Transistors are current sensitive, the collector current is a fixed multiple of the base current, but the multiple is so large that working with currents isn't useful. Instead circuits for switching and even for amplifying configure transistors so that it's the voltages that are important. For switching circuits if the base-emitter voltage is 0.6V then the transistor is switched on, if not then its switched off, and the base-emitter voltage won't go above 0.6V (if you try to drive it higher via a low impedance then you will just blow up the transistor). For amplifier circuits the gain is determined by resistor values only and not by any characteristics of the transistor used.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. By using this site, you agree to our Terms of Use.