Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflict with OneWire? #138

Open
sarelvdwalt opened this issue Sep 4, 2024 · 5 comments
Open

Conflict with OneWire? #138

sarelvdwalt opened this issue Sep 4, 2024 · 5 comments
Assignees

Comments

@sarelvdwalt
Copy link

I suspect there is some sort of a conflict with the OneWire library. When I comment out my gpio_viewer.begin(); line (i.e. everything is loaded and set up, but I don't start the viewer) I get the normal 22 degrees or whatever the DS18B20 measures. But, the moment I have that line in the code I get -127. From looking at the OneWire code, that means "Device not connected".

Here is my code for sample:

#include <gpio_viewer.h>
#include <OneWire.h>
#include <DallasTemperature.h>

GPIOViewer gpio_viewer;

// GPIO where the DS18B20 is connected to
const int oneWireBus = 33;

// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(oneWireBus);

// Pass our oneWire reference to Dallas Temperature sensor 
DallasTemperature sensors(&oneWire);

void setup() {
  // Start the Serial Monitor
  Serial.begin(115200);

  // Start the DS18B20 sensor
  sensors.begin();

  // Connect to WiFi:
  gpio_viewer.connectToWifi("REDACTED", "REDACTED");
  gpio_viewer.begin();
}

void loop() {
  sensors.requestTemperatures(); 
  float temperatureC = sensors.getTempCByIndex(0);
  float temperatureF = sensors.getTempFByIndex(0);
  Serial.println(temperatureC);
  delay(1000);
}

Sample output of "normal" operation with it commented out:

21.75
21.75
21.75
21.75
21.75

Sample output of "broken" operation when it is enabled and running:

GPIOViewer >> Connected to WiFi
GPIOViewer >> Release 1.5.6
GPIOViewer >> ESP32 Core Version 3.0.4
GPIOViewer >> Chip Model:ESP32-D0WDQ6, revision:100
GPIOViewer >> No PSRAM
GPIOViewer >> Web Application URL is: http://192.168.107.132:8080
-127.00
GPIOViewer >> Connected, sampling interval is 100ms
-127.00
-127.00
-127.00
-127.00
@thelastoutpostworkshop
Copy link
Owner

thelastoutpostworkshop commented Sep 4, 2024

Yes there is probably a conflict, I dot not have a DS18B20, but I will try to find a way to test it.
Can you try with version 1.5 of the GPIOViewer library to see if you get the same results ?

@sarelvdwalt
Copy link
Author

Hey hey, ok so I had success. The following versions had a compiler issue:

  • 1.5.0
  • 1.5.1
  • 1.5.2
  • 1.5.3

The error was:

In file included from /Users/myname/Documents/Arduino/sarel/sarel.ino:1:
/Users/myname/Documents/Arduino/libraries/GPIOViewer/src/gpio_viewer.h: In member function 'int GPIOViewer::readGPIO(int, uint32_t*, pinTypes*)':
/Users/myname/Documents/Arduino/libraries/GPIOViewer/src/gpio_viewer.h:500:33: error: 'analogGetChannel' was not declared in this scope; did you mean 'analogChannel'?
  500 |         uint8_t analogChannel = analogGetChannel(gpioNum);
      |                                 ^~~~~~~~~~~~~~~~
      |                                 analogChannel

exit status 1

Compilation error: exit status 1

When I tried 1.5.4 it compiled, and upon running it I got a good result:

GPIOViewer >> Connected to WiFi
GPIOViewer >> Release 1.5.4
GPIOViewer >> ESP32 Core Version 3.0.4
GPIOViewer >> Chip Model:ESP32-D0WDQ6, revision:100
GPIOViewer >> No PSRAM
GPIOViewer >> Web Application URL is: http://192.168.107.132:8080
19.00
19.06
19.00
19.06
19.06

Tried version 1.5.5 and that was fine too:

GPIOViewer >> Connected to WiFi
GPIOViewer >> Release 1.5.5
GPIOViewer >> ESP32 Core Version 3.0.4
GPIOViewer >> Chip Model:ESP32-D0WDQ6, revision:100
GPIOViewer >> No PSRAM
GPIOViewer >> Web Application URL is: http://192.168.107.132:8080
19.06
19.06
19.06

So it appears the bug is with 1.5.6 specifically.

@thelastoutpostworkshop
Copy link
Owner

ok thanks for doing the test, Do you see pin activity on your GPIO 33 (oneWireBus) in the GPIOViewer web application ?

@sarelvdwalt
Copy link
Author

Any time :) Yes, I do see activity on it - but only after a while.

  • v1.5.5 (where it's working fine) - I see activity immediately, and it's binary (so it shows "High" with a red circle)
  • v1.5.6 (where it's broken) - after initial startup it doesn't show anything, and after a while (around a minute later at most) it shows Analog red, value 4095.

@thelastoutpostworkshop
Copy link
Owner

Thank again it will help. I do not know yet when I will be able to test it, stay tuned!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants