I’m trying to make a shield that can read a ds18b20 using a Spark Core (using a shield shield) OR a Mega as the microcontroller. On the shield we are using the ds18b20 is routed to pin 11 on the arduino, which is then translated into pin A5 on the spark core using a shield shield.
Q1 - I understand that the analogue pins can still read as a digital pins? - does this mean we can read the ds18b20 on A5?
Q2 - A5 should only receive 3.3V? (looking athttps://community.spark.io/t/one-awsome-pinout-diagram-for-spark-core-located/3361) Does this mean that the pwr line should be limited to 3.3v or can the A pins also take 5V (and if they do get 5V and they can’t read it - will it fry them?)
As I read your sketch you are using the A5 pin for the LCD and D2 for the OneWire anyhow.
If you go for D0,D1,D3…D6 instead you’ll be good with 5V, too. But 3.3V should just be fine, as the datasheet I’ve looked at suggest Vdd min as 3.0V.
And as for plugging in an Arduino, you’d just need to have that Arduino programmed accordingly, then you’re good again.
Or what shield are you using, have you got some details?
Yeah, it just has a relay for a pump, some button inputs and LCD pinout. It’s a custom one. Just working out where to pin out the ds18b20 to.
Ok, so in the code posted I’m just breadboarding trying to figure out why I was getting a -127 reading. So i’ve swapped the A5 and D2 pins. But I’m getting -127 on both pins. I was wondering if it was using the A5 pin that was the problem or the shield shield or something else. But it looks like there is an issue reading the probe. Any idea why?
Have you got any possibility to test the sensor without the Shield shield - possibly on a 5V tolerant pin with 5V supply first, then stepping down to 3.3V supply and communication?
When you hit a wall of possible problems, try to eliminate as many bricks as possible and the add one after the other till you find the culprit
Yeah, the sketch above is aiming to do that. That’s why I moved the pin to D2 as it is 5V tolerant. I started with the shield and have moved backwards trying to eliminate complexity - the above sketch is for a breadboard with a power supply that allows each rail to be switched between 3.3v and 5v. That said, I think I’ve only tried it with 3.3V so far. I’ll try with 5V.
The temp probes read properly with an arduino sketch, so I know they work fine.
That is interesting. So maybe it won’t be possible to do it using the shield-shield? That would be frustrating.
Even so, I have tried with everything breadboarded and no shield-shield - just pins using 3.3V. I keep getting -127.00, hence my question if the code ‘should’ work. I’m assuming that all ds18b20s are the same and there isn’t some ‘gotcha’ that I need to be aware of?
I need a new battery for my multimeter, but will try it again tonight
So I haven’t used the Spark-dallas-temperature library, I just rolled my own from the one wire library. Feel free to steal code from my time and temperature tutorial code here:
The Spark Core offers a total 18 I/O pins to the user:
D0 to D7, A0 to A7 and two pins that are preset to serial - TX and RX.
All of these I/O pins run at 3.3V and the user should keep this in mind before attaching any external peripherals to them.
The only exception to this are the following pins that are tolerant to 5V inputs:
D0, D1, D3, D4, D5, D6 and D7
I've avoided to suggest D7 since the attached LED might interfere with OneWire.
As for the possible problems with the Spar Core Shield shield, you might like to hear that this issue seems to be addressed with the Spark Photon Shield shield, which should be compatible with the older Core one, but without (or with less ) gotchas.
ok - can confirm that I can read temp fine with breadboard, but the spark core shield shield will not let me read and I get a -127 value.
ScruffR - do you know what the issues are that have been fixed and when the new shields are available? I’ve pre-ordered a couple of photons with new shields…
edit - oh, and I tried 5v volts on A5 and it read fine(using the breadboard)… I tried as I knew I had run 5V through it before at some point when didn’t know I wasn’t supposed to and it still seemed to be working reading on 3.3V. Could it actually be 5V tolerant, or would it burn out in time?
@lael, as for the new Shield shiled there is a thread here
and I guess @mohit would be the person to ask about your particular issue, if this will be fixed on the new one.
As for the A5 5V-tolerance, I’m pretty sure it’s not, but you could have been lucky or you only frazzled the ADC part of it , which would not show on a digitalRead() test.
But if it is in perfect condition now, you should not need to worry about after effects of this - just don’t do it again
A simple voltage divider and analogRead(A5) should give you a clue.
e.g. 2k2 and 4k7 across two other pins which you set via digitalWrite() HIGH and LOW in all four possible combinations should give you four readings, where the two “middle” ones are the most interesting ones.