Uno Wifi Rev 2

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.

// 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); 
}

(deleted)

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

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.

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.

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

I'm not even sure they are errors

Here's a hint. Warning != Error.

So I can ignore the Warning's?

rchelicopter:
So I can ignore the Warning's?

Generally, yes.

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.

// 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

Did you try the OneWire scanner? Give this a try:

sensors.requestTemperatures(); // Send the command to get temperatures
delay(1000);
Serial.println("DONE");

Here's the address finder:

// 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

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

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.

Looking for 1-Wire devices...



That's it.

Any help is appreciated.

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?

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

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

Yeah; I took a look and it won't work. The OneWire library has some direct_gpio function that it assumes will work across all "AVR" boards. But the ATmega4809 has GPIO that works significantly differently :frowning:

Want to try a patched version of the onewire library?

OneWire.zip (23.1 KB)

Thanks for taking a look!

First time using a replacement library like this, I unzipped into a 'Libraries' directory next to my sketch file, and tried to switch the library out like this:

//#include <OneWire.h>
#include "Libraries/OneWire/OneWire.h"

... I didn't see a change on the Uno WiFi Rev2 though (still -127.0 readings, I have three DB18S20s on one bus and get this from all three of them).

Perhaps I'm using the replacement library incorrectly though.

  • N

Perhaps I'm using the replacement library incorrectly though.

I would delete the old library (you can always download it again), and install the new version using "Install Zip Library"...

Turn on the verbose compilation option, and you'll be able to see which library is actually being compiled.

(Hmm. I don't actually see any way to delete a library, from within the IDE. You should be able to delete it manually by removing the sketchbook/libraries/OneWire directory (and everything in it.))

Hi westfw,
I'll give the patched library a try tonight.

Thanks