Saturday, February 16, 2013

ADS1247–Now we are cooking with fire!

This little chip is going to revolutionize my design, simplify it, add thermal compensation (if needed, need to do temp testing) and drop the price of the board.
Potentially the electronics might be down to less than 20 dollars ($8 ADC + $2.5 nRF51 + $4 gyro + $6 do-dads) + PCB and assembly. The strain gauges are at 50 dollars + installation, and then an enclosure and battery. Labour would clock in around 8 hours for installation initially, and then overhead.
Some props to TI for the nice part. 451 counts of noise on 24 bit = 2.69E-5, or 0.003%. This is at 10 SPS. I’ll likely be ramping up to 320, 640, or 1000 divided over two channels. This is significantly less than the 32000sps combined (12 – 16k sps depending on calculations). However, to get the noise down to what the ADS1247 is giving me now would requiring averaging techniques.
So effectively I’ve replaced four pricey IC’s, four expensive resistors, and a bunch of board space with a single IC from Texas Instruments. Not bad. Some .netMF code (.NET Micro Framework) for the FEZ Panda II below. Unlike Josh from Josh.to I’m using continuous read. I was hung up most of the day on realizing register 00h resets to 01h and NOT 00h which sets the inputs to AIN0 and AIN0 for both positive and negative inputs, rather than AIN0 and AIN1.
Code after the break.
using System;
using System.Text;
using System.IO.Ports;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using ANTPLUS;
using GHIElectronics.NETMF.FEZ;

namespace Test1
{
    public class Program
    {
        public static void Main()
        {
            SPI SPI_Out = new SPI(new SPI.Configuration(
                (Cpu.Pin)FEZ_Pin.Digital.Di9,            // SS on GPIO pin 10
                false,                  // SS active-low
                0,                      // No setup time
                0,                      // No hold time
                false,                  // Clock low on idle
                false,                  // Data valid on falling edge
                1000,                   // 1MHz clock rate
                SPI.SPI_module.SPI1     // SPI device 2
                )
            );


            InputPort DRDY;
            OutputPort START;
            OutputPort RESET;

            DRDY = new InputPort((Cpu.Pin)FEZ_Pin.Digital.Di10, false, Port.ResistorMode.PullDown);
            START = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.Di8, true);
            RESET = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.Di7, false);

            Thread.Sleep(100);
            RESET.Write(true);
            Thread.Sleep(100);

            while (true)
            {
                byte[] rx = new byte[3];
                byte[] rx2 = new byte[3];
                byte[] rx3 = new byte[1];
                Thread.Sleep(10);
                SPI_Out.Write(new byte[2] { (byte)(0xFF), (byte)(0xFF) });
                Thread.Sleep(10);
                SPI_Out.Write(new byte[3] { (byte)(0x43), (byte)(0x00), (byte)(0x61) });  //Set Gain and SPS
                Thread.Sleep(10);


                while (true)
                {
                    while (DRDY.Read() == true)
                    {
                    }
                    SPI_Out.WriteRead(new byte[3] { (byte)(0x40), (byte)(0x00), (byte)(0x13) }, rx2);
                    long value = rx2[0] << 24 | rx2[1] << 16 | rx2[2] << 8;
                    value = value / 256;
                    int sample = rx2[0] << 8 | rx2[1];

                    while (DRDY.Read() == true)
                    {
                    }
                    SPI_Out.WriteRead(new byte[3] { (byte)(0x40), (byte)(0x00), (byte)(0x01) }, rx2);
                    long value2 = rx2[0] << 24 | rx2[1] << 16 | rx2[2] << 8;
                    value2 = value2 / 256;
                    int sample2 = rx2[0] << 8 | rx2[1];
                    Debug.Print(value.ToString() + ", " + sample.ToString() +", " + value2.ToString() + ", " + sample2.ToString());

                }
                
                Thread.Sleep(-1);
            }
        }

    
    }
}

1 comment:

  1. Really interesting article. I have found this company that provide the product you are looking for.
    swindon asic design

    ReplyDelete