#### crnewton

##### Newbie

I have an 8 pin dip switch, and I want to connect it to my ADC so I can connect other peripherals to my DI.

I want to use all the 256 codes.

With the help of this topic I figured out how this is possible, but I'm not sure if my schematics are correct, and if this would work with these resistors.

The math works out, but I feel like my resistor values are too low, and I've read that they should be of the power of 2 of the previous one.

I hope someone an look over it and tell me what I'm doing wrong.

My components:

Here is what I came up with:

(The V_out is below 3.3V, and each combination differs with more than the 'min_adc_step_voltage'.)

Do I also have to look at the current?

Formulas used:

v_out = v_in * (r_bottom/(r_bottom+r_top));

power_dissipation_mw = (pow(v_in, 2) / (r_bottom + r_top)) * 1000 ;

I want to use all the 256 codes.

With the help of this topic I figured out how this is possible, but I'm not sure if my schematics are correct, and if this would work with these resistors.

The math works out, but I feel like my resistor values are too low, and I've read that they should be of the power of 2 of the previous one.

I hope someone an look over it and tell me what I'm doing wrong.

My components:

- STM32F446RE
- - 12bit - ADC
- - max ADC input voltage = 3.3V
- - min_adc_step_voltage = 0.008056 V
- 8 pin dip switch
- R1 - R8 = resistor for each dip (r_top)
- R9 = resistor bottom voltage devider (r_bottom)

Here is what I came up with:

(The V_out is below 3.3V, and each combination differs with more than the 'min_adc_step_voltage'.)

Do I also have to look at the current?

Formulas used:

v_out = v_in * (r_bottom/(r_bottom+r_top));

power_dissipation_mw = (pow(v_in, 2) / (r_bottom + r_top)) * 1000 ;

Last edited: