-
Notifications
You must be signed in to change notification settings - Fork 2
Arduino basic analogue input
Analogue inputs are used to generate float values directly from most of the big blue-roofed room stuff. The Elduino STM32F051 contains several ADC hardwares connected to many input pins. As the ADC can only measure voltages between 0V and supply voltage of 3,3V it is of importance to scale any input to this range. Not only does this protect the chip from malfunction it maximises the usable dynamic range.
A potentiometers end legs are connected to supply rails and the middle pin to the actual input pin. Select the potentiometer so that its resistive value does not draw excess current.
Usually the input signal voltage range is different from the supply voltage, some scaling and/or shifting is necessary. The standard way is using an opamp connected in negative feedback like so (pic of so). Scaling factor is set with the relative values of input series resistor and feedback resistor. The positive input resistor ladder is used to set a range midpoint. As the opamp is supplied from 0V and 3.3V, input still cannot be tolerated beyond these limits with this circuit.
A bigger signal can be read scaling the input with a resistor ladder, either directly to the input pin or via an opamp. like so (pic of so) A better way is using multiple supply voltages and driving the prescaler opamp circuit from larger voltages. This is discussed in more detail in Arduino advanced analogue input.
A negative voltage signal can be read with supplying the prescaler circuit from double rail supply. This too is discussed in more detail in Arduino advanced analogue input.
Sometimes a current instead of voltage is used to signal stuff. This needs care in the input circuit. A current can be converted to voltage at its simplest with a resistor. This can then be scaled or buffered with a suitable opamp circuit if necessary. Calculating a suitable resistor should be relatively easy considering R=U/I and that U should be below 3.3V and nearly hit it at the maximum input value.
Insert here a figure of a simple resistor conversion buffered by an op amp.
Some more elaborate schemes are discussed in detail in Arduino advanced analogue input.