Conectar celula de carga usando un CS5532 (info)

No se quien me pregunto hace tiempo por privado el como se podia conectar una celula de carga al arduino. Hasta ahora lo que se me podia ocurrir era usar un operacional tipo INA125 junto con ADC de 24 bit. Pues bien otra solucion seria usar un CS5532 con interfaz SPI.
Os dejo el datasheet y ejemplo de uso.

#include <SPI.h>


const byte CHANNELREG011 = 0b00110000;    
const byte CHANNELREG012 = 0b01000000;
const byte CHANNELREG013 = 0b00000000;
const byte CHANNELREG014 = 0b00000000;

const byte CHANNELREG021 = 0b01110000;    
const byte CHANNELREG022 = 0b01000000;
const byte CHANNELREG023 = 0b00000000;
const byte CHANNELREG024 = 0b00000000;

const byte CONFIGREG11 = 0b00000010;
const byte CONFIGREG12 = 0b00000000;
const byte CONFIGREG13 = 0b00000000;
const byte CONFIGREG14 = 0b00000000;

const byte READ01 = 0b10000000;
const byte READ02 = 0b10001000;

const byte CONF_RESET1 = 0b00100000;
const byte CONF_RESET2 = 0b00000000;
const byte CONF_RESET3 = 0b00000000;
const byte CONF_RESET4 = 0b00000000;

const byte COMMAND_CONFGREG = 0b00000011;
const byte COMMAND_CHANNELREG1 = 0b00000101;
const byte COMMAND_CHANNELREG2 = 0b00010101;
const byte COMMAND_READCONF = 0b00001011;


byte CONF_READED = 0;
byte CONF_READED2 = 0;
byte CONF_READED3 = 0;
byte CONF_READED4 = 0;
byte CONF_TMP1 = 0, CONF_TMP2 = 0, CONF_TMP3=0;


void ADreset(){
//digitalWrite(SS,LOW);
for(int i = 0;i<15;i++){
  SPI.transfer(0xFF);}
  
SPI.transfer(0xFE);
delay(50);

  SPI.transfer(COMMAND_CONFGREG);
  SPI.transfer(CONF_RESET1);
  SPI.transfer(CONF_RESET2);
  SPI.transfer(CONF_RESET3);
  SPI.transfer(CONF_RESET4);
  
  SPI.transfer(CONF_RESET2);
  SPI.transfer(CONF_RESET2);
  SPI.transfer(CONF_RESET2);
  SPI.transfer(CONF_RESET2);
  
  SPI.transfer(COMMAND_READCONF);
  CONF_READED2 = SPI.transfer(0x00);
  CONF_TMP1 = SPI.transfer(0x00);
  CONF_TMP2 = SPI.transfer(0x00);
  CONF_TMP3 = SPI.transfer(0x00);

  CONF_READED2 = CONF_READED2 << 8;
  CONF_READED = CONF_READED2 | CONF_TMP1;
  CONF_READED = CONF_READED << 8;
  CONF_READED = CONF_READED | CONF_TMP2;
  CONF_READED = CONF_READED << 8;
  CONF_READED = CONF_READED | CONF_TMP3;
  
  Serial.println(CONF_READED,BIN);
  
  //  CONF_READED = CONF_READED << 8;
 // CONF_READED = CONF_READED | CONF_TMP;
  
//  CONF_READED = CONF_READED << 8;
//  CONF_READED = CONF_READED | CONF_TMP;
//  CONF_TMP = SPI.transfer(0x00);
//  CONF_READED = CONF_READED << 8;
//  CONF_READED = CONF_READED | CONF_TMP;
  
  
 // digitalWrite(SS,HIGH);
  
}

void ADConfig(){
 // digitalWrite(SS, LOW);
  SPI.transfer(COMMAND_CONFGREG);
  SPI.transfer(CONFIGREG11);
  SPI.transfer(CONFIGREG12);
  SPI.transfer(CONFIGREG13);
  SPI.transfer(CONFIGREG14);
  delay(10);
  
  SPI.transfer(COMMAND_CHANNELREG1);
  SPI.transfer(CHANNELREG011);
  SPI.transfer(CHANNELREG012);
  SPI.transfer(CHANNELREG013);
  SPI.transfer(CHANNELREG014);
  delay(10);
  
  SPI.transfer(COMMAND_CHANNELREG2);
  SPI.transfer(CHANNELREG021);
  SPI.transfer(CHANNELREG022);
  SPI.transfer(CHANNELREG023);
  SPI.transfer(CHANNELREG024);
  delay(10);
 // digitalWrite(SS, HIGH);

  
  CONF_READED2 = SPI.transfer(COMMAND_READCONF);
  CONF_TMP1 = SPI.transfer(0x00);
  CONF_TMP2 = SPI.transfer(0x00);
  CONF_TMP3 = SPI.transfer(0x00);
  CONF_READED = CONF_READED2 << 8;
  CONF_READED = CONF_READED | CONF_TMP1;
  CONF_READED = CONF_READED << 8;
  CONF_READED = CONF_READED | CONF_TMP2;
  CONF_READED = CONF_READED << 8;
  CONF_READED = CONF_READED | CONF_TMP3;

  Serial.println(CONF_TMP1,BIN);
  Serial.println(CONF_TMP2,BIN);
  Serial.println(CONF_READED,BIN);
}


// pins used for the connection with the sensor
// the other you need are controlled by the SPI library):



void setup() {
  Serial.begin(9600);

  // start the SPI library:
  SPI.begin();
  SPI.setClockDivider(SPI_CLOCK_DIV16);
  SPI.setDataMode(SPI_MODE2);

  // initalize the  data ready and chip select pins:
  
  

  ADreset();
  ADConfig();
  delay(100);
}

int SerialRead = 0;
int SerialTMP = 0;
int incomingByte = 0;
void loop() {

Serial.println("AD CS5532 - Programa de teste ");

Serial.println("Para ler canal AD 01, precione 1 ");
Serial.println("Para ler canal AD 02, precione 2 ");
Serial.println("Para ler REG_CONF, precione 3 ");
while(SerialRead == 0){
  

//Serial.println(SerialTMP);
if (Serial.available() > 0) {
	SerialRead = Serial.read();
	Serial.print("I received: ");
	Serial.println(SerialRead, DEC);
	}

switch(SerialRead){
  
case 49:
readAD1();
delay(100);
break;

case 50:
readAD2();
delay(100);
break;

case 51:
Serial.println(CONF_READED,BIN);
Serial.println(CONF_READED2,BIN);
break;

}

SerialRead = 0;

}
}




//Read from or write to register from the SCP1000:
unsigned int readAD1() {
  byte inByte = 0;           // incoming byte from the SPI
  unsigned int result = 0;   // result to return
  unsigned int result_blank = 0;   // result to return
  Serial.print("Comando Enviado: ");
  Serial.println(READ01, BIN);


 // digitalWrite(SS, LOW);
  SPI.transfer(READ01);
  // send a value of 0 to read the first byte returned:
  result_blank = SPI.transfer(0x00);
  // decrement the number of bytes left to read:
  result = SPI.transfer(0x00);
  // if you still have another byte to read:
  for(int i = 0;i<2;i++) {
    // shift the first byte left, then get the second byte:
    result = result << 8;
    inByte = SPI.transfer(0x00);
    // combine the byte you just got with the previous one:
    result = result | inByte;
    // decrement the number of bytes left to read:
    }
  // take the chip select high to de-select:
  //digitalWrite(SS, HIGH);
  // return the result:
  Serial.print("Valor recebido: ");
  Serial.println(result,BIN);
 ;
  return(result);
}

unsigned int readAD2() {
  byte inByte = 0;           // incoming byte from the SPI
  unsigned int result = 0;   // result to return
  unsigned int result_blank = 0;   // result to return
  Serial.print("Comando Enviado: ");
  Serial.println(READ02, BIN);



//  digitalWrite(SS, LOW);
  SPI.transfer(READ02);
  // send a value of 0 to read the first byte returned:
  result_blank = SPI.transfer(0x00);
  // decement the number of bytes left to read:
  result = SPI.transfer(0x00);
  // if you still have another byte to read:
  for(int i = 0;i<2;i++) {
    // shift the first byte left, then get the second byte:
    result = result << 8;
    inByte = SPI.transfer(0x00);
    // combine the byte you just got with the previous one:
    result = result | inByte;
    // decrement the number of bytes left to read:
    }
  // take the chip select high to de-select:
 //digitalWrite(SS, HIGH);
  // return the result:
  Serial.print("Valor recebido: ");
  Serial.println(result,BIN);
  return(result);
}

Saludos.

CS5532.pdf (731 KB)

Flico
Una pregunta, Celula de carga ¿es un medidor de presion?

Una célula de carga es un traductor que convierte la fuerza que le aplicas en una tensión proporcional a ella, siendo esta unos pocos milivoltios de hay que haya que usar operacionales para amplificar en nivel de señal.

Internamente las celulas de carga son varias galgas extensiometricas y varias resistencias de carbón configuradas en puente.

En resumidas cuentas una celula de carga es la pieza principal de una bascula electrónica.

En este enlace viene las diversas formas de adaptar los niveles de tensión.
http://www.national.com/en/industrial/sensing/pressure_load.html

Saludos.

Hola flico,
Gracias, algún día tengo pensado aplicar un medidor de peso a una colmena de abejas, para ver la evolución de la cosecha. Seguro que me servirá.
No te olvides de añadir (info) en el 'Subject'

Hola, @flico, voy a recibir unas muestras del cs5534 para usar 2 celdas de carga, me podrias contar con el ad de arduino mide bien? tengo que pesar 400kg con un error maximo de 1kg

Al final lo hice con un INA125, porque el CS5532 no lo localice. Ya nos contaras.

Me suscribi a Cirrus logic y me envias 5 muestra de ese sin cargo, tambien pedi de texas unos ina125.
Pregunto porque necesito leer una celdas con arduino para hacer un pequeno sistema de dosaje y mezclado, tengo experiencia en el tema pero no de la parte electronica con AD. Donde trabajaba hice un sistema de dosje de cemento. Ahora intento hacerlo por mi cuenta pero algo muy simple y especifico.

podrias contarme como conectaste el ina125, tengo 2 celdas de 1000kg que tengo que usar y no se como conectaqrlas sumadas o en paralelo como se deba hacer.

Para conectar dos celulas de carga se usan cajas de sumas pero tampoco se mucho.

http://www.sensocar.com/web.asp?mod=cataleg&idProducte={AADBA671-95AE-41B4-9886-CB0B67D68C70}

Una cosa...
el CS5532 es dificil de soldar, ¿no? ¿Como lo has hecho?

Un saludo.

flico:
Para conectar dos celulas de carga se usan cajas de sumas pero tampoco se mucho.

Sensocar

Ya tengo respuesta.

Todos los pines van en paralelo. El positivo de alimentacion de cada celula pasa por un potenciometro de 50ohm

Hay una libreria que se podria usar con arduino.

CS5532.h (879 Bytes)

CS5532.c (4.36 KB)

bien, el hilo se pone interesante!!!.
@Jose Francisco: Tengo una estacion de soldadura con aire caliente, y con punta bien fina, aun no hice la placa, y nunca he soldado mas de SOIC, pero para soldar se usa flux y pasta de soldadura, o con un estaño muy fino, una lupa muy grande y tremenda paciencia.
Cuando tenga el circuito para soldar pongo mi experiencia.
Les parece si armamos entre todos una placa amplificadora de celdas? tengo cs5534 para 4 celdas.

Una interfaz de células de carga es uno de mis proyectos pendientes.

lo tomo como un si?
Soy de Córdoba/Argentina

Aca les dejo un esquema de conexion con una sola celda pero es cuestion de duplicar la etapa de filtrado.
Pronto subo el pcb en eagle de esto.

Las dos celdas de carga es porque quieres pesar dos cosas

la idea de una interfaz de celdas es tener varias entradas aprovechando todo el conversor, yo tengo muestras del cs5534 de 4 canales