Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

does not work with ADS8688IDBTR #1

Open
abdallan45 opened this issue Nov 15, 2021 · 5 comments
Open

does not work with ADS8688IDBTR #1

abdallan45 opened this issue Nov 15, 2021 · 5 comments

Comments

@abdallan45
Copy link

hi dear,

I am using a ADS8688IDBTR with Arduino zero it works with the code below, but every time i upload the code the channel number changes for each channel :

#include "SPI.h"

int CS=A3;
float ch =0;

void setup() {

pinMode(CS, OUTPUT);
digitalWrite(CS, 1);
SPI.begin();
SPI.setDataMode(SPI_MODE1);
SPI.setBitOrder(MSBFIRST);
SerialUSB.begin(9600);
Serial.begin(9600);
digitalWrite(CS, 1);

}

void loop() {

for(int i =0 ; i<8 ;i++){
digitalWrite(CS, 0);
SPI.transfer16(0x00); // start Ch0 sampling
ch=SPI.transfer16(0x00); // get Ch0 conversion
digitalWrite(CS, 1);

ch=mapfloat(ch,32770,65535,0,10.15);
SerialUSB.print("CH");
SerialUSB.print(i) ;
SerialUSB.print(" = ") ;

SerialUSB.println(ch) ;

delay(10);

}
delay(1000);

}

float mapfloat(float x, float in_min, float in_max, float out_min, float out_max)
{
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}

I tried to use this lib but it wont work ::https://github.com/siteswapjuggler/ADS8688a

can any body help in this case and if there is any c++ code fit with this IC and Arduino zero

i want to know also the registers command order to initialize it before read channels

@siteswapjuggler
Copy link
Owner

Hello,

your code seems to be in auto sampling mode so each time you call a channel conversion it moves to the next channel. This process is described page 46 of the ADS8688 datasheet.

The lib you tried which is actually the one on github where your are commenting should be valid and has been tested on different µcontroller but not on Arduino Zero, and I don't have this platform in my lab.

Can you tell me more about what exactly is "not working" when you try it ?

@abdallan45
Copy link
Author

Hi dear

thanks for your response.

the problem is when i use the library the values are always - 5.12
but when I use the code above it reads the correct value, but i want to use the ADC full resolution with positive analog signal and as I see with your lib we can change the range but unfortunately as I explain it always reads -5.12.

I hope that you can help and it will be appreciated
fff

@siteswapjuggler
Copy link
Owner

Hi,

it's difficult for me to say the library should work on other controller so the example should work without to much effort. And as I do not have access at neither your schematic or your hardware...

From what I understand CS is plugged in A3 so perhaps you should start to declare this in the example code... by changing this line ADS8688 bank = ADS8688(); by ADS8688 bank = ADS8688(A3); if you don't do this it will take the defaut value on arduino wich is 10.

You can also check the header file in the library folder, you should find all the methods and macro you need to configure the rang and the resolution of this ADC.

Have a nice day

@abdallan45
Copy link
Author

Dear the CS pin already changed in the header file to A3 , I tried it also like this ADS8688 bank = ADS8688(A3); and it shows the same values. I've checked the header and CPP file and try to change it, but with no result

plz check the schematic below
123
1234
if you want to see the full schematic to chk it plz share your email with me and ill share it with you : [email protected]

@siteswapjuggler
Copy link
Owner

-5.12 is just the default value return by the I2V function when the first parameter is 0. So it's basically just a consequence of the ADS8688 not responding.

You tell me that you changed the header with value A3 but the value of the _cs properties is overwritten in the object constructor in the cpp file. It will not work this way. Did you change any other things in the library files ?

For what I see here you ask me to solve a problem I cannot reproduce, with a library you changed, without any full schematic for me to know, with an old unstable nightly build of Arduino and with question that let me think you miss some basic points in the running process of this component. It's quiet rude and hard for me to answer correctly.

As far as I can see and test here, the library works on my differents Arduinos boards including 32 bits ones, methods and functionnality are commented in the header file and I see no difference in action beetween what you do in you test code and what should the library actually do apart from the CS pin configuration as previously stated and the use of two successive SPI.transfer instead of SPI.transfer16 and they should theorically have the same result.

So perhaps I miss something, I didn't use this component very often and this library is quiet old but as far as I can say it should totally work properly.

I send you an email for the full schematic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants