Potentiometer
The potentiometer control is used to connect analog inputs to the HID Device. Usually this will be a potentiometer, but other analog inputs can be connected. An analog input can only be connected to one of the microcontrollers ADC pins, PF0-PF7.
A potentiometer allows a variable voltage to be generated. They are typically an open resistor connected between the power supply and ground, with a wiper arm that touches the resistor. This creates a voltage divider circuit. When the wiper arm is in the middle, the output is half the voltage. At the top, it is full voltage. At the bottom, 0. Or, 50%, 100%, and 0%. The schematic of the potentiometer is shown below.
The most common type of potentiometers are the rotary type. They can be used as they are to provide a volume control style input. Rotary potentiometers are usually found on the axis of joysticks. A two axis joystick will have two independent potentiometers.
There are also slide potentiometers that have a slider that moves up and down, rather than rotating.
Don't confuse a rotary/slide potentiometer with a linear/log potentiometer. Linear and Log refer to divider relationship with the wiper position. A Linear potentiometer will a linear relationship, eg 25% turn gives 25% voltage, 75% gives 75%. A Log potentiometer gives a logarithmic response, eg 25% turn gives 5% output, 50% gives 10%, 75% give 50%.
Non-potentiometer devices, such as Hall Effect Joysticks, can be used as an analogue input, as long the voltage range stays within the range of the HID Device's voltage - 0v to 3.3v or 5v.
ADC
The ADC (Analogue to Digital Converter) of the microcontroller is used to convert the analogue signal to a digital number. Internally, the microcontroller measures the voltage and converts it to a 10 bit number (0 - 1023 (210-1)). The Bits property can then be used to change the precision of the the number. 8 bit resolution (0-255) is generally precise enough.
The ADC converter samples the voltage about 8,000 times per second and averages 4 samples.
Properties
Name
Components can be given an optional name. This is seen in the Test tab. Not all applications support the name. Hidcomp/hidconfig supports names.
UsagePage/Usage
The UsagePage and Usage of the Potentiometer. See Usages for more information.
Bits
ADC resolution the Potentiometer voltage is returned as. 8 bits returns a value from 0 - 255. 10 bits returns a value from 0 - 1023.
Current
Defines the amount of electrical current used by the potentiometer in mA. This is used to estimate the USB power draw. See the section on Power for more information.
The current can be calculated by dividing the power supply voltage by the potentiometer resistance. V/R will give the current in amps, so it must be multiplied by 1000 to get mA.