SNVAA20 July 2021 DRV8833 , DRV8833 , LMR33630 , LMR33630
To interface with the motorized resistive load, the user must turn a knob that controls the target resistance, and press a tactile button to confirm the target resistance and initiate the command. The knob is a potentiometer with the center tap connected to an ADC, and the remaining two taps are connected to the quiet 3.3-V rail, and GND respectively. As the knob is turned, the center tap voltage changes, and its value can be used as a reference to set the target resistance. To signal the Raspberry Pi that the button has been pressed, a GPIO pin is configured to be an active-low input pin and an internal pullup resistor is connected to the pin. This causes that pin to be pulled up to 3 V by default and when this pin is pulled down to 0 V, the Raspberry Pi is signaled to take action. The circuit for the interface is shown in Figure 3-2.
The selected button for this design includes an embedded blue LED. Blue LEDs have a relatively high forward voltage drop and so the 5-V rail that powers the Raspberry Pi also biases the anode of this LED. The cathode connects to one side of the switch, that also connects to a GPIO pin. To protect the 3-V pin from the 5-V source, a diode and current-limiting resistor are placed in series with the GPIO pin and the switch node connected to the LED. The other end of the switch is connected to GND. When the button is pressed, the GPIO pin is pulled to 0 V through the switch. During this time current also flows from the 5-V rail through the LED, lighting the LED up and indicating to the user that the pin has been pulled low. When the button is not pressed, the protection diode is reverse biased with 5 V on the cathode and 3 V on the anode, protecting the GPIO pin. In this state, the LED will not be lit. The 3-V GPIO pin is connected to GND via a high impedance resistor to prevent it from floating during power up.
Raspberry Pi models are typically equipped with GPIO pins only. These pins are digital and current Raspberry Pi models do not have analog input/output pins. This makes the selection of an external ADC necessary to convert user inputs into valid signals. To make a functional knob, a potentiometer can be used with 3.3 V applied on one terminal, an external ADC input on the center tap (variable terminal), and GND on the last terminal. This allows the ADC input signal to vary from 3.3 V to 0 V. The ADC reading can be mapped to a resistance and used as the target value. Limiting the resistor range by using the same resistors on the resistor track allows for a simpler mapping of the potentiometer voltage to resistance. To match the target resistance to the actual resistance, the potentiometer voltage is first mapped to a target resistance. Then the motor is commanded to rotate in single step increments, with the ADC taking a single measurement between each step, until the measured voltage on the second ADC matches the expected voltage, within a suitable threshold. The load range and resistor values will affect the threshold value.
The ADC121C021 is an I2C-Compatible, 12-bit analog-to-digital converter that can communicate with the Raspberry Pi via I2C and has enough resolution to ensure accurate voltage measurements:
The other ADC121C021 is used to read in the current load resistance value and its input terminal can be connected to an external port to facilitate its connection to the resistor plate PCB.