Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
Since a couple of days i'm playing around with the temperature sensor ds18b20 on my new tft maximite V1.4.
For testing purposes i build a small breadboard and led out 5 I/O pins.
--> MMBasic Pins # 12,13,18,19,20.
If i connect the ds18b20 to Pin 12 or 13 it works perfect.
Connected to the pins 18,19,20 it doesn't work. On these pins i always get '85' as the result (Which seems to be the reset value until no measurement was started).
If i confgure these pins as digital I/O, they work. I'm able to measure 0V and 3.3V for Low and HIgh. So my wiring is fine and the pins are working in principle.
I've updated MMBasic to 4.5.
Does someone have an idea what's wrong?
ReinerEdited by Reiner 2016-02-24
WhiteWizzard Guru Joined: 05/04/2013 Location: United KingdomPosts: 2934
Posted: 10:26am 23 Feb 2016
Copy link to clipboard
Print this post
Hi Reiner,
Welcome first of all!
Nothing obviously wrong with what you are doing but the mention of 'breadboard' highlights a potential cause.
There has been a (large) number of issues caused by 'cheap' breadboards here on TBS (the contact strips underneath are either set too low; or in some cases are missing/broken). I'm not saying this is the cause of your issue, but the first thing I would try is 'moving' your test circuit into another position on the Breadboard - it may just fix your issue.
I was trying to confirm if all the MaxiMite pins you mention are compatible with the DS18B20 but could not find anything to say it isn't. Perhaps others can chime in here . . .
Let us know if moving the circuit on the breadboard resolves things!
It's a soldered breadboard (in german "Lochrasterplatine" i couldn't find any other translation) made with silver wire.
The sensor is connected with soldered wires into screw terminals on the board.
Reiner
Frank N. Furter Guru Joined: 28/05/2012 Location: GermanyPosts: 947
Attached 330R resistor to pin19 vs. gnd and set the pin to "high". --> 3.0V output signal.
Attached 330R vs. 3.3V, the pin shows 0.3V when set to "low".
--> The output is able to drive at least 15mA (specification says 25mA).
Configured as digital Input, the pin works fine.
So i can exclude any problems in the wiring or a defect of the PIC Portpin.
Question: The startscreen shows MMBasic 4.5. Variable 'mm.ver' 4.05.
Is this correct?
I try a second Sensor afterwards, although im pretty sure that this wouldn't change anything.
Reiner
edit:
1. Test with a second ds18b20 shows the same behaviour.
2. Pin 19 (were i made the "Load-Test" at 15mA) seems to be dead. Now i get only 0.4V Output High Level when set to high and configured as dout.
I'm nearly 100% sure that i'm not mistreated this pin (and certainly not the others) nor the whole maximite.
So i assume that there could be some kind of predamage on my maximite....
Edited by Reiner 2016-02-26
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10251
Posted: 06:35am 25 Feb 2016
Copy link to clipboard
Print this post
You do have a 4K7 pullup resistor on the data pin of the DS18B20?
No! I don't want to use the parasitic power.
The ds18b20 is connected to Pin, Gnd and 3.3V.
WhiteWizzard Guru Joined: 05/04/2013 Location: United KingdomPosts: 2934
Posted: 06:49am 25 Feb 2016
Copy link to clipboard
Print this post
You still require a pull-up as matherp has highlighted (parasitic power or not!)
Sounds like this is your issue.
WhiteWizzard Guru Joined: 05/04/2013 Location: United KingdomPosts: 2934
Posted: 06:53am 25 Feb 2016
Copy link to clipboard
Print this post
Extract from DataSheet:
The DS18B20 uses Dallas’ exclusive 1-Wire bus protocol that implements bus communication using one control signal. The control line requires a weak pullup resistor since all devices are linked to the bus via a 3-state or open-drain port (the DQ pin in the case of the DS18B20).
Perfect, now it works.... Thanks!
Strange accident.... Because two pins worked fine, i didn't think about to have a look into the datasheet.
But Pin19 is dead Very strange.... less than 15mA while spec. said 25mA.
The only thing i could imagine is that i made a short with my measurement tips. But i didn't noticed anything.
WhiteWizzard Guru Joined: 05/04/2013 Location: United KingdomPosts: 2934
Posted: 08:29am 25 Feb 2016
Copy link to clipboard
Print this post
But Pin19 is dead Very strange.... less than 15mA while spec. said 25mA.
The only thing i could imagine is that i made a short with my measurement tips.
I find it worth adding a series resistor on every I/O pin - something like a 220R-470R. This then limits current to approx 10mA; even with direct shorts to Gnd/+v.
Anyway - glad PeterM highlighted the Pull-Up to fix your issue.
I find it worth adding a series resistor on every I/O pin - something like a 220R-470R. This then limits current to approx 10mA; even with direct shorts to Gnd/+v.
You're right, i will do that. This is helpful, especially for the experimental phase.
WhiteWizzard Guru Joined: 05/04/2013 Location: United KingdomPosts: 2934
Posted: 02:11pm 25 Feb 2016
Copy link to clipboard
Print this post
I find it worth adding a series resistor on every I/O pin - something like a 220R-470R. This then limits current to approx 10mA; even with direct shorts to Gnd/+v.
You're right, i will do that. This is helpful, especially for the experimental phase.
On a lot of my MicroMite project experimental work, I use a 220R PTC in series with an I/O pin (but they more expensive than just a 220R resistor!) and also use a 3v3 zener to gnd (on the MM side of the PTC). This then gives a bit more protection especially from excessive voltage.
Not suitable for all types of input pins - just adds useful protection against those test probes (and the like).
The 220R PTC also means you don't need LED series resistors as they limit the current perfectly