DS18B20 one-wire implementation Arduino OPTA

Hello there!

I'm having problem with Arduino OPTA reading temperature from DS18B20 temp sensor.

I'm using my old code for Arduino mega, but I guess there is problem to recognise input as digital as Arduino Opta has digital/analog inputs.

Could you please give some hints how should I get it going? Besides - what does it mean when led is blinking red? No errors in Serial Monitor...

#include <OneWire.h>
#include <DallasTemperature.h>
 
OneWire oneWire(3); 
DallasTemperature sensors(&oneWire); 
 
void setup(void) {
  Serial.begin(9600);
  sensors.begin(); 
}
 
void loop(void) { 
  sensors.requestTemperatures(); 
  Serial.print("T [C]: ");
  Serial.println(sensors.getTempCByIndex(0));  
  delay(500);
}

Not sure what the problem is you did not state it. Since you are talking about I/O post an annotated schematic is extremely helpful in solving your problem as I cannot see what you have nor can others.

1 Like

I think there is not need for schematics - signal from ds18b20 is connected to I3, that’s it.

Arduino Opta is relatively new piece of hardware and potentially it has no possibility to work with 1-wire sensors… I got an answer from my local distributor that they have not tested 1-wire with Opta, but they are pretty sure it won’t work. They sent me this link: Mbed_opta - Arduino Libraries, but I can not get it working either.

I have purchased LM35DZ analog temperature sensor and will test it in upcoming week.

1 Like

So no other connections to the DS18B20 ?

Good Luck. I cannot see what you have and I do not have time to play guessing games.

OneWire oneWire(3); 

@adam_2,

The DS18B20 will not work with the Opta. The Opta only has analog inputs, not digital inputs. One-wire is a serial protocol that needs one digital input. To read a temperature sensor with the Opta, use an analog temperature sensor such as the LM35, the TMP36, or a thermocouple with an analog output amplifier.

1 Like

I've been having the same issue with DHT11 temp/hum sensors. They work fine with normal arduino board using the adafruit library.

The docs do say the inputs can be analog or digital (https://docs.arduino.cc/tutorials/opta/getting-started#using-opta-plcs-inputs)

To use them as digital inputs, add the Arduino command
pinMode(pinName, INPUT);

inside the setup()

To use them as analog inputs, add the command

analogReadResolution();

with the bit resolution that you want to use.

However even with pinMode() I can't seem to get anything from the DHT11. I may dig into the library code at some point but I don't have time now. Guess I'll just get some analog sensors for now.

1 Like

Hi, is this true given that pins can be configured as digital?

Hello @dmlest!

Pins can be configured and used as digital inputs. Notice that the input voltage can be from 0 to 10V only.

I'm admittedly out of my league with regards to this subject matter but I've also been banging my head against a wall trying to work with the OPTA's digital inputs this week, originally in an effort to get a DS18B20 functioning.

According to this document: Arduino Opta® Collective Datasheet, section 3.5.2 Digital Inputs, the OPTA's Digital Input voltage logic level = VIL Max: 4.46 VDC. VHL Min: 6.6 VDC.

I don't know the acronyms but I found that document after, through trial and error, I learned that supplying 6VDC or greater is the only way to reliably get a 1 with digitalRead on the OPTA's input pins when they're configured in digital mode.

I'm posting this here in hopes that someone else can extrapolate my findings against logical expectations from the OneWire library and the DS18B20's operating specification.

I'm not sure if the DS18B20 is capable of operating above 5VDC but my suspicion is that it can't and thus can't provide the 6V minimum required to represent the digital 1.

Hello!

The pins are not working as other boards' inputs, that's why you are having issues with the oneWire library, it is not getting the HIGH/LOW properly, you might tweak that by adding a voltage translator.

I would recommend to use analogRead to get the voltage from an analog sensor instead.

Best regards!

When you said in an earlier post that the Opta only has analog inputs, were you talking about the microprocessor level, where the inputs are always analog, then if configured as digital are simply compared to analog levels within the core software or perhaps by internal microcontroller comparators?
The Opta datasheet states the digital input voltage range is 0 to 24V. Where is this 10V limit?

2 Likes

Not at MCU level, the final prodcut has only analog inputs that read 0-10V, if you have 24V it will not break the input.

1 Like

The OneWire library will not work for Arduino Opta, because the 1-Wire communication protocol is half duplex meaning that a GPIO is required and Arduino Opta does not have digital OUTPUTS (the only outputs it has are the four relays). Arduino Opta datasheet