Arduino nano, multiple DS18B20 problem
Moderator: Benj
Arduino nano, multiple DS18B20 problem
Hello
Friend of mine wants connect multiple sensors (DS18B20) to arduino nano via 1wire protocol. Each sensor is connected to different pin. If he connect 5 sensors (example: ports PC0 to PC4) everything works fine. If he connect another sensor (PC5), everything stops. He also tried other ports, or some sensors on one port and some to another, but same result. Five sensors works, six doesn't. Because he's not good in english, he ask me to ask here on forum. He also send me two flowcharts. One is ok and one is not.
Any suggestions?
Friend of mine wants connect multiple sensors (DS18B20) to arduino nano via 1wire protocol. Each sensor is connected to different pin. If he connect 5 sensors (example: ports PC0 to PC4) everything works fine. If he connect another sensor (PC5), everything stops. He also tried other ports, or some sensors on one port and some to another, but same result. Five sensors works, six doesn't. Because he's not good in english, he ask me to ask here on forum. He also send me two flowcharts. One is ok and one is not.
Any suggestions?
- Attachments
-
- Merjenje_temp_zalogovnika_OK.fcfx
- (24.99 KiB) Downloaded 249 times
-
- Merjenje_temp_zalogovnika_NE_6T.fcfx
- (26.1 KiB) Downloaded 296 times
-
- Posts: 362
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 45 times
- Been thanked: 62 times
- Contact:
Re: Arduino nano, multiple DS18B20 problem
One more thing...
Your friend has declared 9 values for 8 max sensors:
tempr_0
tempr_1
tempr_2
tempr_3
tempr_4
tempr_5
tempr_6
tempr_7
tempr_8
------------------
should be 0 to 7
-----------------
Your friend has declared 9 values for 8 max sensors:
tempr_0
tempr_1
tempr_2
tempr_3
tempr_4
tempr_5
tempr_6
tempr_7
tempr_8
------------------
should be 0 to 7
-----------------
-
- Posts: 362
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 45 times
- Been thanked: 62 times
- Contact:
Re: Arduino nano, multiple DS18B20 problem
I haven't used OneWire devices, so I checked...
Looks like we do need not to use the diff. pins, but only one.
--------------------------------------------------------------------------------------------
Please read:
https://www.matrixtsl.com/wikiv7/index. ... Interface)
Looks like we do need not to use the diff. pins, but only one.
--------------------------------------------------------------------------------------------
Please read:
https://www.matrixtsl.com/wikiv7/index. ... Interface)
- Attachments
-
- MultiOneWire.fcfx
- (43.5 KiB) Downloaded 251 times
-
- ds1820_uc_interface.jpg (41.84 KiB) Viewed 34049 times
Re: Arduino nano, multiple DS18B20 problem
Yes, he know how 1wire works, but he need to read ID of each sensor. If you have 1 sensor on 1port, you don't need ID. If one sensor stop working, you can simply replace with new one.
-
- Valued Contributor
- Posts: 784
- Joined: Fri Jun 06, 2014 3:53 pm
- Has thanked: 186 times
- Been thanked: 205 times
Re: Arduino nano, multiple DS18B20 problem
Hi
I can understand the thinking in having individual devices rather than a string. I don't have Flowcode on this machine to look at his code but from what I've read it is five sensors on whatever port(s) and all is good, but when a sixth is added they all stop working.
Is it always the same module that when added causes issue, or can any of the modules be connected in any order and when a 6th (any of the modules) is added things go wrong?
How is he powering things?
I have a few 1-wire devices kicking around and should have a Nano somewhere too, so once I'm back from my travels I'll see if I can replicate, but that won't be until later next week.
Regards
I can understand the thinking in having individual devices rather than a string. I don't have Flowcode on this machine to look at his code but from what I've read it is five sensors on whatever port(s) and all is good, but when a sixth is added they all stop working.
Is it always the same module that when added causes issue, or can any of the modules be connected in any order and when a 6th (any of the modules) is added things go wrong?
How is he powering things?
I have a few 1-wire devices kicking around and should have a Nano somewhere too, so once I'm back from my travels I'll see if I can replicate, but that won't be until later next week.
Regards
Re: Arduino nano, multiple DS18B20 problem
"I can understand the thinking in having individual devices rather than a string. I don't have Flowcode on this machine to look at his code but from what I've read it is five sensors on whatever port(s) and all is good, but when a sixth is added they all stop working."
Correct
"Is it always the same module that when added causes issue, or can any of the modules be connected in any order and when a 6th (any of the modules) is added things go wrong?"
He also tried different combinations. Example: 4 sensors on port D and 1 on port B (working). If added one more on port B, stop working. 5 sensors working in any combination, when he added 6th, stop working everything.
"How is he powering things?"
I will ask.
Correct
"Is it always the same module that when added causes issue, or can any of the modules be connected in any order and when a 6th (any of the modules) is added things go wrong?"
He also tried different combinations. Example: 4 sensors on port D and 1 on port B (working). If added one more on port B, stop working. 5 sensors working in any combination, when he added 6th, stop working everything.
"How is he powering things?"
I will ask.
-
- Posts: 362
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 45 times
- Been thanked: 62 times
- Contact:
Re: Arduino nano, multiple DS18B20 problem
Hello Ule
Can you ask your friend to 'ping' the bus before
the program will access sensor N6?
Can you ask your friend to 'ping' the bus before
the program will access sensor N6?
- Attachments
-
- NanoPingBus_1.fcfx
- (38.89 KiB) Downloaded 244 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Arduino nano, multiple DS18B20 problem
Hello,
We overhauled one wire device communications for Flowcode v9 both simplifying the macros and adding additional components to drive specific devices. Would it be worth having a go with the 30-day free trial to see if this solves your problems.
V9 example project available here.
https://www.flowcode.co.uk/wiki/index.p ... ronmental)
We overhauled one wire device communications for Flowcode v9 both simplifying the macros and adding additional components to drive specific devices. Would it be worth having a go with the 30-day free trial to see if this solves your problems.
V9 example project available here.
https://www.flowcode.co.uk/wiki/index.p ... ronmental)
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Valued Contributor
- Posts: 784
- Joined: Fri Jun 06, 2014 3:53 pm
- Has thanked: 186 times
- Been thanked: 205 times
Re: Arduino nano, multiple DS18B20 problem
Hi
The Nano I have was previously used by a "design" undergraduate and to say their soldering skills leave a lot to de desired is putting it politely... Anyway, headers are now attached properly.
Unfortunately my USB lead is elsewhere so testing will need to wait until another day.
My FCv6 license doesn't include Arduino so I won't be able to compile, but I can use FCv9 to see if anything shows up.
Regards
The Nano I have was previously used by a "design" undergraduate and to say their soldering skills leave a lot to de desired is putting it politely... Anyway, headers are now attached properly.
Unfortunately my USB lead is elsewhere so testing will need to wait until another day.
My FCv6 license doesn't include Arduino so I won't be able to compile, but I can use FCv9 to see if anything shows up.
Regards
Re: Arduino nano, multiple DS18B20 problem
Friend tried same program on Arduino Mega2560. Everything works. Even 7 sensors. Is it possible that nano is not capable of reading more than 5 sensors same time? He send me screenshots. When reading 5 sensors works ok, when connect 6th sensor, strange things happens. Something with rs232 maybe?
- Attachments
-
- 6sensors.png (160.49 KiB) Viewed 33839 times
-
- 5sensors.png (173.87 KiB) Viewed 33839 times
- Bachman
- Posts: 116
- Joined: Sun Sep 07, 2014 11:37 am
- Location: Hungary
- Has thanked: 9 times
- Been thanked: 53 times
Re: Arduino nano, multiple DS18B20 problem
This must be some kind of RS232 problem. My hint is buffer overrun problem. For test, put delays between the print commands. Eg:
print temperature 1
delay 250 ms
print temperature 2
delay 250 ms
print temperature 3
delay 250 ms
etc.
250 ms delay must be more than enough, later you can test, what is the minimum, if it's solving the problem. I don't have knowledge about Arduino, don't know how its serial module (not) handling the data.
print temperature 1
delay 250 ms
print temperature 2
delay 250 ms
print temperature 3
delay 250 ms
etc.
250 ms delay must be more than enough, later you can test, what is the minimum, if it's solving the problem. I don't have knowledge about Arduino, don't know how its serial module (not) handling the data.
-
- Valued Contributor
- Posts: 784
- Joined: Fri Jun 06, 2014 3:53 pm
- Has thanked: 186 times
- Been thanked: 205 times
Re: Arduino nano, multiple DS18B20 problem
Hi
I thought I had some DS18B20 sensors but unfortunately not. I do have DHT11's which I connected to D2-D8 on a Nano and made a very basic loop that read each sensor in turn then displayed the readings on a display. I had to use FCv9 as I don't have a Nano licence for FCv6.
All seven sensors responded and I could mix and match in any order by simply unplugging/inserting from the breadboard etc.
I appreciate this isn't quite the same as what your friend is trying to do, but hopefully suggests it is possible. Has he tried a different Nano or swapped port pins to eliminate the possibility of dodgy connections?
If I get the chance I'll fire the results out of the UART and let you know how things go.
Regards
I thought I had some DS18B20 sensors but unfortunately not. I do have DHT11's which I connected to D2-D8 on a Nano and made a very basic loop that read each sensor in turn then displayed the readings on a display. I had to use FCv9 as I don't have a Nano licence for FCv6.
All seven sensors responded and I could mix and match in any order by simply unplugging/inserting from the breadboard etc.
I appreciate this isn't quite the same as what your friend is trying to do, but hopefully suggests it is possible. Has he tried a different Nano or swapped port pins to eliminate the possibility of dodgy connections?
If I get the chance I'll fire the results out of the UART and let you know how things go.
Regards
-
- Valued Contributor
- Posts: 784
- Joined: Fri Jun 06, 2014 3:53 pm
- Has thanked: 186 times
- Been thanked: 205 times
Re: Arduino nano, multiple DS18B20 problem
Hi
Could you post his chart? Easier to try and suggest something if we can see the entire thing.
Incidentally I sent the results of my DHT11 tests out on the UART. I sent each sensor on a separate line without issue.
Regards
Could you post his chart? Easier to try and suggest something if we can see the entire thing.
Incidentally I sent the results of my DHT11 tests out on the UART. I sent each sensor on a separate line without issue.
Regards
Re: Arduino nano, multiple DS18B20 problem
Charts are posted in first post. One with 5 sensors (Merjenje_temp_zalogovnika_OK)-> (working) and one with 6 sensors (Merjenje_temp_zalogovnika_NE_6T)-> (not working).