DFR0972 output not update when run with SEN0322

userHead Peter.YeS 2023-09-24 14:48:37 610 Views3 Replies

Hi to all,

Appreciate anyone can give a hand. 

 

When DFR0972 and SEN0322 both program run in sketch. 

DFR0972 output not update to ammeter by loop program wrtAOM(). 

My ammeter always show 4.73mA which is set by aomInit ().

 

See below information captured by serial monitor, look like this module is working fine, 

but do not know why it did not update to output. 

 

O2 Oxygen Transmitter
I2C to 0-25 mA analog current moudle initialization ... done!
[output(): 102 ] 775
[output(): 103 ] 774.77
[output(): 104 ] -2.26
[output_mA(): 84 ] 307
I2c connect success !
Button 3 state changed
oxygen concentration is 20.96 %vol
DAC value: 423
[output_mA(): 84 ] 1A7
Current value: 2.58
oxygen concentration is 21.06 %vol
DAC value: 2801
[output_mA(): 84 ] AF1
Current value: 17.10
oxygen concentration is 21.05 %vol
DAC value: 3289
[output_mA(): 84 ] CD9
Current value: 20.08 

 

 

If I only run DFR0972 and block SEN0322 program, ammeter is updating and shown

current value from DFR0972 module.

 

Thanks in advance.

 

 

icon ProjO2_230920.zip 11KB Download(0)
2023-10-05 01:36:52

Did dfrobot contact you regarding this matter? Maybe the hardware needs to be checked.

userHeadPic lia.ifat
2023-10-04 11:56:04

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?

 

 

 

 

userHeadPic Peter.YeS
2023-10-03 18:09:34

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 !");}

 

 

userHeadPic Peter.YeS