ANALOG INPUT TO MICRO EXAMPLE
Requirements
Must be able to detect all four states from 9V to 16V battery
Dedicated ground so ground offset is zero.
Operating temperature is from -40 degC to 85 degC
Ra = 1.8kΩ, Rb = 700Ω, Rc = 300Ω all are 5% resistor tolerance
Maximum switch resistance is 50Ω
Must be protected from shorts to ground and battery
Must survive reverse battery
Must survive failed alternator and double battery for one minute
Minimum wetting current is 1mA
Charlie Richlie
Page 1 of 8
Micro analog input example.xmcd
12/1/2005
Analysis plan
Show A/D input can distinguish between the following switch states with no overlap.
All switches open
Switch A closed, B and C open
Switch A and B closed, switch C open
Switch A, B and C closed
Show A/D input at micro will not exceed 5V
Show minimum wetting current is not less than 1mA
Calculate circuit response time
Calculate power and temperature of R1
Show the 5V supply will not sore during a short
Variables
k
:=
1000
m 1 10 3−
:=
⋅
M 1 106
:=
⋅
μ
:=
1 10 6−
⋅
OK
:=
"OK"
Fail
:=
"Does not meet requirements"
n
:=
degC
1:=
1 10 9−
⋅
Declare variables to improve readability
Supplies
Vbat
:=
13.5V
Vcc
:=
5V
Environment
:=
9V
Vbatmin
Vccmin Vcc 1
:=
⋅
2%−(
Vbatmax
)
:=
16V
Vccmax Vcc 1
:=
⋅
2%+(
)
Tamb
:=
25degC
Tambmin
:=
40− degC
Tambmax
:=
105degC
50Ω
50Ω
50Ω
:=
:=
:=
Switch parameters
Rseries_amax
Rseries_bmax
Rseries_cmax
1.8 k⋅ Ω⋅
Ra
0.7 k⋅ Ω⋅
Rb
Rc
0.3 k⋅ Ω⋅
:=
:=
:=
:=
:=
:=
1mΩ
1mΩ
1mΩ
Rseries_amin
Rseries_bmin
Rseries_cmin
Ra 1
Rb 1
Rc 1
:=
:=
:=
⋅
⋅
Ramin
Rbmin
Rcmin
)
5%−(
5%−(
)
⋅
5%−(
)
Ramax
Rbmax
Rcmax
:=
:=
:=
⋅
Ra 1
Rb 1
Rc 1
)
5%+(
5%+(
)
⋅
5%+(
)
⋅
Resistors
R1
:=
750Ω
R2
:=
30 k⋅ Ω⋅
R1min
R2min
:=
:=
Rthja_0805
:=
170
degC
W
R1 1
8%−(
⋅
R1 1
8%−(
⋅
)
)
R1max
R2max
:=
:=
R1 1
8%+(
⋅
R1 1
8%+(
⋅
)
)
Charlie Richlie
Page 2 of 8
Micro analog input example.xmcd
12/1/2005
Capacitors
C1
:=
10 n⋅ F⋅
C2
:=
10 n⋅ F⋅
C1min
C2min
:=
:=
Micro parameters
C1 1
27%−(
⋅
C2 1
27%−(
⋅
)
)
C1max
C2max
:=
:=
C1 1
27%+(
⋅
C1 1
27%+(
⋅
)
)
Vmicrohigh_required
Ileaknom 0A
ADerror
4:=
:=
:=
⋅
Vccmax 0.65
Ileakmax
:=
Vmicrolow_required
Ileakmin
:=
1μ A⋅
:=
⋅
Vccmin 0.35
1− μ A⋅
Micro A/D conversion error is +/- 4 counts
Diode
Vf
Analysis
:=
0.7V
Vfmin
:=
0.45V
Vfmax
:=
1.0V
Find minimum and maximum value at the micro pin with all switches open.
Initial guess:
VN1
:=
5V
Given
Vcc VN1
−
R1
=
VN1
Ra Rb+
Rc+
+
Ileak
VN1 Vcc R1,
(
Rc,
,
Ileak
)
:=
Find VN1
)
(
Ra,
Rb,
(
VN1min VN1 Vccmin R1max
:=
,
,
Ramin
,
Rbmin
V_all_opennom VN1 Vcc R1,
:=
(
Ra,
Rb,
Rc,
,
,
Rcmin
)
Ileaknom
,
)
Ileakmax
VN1min
=
3.756 V
V_all_opennom 3.944 V
=
VN1max VN1 Vccmax R1min
:=
,
(
,
Ramax
,
Rbmax
,
Rcmax
,
)
Ileakmin
VN1max
=
4.131 V
V1micro_min
:=
V1micro_max
:=
VN1min R2max Ileakmax
−
⋅
VN1max R2max Ileakmin
−
⋅
V1micro_min
=
3.755 V
V1micro_max
=
4.132 V
Charlie Richlie
Page 3 of 8
Micro analog input example.xmcd
12/1/2005
Find minimum and maximum value at the micro with Switch A closed and Switches B and C open
Initial guess:
VN1
:=
5V
Given
Vcc VN1
−
R1
=
VN1
Rseries Rb+
Rc+
+
Ileak
VN1 Vcc R1,
(
,
Rb,
Rc,
,
Ileak
)
:=
Find VN1
)
(
Rseries
(
:=
VN1min VN1 Vccmin R1max
(
V_switchA_closednom VN1 Vcc R1,
:=
,
,
Rseries_amin
,
Rbmin
,
Rcmin
,
Rseries_amin
Rb,
Rc,
,
,
)
Ileakmax
)
Ileaknom
VN1min
=
2.644 V
V_switchA_closednom 2.857 V
=
VN1max VN1 Vccmax R1min
:=
,
(
,
Rseries_amax
,
Rbmax
,
Rcmax
,
)
Ileakmin
VN1max
=
3.135 V
V2micro_min
:=
V2micro_max
:=
VN1min R2max Ileakmax
−
⋅
VN1max R2max Ileakmin
−
⋅
V2micro_min
=
2.644 V
V2micro_max
=
3.135 V
Find minimum and maximum value at the micro with Switch A and B closed and Switch C open
Initial guess:
VN1
:=
5V
Given
Vcc VN1
−
R1
=
VN1
+
Rseries_a Rseries_b
+
Ileak
Rc+
VN1 Vcc R1,
(
,
,
Rseries_b
Rc,
,
Ileak
)
:=
Find VN1
)
(
Rseries_a
(
(
VN1min VN1 Vccmin R1max
:=
,
,
Rseries_amin
,
Rseries_bmin
,
Rcmin
,
)
Ileakmax
VN1min
=
1.275 V
VN1max VN1 Vccmax R1min
:=
,
,
Rseries_amax
,
Rseries_bmax
,
Rcmax
,
)
Ileakmin
VN1max
=
1.916 V
V3micro_min
:=
V3micro_max
:=
VN1min R2max Ileakmax
−
⋅
VN1max R2max Ileakmin
−
⋅
V3micro_min
=
1.274 V
V3micro_max
=
1.916 V
Charlie Richlie
Page 4 of 8
Micro analog input example.xmcd
12/1/2005
Find minimum and maximum value at the micro with Switch A, B and C closed
Initial guess:
VN1
:=
5V
Given
Vcc VN1
−
R1
=
VN1
Rseries_a Rseries_b
+
+
Rseries_c
+
Ileak
VN1 Vcc R1,
(
,
Rseries_a
,
Rseries_b
,
Rseries_c
,
Ileak
)
:=
Find VN1
)
(
VN1min VN1 Vccmin R1max
:=
,
,
Rseries_amin
,
Rseries_bmin
,
Rseries_cmin
,
)
Ileakmax
VN1min
=
18.145 μ V⋅
VN1max VN1 Vccmax R1min
:=
,
,
Rseries_amax
,
Rseries_bmax
,
Rseries_cmax
,
)
Ileakmin
VN1max
=
0.911 V
(
(
V4micro_min
:=
V4micro_max
:=
VN1min R2max Ileakmax
−
⋅
VN1max R2max Ileakmin
−
⋅
V4micro_min
=
0.792
−
m V⋅
V4micro_max
=
0.912 V
V1micro_max
=
4.132 V
counts1max V1micro_max
⋅
:=
V1micro_min
=
3.755 V
counts1min V1micro_min
⋅
:=
V2micro_max
=
3.135 V
counts2max V2micro_max
⋅
:=
V2micro_min
=
2.644 V
counts2min V2micro_min
⋅
:=
V3micro_max
=
1.916 V
counts3max V3micro_max
⋅
:=
1023
Vccmin
1023
Vccmax
1023
Vccmin
1023
Vccmax
1023
Vccmin
1023
Vccmax
1023
Vccmin
1023
Vccmax
V3micro_min
=
1.274 V
counts3min V3micro_min
⋅
:=
V4micro_max
=
0.912 V
counts4max V4micro_max
⋅
:=
V4micro_min
=
7.919
−
×
10 4−
V
counts4min V4micro_min
⋅
:=
Charlie Richlie
Page 5 of 8
Micro analog input example.xmcd
12/1/2005
counts1max
counts1min
counts2max
counts2min
counts3max
counts3min
counts4max
counts4min
=
862.649
=
753.162
=
654.576
=
530.283
=
400.109
=
255.615
=
190.33
−=
0.159
if
(
⎡⎣
if
(
⎡⎣
if
(
⎡⎣
ADerror
4=
Micro A/D conversion error
)
counts1min ADerror
−
>
(
)
counts2max ADerror
+
OK,
,
Fail
⎤⎦
=
"OK"
)
counts2min ADerror
−
>
(
)
counts3max ADerror
+
OK,
,
Fail
⎤⎦
=
"OK"
)
counts3min ADerror
−
>
(
)
counts4max ADerror
+
OK,
,
Fail
⎤⎦
=
"OK"
counts_decision_12
:=
round
counts_decision_23
:=
round
counts_decision_34
:=
round
counts1min
counts2min
counts3min
+
2
+
2
+
2
⎛
⎜
⎝
⎛
⎜
⎝
⎛
⎜
⎝
counts2max
counts3max
counts4max
⎞
⎟
⎠
⎞
⎟
⎠
⎞
⎟
⎠
counts_decision_12
=
704
counts_decision_23
=
465
counts_decision_34
=
223
Note: Micro A/D conversion error must also be included to ensure the different switch states can be distinguished
Show A/D input at micro will not exceed Vcc
(
if V1micro_max Vccmin
≤
OK,
,
)
Fail
=
"OK"
Show minimum wetting current is not less than 1mA
Iwetting_min
:=
Vccmin
R1max Ra+
Rb+
Rc+
Iwetting_min
=
1.357 m A⋅
Charlie Richlie
Page 6 of 8
Micro analog input example.xmcd
12/1/2005
Calculate circuit response time
We will find the circuit response time going from all switches open to Switch A closed.
VN0
:=
V_all_opennom
VN0
=
3.944 V
V_final
:=
V_switchA_closednom
V_final
=
2.857 V
τ1
:=
R1 Rb Rc+
)
Rb Rc+
R1
)
(
⋅
+
(
C1⋅
τ1
=
4.286 μ s⋅
τ2
:=
R2 C2⋅
τ2
=
300 μ s⋅
Note: Because τ2 is much greater than τ1, it will dominate the slew time so we can ignore τ1.
Vmicro t( )
:=
(
VN0 V_final
−
) e
⋅
t−
τ2
+
V_final
We will assume the response time is
5 τ2⋅
=
1.5 m s⋅
Vmicro 5 τ2⋅(
)
=
2.864 V
Percent_final_voltage
:=
Percent_final_voltage
=
Vmicro 5 τ2⋅(
) V_final
−
V_final
−⎛⎜
1
⎝
99.744
⋅
100
⎞⎟
⎠
Calculate power and temperature of R1
Imax
=
7.391 m A⋅
Imax
:=
Vccmax
R1min
PR1_max
:=
Imax
2 R1min
⋅
PR1_max
=
37.696 m W⋅
TjR1_max
:=
Tambmax
+
PR1_max Rthja_0805
⋅
=
TjR1_max
(
if TjR1_max
111.408 degC
≤
135degC
OK,
,
)
Fail
=
"OK"
Charlie Richlie
Page 7 of 8
Micro analog input example.xmcd
12/1/2005
What about the power dissipation during a short to battery?
Imax
=
16.087 m A⋅
Imax
:=
Vbatmax Vccmin
−
R1min
PR1_max
:=
Imax
2 R1min
⋅
PR1_max
=
178.565 m W⋅
TjR1_max
:=
=
TjR1_max
(
if TjR1_max
55degC PR1_max Rthja_0805
+
⋅
85.356 degC
≤
135degC
OK,
,
)
Fail
=
"OK"
Show the 5V supply will not sore during a short
Imax
=
16.087 m A⋅
Must ensure at least a 16.1mA draw on the 5V regulator anytime a short to battery can occur on this input.
One option is to add a 6.2V zener on the 5V line.
Charlie Richlie
Page 8 of 8
Micro analog input example.xmcd
12/1/2005