analog switch/voltage divider

Status
Not open for further replies.

vlady_2009

New Member
attached schematic (PICcircuit.jpg) shows PIC attached to RS232/PC etc which controls HEF4051B 8-channel analogue multiplexer/demultiplexer that switches between various voltage divider ranges (analogInput.jpg). The voltage divider ranges are approximately 4, 3, 2 and 1.5 (at this stage just for testing purpose - I also checked operation of the PIC code/RS232/HEF4051 by selectively turning on LED's from PC keyboard input in a previous circuit). I'm using a handheld DMM to measure the output voltage of the voltage divider as the analogue switch selects different ranges. Results below are fine when I use the PIC Vdd supply as the input to the voltage divider, and also no problem when using a battery.

But when I use input voltage from a LM1086 (LM1086VarVoltage.jpg), which with a 20V input from a "wall wart" allows variable voltage up to ~17V, voltage from the output of the voltage divider isn't correct (the PIC Vdd is from a 7805 from a seperate wall wart). I plan on using the output from the voltage divider (with a Zener for over voltage protection after R1 of the voltage divider, and some more code in the PIC for auto ranging selection) into the ADC of the PIC, with display on the LCD/RS232.

I'm doing something wrong with the GND's? or is the approach using the HEF4051B wrong? ("Funny" values for R1 and R2 are because these are actual measurement of the resistors used in the circuit).

R1 9930 9930 9930 9930
R2 3300 4600 9800 17710
Vout/Vin 4.0 3.2 2.0 1.6

Vin 4.9 with Vin from uP supply
Vout Calc 1.22 1.55 2.43 3.14
Vout Meas 1.24 1.58 2.45 3.15

Vin 6.27 with Vin from battery
Vout Calc 1.56 1.98 3.11 4.02
Vout Meas 1.60 2.04 3.12 4.00

Vin 6.01 with Vin from LM1086IT adj voltage reg
Vout Calc 1.50 1.90 2.99 3.85
Vout Meas 1.21 1.46 2.11 2.63

Thanks in advance for any help/advice.
 

Attachments

  • analogInput.jpg
    128.6 KB · Views: 697
  • PICcircuit.jpg
    266.9 KB · Views: 1,030
  • LM1086VarVoltage.jpg
    92.5 KB · Views: 596
hi,
If the dividers are wired as per the left hand circuit, they are not dividers, the resistors are in series, so the full voltage will appear on the adc pins.
 
Not sure I understand, maybe my schematic not clear (attached revised).

The inputs A0, A1, A2 on the HEF4051B can selectively switch either R3 to R6 to "Analog Gnd", which taking the voltage at the "red test" lead will give the result of the voltage divider formed by R2 and one of the resistors R3 to R6 depending upon the combination of inputs A0, A1, A2 controlled by the PIC (well at least I think so). This seems to be the case when using Vdd from the PIC or a battery as input to "Analog Vin" - the volt measurements with the DMM give the correct values compared to calculate value using voltage divider equation. But not when using input from LM1086 (I wanted to try greater range voltage before using ADC and Zener to limit, with auto range from PIC code).
 

Attachments

  • analogInput2.jpg
    157.8 KB · Views: 628
Even when not called by the program an ADC input has a very high input impedance, so R4 thru R6 are not carrying any current so there is no voltage drop across the common resistor.

EDIT;
Use two resistors for each ADC voltage required
 
Last edited:
No ADC is involved (yet), only put on schematic to show where ADC input would come. Only building the circuit one functional block at a time for testing before next stage.

Measured current in the circuit as follows
Vin 6.87
R1 9930 9930 9930 9930
R2 3300 4600 9800 17710
Vout Calc 1.71 2.17 3.41 4.40
Vout Meas 1.74 2.20 3.42 4.41
I Meas (mA) 0.51 0.46 0.34 0.25

Sorry accident press tab key before finish

Data sheet for PIC 16F876 onboard ADC is recommend input impedance 2700 ohm (high impedance from measurement circuit, mean the ADC, good as does not load test circuit).

Divider circuit seems OK when using with battery as input "analog V", but not with LM1086IT adj voltage reg, so still think some problem with LM1086 feeding the HEF4051BP analog multiplexer and me getting some confusion with "analog" and "digital" grounds.
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…