Pages: 1 ... 3 4 [5] 6   Go Down
Author Topic: Arduino and 1-wire  (Read 16623 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 1
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Anybody use DS1920 (thermocron)?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 39
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Anybody use DS1920 (thermocron)?
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.
Logged

Lacomb, Oregon
Offline Offline
Sr. Member
****
Karma: 0
Posts: 302
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Stephen

0
Offline Offline
Newbie
*
Karma: 0
Posts: 39
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.
Logged

Lacomb, Oregon
Offline Offline
Sr. Member
****
Karma: 0
Posts: 302
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Stephen

Lacomb, Oregon
Offline Offline
Sr. Member
****
Karma: 0
Posts: 302
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK, told you I was new to all of this.  :o 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.
Logged

Stephen

Lacomb, Oregon
Offline Offline
Sr. Member
****
Karma: 0
Posts: 302
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Stephen

0
Offline Offline
Newbie
*
Karma: 0
Posts: 1
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello everyone,

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.

I am pretty much sure is a software problem( the 1-wire library).

Can you provide any help?

Many thanks,.

Ulises
 :-[Irvine, CA.
Logged

Lacomb, Oregon
Offline Offline
Sr. Member
****
Karma: 0
Posts: 302
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What happens if you run them with power? and do you have the pullup resistor in your circuit?
Logged

Stephen

0
Offline Offline
Newbie
*
Karma: 0
Posts: 39
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
[...] and do you have the pullup resistor in your circuit?
Without the pull-up resistor, even one device wouldn't work.  
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 39
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.  
Logged

Central Florida, USA
Offline Offline
Jr. Member
**
Karma: 0
Posts: 59
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 scope
OneWire.cpp:76: error: 'port_to_output' was not declared in this scope
OneWire.cpp:77: error: 'port_to_input' was not declared in this scope
OneWire.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?

Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 39
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 1
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Here is an example of what happens:

Four sensors connected:
R=10 F2 36 55 0 8 0 D0 P=1 31 0 4B 46 FF FF 2 10 72  CRC=72
R=10 8A 14 55 0 8 0 92 P=1 33 0 4B 46 FF FF 3 10 30  CRC=30
R=10 E3 73 55 0 8 0 87 P=1 32 0 4B 46 FF FF E 10 FA  CRC=FA
R=10 EF 4A 55 0 8 0 8D P=1 31 0 4B 46 FF FF 3 10 B6  CRC=B6
No more addresses.

Looks good...  Now, I add a fifth:
R=10 F4 31 55 0 8 0 33 P=1 41 0 4B 46 FF FF 4 10 6D  CRC=6D
R=10 F2 36 55 0 8 0 D0 P=1 31 0 4B 46 FF FF 4 10 D8  CRC=D8
R=10 8A 14 55 0 8 0 92 P=1 34 0 4B 46 FF FF E 10 69  CRC=69
R=10 F2 36 55 0 8 0 D0 P=1 31 0 4B 46 FF FF 4 10 D8  CRC=D8
R=10 8A 14 55 0 8 0 92 P=1 35 0 4B 46 FF FF 3 10 A3  CRC=A3
R=10 F2 36 55 0 8 0 D0 P=1 31 0 4B 46 FF FF 4 10 D8  CRC=D8
R=10 8A 14 55 0 8 0 92 P=1 35 0 4B 46 FF FF 3 10 A3  CRC=A3
R=10 F2 36 55 0 8 0 D0 P=1 31 0 4B 46 FF FF 4 10 D8  CRC=D8
...and on and on and on...

Now, of course, I thought I might have a bad sensor, so I swapped out one sensor each time, while running only four, and it worked every time.  Every time I added a fifth sensor, it would loop.

I'm not running parasite power, and have the 4.7k pull-up (to +5V) resistor on the DQ line, which also goes to the Arduino.  Pin 1 is going to ground, and pin 3 is connected to the same +5v source.

Anyone have any ideas?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 5
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

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.

- using latest code, parasite power....

any thoughts would be greatly appreciated
Logged

Pages: 1 ... 3 4 [5] 6   Go Up
Jump to: