The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Tag Info

12

Unlike the LSB code, which can only have certain discrete values, the analog input is a real, physical, continuous voltage input, which can go above full scale and below zero (even if that violates existing table or abs max rating). What’s misleading is that the graph makes it look like the analog input range for code 0 is smaller than the others, when in ...

8

The problem is how your calculation is being expressed. The calculation for voltage will be done using integer math and then the result is converted to a double, resulting in the values you report. Corrected code: void setup() { Serial.begin (9600); } void loop() { int code = analogRead (A2); double voltage = (double)code * 5.0 / 1024.0; Serial.print("...

7

Zeners have a very 'soft' characteristic. As you discovered, they start drawing current well before their advertised voltage. The best way to limit overvoltage into an ADC is to use a silicon diode to a fixed voltage. Usually this will be the ADC rail, especially if you put a series resistor between the diode and the ADC to limit any current drawn, but you ...

5

If a DAC is used as part of a SAR ADC, then we don't already know the value of the MSB. The logic in the ADC makes an assumption about the value of the MSB, uses the DAC to create an analog voltage corresponding to that assumption, and then the comparator determines whether the actual input voltage is higher or lower than the DAC output. At that point, the ...

5

One solution is to convert the encoder's binary digital output to a quaternary (4-valued) digital signal. It uses only 4 resistors. The only reasonable values for such a circuit that yield uniformly spaced output voltages require adding two unused values to the signal, so the encoding is really senary (6-valued), with two unused values (0/5 and 5/5), and ...

3

The HX711 is a load cell sensor that contains a 24-bit Analog to Digital converter. A converter of this resolution is going to be extremely sensitive to changes in the system level environment including the chip itself and breakout module that it may be mounted upon. The environmental factors that have to be considered include: Chip temperature Ambient or ...

3

Consider a successive approximation ADC. Each step size successively halves the step size at the previous step, so teh first step (for the MSB) compares the input with Vref/2. Then successive steps are smaller powers of 2, until ... 4095? No, 4096. Now the ADC can output 4096 codes, from 0 to ... 4095. Every output code is effectively "rounded down" to ...

3

One way to get a low leakage clamp is to employ a BJT emitter-base junction. For example, simulate this circuit – Schematic created using CircuitLab Typical peak current at 4.2V is about 30nA leading to an error of 3uV with a 100 ohm source resistance. It clamps to typically about 5.2V with 12V applied with power dissipation of about 350mW, which ...

2

You could also use an R-2R resistor ladder. The advantage is that you need resistors of only one value. Two 1R resistors in series make one 2R, or two 2R resistors in parallel make one 1R. simulate this circuit – Schematic created using CircuitLab You can use a dip resistor network to build the circuit.

2

consider something like this simulate this circuit – Schematic created using CircuitLab

2

I believe it's all embedded in this graph from the device data sheet: - So, calculate what 1 LSb means in terms of input voltage and multiply that by the digital value produced by that input voltage. You have to take into account several error factors though such as: - Offset error (the input voltage equivalent to digital zero) Gain error (the real average ...

2

The microcontroller requires a steady DC supply. LED current is sourced from the microcontroller's Vdd pin. If no LED are lit, Vdd current is small. One LED lit draws about 10mA, which is sourced through Vdd. All eight LED will pull about 80mA from Vdd (a bit much). This current cannot be sourced from a DC supply having 670 ohms equivalent resistance that ...

1

You really did not tell us anything about the ADC specs that you require. Various manufacturers like Analog Devices and TI have vast lines of products, including integrated parts that have PGA (programmable gain amplifier) front ends. Here is a copy and paste from A TI webpage with a full scale input range in hundreds of millivolts. "The ADS111x perform ...

1

A 250 ohm resistor will give you 1~5V which you can low pass filter, clamp, and feed to your ADC. Subtract the 1V off digitally and scale to your engineering units as applicable. The pressure sensor will need a supply of at least 14V with 24VDC being more-or-less standard.

1

I disagree with that article. First, note that not only is the LH (000) interval only 0.5 LSB wide, but also the RH (111) interval is 1.5 LSBs wide. So, making the bit transition happen on the LSB interval instead of half an LSB below it makes for a symmetrical plot with all intervals the same size. Note that this is exactly equivalent to truncating the ...

1

A typical ADC gets very, very nonlinear as you hit the saturation. The 1/2 LSB is just the tip of it, since it reads 0 for any voltage below 0. It’s all kind of theoretical anyway since most ADCs have more than 1/2 LSB of offset voltage.

1

The F4/F7 have plenty of memory to handle this. You'll need just over 200 bytes (100 samples * 2 bytes each), which is a fraction of even the smallest F4 chips. A moving average is a type of FIR filter and has some advantages to an IIR filter (such as an "infinite average"), such as that it responds more quickly to changes and will settle more quickly on a ...

1

If it were only a small number of averages then I would create a shift register. Pseudo code for a small number of averages. function movingAverage(pulseAverage) { static register; // 3 registers register = register; // data shift register = register; // data shift register = pulseAverage; // move the input into the ...

1

Since this is a rotary encoder, let's call "switch 1" "Clock" and "switch 2" "Direction". We need to sample Direction every time Clock changes level. It would be nice to be able to use a Pin Change Interrupt (PCI) for this. This can be achieved by modifying the circuit in Kuba's answer to ensure that a transition on Clock results in a voltage level ...

1

Both functions appear to work essentially identically, except for how bits 31:24 are handled - but I do not think this is your issue. You did not specify which Arduino you were using though, and since shiftIn is a simple bit-banging function it will run att different speeds depending on what processor and speed you are working with, so if you are using an ...

Only top voted, non community-wiki answers of a minimum length are eligible