Hi,
I am having trouble getting this adc to work..
Is there any library or code that someone tested that work with this adc..
Here is the link.. http://www.ledsandchips.com/232
The code from the link is not working..
Thanks for your time,
Teo
sensor unknown and I cannot open the code.
can you post the (not working )code?
I have received the modul too and hooked it up to an UNO with a load cell.
I used the code supplied with the link and it works.
In serial monitor it shows nicely a 0.000123 value at no load.
With load it goes to a max of 0.034578
What does not work in the code?
Does it not compile?
I need to parse not only the value from ADC to Processing and VB6 but also some other values from the UNO.
Dang that is a challenge.
Paco
Try this code.
//TM7709 24bit ADC module arduino sketch
//coldtears electronics
//code reworked to read in grams
//default connection arduino UNO
//DRDY = pin 11 >MOSI
//ADIO = pin 12 >MISO
//SCLK = pin 13 >SCK
//default connection arduino MEGA
//DRDY = pin 21 >MOSI
//ADIO = pin 22 >MISO
//SCLK = pin 28 >SCK
#define TM7710_DRDY 3
#define TM7710_ADIO 4
#define TM7710_ADIO_OUT() DDRB|=1<<4
#define TM7710_ADIO_IN() DDRB&=~(1<<4)
#define Set_TM7710_SCLK() PORTB|=1<<5
#define Set_TM7710_ADIO() PORTB|=1<<4
#define Clr_TM7710_SCLK() PORTB&=~(1<<5)
#define Clr_TM7710_ADIO() PORTB&=~(1<<4)
unsigned char x[3];
long Result;
float vref=4.89;
double microvolt = 0;
long microvoltA = 456;
long microvoltB = 180;
int extradata1 = 777;
int extradata2 = 888;
float loadA = 0; //this is the first weight (we use no load at the sensor) our sensor already has as a small plate on it we use a preload.
float loadB = 1590; //this is the second calibrated weight in grams
float valueA = 173; //value of the the serialmonitor reading with the first known weigth at the sensor (we use no load at the sensor).
float valueB = 9360; //value of the the serialmonitor reading with the second known load at the sensor (we 1590 grams at the sensor).
float load;
long finalValue;
void setup()
{
DDRB|=1<<5 ;
delay(1000);
Serial.begin(57600);// set baudrate for PC or serialmonitor the same!
TM7710_Init();
}
void loop()
{
while((PINB&(1<<TM7710_DRDY))==(1<<TM7710_DRDY));
TM7710_start();
TM7710_write(0x7F);
TM7710_ADIO_IN();
for(unsigned char j=0;j<3;j++)
{
x[j]=TM7710_read();
}
TM7710_ADIO_OUT();
TM7710_stop();
Result=x[0];
Result = Result * 256;
Result = Result + x[1];
Result = Result * 256;
Result = Result + x[2];
Result = Result - 6912000;
double volt = Result * vref /16/6912000; //data coming from this line is ..... "0.123456" for example
long microvolt = (volt*1000000); // microvolts are easier to break down in blocks of 3 then floats so we multiply with 1000000.
//split the microvolt value in blocks of three digits so it can be parsed to the serial output by Serial.print as integer value as it is lower as 1024.
//sample value of volt = "123456" so we brake it down in 123 and 456 <> volt.
//In our case it will never go below 0 or above 999999
//float (load.substring (0,2)); // we need the three most right side digits
//float (load.substring (3,5)); //we need the three most left side digits
//at the PC side VB6 should detect the "letter - comma - value" and parse it in a textbox
// how things work with Processing I have no idea yet :-(.
float load = ((loadB - loadA)/(valueB - valueA)) * ( microvolt - valueA) + loadA; //the final value of the real load on the sensor
Serial.print ("A,");
Serial.println (microvoltA);
Serial.print ("B,");
Serial.println (microvoltB);
Serial.print ("C,");
Serial.println (extradata1);
Serial.print ("D,");
Serial.println (extradata2);
Serial.print ("E,");
Serial.println (microvolt); //raw sensor value in microvolts
Serial.print ("F,");
Serial.println (load,0); // value in grams
}
void TM7710_Init()
{
TM7710_ADIO_OUT();
delay(100);
TM7710_stop();
TM7710_start();
TM7710_write(0xBF);
TM7710_write(0x20); //Gain=128
//TM7710_write(0x00); //Gain=16
TM7710_stop();
}
void TM7710_start(void)
{
Clr_TM7710_ADIO();
delayMicroseconds(1);
Clr_TM7710_SCLK();
delayMicroseconds(1);
}
void TM7710_stop(void)
{
Clr_TM7710_ADIO();
delayMicroseconds(1);
Set_TM7710_SCLK();
delayMicroseconds(1);
Set_TM7710_ADIO();
delayMicroseconds(1);
}
void TM7710_write(unsigned char dd)
{
unsigned char i;
for(i=8;i>0;i--)
{
if(dd&0x80)
Set_TM7710_ADIO();
else
Clr_TM7710_ADIO();
delayMicroseconds(1);
Set_TM7710_SCLK();
delayMicroseconds(1);
Clr_TM7710_SCLK();
dd<<=1;
}
}
unsigned char TM7710_read(void)
{
unsigned char data=0,i;
for(i=0;i<8;i++)
{
Set_TM7710_SCLK();
data=data<<1;
if((PINB&(1<<TM7710_ADIO))==(1<<TM7710_ADIO))
{
data=data+1;
}
delayMicroseconds(1);
Clr_TM7710_SCLK();
delayMicroseconds(1);
}
return data;
}
void printFloat(float value, int places) {
// this is used to cast digits
int digit;
float tens = 0.1;
int tenscount = 0;
int i;
float tempfloat = value;
// if value is negative, set tempfloat to the abs value
// calculate rounding term d: 0.5/pow(10,places)
float d = 0.5;
if (value < 0)
d *= -1.0;
// divide by ten for each decimal place
for (i = 0; i < places; i++)
d/= 10.0;
// this small addition, combined with truncation will round out
tempfloat += d;
if (value < 0)
tempfloat *= -1.0;
while ((tens * 10.0) <= tempfloat)
{
tens *= 10.0;
tenscount += 1;
}
// write out the negative if needed
if (value < 0)
//Serial.print('-');
if (tenscount == 0)
//Serial.print(0, DEC);
for (i=0; i< tenscount; i++)
{
digit = (int) (tempfloat/tens);
//Serial.print(digit, DEC);
tempfloat = tempfloat - ((float)digit * tens);
tens /= 10.0;
}
// if no places after decimal, stop now and return
if (places <= 0)
return;
// otherwise, write the point and continue on
//Serial.print('.');
for (i = 0; i < places; i++)
{
tempfloat *= 10.0;
digit = (int) tempfloat;
//Serial.print(digit,DEC);
// once written, subtract off that digit
tempfloat = tempfloat - (float) digit;
}
}
When you buy an ebay version of the TM7709 with pcb then this is the layout for connection.
At the side with the 4 connection pins you connect the load cell.
Where +input and -input are the wires that carry the differential value from the loadcell.
VCC and GND are power source (exatation value) for the loadcell.
Paco
thanks Paco,
Can you elaborate a bit on the strain gauge circuit please?
I want to use a two wire strain gauge like this one.....
Because I only want to use a single strain gauge, I think I need a circuit like shown here ....
http://docs-europe.electrocomponents.com/webdocs/001b/0900766b8001b962.pdf
(page 2, bottom right hand corner, 'figure 5, quarter bridge (3wire)')
I think the points labeled '+ bridge supply' and '- bridge supply' need to go to VCC and ground on your diagram, and the points labeled '+ input' and '- input' need to go to the same-named pins on your diagram?
Is this correct?
thanks
OK,
Understand your question.
Regardless the type of loadcell you always measure in a bridge configuration.
See all other drawings where there are Always 4 resistors.
In your case the idle resistor value = 120 Ohm.
So if you like to measure it in a bridge all other three resistors need to be 120 Ohm too.
Now if your load cell is pressed on, this 120 ohm value will change and cause a differential output which need to go to the +input and -input of of the TM7709. The TM7709 will amplify the signal.
Do you have one of these with the board or just a single TM7709 IC?
Does this help?
What application you are using this strain foil?
Paco
Do you have one of these
I'm about to order one of these....
http://www.ledsandchips.com/232
I think it's the same item as in your link.
What application you are using this strain foil?
I want to measure the torque in a drive shaft and then use this (along with the rpm) to measure the power being delivered.
thanks for your help.
Ok so your building a engine dyno. What kind of engine you need to measure?
The TM7709 board is the same.
Paco
I want to do the same. To measure the torque in a drive shaft..