OneWire ?????????? arduino nano 33 iot

Hello, I just bought an Arduino nano 33 iot, I want to connect several temperature sensor (ds18b20) with the oneWire library. After several days of research, it appears that this library is not compatible with the NANO 33IOT. Do you have a solution to solve this problem?

This maybe in the too hard box . The board uses a totally different processor to the 328 type NANO , there will be some incompatibilities ( eg EEPROM).

The ds18b20 works at 5v not the 3.3v of your board , so you would need to overcome that first .

I’m not sure the one wire library does exist either yet for this device ( might be wrong) - suggest you ask google or someone here may know more.

https://www.arduino.cc/en/reference/libraries

hammy:
The ds18b20 works at 5v not the 3.3v of your board , so you would need to overcome that first .

The Maxim datasheet for it suggests operation between 3.0 -> 5.5V.

As far as I can tell, the OneWire library 2.3.5 already has customisations for the SAMD21G18A and when I compile the DS18x20 example sketch for the Nano 33 IOT it successfully compiles.

What's your actual problem with it?

When a temperature sensor is connected to arduino nano 33 iot works very well. When I connect a second sensor with the oneWire library and by modifying the code. verification is impossible, an error message is displayed saying that my arduino card cannot access this code.

Can you send me your code?

I just used the example sketch which you already have.

gui21540:
by modifying the code. verification is impossible, an error message is displayed saying that my arduino card cannot access this code.

Why not post your code which you modified? Don't forget to use code tags so that is is appropriately formatted for the forum; an easy way to do this is from the Arduino IDE -> Edit -> Copy for forum; then just paste into your post.

I just found this code, what do you think?

#include <OneWire.h>
#define BLYNK_PRINT Serial

#include <WiFiNINA.h>
#include <SPI.h>
#include <BlynkSimpleWiFiNINA.h>

char auth[] = "xxxx"; // your token from blynk
char ssid[] = "xxxx"; // your WiFi SSID
char pass[] = "xxxxx"; // your WiFi password
 
/* Broche du bus 1-Wire */
const byte BROCHE_ONEWIRE = 7;

/* Code de retour de la fonction getTemperature() */
enum DS18B20_RCODES {
  READ_OK,  // Lecture ok
  NO_SENSOR_FOUND,  // Pas de capteur
  INVALID_ADDRESS,  // Adresse reçue invalide
  INVALID_SENSOR  // Capteur invalide (pas un DS18B20)
};


/* Création de l'objet OneWire pour manipuler le bus 1-Wire */
OneWire ds(BROCHE_ONEWIRE);
 
 
/**
 * Fonction de lecture de la température via un capteur DS18B20.
 */
byte getTemperature(float *temperature, byte reset_search) {
  byte data[9], addr[8];
  // data[] : Données lues depuis le scratchpad
  // addr[] : Adresse du module 1-Wire détecté
  
  /* Reset le bus 1-Wire ci nécessaire (requis pour la lecture du premier capteur) */
  if (reset_search) {
    ds.reset_search();
  }
 
  /* Recherche le prochain capteur 1-Wire disponible */
  if (!ds.search(addr)) {
    // Pas de capteur
    return NO_SENSOR_FOUND;
  }
  
  /* Vérifie que l'adresse a été correctement reçue */
  if (OneWire::crc8(addr, 7) != addr[7]) {
    // Adresse invalide
    return INVALID_ADDRESS;
  }
 
  /* Vérifie qu'il s'agit bien d'un DS18B20 */
  if (addr[0] != 0x28) {
    // Mauvais type de capteur
    return INVALID_SENSOR;
  }
 
  /* Reset le bus 1-Wire et sélectionne le capteur */
  ds.reset();
  ds.select(addr);
  
  /* Lance une prise de mesure de température et attend la fin de la mesure */
  ds.write(0x44, 1);
  delay(800);
  
  /* Reset le bus 1-Wire, sélectionne le capteur et envoie une demande de lecture du scratchpad */
  ds.reset();
  ds.select(addr);
  ds.write(0xBE);
 
 /* Lecture du scratchpad */
  for (byte i = 0; i < 9; i++) {
    data[i] = ds.read();
  }
   
  /* Calcul de la température en degré Celsius */
  *temperature = (int16_t) ((data[1] << 8) | data[0]) * 0.0625; 
  
  // Pas d'erreur
  return READ_OK;
}
 
 
/** Fonction setup() **/
void setup() {
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);

}
 
 
/** Fonction loop() **/
void loop() {
  float temperature[3];
   
  /* Lit les températures des trois capteurs */
  if (getTemperature(&temperature[0], true) != READ_OK) {
    Serial.println(F("Erreur de lecture du capteur 1"));
    return;
  }
  if (getTemperature(&temperature[1], false) != READ_OK) {
    Serial.println(F("Erreur de lecture du capteur 2"));
    return;
  }
  if (getTemperature(&temperature[2], false) != READ_OK) {
    Serial.println(F("Erreur de lecture du capteur 3"));
    return;
  }
   
  /* Affiche les températures */
  Serial.print(F("Temperatures : "));
  Serial.print(temperature[0], 2);
  Serial.write(176); // Caractère degré
  Serial.print(F("C, "));
  Serial.print(temperature[1], 2);
  Serial.write(176); // Caractère degré
  Serial.print(F("C, "));
  Serial.print(temperature[2], 2);
  Serial.write(176); // Caractère degré
  Serial.println('C');
}

gui21540:
I just found this code, what do you think?

So this's not the code you were testing with and modified? ie. Not the code I asked for?

I haven't looked at this new code, but if it works and does what you want then it's all good.

I was wrong about the voltage for the ds18b20 - apologies

Hi,
I can assure maxim temperature sensor (ds18b20) dallas temperature and onewire libraries works ok with arduino nano 33 IOT.
one wire
8 sensors
multiple addres founded
readings ok with some dispertion between them
test for sevaral hours every 10 seconds
hope this help
Ale