Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
Can you see how it would work if you put a 500Ω resistor from the MCU input to ground? Try working out the voltages when the different switches are closed.
I will rather modify the picture, cause, there is no MCU.
Just 4-position switch with added resistors to each position, and the output of the witch is single wire. And I need a device with four outputs which will recognise, which position was switched. I dont want it done with MCU, cause I dont have any experience with it.
In that case, I'd say a quad comparator, or a quad opamp as a comparator. Each comparator has a voltage threshold, say 2V, 5V, 8V. and 10V... the inputs to the comparators are tied together, along with a resistor to ground. Using your switching resistors, you're creating a voltage divider, with the switched resistors being the upper res, and the resistor from the input to your comparators to ground being the lower.
So, if you switch to position one in your diagram, yoru switch line connects to 12V. This is above all the thresholds and so all outputs will be active. If you only want one output active at a time, you will need to use feedback to create a 'majority vote' type circuit.
I can provide a diagram if you wish, but its just a lot of resistors really
Yes! that'll work, a window comparator that outputs a high if the input voltage is within range.
I came up with a quick one using 4 comparators, a few transistors and diodes. Essentially, its a 4 level comparator - the tough part is decoding the output so instead of it being 0001, 0011, 0111 and 1111, its 0001,0010,0100,1000. Mines a bit complicated..... and I drew it in LTspice, which is great for simulation of analogue, but not so clear for basic schematics, or digital stuff.
You might be able to do it with 4 comparators, and perhaps a couple of diodes. Creating two digital lines, which go into a 2-4 decoder (like the 74HC139).
But probably the smallest and quickest solution is the LM3914:
- I need the output voltage the same as input = +12V
So which one do you consider most suitable for my needs?
does the windows comparator output voltage is the same as input? I need two comparators for each output, right? So I need 2 quad camp, for example LM239???
Yes, you can omit the RV, your input will go straight into both comparators. It will behave the same, as the inputs to each comparator are still connected together, the only difference is that instead of RV supplying a variable voltage, your switch is doing so.
I suggest you read up about comparators, and also voltage dividers. **broken link removed**
**broken link removed**
The trouble with an all-analgue project like this is you have to decide the value of every resistor Of course absolute value is not critical, but the value relative to other resistors in the circuit is!
If you have say, two resistors in series, connected from 12V to GND (0V). If they are the same value, then the voltage at the connection between them will be half of the supply voltage, or 12/2 = 6V. If you use 2 10ohm resistors, then total resistance is 2 x 10 = 20ohm. V=IR, I = V/R, with 12V across 20ohms = 0.6A will flow. Thats 600mA. This current is far too high for this circuit (resistance too low) and it doesn't need hardly any current to flow as the inputs to the comparators draw nA (thats nanoamps). So 20ohms = too low. But at say 10Meg, so little current flows that noise can interfere with operation. Generally, I use 10k-100k as starting values, and calculate the other resistor values based on that.
It is your project, and up to you to do all the maths
Still dont know how to calculate R1, R2, R3 resistors for voltage dividers.
If it would be 2 resistor on single rail, i would knew, but three.... dont know. And didnt found any calculator, or formula.
V reference 1 = ?
V reference 2 = ?
Or to create 2 separate voltage dividers (i know it would be one resistor more)
- R1, R2 with voltage divider connected to positive of IC1A
- R3, R4 with voltage divider connected to negative of IC1B
But if there is formula for how to calculate resistors for voltage divider with three resistors, it would be best.
- R1 vs (R2+R3) and (R1+R2) vs R3 and caluclate it as two single dividers?
Calculating the voltages at the points between R1 and R2, then at R2 and R3 just involves treating R1 and R2 as a single resistor - or treating R2 and R3 as a single resistor. SO say R1 = 5k, R2 = 8K, and R3 = 3k. R1 connected to GND< and R3 connected to VCC.
Total resistance = 5+8+3 = 15K. The voltage between R1 and R2 = VCC* (R1/(R1+R2+R3)). The voltage between R2 and R3 = VCC*(R1+R2)/(R1+R2+R3).
As you're usnig this for a 'window', it would be best to pick a specific voltage, or rather a fraction of your power supply voltage (12v) and then set your window above and below this. Example, 4V. The window is centred at 4V, but you want between 3V and 5V for a bit of space. So VCC = 12V. V1 - 3V, V2 = 5V. Now V1 is 3V, which is 25% of 12V (VCC) so you know that:
An easy way of creating references is to use a string of resistors of the same value. Example: 10k. If you have 5 resistors of 10K, then the total is 50K, with VCC across it. The voltage across the first resistor os 10k/50k = 1/5 = 20% of VCC. Next? 20k/50k = 2/5 = 40% of VCC, then 60% of VCC, then 80% etc... So this way you can create evenly spaced voltage references
As you want 4 outputs, and you have 12V supply, your windows should be centred at roughly, 12/(4+1) = 12/5. S0, 2.4V, 4.8V, 7.2V and 9.6V.
When you use 4 resistors as in the OP's circuit, the current changes.
When you use a voltage divider, which would entail another resistor, you can determine the position by measuring the divided voltage just as Blueteeth's circuit does.
The OP didn't draw a complete circuit, for there is no load. If the load is variable, then we have a problem.
I had assumed (probably wrongly) that it was a current based thing, meaning, at the 'reciever' end, the input would have a resistor to ground, effectively creating a voltage divider between the resistor on the switch, and the resistor in the reciever. Granted, a bit of weird way of doing it, unless line noise is a problem (how long is this transmission line?).
Really, its a basic problem, 4-way switch, two wires (you NEED a return path) and a box with 4 outputs. Simple enough with discrete voltage levels and a few comparators, maybe some basic logic to decode.
I get the impression the OP really is a beginner, which means any info we provide he/she would have to research - unless myself or someone spoonfeeds a nice schematic and the OP jst builds - which is fair enough, the problem still gets solved.
took me some minutes, but made it i mean the formula....
transmission line is few centimeters at one application and 3meters at the other one...
I checked the switch and it switch to the ground via resistor... I connected another fixed resistor (500ohm) from positive to the switch output and it gives me 0,14V, 2,9V, 6,23V and 9,39V so there will be 4 ranges
Output voltage of the switch:
1. position - 0,14V
2. position - 2,91V
3. position - 6,23V
4. position - 9,39V
Not Switched - 12V
On the OUT1+2 I putted transistor (as switch) via resistor 1K and try to connect LED. Dont know what is RL good for on the shema of the window voltage detector, so I tried to connect it with 1K resistor from positive to output 1+2. LED1 was glowing, some current passed thru. I switched the RL to higher value 1M and it worked... LED completly off when not switched, and on as I switch to 2.position.
Now I tried to connect the INPUT3+4. Tried it, and worked. As I switched 4. position, the LED2 was on. (same value for the RL = 1M). But, as I tried the 2. position (LED1 light up - normaly) the otherLED (LED2) lightly blink. Just for some miliseconds.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.