navitron
 
Renewable Energy and Sustainability Forum
UK's most popular Renewable Energy Forum May 23, 2012, 10:16:30 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Anyone wishing to register as a new member on the forum is strongly recommended to use a "proper" email address - following recent spam/hack attempts on the forum, all security is set to "high", and "disposable" email addresses like Gmail, Yahoo and Hotmail tend to be viewed with suspicion, and the application rejected if there is any doubt whatsoever
 
Recent Articles: UPDATE ON DECC APPLICATION FOR LEAVE TO APPEAL TO THE SUPREME COURT | Yingli Green Energy's PV Module Ranks No.2 in TUV Rheinland Energy Yield Test | Navitron Solar Showers at Glastonbury for Year 5!
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Problems with 1-wire on Arduino  (Read 1932 times)
StBarnabas
Hero Member
*****
Offline Offline

Posts: 2111


St Barnabas Chapel (2009)


« on: October 20, 2010, 05:48:26 PM »

The day started well
My Nuelectronics shield arrived so time to look a bit more at the Arduino. As an aside I will be teaching an instrumentation course in the next few weeks and have implimented a thermister based HalFBee PIC sensor using two look up tables.  I will do the same with a PT1000 sensor in a week or so. I know that some of you will think why bother when there are DS18B20 and 18S20 ICs easily available but thermistors are cheaper and some come with decent mounting systems.

Anyway I downloaded the One-wire Arduino Library from http://www.pjrc.com/teensy/td_libs_OneWire.html and think I have installed and complled the example correctly (for DS18S20s on Pin 10). This compiles and links to 4038 Bytes.

I have a working DS18S20 and can see it with my USB9097 but when I plug into the Arduino setup in either powereed and parasitic mode it is not seen. and I continually get  "No more addresses.\n" on my serial monitor. This is the error if no devices are found.

Am I doing anything obvious wrong?

Segment of code attached

 #include <OneWire.h>

/* DS18S20 Temperature chip i/o */

OneWire  ds(10);  // on pin 10

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

void loop(void) {
  byte i;
  byte present = 0;
  byte data[12];
  byte addr[8];
 
  if ( !ds.search(addr)) {
    Serial.print("No more addresses.\n");
    ds.reset_search();
    delay(250);
    return;
  }


 
Logged


Gestis Censere. 40x47mm DHW with TDC3. 3kW ASHP, 9kW GSHP, 3kW Navitron PV with Platinum 3100S GTI, 6.5kW WBS, 5 chickens. FMY 2009.
ericw
Hero Member
*****
Offline Offline

Posts: 735


« Reply #1 on: October 20, 2010, 06:04:42 PM »

Sean,
Don't use pin 10, use one of the ones they bring out to their sockets. Pin 10 is normally part of the interface used by the card and apparently there is a quirk in the Atmega that means it must be an output for the interface to work.

On other SD shields pin 10 is used as the CS for the card but for some reason Nuelectronics have used pin 5.
I had a very frustrating time trying to get the built in LED on pin 13 flashing with the shield software in place, until I found that it was being used for the card interface.

Nuelectronics have been a bit liberal with the number of pins they have used.
Pins 3,4 & 6 are used by the RTC
Pins 5 11,12,7 13 plus 10 are used by the card.

Eric
Logged
StBarnabas
Hero Member
*****
Offline Offline

Posts: 2111


St Barnabas Chapel (2009)


« Reply #2 on: October 20, 2010, 09:28:37 PM »

Eric
I have no shield at present and am using a "naked" Duemilanove. Does this still apply? Obviously I can change the DQ pin - will give it a go tomorrow if I have time.
Sean
Logged


Gestis Censere. 40x47mm DHW with TDC3. 3kW ASHP, 9kW GSHP, 3kW Navitron PV with Platinum 3100S GTI, 6.5kW WBS, 5 chickens. FMY 2009.
ericw
Hero Member
*****
Offline Offline

Posts: 735


« Reply #3 on: October 20, 2010, 11:15:33 PM »

Sean,
If there is no added shield then it shouldn't apply.
Probably a silly question - have you forgotten the pull up resistor ?

If you email me the full sketch I'll give it a try and see what happens.

Eric
Logged
StBarnabas
Hero Member
*****
Offline Offline

Posts: 2111


St Barnabas Chapel (2009)


« Reply #4 on: October 21, 2010, 11:22:37 AM »

Where is the embarassed smiley when you need it! Works fine with a 5.6k resistor. I had indeed forgotten the pull up!
Logged


Gestis Censere. 40x47mm DHW with TDC3. 3kW ASHP, 9kW GSHP, 3kW Navitron PV with Platinum 3100S GTI, 6.5kW WBS, 5 chickens. FMY 2009.
wyleu
Guest
« Reply #5 on: October 21, 2010, 11:30:48 AM »

Takes long hard look at packing case of smites...
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!