MEASURE SENSOR VOLTAGE FROM 2 SENSOR USING ADS 1263 (High-Precision AD HAT For Raspberry Pi, ADS1263 10-Ch 32-Bit ADC ) and arduino nano 33 ble ?

Hii, I am new to the ADC and arduino board connection as mentioned I am using (High-Precision AD HAT For Raspberry Pi, ADS1263 10-Ch 32-Bit ADC) which is brought from
> Blockquote
I need to measure the voltage from 2 sensors using this ADC which will be connected to nano BLE.
i don't know how to connect, the pin header as ADC is SPI protocol, and Nano ble is i2c protocol, can anyone help me to fix this? i have attached both boards.
ADS 1263

Interesting project but we are not a free design or code writing service. Why are you screaming with all upper case in your title? We would be happy help out with your design and or code but first you have to make an attempt to design it, write it, post it and explain what is not working properly.

If there is hardware it is always best to post links to technical information as there are many versions of the same or different items. Since we cannot see your project, my eyes are to weak, you need to post using the language of electronics, an annotated schematic (best) or a clear picture of a drawing. Pictures never hurt. Frizzing diagrams are not considered schematics here.

FYI it is not very hard to do a software SPI. Get your favorite search engine out and research some of your concerns.

Not all sensors are the same, what are you talking about?

have a look at the Raspberry pi 40pin header which lists the SPI pins
have a look at Nano 33 technical specification when lists the SPI pins
you should therefore be able to connect the ADS 1264 to the Nano 33 using SPI
be careful to power the ADS1264 correctly
then look for suitable software to interface to the device

1 Like

Thank you for your response, i connected the pin as per the datasheet, for SPI communication, But my code has some problems I am not getting the 32-bit
``#include <SPI.h>

const int csPin = 10; // ADC Chip select pin (connected to D10 on Arduino)
const int dataOutPin = 12; // ADC Data output pin (connected to D12 on Arduino)
const float referenceVoltage = 2.5; // Reference voltage used by the ADC (in volts)
const int resolution = 32; // ADC resolution (number of bits)

void setup() {
// Initialize SPI
SPI.begin();
// Set CS pin as output
pinMode(csPin, OUTPUT);
// Start serial communication
Serial.begin(9600);
}
long spiRead() {
// Read 32-bit ADC value from data out pin
long adcValue = 0;
for (int i = 0; i < 4; i++) {
adcValue <<= 8; // Shift previous byte left by 8 bits
adcValue |= SPI.transfer(0x00); // Read next byte from SPI
}
return adcValue;
}
void loop() {
// Select the ADC1263 by setting CS low
digitalWrite(csPin, LOW);

// Start single-ended conversion on AIN0
SPI.transfer(0x80); // Start single-ended conversion on AIN0

// Wait for conversion to finish
delay(10); // Adjust delay based on ADC1263 datasheet

// Read ADC value from data out pin
int adcValue = spiRead();

// Deselect the ADC1263 by setting CS high
digitalWrite(csPin, HIGH);

// Convert digital value to analog voltage
float analogVoltage = (float)adcValue / 4294967295.0 * referenceVoltage;

// Print the analog voltage to Serial Monitor
Serial.print("Analog Voltage (AIN0): ");
Serial.println(analogVoltage, 3); // Print with 3 decimal places
//Serial.println(adcValue,3);
// Wait before next reading
delay(1000);
}
Could you please help me.

repost the code using code tags </>
what appears on the serial monitor ? (post as text not a screen image)
try a web search for arduino ads1263, e.g. have you seen the ADS1263 library
post a schematic of the wiring ?

1 Like

My code is like this, and also I attached my schematic .

#include <ADS1263.h>
#include <SPI.h>

const int csPin = 10; // ADC Chip select pin (connected to D10 on Arduino)
const int dataOutPin = 12; // ADC Data output pin (connected to D12 on Arduino)
const float referenceVoltage = 2.5; // Reference voltage used by the ADC (in volts)
const int resolution = 32; // ADC resolution (number of bits)

void setup() {
  // Initialize SPI
  SPI.begin();
  // Set CS pin as output
  pinMode(csPin, OUTPUT);
  // Start serial communication
  Serial.begin(9600);
}
long spiRead() {
  // Read 32-bit ADC value from data out pin
  long adcValue = 0;
  for (int i = 0; i < 4; i++) {
    adcValue <<= 8; // Shift previous byte left by 8 bits
    adcValue |= SPI.transfer(0x00); // Read next byte from SPI
  }
  return adcValue;
}
void loop() {
  // Select the ADC1263 by setting CS low
  digitalWrite(csPin, LOW);
  
  // Start single-ended conversion on AIN0
  SPI.transfer(0x80); // Start single-ended conversion on AIN0
  
  // Wait for conversion to finish
  delay(10); // Adjust delay based on ADC1263 datasheet
  
  // Read ADC value from data out pin
  int adcValue = spiRead();
  
  // Deselect the ADC1263 by setting CS high
  digitalWrite(csPin, HIGH);
  
  // Convert digital value to analog voltage
  float analogVoltage = (float)adcValue / 4294967295.0 * referenceVoltage;
  
  // Print the analog voltage to Serial Monitor
  //Serial.print("Analog Voltage (AIN0): ");
  //Serial.println(analogVoltage, 3); // Print with 3 decimal places  
  Serial.println(adcValue);
  // Wait before next reading
  delay(1000);
}

output from the serial monitor :
276824064

1081344

4224

16

0

-2147483648

276824064

1081344

4224
16
0

Hii, Can you please help to find the error in the code , why it is showing like this ?

You included a library for ADS1263, but didn't use it in the code. Please show the link to the library.

The return value of spiRead() function is long type, but you assigned it to the int variable:

Link for this library

Why didn't you used an library example?

I used the example given in the above Library ..but it is not working , when I start uploading the code my board got disconnected automatically and then after reset, again it is working. .I

This library is working now , i just chnage some typo,,, thank you so much

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.