Yacov Cohen

Members
  • Content Count

    16
  • Joined

  • Last visited

About Yacov Cohen

  • Rank
    Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. The AD7193_VoltageMeasurePsuedoDifferential_Example Created 4 Oct 2016 by Anne Mahaffey and published as example for PmodAD5 has bugs. Unfortunately tried to set the bugs but got incorrect measurements. Can you please help? This is the script from the example from GitHub : /* AD7193_VoltageMeasurePsuedoDifferential_Example Configures and calibrates the AD7193 to measure psuedo-differential voltage on channel 6 Tutorial can be found at <TBD>, and uses the PmodAD5 from Digilent. Signal Connections: ----------------------------------------------------- Signal Name | PmodAD Pin | Arduino Pin ----------------------------------------------------- ~CS | J1, Pin 1 | 10 MOSI | J1, Pin 2 | MOSI or 11 or ICSP-4 MISO | J1, Pin 3 | MISO or 12 or ICSP-1 SCLK | J1, Pin 4 | SCLK or 13 or ICSP-3 GND | J1, Pin 5 | GND VCC (3.3V) | J1, Pin 6 | 3.3V ----------------------------------------------------- ----------------------------------- Signal Name | PmodAD5 Pin ----------------------------------- Channel 6 Pos | J2, Pin 7 AINCOM | J2, Pin 9 ----------------------------------- See Table 24 of AD7193 datasheet for more information Refer to: https://reference.digilentinc.com/reference/pmod/pmodad5/start https://www.arduino.cc/en/Reference/SPI Created 4 Oct 2016 by Anne Mahaffey This example code is in the public domain */ #include <SPI.h> #include <AD7193.h> AD7193 AD7193; void setup() { /////////////////////////// // setup Serial and SPI /////////////////////////// Serial.begin(9600); delay(1000); while (!Serial) { ; // wait for serial port to connect. Needed for native USB port only } AD7193.begin(); /////////////////////////////////// // Device setup /////////////////////////////////// AD7193.AppendStatusValuetoData(); //This might be a requirement - functions will be simpler if I can assume this is true AD7193.SetPGAGain(1); AD7193.SetAveraging(100); // sets input to measure across channel input and AINCOM pin AD7193.SetPsuedoDifferentialInputs(); ///////////////////////////////////// // Calibrate with given PGA settings - need to recalibrate if PGA setting is changed ///////////////////////////////////// AD7193.Calibrate(); // Debug - Check register map values AD7193.ReadRegisterMap(); ////////////////////////////////////// Serial.println("\nBegin AD7193 conversion - single conversion (pg 35 of datasheet, figure 25)"); } void loop() { unsigned long ch6Data; float ch6Voltage; // Read channel measurement data ch6Data = (AD7193.ReadADCChannel(6) >> 8); Serial.print(" CH6 data: "); Serial.print(ch1Data, HEX); // Convert to voltage ch1Voltage = AD7193.DataToVoltage(ch6Data); Serial.print("\n\t\tChannel 1 Voltage Measurement: "); Serial.println(ch1Voltage, 3); delay(100); }
  2. Trying to use PsuedoDifferential measurements. See software bellow posted by Anne. By obvious there are some mistakes on original script. There are some bugs I tried to repair, here is the modified software set ground on pin 9 placed +1 volt to pin1 AIN1 ground of voltage source AINCOM (pin9) but could not get results. Please Help  the program /* AD7193_VoltageMeasurePsuedoDifferential_Example Configures and calibrates the AD7193 to measure psuedo-differential voltage on channel 6 Tutorial can be found at <TBD>, and uses the PmodAD5 from Digilent. Signal Connections: ----------------------------------------------------- Signal Name | PmodAD Pin | Arduino Pin ----------------------------------------------------- ~CS | J1, Pin 1 | 10 MOSI | J1, Pin 2 | MOSI or 11 or ICSP-4 MISO | J1, Pin 3 | MISO or 12 or ICSP-1 SCLK | J1, Pin 4 | SCLK or 13 or ICSP-3 GND | J1, Pin 5 | GND VCC (3.3V) | J1, Pin 6 | 3.3V ----------------------------------------------------- ----------------------------------- Signal Name | PmodAD5 Pin ----------------------------------- Channel 6 Pos | J2, Pin 7 AINCOM | J2, Pin 9 ----------------------------------- See Table 24 of AD7193 datasheet for more information Refer to: https://reference.digilentinc.com/reference/pmod/pmodad5/start https://www.arduino.cc/en/Reference/SPI Created 4 Oct 2016 by Anne Mahaffey This example code is in the public domain */ #include <SPI.h> #include <AD7193.h> AD7193 AD7193; void setup() { /////////////////////////// // setup Serial and SPI /////////////////////////// Serial.begin(9600); delay(1000); while (!Serial) { ; // wait for serial port to connect. Needed for native USB port only } AD7193.begin(); /////////////////////////////////// // Device setup /////////////////////////////////// AD7193.AppendStatusValuetoData(); //This might be a requirement - functions will be simpler if I can assume this is true AD7193.SetPGAGain(1); AD7193.SetAveraging(100); // sets input to measure across channel input and AINCOM pin AD7193.SetPsuedoDifferentialInputs(); ///////////////////////////////////// // Calibrate with given PGA settings - need to recalibrate if PGA setting is changed ///////////////////////////////////// AD7193.Calibrate(); // Debug - Check register map values AD7193.ReadRegisterMap(); ////////////////////////////////////// Serial.println("\nBegin AD7193 conversion - single conversion (pg 35 of datasheet, figure 25)"); } void loop() { unsigned long ch1Data; float ch1Voltage; // Read channel measurement data ch1Data = (AD7193.ReadADCChannel(1) >> 8); //Serial.print(" CH1 data: "); //Serial.print(ch1Data, HEX); // Convert to voltage ch1Voltage = AD7193.DataToVoltage(ch1Data); Serial.print("\n\t\tChanne1 1 Voltage Measurement: "); Serial.println(ch1Voltage, 3); delay(100); }
  3. Yacov Cohen

    PmodAD5 evaluation

    Trying to use PsuedoDifferential measurements. See software bellow posted by Anne There are some bugs I tried to repair, here is the modified software set ground on pin 9 placed +1 volt to pin1 AIN1 ground of voltage source AINCOM (pin9) but could not get results. Please Help the program /* AD7193_VoltageMeasurePsuedoDifferential_Example Configures and calibrates the AD7193 to measure psuedo-differential voltage on channel 6 Tutorial can be found at <TBD>, and uses the PmodAD5 from Digilent. Signal Connections: ----------------------------------------------------- Signal Name | PmodAD Pin | Arduino Pin ----------------------------------------------------- ~CS | J1, Pin 1 | 10 MOSI | J1, Pin 2 | MOSI or 11 or ICSP-4 MISO | J1, Pin 3 | MISO or 12 or ICSP-1 SCLK | J1, Pin 4 | SCLK or 13 or ICSP-3 GND | J1, Pin 5 | GND VCC (3.3V) | J1, Pin 6 | 3.3V ----------------------------------------------------- ----------------------------------- Signal Name | PmodAD5 Pin ----------------------------------- Channel 6 Pos | J2, Pin 7 AINCOM | J2, Pin 9 ----------------------------------- See Table 24 of AD7193 datasheet for more information Refer to: https://reference.digilentinc.com/reference/pmod/pmodad5/start https://www.arduino.cc/en/Reference/SPI Created 4 Oct 2016 by Anne Mahaffey This example code is in the public domain */ #include <SPI.h> #include <AD7193.h> AD7193 AD7193; void setup() { /////////////////////////// // setup Serial and SPI /////////////////////////// Serial.begin(9600); delay(1000); while (!Serial) { ; // wait for serial port to connect. Needed for native USB port only } AD7193.begin(); /////////////////////////////////// // Device setup /////////////////////////////////// AD7193.AppendStatusValuetoData(); //This might be a requirement - functions will be simpler if I can assume this is true AD7193.SetPGAGain(1); AD7193.SetAveraging(100); // sets input to measure across channel input and AINCOM pin AD7193.SetPsuedoDifferentialInputs(); ///////////////////////////////////// // Calibrate with given PGA settings - need to recalibrate if PGA setting is changed ///////////////////////////////////// AD7193.Calibrate(); // Debug - Check register map values AD7193.ReadRegisterMap(); ////////////////////////////////////// Serial.println("\nBegin AD7193 conversion - single conversion (pg 35 of datasheet, figure 25)"); } void loop() { unsigned long ch1Data; float ch1Voltage; // Read channel measurement data ch1Data = (AD7193.ReadADCChannel(1) >> 8); //Serial.print(" CH1 data: "); //Serial.print(ch1Data, HEX); // Convert to voltage ch1Voltage = AD7193.DataToVoltage(ch1Data); Serial.print("\n\t\tChanne1 1 Voltage Measurement: "); Serial.println(ch1Voltage, 3); delay(100); }
  4. Yacov Cohen

    PmodAD5 evaluation

    Now I understand sorry about silly questions. I started to understand. Many thanks
  5. Yacov Cohen

    PmodAD5 evaluation

    Hi, Sorry about missing the description. I intended to ask if there is a need to "you'll want to change bit 20 " as by taking out the J1 jumper and connecting to the pin of J1 going to Vref of the 3.5 Volt is not enough ? Thanks Yacov
  6. Yacov Cohen

    PmodAD5 evaluation

    Hello JColvin, If JP1 is connected now it means that the A/D gets 2.5 so may be it is right to connect 3.3 Volts instead the Jumper. What is your opinion. I am glad that you help. Yacov
  7. Yacov Cohen

    PmodAD5 evaluation

    Can not find JP1 on the schematics. As the 2.5 Ref source is on board may be no need for software change.
  8. Yacov Cohen

    PmodAD5 evaluation

    Thank you for the big help you gave!!!! Now I need to change to external Vref. As I am beginner it will be very helpful for me if you can write me the code line to change the reference select bit (bit 20) as you wrote me previously in the Configuration Register (pg 27 of the datasheet) so that the Pmod AD5 uses an externally supplied reference voltage (5 V will work in your case) rather than the default internal 2.5 V reference. Note that you will need to remove jumper JP1 if the digital logic levels you are using are not based with 5V as the logic high.
  9. Yacov Cohen

    PmodAD5 evaluation

    Congratulation: You are terrific. I used a floating 1 Volt source from the power supply. Now when supplying 1 and 0 it works correctly. Many Thanks
  10. Yacov Cohen

    PmodAD5 evaluation

    Here you can see that I am sampling 1 Volt Also I am abroad I will be more than happy if you can take control on my computer. May be I am asking 2 much..................
  11. Yacov Cohen

    PmodAD5 evaluation

    Dear JColvin It is inbreeding. I attached that print screen. You can see I am using the suggested library and running the correct example SnipImage.JPG1SnipImage.JPG1SnipImage.JPG1SnipImage.JPG1 I am sampling 1 volt and this is what I get. Can you please sent me the file you are using end the exact library? Please, please help also I am over Yacov
  12. Yacov Cohen

    PmodAD5 evaluation

    This is the example I am running:
  13. Yacov Cohen

    PmodAD5 evaluation

    JColvin, Thank you for your detailed answer, Lets omit the issue that I intend to measure 3.5 Volts. I am running the AD7193_VoltageMeasure_Example using the library as explained on EnginnerZone: https://ez.analog.com/blogs/annem/2017/03/20/ad7193-arduino-tutorial As I Mentioned previously I am getting non linear Voltage measurement Power supply measured voltage Measured by PmodeAD5 Ratio 0.6 0.288 0.48 0.7 0.38 0.542 0.9 0.584 0.650 1.0 0.675 0.675 Can you please help on this specific issue? Thanks again Y.
  14. Yacov Cohen

    PmodAD5 evaluation

    Hi Jon, Thank you for your quick response. When running the AD7193_VoltageMeasure_Example on Arduino Uno I am getting the following results: Instead of measuring 0.6 Volt I am getting a reading on serial monitor of 0.288 Volt. Instead of reading 1 Volt I am getting 0.675 Volt on serial monitor. What I need is a display of the correct voltage. At the beginning I thought that I have only to multiply the results by a factor but it is not true. Can you please Help. I prefer to work using 5 Volt as I have to measure 0 to 3.5 Volts and I can not use a simple resistive divider as the source may change internal impedance. So am I taking any risk to burn the device? Thank u
  15. Yacov Cohen

    PmodAD5 evaluation

    Hi Jon, Thank you for your quick response. When running the AD7193_VoltageMeasure_Example on Arduino Uno I am getting the following results: Instead of measuring 0.6 Volt I am getting a reading on serial monitor of 0.288 Volt. Instead of reading 1 Volt I am getting 0.675 Volt on serial monitor. What I need is a display of the correct voltage. At the beginning I thought that I have only to multiply the results by a factor but it is not true. Can you please Help. I prefer to work using 5 Volt as I have to measure 0 to 3.5 Volts and I can not use a simple resistive divider as the source may change internal impedance. So am I taking any risk to burn the device? Thank u