Atmega4808, one wire & DS18B20

I’m trying to use DS18B20 temperature sensors with an Atmega4808 using PIN_PD6 and it just does not work!

I’ve used the sensor on an UNO, using this: Guide for DS18B20 Temperature Sensor with Arduino | Random Nerd Tutorials and I can easily read the temperature.

I replaced the UNO with a 4808 (on my PCB), and just get nothing. I used a scope to measure the DQ pin, and cannot see any communication.
If I use blink on PIN_PD6 I see the single changing.

Did many search on this and found this:

But doesn’t help to solve the issue.

How can I get the sensor to work with my PCB?

Can you explain this statement. An UNO is a board with a 328P micro on it, but a 4808 is a chip.

How have you replaced one with the other?

1 Like

Post an annotated schematic of your circuit, show all connections including power, ground, and power sources.

It might help if you mentioned which core and which board you're compiling against (i.e. the FQBN).

Sorry for the missing information!

What I meant was that I tested the DS18B20 using a UNO board in the "normal mode" (5V to the VDD as seen in the link I sent):

I used the "One wire" and "dallas" libraries and the arduino code (single sensor) as in the link I sent.
This works fine.

I then disconnected the UNO and connected my 4808 board (32pin) which has the MegaCoreX.
I just updated the sensor pin to:
#define ONE_WIRE_BUS PIN_PD6

/*********
  Rui Santos
  Complete project details at http://randomnerdtutorials.com  
  Based on the Dallas Temperature Library example
*********/
#include <OneWire.h>
#include <DallasTemperature.h>

#define ONE_WIRE_BUS PIN_PD6
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

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

void loop(void){ 
  sensors.begin();
  sensors.requestTemperatures(); 
  Serial.print("T=");
  Serial.println(sensors.getTempCByIndex(0)); 
  delay(1000);
}

But this does not work. and I don’t see any communication when probing DQ leg with my oscilloscope.

As I can figure out, there is something that does not work with the "one wire" and the 4808.

I hope this has all the missing information.

I have no idea what I did today different than yesterday (probably it’s better to work after a good night sleep), but now I got it working!!

According to Add line for Atmega4808 · Issue #99 · PaulStoffregen/OneWire · GitHub

In OneWire_direct_gpio.h I changed

#if defined(__AVR_ATmega4809__)

To

#if defined(MEGACOREX)

And now it works on my 4808!!!