Go Down

Topic: Uno Wifi Rev 2 (Read 2169 times) previous topic - next topic

rchelicopter

Hello,
I just received an Arduino Uno WiFi Rev 2 board and I'm having a bit of trouble reading from a DS18B20 digital temperature device.  I'm using the DallasTemperature.h and the OneWire.h libraries.  The sketch is directly from the dallas examples built-in the libraries.

The same exact setup works with an Arduino mega by simply switching the boards in the board manager, so I know the wiring is correct.

All I get is a -127 in the serial monitor.

Code: [Select]

// Include the libraries we need
#include <OneWire.h>
#include <DallasTemperature.h>

// Data wire is plugged into port 2 on the Arduino
#define ONE_WIRE_BUS 5

// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);

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

/*
 * The setup function. We only start the sensors here
 */
void setup(void)
{
  // start serial port
  Serial.begin(9600);
  Serial.println("Dallas Temperature IC Control Library Demo");

  // Start up the library
  sensors.begin();
}

/*
 * Main function, get and show the temperature
 */
void loop(void)
{
  // call sensors.requestTemperatures() to issue a global temperature
  // request to all devices on the bus
  Serial.print("Requesting temperatures...");
  sensors.requestTemperatures(); // Send the command to get temperatures
  Serial.println("DONE");
  // After we got the temperatures, we can print them here.
  // We use the function ByIndex, and as an example get the temperature from the first sensor only.
  Serial.print("Temperature for the device 1 (index 0) is: ");
  Serial.println(sensors.getTempCByIndex(0));
  delay(1000);
}

spycatcher2k

Quote
// Data wire is plugged into port 2 on the Arduino
#define ONE_WIRE_BUS 5
Where exactly do you have the sensor plugged in?
Mrs Drew
-=-
http://www.uk-pcb.co.uk - UK PCB Fab Company
I will design & code for you, but I will also charge you (PM me)
If you don't like my answers, realize : I'm not being cheeky, I'm Just trying to prompt you to use your own brain/google etc.

rchelicopter

Sorry for the confusion, currently I'm using pin 5 however I have tried pins 2 through 5 without success.

rchelicopter

One additional thing to note:
The first time I open the IDE (version 1.8.6) and try to upload the sketch I get the below errors.  Any additional uploads the errors are gone.

Code: [Select]

In file included from C:\Users\Media Center\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.6.23\cores\arduino\wiring_private.h:31:0,

                 from C:\Users\Media Center\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.6.23\cores\arduino\WInterrupts.c:33:

C:\Users\Media Center\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.6.23\cores\arduino\WInterrupts.c: In function 'attachInterrupt':

C:\Users\Media Center\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.6.23\cores\arduino\Arduino.h:130:44: warning: initialization discards 'volatile' qualifier from pointer target type [-Wdiscarded-qualifiers]

 #define getPINnCTRLregister(port, bit_pos) ( ((port != NULL) && (bit_pos < NOT_A_PIN)) ? ((volatile uint8_t *)&(port->PIN0CTRL) + bit_pos) : NULL )

                                            ^

C:\Users\Media Center\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.6.23\cores\arduino\WInterrupts.c:77:29: note: in expansion of macro 'getPINnCTRLregister'

     uint8_t* pin_ctrl_reg = getPINnCTRLregister(port, bit_pos);

                             ^

C:\Users\Media Center\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.6.23\cores\arduino\WInterrupts.c: In function 'detachInterrupt':

C:\Users\Media Center\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.6.23\cores\arduino\Arduino.h:130:44: warning: initialization discards 'volatile' qualifier from pointer target type [-Wdiscarded-qualifiers]

 #define getPINnCTRLregister(port, bit_pos) ( ((port != NULL) && (bit_pos < NOT_A_PIN)) ? ((volatile uint8_t *)&(port->PIN0CTRL) + bit_pos) : NULL )

                                            ^

C:\Users\Media Center\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.6.23\cores\arduino\WInterrupts.c:100:29: note: in expansion of macro 'getPINnCTRLregister'

     uint8_t* pin_ctrl_reg = getPINnCTRLregister(port, bit_pos);

                             ^

In file included from C:\Users\Media Center\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.6.23\cores\arduino\wiring_private.h:31:0,

                 from C:\Users\Media Center\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.6.23\cores\arduino\wiring_digital.c:26:

C:\Users\Media Center\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.6.23\cores\arduino\wiring_digital.c: In function 'pinMode':

C:\Users\Media Center\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.6.23\cores\arduino\Arduino.h:130:44: warning: initialization discards 'volatile' qualifier from pointer target type [-Wdiscarded-qualifiers]

 #define getPINnCTRLregister(port, bit_pos) ( ((port != NULL) && (bit_pos < NOT_A_PIN)) ? ((volatile uint8_t *)&(port->PIN0CTRL) + bit_pos) : NULL )

                                            ^

C:\Users\Media Center\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.6.23\cores\arduino\wiring_digital.c:59:27: note: in expansion of macro 'getPINnCTRLregister'

   uint8_t* pin_ctrl_reg = getPINnCTRLregister(port, bit_pos);

                           ^

C:\Users\Media Center\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.6.23\cores\arduino\wiring_digital.c: In function 'digitalWrite':

C:\Users\Media Center\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.6.23\cores\arduino\Arduino.h:130:44: warning: initialization discards 'volatile' qualifier from pointer target type [-Wdiscarded-qualifiers]

 #define getPINnCTRLregister(port, bit_pos) ( ((port != NULL) && (bit_pos < NOT_A_PIN)) ? ((volatile uint8_t *)&(port->PIN0CTRL) + bit_pos) : NULL )

                                            ^

C:\Users\Media Center\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.6.23\cores\arduino\wiring_digital.c:189:27: note: in expansion of macro 'getPINnCTRLregister'

   uint8_t* pin_ctrl_reg = getPINnCTRLregister(port, bit_pos);

                           ^

Sketch uses 6424 bytes (17%) of program storage space. Maximum is 37168 bytes.
Global variables use 209 bytes (3%) of dynamic memory, leaving 5935 bytes for local variables. Maximum is 6144 bytes.

rchelicopter

Hello,
Can anyone explain the errors I'm getting (previous post).  I'm not even sure they are errors; however I get them regardless of what sketch I'm trying to use, even the blink sketch shows these "errors".

Does anyone have a Uno WiFi Rev 2 they could test, seems like an Arduino megaAVR boards by Arduino version 1.6.24 software issue.

Mark

PaulS

Quote
I'm not even sure they are errors
Here's a hint. Warning != Error.
The art of getting good answers lies in asking good questions.

rchelicopter

So I can ignore the Warning's?

PaulS

The art of getting good answers lies in asking good questions.

rchelicopter

Hello,
Can anyone help with my original problem with a Dallas DS18B20 temperature probe.  I simply cannot get it to work on my Uno WiFi Rev 2.

Code below is from the example sketch from the library "DallasTemperature by Miles Burton", version 3.8.

Code: [Select]

// Include the libraries we need
#include <OneWire.h>
#include <DallasTemperature.h>

// Data wire is plugged into port 2 on the Arduino
#define ONE_WIRE_BUS 2

// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);

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

/*
 * The setup function. We only start the sensors here
 */
void setup(void)
{
  // start serial port
  Serial.begin(9600);
  Serial.println("Dallas Temperature IC Control Library Demo");

  // Start up the library
  sensors.begin();
}

/*
 * Main function, get and show the temperature
 */
void loop(void)
{
  // call sensors.requestTemperatures() to issue a global temperature
  // request to all devices on the bus
  Serial.print("Requesting temperatures...");
  sensors.requestTemperatures(); // Send the command to get temperatures
  Serial.println("DONE");
  // After we got the temperatures, we can print them here.
  // We use the function ByIndex, and as an example get the temperature from the first sensor only.
  Serial.print("Temperature for the device 1 (index 0) is: ");
  Serial.println(sensors.getTempFByIndex(0)); 
}


The result of running this code or any other Dallas or onewire examples is the board cannot see the temp sensor.

The current sketch above results in -127 output for Celsius and -196.6 for Fahrenheit.

Wiring diagram is attached.

Thanks for looking

outsider

#9
Nov 21, 2018, 11:19 pm Last Edit: Nov 21, 2018, 11:38 pm by outsider
Did you try the OneWire scanner? Give this a try:
Code: [Select]
sensors.requestTemperatures(); // Send the command to get temperatures
delay(1000);
Serial.println("DONE");

Here's the address finder:
Code: [Select]
// This sketch looks for 1-wire devices and
// prints their addresses (serial number) to
// the UART, in a format that is useful in Arduino sketches
// Tutorial:
// http://www.hacktronics.com/Tutorials/arduino-1-wire-address-finder.html

#include <OneWire.h>

OneWire  ds(3);  // Connect your 1-wire device to pin 3

void setup(void) {
  Serial.begin(9600);
  discoverOneWireDevices();
}

void discoverOneWireDevices(void) {
  byte i;
  byte present = 0;
  byte data[12];
  byte addr[8];
  
  Serial.print("Looking for 1-Wire devices...\n\r");
  while(ds.search(addr)) {
    Serial.print("\n\rFound \'1-Wire\' device with address:\n\r");
    for( i = 0; i < 8; i++) {
      Serial.print("0x");
      if (addr[i] < 16) {
        Serial.print('0');
      }
      Serial.print(addr[i], HEX);
      if (i < 7) {
        Serial.print(", ");
      }
    }
    if ( OneWire::crc8( addr, 7) != addr[7]) {
        Serial.print("CRC is not valid!\n");
        return;
    }
  }
  Serial.print("\n\r\n\rThat's it.\r\n");
  ds.reset_search();
  return;
}

void loop(void) {
  // nothing to see here
}


And another goody:
https://forum.arduino.cc/index.php?topic=333923.0

tdavila68

Hi

I will be aiming at a similar goal and got stuck even earlier than you.

I had similar warning message (quite weard) and now I can not even manage to get the serial monitor working.

The screen gets blank.

How have you been able to set up the serial monitor to work ?

thanks

rchelicopter

Hello outsider,
I have tried the scanner sketch and it also cannot communicate with the sensor.  The message I see is No more addresses.



When I run the sketch you posted I get similar results.

Code: [Select]

Looking for 1-Wire devices...



That's it.


Any help is appreciated.


Nexum

Hi rchelicopter,

I have also got exactly the same issue as you, Arduino Uno WiFi Rev 2, DS18B20 temp sensor, works perfectly with another Arduino Uno but with the WiFi Rev 2 all I get is -127.0C.

I think there may be a serious issue with this board.

Did you get any further?

rchelicopter

Hello Nexum,
No I never got any further with the temp sensor.  I did encounter several other issues (pins reading analog thermocouple change wildly if DC adapter plugged in) which led me to completely give up on this board.

Mark

Nexum

Thanks for your info - I also have noticed exactly the same weirdness on the analog pins with an analog team sensor. It sounds like we wanted to make similar projects :-).

I am going to do the same, ditch the Rev 2, which is a shame because the WiFi functionality worked very well for me, it just seems to have baffling issues with normal functionality on the pins.

Based on the information here, I would not recommend the Uno WiFi Rev 2 to anyone.

I will start looking for a WiFi shield or something similar for my Uno Rev 3.

Thanks!

- N

Go Up