Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 06:55 02 Aug 2025 Privacy Policy
Jump to

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.

Forum Index : Microcontroller and PC projects : MM2: ONEWIRE question....

Author Message
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9610
Posted: 06:02am 17 Feb 2021
Copy link to clipboard 
Print this post

Hello everyone.

I am thinking of using the ONEWIRE protocol to talk between two different MM2 projects.  In the manual for the MM2, page 91, it describes how you send and receive data using this protocol and any spare I/O pin.

Q1: Does the ONEWIRE "BUS" need to be pulled up idle-high(or low) via something like a 4k7, a-la I2C?
Q2: "MM.ONEWIRE returns true if a device was found" - is there any way to make the 'Slave' MM2 device respond to the 'Master' so that the 'Master' knows that the 'Slave' MM2 device is there?

....or is that ONLY valid for true ONEWIRE devices such as 18B20's?

EDIT:

Q3: Also, what is the effective baud-rate/data-rate/bit-rate of the ONEWIRE protocol used in the MM2 firmware?
Edited 2021-02-17 16:11 by Grogster
Smoke makes things work. When the smoke gets out, it stops!
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 06:55am 17 Feb 2021
Copy link to clipboard 
Print this post

I wasn't aware that the MM could act as a onewire slave.

To answer Q2, onewire does have pullups, usually 4.7k. There is a mode that drives the line high to provide parasitic power and I would not like to see one end driven high and the other end low.

Jim
VK7JH
MMedit
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9610
Posted: 04:13am 18 Feb 2021
Copy link to clipboard 
Print this post

Hey Jim.

No, I don't think it can.(act as a slave)
That was one of the things I was asking about.

I think I will just use serial instead.
I need to squirt it over some 4-core security cable, so am thinking if I use a really slow baud-rate, it might work OK.  I will have to do some tests with a length of cable to test reliability.
Smoke makes things work. When the smoke gets out, it stops!
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10315
Posted: 07:53am 18 Feb 2021
Copy link to clipboard 
Print this post

  Quote  I need to squirt it over some 4-core security cable


RS422?
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2170
Posted: 10:44am 18 Feb 2021
Copy link to clipboard 
Print this post

  Grogster said  
I need to squirt it over some 4-core security cable, so am thinking if I use a really slow baud-rate, it might work OK.  I will have to do some tests with a length of cable to test reliability.


How far? I used twisted pair telephone cable for a 60m run for VCC, GND and serial @9600 without issue, doesn't even seem to care about which wire is twisted with what. Test it on a reel of the cable you intend to use - hopefully you'll be pleasantly surprised.

As Peter has already pointed out if you want to do it "properly" then consider 422 drivers at both ends - that also gives you multi-drop so at any point in the future if you want to splice in and add more nodes, no problem.
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3378
Posted: 01:18pm 18 Feb 2021
Copy link to clipboard 
Print this post

  CaptainBoing said  
  Grogster said  
I need to squirt it over some 4-core security cable, so am thinking if I use a really slow baud-rate, it might work OK.  I will have to do some tests with a length of cable to test reliability.


How far? I used twisted pair telephone cable for a 60m run for VCC, GND and serial @9600 without issue


I've successfully run 3.3V serial TTL RS232 over 50 FEET of Cat6 on several occasions (don't remember the baud rate, but I suspect at least 9600, and probably 38400).
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 08:13pm 18 Feb 2021
Copy link to clipboard 
Print this post

I agree with Peter.



If you only have 2 cores available for data, RS485 but I like RS422 for full duplex without any need for the extra control lines.

Jim
VK7JH
MMedit
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2642
Posted: 12:44am 19 Feb 2021
Copy link to clipboard 
Print this post

Just tested 40m of 2 pair phone cable (light gauge - 0.2 sq mm conductors) with TTL serial and got reliable 2 way data at 57600 baud. Many errors in one direction at 115200 baud. Pair 1 (blue-white) used for Rx & Tx, Pair 2 (red-black) tied together for ground. CH340 at one end CP2102 at the other.
 
MustardMan

Senior Member

Joined: 30/08/2019
Location: Australia
Posts: 175
Posted: 01:13am 19 Feb 2021
Copy link to clipboard 
Print this post

RS422/RS485 is a differential protocol (2 wires per communications channel). GND is handy to have, but not absolutely essential. With a 6+ core cable (eg: ethernet cable) GND, +V and full duplex communication is easily achievable (in fact, doing it with my current project). Being differential speeds can be significantly higher. I am doing 56kbaud over a meter (for testing) and fully expect that to go at *least* 20 meters. My limits are actually going to be set by the voltage drop on the power conductors and not by the baud rate. Does require a little bit of hardware though.

RS232, especially TTL level, is single-ended and pretty good for several tens of meters, but as others have pointed out, distance drops rapidly with higher baud rates. Good for duplex with four cores (with GND and +V), but ethernet cable is cheaper than most other alternatives now anyway. Less than 8 core has become "only if the cable already exists". And for quick and dirty, the wires can be connected directly to the micro with no extra hardware required! Although I'd be expecting to replace my micro on random occasions with such a setup.

Cheers,
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025