Wednesday, 26 April 2017

microcontroller - Electronically switched decade resistance box design


I'd like to design a decade resistance box that uses a microcontroller to control the resistance.


Would it be possible to switch between different valued resistors using transistors? (or another component?)



Answer



Transistors are not a good choice; they can't handle AC, and DC in only one direction. That's not the way to emulate a resistor.


I would build a chain of 20 resistors, each double the previous one, so 1 \$\Omega\$, 2 \$\Omega\$, 4 \$\Omega\$, 8 \$\Omega\$, etc. By shorting selectively resistors you can create any value between 1 \$\Omega\$ and 1 M\$\Omega\$ with just those 20 values.


Use a reed relays parallel to each resistor.



This reed relay needs only 10 mA at 5 V, so can be driven directly by the microcontroller. Nick correctly points out that you have to check if the total current doesn't exceed the controller's capabilities. But at 20 \$\times\$ 10 mA we would stay way below the maximum of 300 mA for the ATMega8, for instance.


You can use latching relays, so that you can use the resistor without power supply. The price is higher than the reed relay (3.14 dollar vs. 1.20 dollar), and you need either extra logic, or twice the I/Os for driving them.


edit, re jippie's suggestion.
jippie suggests to use an R-2R ladder, so that only two different resistor values are needed. Though I felt immediately that this wouldn't work it took me a few minutes to understand why not. First intuition. An N-bit ladder network consists of (N+1) 2R resistors, and (N-1) R resistors. Without exact calculations, the largest resistor value you can create with these is always less than 2N \$\times\$ R, that's when you place the all in series. The smallest value is when they're all parallel, and that's always larger than R / (2N). So the ratio between largest and smallest is less than (2N)\$^2\$, which for 20 bits is 1600, and not 2\$^N\$, or 1048 576 as expected. How come? Because an R-2R ladder is ratiometric, i.e. the output depends on the ratio between two resistor values, and then you have a lot more possibilities. That's not what we have here; our network has just two nodes, not three. So it's a pity, but R-2R won't work.


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...