Only positive/negative numbers when using AMP in ADC

Status
Not open for further replies.

nadabro

Member level 4
Joined
Mar 8, 2007
Messages
70
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,953
Hi.

I think this is a very simple issue, but my knowledge is very limited, so here it goes my issue:

-I´m using ADC to connected to a sensor, with the sensor connected directly to the ADC inputs, i´ve positive and negative values.
-I´ve added a OPA227 OP-AMP to do some tests with the sensor, and connected the output of the amp to one ADC input, the second input of that ADC channel i´ve connected to GND (also i tried to +2.5V).

But i only have positive or negative values (depending the INPUT i use in ADC), i tried some types of calibration on the ADC (ADS1211) but no luck.

What can i do to solve this?

Thanks.
 

I think that after signal re-scale (amplification/attenuation), you need to shit the common mode voltage to match the ADC mid scale voltage.. By other words, you need to translate the bipolar signal to unipolar signal... https://masteringelectronicsdesign.com/design-a-bipolar-to-unipolar-converter/

---------- Post added at 01:45 ---------- Previous post was at 01:37 ----------

check also:
https://www.edaboard.com/threads/245197/#post1049199

---------- Post added at 01:49 ---------- Previous post was at 01:45 ----------

check also:
https://www.edaboard.com/threads/249191/#post1066105
 
It makes sense on "converting" the bipolar signal from the amp to match the unipolar signal in the ADC. But before try some of the schematics you gave, i looked in the ADC datasheet and it looks like it has a function (Vbias) that should solve my issue:


So using "Vbias" in the ADC should work?

Thanks (Obrigado! Tb sou de Portugal :smile
 

Yes, it should work...

I suggest you to post the the interfacing circuit diagram and source code, so that we can be able to help you on this
 

I´m testing it in a breadboard, following the datasheet pag18 circuit.

But my main issue is to change the code in the microcontroller (Arduino) to activate VBIAS..

The code i use can be found here (**broken link removed**), the part to write to the ADC:

Code:
void ADSx::CMRwrite(byte channel,byte mode,byte gain,byte TMR,int DR)
{
  byte Byte[3];
  
  int _gain;
  switch (gain) {
    case 2: _gain = B001; break;
    case 4: _gain = B010; break;
    case 8: _gain = B011; break;
    case 16: _gain= B100; break;
    default: _gain = 0;
  }
  Byte[0] = mode<<5 | _gain<<2 | channel-1;
  
  byte _TMR;
  switch (TMR) {
    case 2: _TMR = B001; break;
    case 4: _TMR = B010; break;
    case 8: _TMR = B011; break;
    case 16: _TMR= B100; break;
    default: _TMR = 0;
  }
  Byte[1] = _TMR<<5 | DR>>8;
  Byte[2] = DR;
  write(B0101,3,Byte);
}

In datasheet
The BIAS bit controls the VBIAS output state—either on (1.33 • REFIN) or off (disabled), as follows:
0 disabled (default)
1 enabled


But i dont understand how i´m going to register the bit that activate Vbias.

Any help i appreciate.

Thanks.
 

Well,

looks like pretty much forward,

According to page 19 of the datasheet, to set the VBias on you need to set BIAS on Command Register (CMR) , witch is at bit 7 of CMR 's byte 3.

The CMDwrite routine that you are using is writing only byte2, byte1 and byte0, as it starts on the byte 2 address (b0101)

Now I have two suggestions... either you recode the CMDwrite routine to include bias handling, witch means write the four command bytes, and considering command byte 3 default values, it would be something like this:


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
void ADSx::CMRwrite(byte channel,byte mode,byte gain,byte TMR,int DR, byte vBIAS)  // vBIAS =1 => ON;vBIAS =0 => OFF
{
  byte Byte[4];
 
  Byte[0] =  ((vBIAS & 0x01) << 7) | 0x40;  // Command Byte3
 
  int _gain;
  switch (gain) {
    case 2: _gain = B001; break;
    case 4: _gain = B010; break;
    case 8: _gain = B011; break;
    case 16: _gain= B100; break;
    default: _gain = 0;
  }
  Byte[1] = mode<<5 | _gain<<2 | channel-1; // Command Byte2
  
  byte _TMR;
  switch (TMR) {
    case 2: _TMR = B001; break;
    case 4: _TMR = B010; break;
    case 8: _TMR = B011; break;
    case 16: _TMR= B100; break;
    default: _TMR = 0;
  }
  Byte[2] = _TMR<<5 | DR>>8; // Command Byte1
  Byte[3] = DR;                      // Command Byte0
  
  write(B0100,4,Byte);  // B0100  is the address for command byte 3 
}



or, since you are not performing any write operation to command byte3 in your source code, could code a sub just for control the Vbias, for example:


Code C - [expand]
1
2
3
4
5
6
7
8
void ADSx::CMR_bias_control(byte vBIAS)  // vBIAS =1 => ON;vBIAS =0 => OFF
{
  byte Byte[1];
 
  Byte[0] =  ((vBIAS & 0x01) << 7) | 0x40;  // Command Byte3
 
  write(B0100,1,Byte);  // B0100  is the address for command byte 3 
}



note: I don't know if the adc allows a write operation only for this byte, but I couldn't found anything saying that we can't do this ...

Regards,
Ricardo
 
Last edited:
Hi.

The first suggestion works great! It allows to enable/disable Vbias, and i can measure voltage (1.76?) from Vbias pin

But unfortunately did not resolve my issue..i followed the schematic on page 18. But it still gives positive numbers, it stables at -4000 (example) but i only get values up to 32768 (16bit).

So my only solution is to try one of the schematics you gave above?

Thanks
 

Post your reading code
 
Last edited:

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…