Pages: [1]   Go Down
Author Topic: DS18B20 & Arduino Uno in Proteus Isis  (Read 1948 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello.

I'm trying to simulate the use of a ds18b20 in isis.

I'm working with arduino 1.0.5. and I downloaded the latest OneWire library.
In my atmega328p, I put the sample code DS18x20_Temperature just with just replacing the ds pin from 10 to 2.
And it's not working : No more adresses.

Here is my schema.

What's going wrong ?

Thanks.


Edit : it's working using d10 pin.  Why not whith d2 ?


* Test.png (37.54 KB, 1010x710 - viewed 249 times.)
« Last Edit: August 01, 2013, 03:51:19 am by tweety » Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

because the pin is not defined as INPUT/OUTPUT?
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No.  The lcd is connected but not used by the atmega.  Only the sample code for ds18b20.

DS connected to pin d2 - not working.
DS connected to pin d10 (and pin d10 also connected to lcd) - working.
Pin d10 disconnected from lcd - not working.

Now I found the pull-up resistor of the ds is wrong : 4R7 in place of 4K7.
Corrected and ... working.
But if I connect again the pin d10 to ldc, it's not working.
Ok, it's stupid to connect the lcd on the pin.  But if I disconnect the lcd and connect the led (on the bottom right) it's also not working.

So I suppose it's a question of value for the resistor.  But how to calculate it ?
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
DS connected to pin d10 (and pin d10 also connected to lcd) - working.

so pin 10 is connected to both the LCD and the DS18B20. (this is not preferred but opens possibilities smiley-wink

Seems that the LCD has somehow the proper resistor value / behavior

What is the function of the LCD pin connected to Arduino pin 10?
- data pin
- ENable pin
- RW pin
- ??

What type of communication does the LCD use?
- Serial
- SPI
- I2C
- parallel (4/8 datalines)
- other?
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
so pin 10 is connected to both the LCD and the DS18B20. (this is not preferred but opens possibilities

Ok, I know it's stupid ... I tell it in the post above  smiley-cool

The pin d10 is connected to the data pin d7 on the lcd and is using parallel 4 bits.
BUT for the moment it is not used ! No code for the lcd in the atmega.  Only for the ds.

 
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Ok, I know it's stupid ..
Maybe, maybe not, it would be great if one could use a single pin for 2 different functions.
The closest I did was to use the serial port for 2 different devices (one input one output) but that are two pins.

OK back to the problem.
The LCD pin seems to act as an additional pull up/down resistor. (I assume the LCD is also connected to 5V and GND)
That is confirmed by the fact that if you remove the LCD the DS doesn't work any more.

What is the length of the cable to the DS? this affects the resistor to choose, the longer the cable the smaller the R.
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

(not related to DS problem)
looking at your schema, pin 13 is also double used - for the LED and the LCD
That might also cause some interference in the future.

Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Heu ... I'm only working with isis ....  I'll try with my arduino later.

I agree with you for the pull-up from the lcd.  So I suppose I have to modify the value of the ds pull-up.  But wich value ?
I tried some values but nothing works.

Perhaps for making it more simple, if I disconnect the lcd and connect the led (in place of pin d13).  It's also not working.


ps : for the led connected on d13, there is no problem.  The lcd works fine.  In fact I make like this because it is the way the arduino uno is made (see http://arduino.cc/en/uploads/Main/Arduino_Uno_Rev3-schematic.pdf).
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

the value of the resistor is 4K7 for short distances. For long distances it depends on the cable used but common values are 2K2 for 10meter (35 feet).

How long is your cable?
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm not working with real cables, only working with isis.
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

what is isis?  (clearly I missed something smiley-wink
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You clearly missed something ....

http://www.labcenter.com/products/vsm/vsm_educational.cfm
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

so there is a chance that the simulator has a bug ...
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Perhaps, I don't know.  The last test to realize : doing it with the real arduino.
Logged

Pages: [1]   Go Up
Jump to: