GravityTroubleshooting

GP8403 and ESP8266

userHead Francois.Richard 2023-07-13 23:47:49 401 Views18 Replies

Hello,
 

I tested the following program on both Arduino nano and Wemos D1 mini pro
 

on Arduino it works as expected, when I connect a multimeter to VOUT0 I can see the voltage ramping from 0 to 10 volts.

on esp8266 nothing occurs and VOUT0 always output 0 volts 

 

It is said in the library documentation https://github.com/DFRobot/DFRobot_GP8403

that the code work well on ESP8266 platform, so I don't know what I am missing.

 

any idea ?

thanks

 

#include <DFRobot_GP8403.h>
#include <Wire.h>

 

DFRobot_GP8403 dac(&Wire,0x5F);

void setup() {
 Serial.begin(9600);
 delay(1000);
 Serial.println("Setup");
 while(dac.begin() != 0){
   Serial.println("init error");
   delay(1000);
 }
 Serial.println("init succeed");
 dac.setDACOutRange(dac.eOutputRange10V);
 dac.setDACOutVoltage(0,0);
 dac.store();
 Serial.println("Loop ...");
}

void loop(){

 int i;

 for (i=0; i<=10000; i=i+500) {
   dac.setDACOutVoltage(i,0);
   Serial.print("Set to : " );
   Serial.print(i);
   Serial.println(" mV");
   dac.setDACOutVoltage(i,0);
   delay(3000);
 }

}

 

2023-07-21 19:38:42

Hi,

 

remove dac.store() and it will work.

After dac.store() you can not change the output value.

 

BR,

Frank

userHeadPic Frank.Rackelmann
Francois.Richard wrote:

Hello Frank,nice catch !I removed the dac.store() from setup and it is now working fine on esp8266 …Any idea of the reason why it is working on Arduino with the dac.store() and not with ESP8266 ?

 

Thanks !

2023-07-22 00:29:47
Francois.Richard wrote:

hummm, 

 

working fine … yes … but not exactly as described in the example :

 

if eOutputRange0_10V is chosen and 4095 is required as outvoltage ==> 11.8 Volts are read on VOUT0 and not 10 Volts.3570 will produce exactly 10 Volts on VOUT0 

as 1785 will produce exactly 5 Volts on VOUT0

 

 

#include <DFRobot_GP8XXX.h>#include <Wire.h>

//DFRobot_GP8403 dac(&Wire,0x5F);DFRobot_GP8403 dac(0x5F);

void setup() { Serial.begin(9600); Serial.println("Setup"); delay(1000);

 while(dac.begin() != 0){   Serial.println("init error");   delay(1000); }  Serial.println("init succeed"); dac.setDACOutRange(dac.eOutputRange10V); dac.setDACOutVoltage(0,0);  Serial.println("Loop ...");}

#define MAX 3570//#define MAX 4095#define MAXmV 10000float Inc = MAX / 20.0;float Incmv = MAXmV / 20.0;

void loop(){ for (int i=0; i<=20; i++) {   dac.setDACOutVoltage((uint16_t)(i*Inc), 0);   Serial.print((uint16_t)(i*Inc));   Serial.print(" ==>  " );   Serial.print((uint16_t)Incmv*i);   Serial.println(" mV");   delay(5000); }}

2023-07-22 01:16:25
2 Replies
2023-07-14 00:29:54
userHeadPic Francois.Richard
jenna wrote:

Hi!

 

I think your ESP8266 board is not compatible with this library. 

 

You can try this board link: https://raw.githubusercontent.com/DFRobot/FireBeetle-ESP8266/master/package_firebeetle8266_index.json

2023-07-17 17:05:57
Francois.Richard wrote:

So did I,

 

 

result is the same … OUTV0 = 0 

 

I also tested with a NodeMcu V3 (ESP8266MOD 12-F) which is very close the the DFRobot with no success.

 

2023-07-17 23:16:47
jenna wrote:

We updated the library. Please try again.

 

https://github.com/DFRobot/DFRobot_GP8XXX

2023-07-18 15:28:41
Francois.Richard wrote:

Hello Jenna,I uploaded the DFRobot_GP8XXX library and did the tests, after modifying accordingly my test program, and I got exactly the same results.Tested on an Arduino Nano ==> OK

Tested on an ESP8266 ==> NOK

 

sorry for that

best regards.

2023-07-18 16:25:12
jenna wrote:

Hi!

 

Sorry to hear this.

 

It may be that the underlying definition does not support your board. 

2023-07-19 16:56:54
Francois.Richard wrote:

H Jenna,

 

I don't see how this can be related to the board, this is pure I2C communication here, every other I2C devices I have been using are working fine with the “Wemos D1 pro mini” board as well as with the “NodeMcu V3” board that is very similar the FireBeetle 8266.

 

 

Nevertheless, I wanted to give a try with an ESP32 platform, and what was my surprise to see that I even couldn't compile the DFRobot_GP8XXX.cpp file having the following well known error : 

 

…/Arduino\libraries\DFRobot_GP8XXX\DFRobot_GP8XXX.cpp: In member function 'virtual int DFRobot_GP8XXX_PWM::begin()':…\Arduino\libraries\DFRobot_GP8XXX\DFRobot_GP8XXX.cpp:206:24: error: 'analogWrite' was not declared in this scope    analogWrite(_pin0,0); 

 

 

It is written in the Github documentation of DFRobot_GP8XXX that it is working well on ESP32 platform, I really wonder how ? 

And I know have the same interrogation for the tests you did over the ESP8266 platform …

2023-07-19 18:47:33
jenna wrote:

Hi!

pls try this board URL. I test esp32-dev and sample code, it can compile successfully.

 

https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json

2023-07-20 11:04:48
Francois.Richard wrote:

Hi Jenna,that's exactly what I am using, driving to a impossibility to compile,something else is certainly different,  “analogWrite” is NOT implemented for ESP32 by default … you maybe have something else in your environment.

2023-07-20 15:08:07
8 Replies
2023-07-14 00:15:00

Hi!

We were using the FireBeetle ESP8266 and the Arduino IDE  for testing. Could you pls let us know which ESP8266 you are using?

 

At the same time, you can check if  ESP8266 can detect the I2C address of this module.

 

userHeadPic jenna
Francois.Richard wrote:

Hi

 

I am using

2023-07-14 00:19:54
Francois.Richard wrote:

tab tab …Hi,I am using a WEMOS D1 MINI PRO based on ESP-8266EXThe I2C seems to work as the dac.begin function is not returning error.

2023-07-14 00:23:52
Francois.Richard wrote:

I am also using the Arduino IDE for both (arduino and ESP)

2023-07-14 00:25:08
Francois.Richard wrote:

yes, when I scan the I2C bus the module is detected.

2023-07-14 00:37:20
Francois.Richard wrote:

Hi,

 

I just did a test using a NodeMcu V3 (ESP8266MOD 12-F) and got the same problem

2023-07-15 16:04:02
5 Replies