Forum >Replies by Peter.YeS
userhead Peter.YeS
Replies (2)
  • You Reply:

    Hi ,

    Further finding the issue.

    I monitored 2 function on DFrobot_GP8302.cpp library with println,

    there is: DFRobot_GP8302::sendByte() and DFRobot_GP8302::recvAck()

    I found it failed acknowledge on  Test4: Run with sequence,  oxyInit();  --->>  aomInit(); program.

    and successful acknowledge on setup Test3: Run with sequence,  aomInit();  --->>  oxyInit(); program. 

     

    Response ACK with Test3.

     

     

    Failed response ACK with Test4.

     

    To me, look like the interface between DFrobot_GP8302 library and the DAC module cause 

    the issue.

     

    Any ideal how to solve this?

     

     

     

     

  • You Reply:

    Hi to all,

    I'm still seeking for help on above issue.

    To narrow down the finding problem,

    I only made new sketch with initialize program for O2 and 4-20mA DAC module in it. 

    No program on loop().Below are my finding and testing on these few days:-

     

    Test1:  Only run aomInit(); program, comment out oxyInit();.   

    Result: working fine. I can see milliampere shown on multimeter.  

     

     

    Test2:  Only run oxyInit(); program, comment out aomInit();.   

    Result: working fine. I can see serial monitor update with O2 concentration. 

     

     

    Test3: Run with sequence,  aomInit();  --->>  oxyInit(); program.

    Result: working fine. I can see milliampere shown on multimeter and serial monitor update with O2 concentration. 

    Remark: DAC module no more update. Please refer to my first post.

     

     

    Test4: Run with sequence,  oxyInit();  --->>  aomInit(); program.

    Result: Error !!!  and i dun see latest milliampere value update on multimeter. It still shown previous mA captured.

     

     

    Test5: Only run i2c scanner program, to check out device address.

    Result: Address detected.

     

     

    Any ideal why test 4 it failed and where is gone wrong? 

    Please help……..Thanks in advance.      

     

     

     

    Here is complete sketch for reference:

    #include "DFRobot_GP8302.h"#include "DFRobot_OxygenSensor.h"

    #define Oxygen_IICAddress ADDRESS_3#define COLLECT_NUMBER  10             // collect number, the collection range is 1-100.DFRobot_OxygenSensor oxygen;

    DFRobot_GP8302 module;

     

    void setup(){ Serial.begin(115200); aomInit(); // oxyInit(); }

    void loop(){}

     

    }

    void aomInit(){//    Serial.begin(115200);  while(!Serial){   //Wait for USB serial port to connect. Needed for native USB port only }

     Serial.print("I2C to 0-25 mA analog current moudle initialization ... ");  uint8_t status = module.begin(); // Default to use the pins used by the MCU hardware I2C Wire object

     if(status != 0){   Serial.print("failed. Error code: ");   Serial.println(status);   Serial.println("Error Code: ");   Serial.println("\t1: _scl or _sda pin is invaild.");   Serial.println("\t2: Device not found, please check if the device is connected.");   while(1) yield(); } Serial.println("done!");  uint16_t dac = module.output(/*current_mA =*/15.273); //Control the DAC module to output the current of 10mA and return the DAC value corresponding to the current of 10mA Serial.print("DAC value: "); Serial.println(dac);}

    void oxyInit(void){ // Serial.begin(115200); while(!oxygen.begin(Oxygen_IICAddress)){   Serial.println("I2c device number error !");   delay(1000); } Serial.println("I2c connect success !");}