TavIR-AVR

TomP

Not me, but the datasheet makes it look like code for the DS1820 or DS18S20 would also work to read temperatures froma DS1920. It has the same family code (0x10) and returns a 9 bit temperature, like the DS1820.

Well, I'm just joining this discussion because I have a new Arduino and have been building a weather station so when I saw Arduino and OneWire in the same post I jumped at the chance. I'm using the 0011 version and put the files in arduino-0011\hardware\libraries\OneWire but I get an error about OneWire::OneWire(unsigned char)'o: In function `loop':I'm still going through the messages but if anyone has the fix I would appreciate it.

Thanks, Stephen

Stephen

TomP

I'm using the 0011 version and put the files in arduino-0011\hardware\libraries\OneWire but I get an error about OneWire::OneWire(unsigned char)'o: In function `loop':I'm still going through the messages but if anyone has the fix I would appreciate it.

The OneWire library, itself, doesn't have any problems with arduino-0011 that I'm aware of. If you're still having this problem, I'd be happy to look at it if you post your code here.

TomP, I'm trying to compile the sample.c program that comes with the OneWire library. Like I say I'm new to the Arduino and have not programmed in c for several (many?) years. Perhaps I'm just doing it wrong. Thanks for trying to help.

OK, told you I was new to all of this. I just noticed that in the files downloaded there is a onewire.h and a onewire.cpp but unlike the other libraries there is no onewire.o file. Do I need to compile the code and what would be the best way to do that? :-/ Thanks.

More info: I've gotten the library to work, I had two problems. First I copied the sample.c file into the directory and I think that was confusing Arduino somehow and there was an extra semicolon in the code ( ..who put that there?..) I got rid of the fluff and it compiled OK and works. Thanks all for the help and support, I can use all I can get at this stage.

audas

I am from Irvine,CA. I am working with a network of 1 wire temp sensors. (DS18B20).

have you ever tried using your 1-wire arduino and Jim's updated library for arduino-10 with more than 9 DS18B20's in parasite power mode?

I am using your example code and the 1-wire library by calling it from the Arduino IDE as someone has posted in the arduino playground.( I have even commented the code)

I am attempting to connect 29 DS18B20's in parasite power mode. So far I have tested those 29 individually with your library and they worked pretty well. I can discover their addresses and ask them for a temperature value.

As long as I connect 8 DS18B20 to the same wire of course, the readings become rubbish. Only two sensors keep giving me their ID and loop forever(CRC's ok). The others sensors seem to be lost or not being able to be discovered ever.

It is not a power issue since I have looked at the signal over the oscilloscope. It is neither a problem of the pull up resistor.

I got 100 DS18B20's from maxim. ALL OF THEM WORK PERFECT INDIVIDUALLY.

The weird behaviors comes into play when I CONNECT MORE THAN 8 sensors. I tried replacing sensors with those hundred I got until I find one that is is able to be read adding an extra sensor to the 8 sensor network. The farthest I could go was 16 sensors. Leaving 16 sensors cataloged as not being able to participate in a network of more than 8 sensors.

this means that If I have a network of 16 DS18B20's working well (after trying with ~32 different sensors until 16 worked ok together) and I replace one of them with one of the cataloged as "bad"(~15) all the information becomes rubish again.

TomP

It is not a power issue since I have looked at the signal over the oscilloscope. It is neither a problem of the pull up resistor. [...] I am pretty much sure is a software problem( the 1-wire library).

I'm not sure how you can conclude that it's not a hardware issue. You can't just continue to add devices to a 1-wire network and expect them all to perform as if they were the only devices on the bus. Maxim publishes an application note (AN148 - ""Guidelines for Reliable 1-Wire Networks") that discusses the issues people encounter when trying to build medium-sized and large 1-wire networks. It's readable and seems to contain a lot of good advice. Two things, in particular, that would probably be helpful would be to power the devices directly and to split your network up into two or more separate, smaller 1-Wire busses.

Personally, I don't think there's bug in the OneWire library that could be responsible for your problems. On the other hand, it may be possible to improve the reliability of your existing circuit by using the library differently. For example, you can either tell all the devices to start a temperature conversion at once, or you can address them individually and ask them to do their conversions one at a time. Having them do all their conversions at once is going to draw much more power from the bus, and so I'd avoid doing that. I guess a similar issue arises with the command to have devices report their addresses, but I'm not sure whether there's an alternative there. All that said, my feeling is that you will probably need to (at a minimum) split up your network into smaller, separately powered networks if you want to support that many devices.

kBit

I just thought I'd try Jim's OneWire library and got the following errors when the Arduino environment (11) starts up:

OneWire.cpp: In constructor 'OneWire::OneWire(uint8_t)':OneWire.cpp:74: error: 'digital_pin_to_port' was not declared in this scopeOneWire.cpp:76: error: 'port_to_output' was not declared in this scopeOneWire.cpp:77: error: 'port_to_input' was not declared in this scopeOneWire.cpp:78: error: 'port_to_mode' was not declared in this scope

OneWire.cpp and OneWire.h are in hardware/libraries/OneWire

Any ideas what went wrong?

TomP

I just thought I'd try Jim's OneWire library and got the following errors when the Arduino environment (11) starts up:

I don't think Jim's original library is usable in anything but Arduino-007. It had to be updated to work with changes in the header files in later Arduino releases, as you can see from your compile errors. I didn't start working with it until Arduino-010, myself, and have only tried using the most recently updated versions. At this point, the most recent update that I'm aware of is mine, which is referenced on the OneWire page in the playground; I would recommend you use that.

The_Deviant

Sorry for the thread ressurection, but I appear to be having a problem similar to the one experienced by audas, except this problem occurs in my setup after a FIFTH DS1820 is added. I'm using the code on the Learning/OneWire page.

don

I am inclined to suspect a software bug perhaps in the search function. I have a bunch of sensors on a board for testing and am able to get 5 sensors reading reliably, but when I add 2-3 more sometimes it works and sometimes I get into loop mode where it never gets to the last address.

It doesn't make sense to me that a network would need to be split with just 5 sensors on a board.