Electronic – arduino – 1-Wire Serial communication to standard RX/TX Serial ports in microcontrollers

1-wirearduinomicrocontrollersensorserial

I just want to start by saying that I'm relatively new to electrical engineering in general, so if I sound absolutely retarded please bear with me.

As part of a learning project I'm working with a few color sensors, specifically Parallax's ColorPAL 28380s, and I have both an Arduino Uno and Arduino Mega 2560 lying around to grab data off them. I've been fiddling around with the specifics for this project over at the Arduino SE but I suppose this question could be for any microcontroller in general. These sensors use a communication method known as 1-Wire/MicroLAN wherein they use only one pin for transmission and reception depending on the state of the pin they're attached to, among a few other specifics. Now, I have three of these, and my final objective is to be able to grab data off all of them in the same point in time repeatedly so that I can send the data over to some other program I'm writing to run an algorithm. The problem is that the example used is based on an emulated serial port on the Arduino that doesn't like working with multiple instances.

Now, the Mega 2560 has three sets for Serial communications embedded into it which would be perfect… only if I could separate the RX and TX from the 1-Wire. A user over at Arduino SE suggested I use a transistor to separate it. Call me silly, but I don't have any spare around so I'll be out to test it soon once I can go out to a nearby electronics store. Yet, searching around the internet I've read that 1-Wires should never be connected to native serial ports because of how they work with states.

In summary, can 1-Wire sensors communicate with native serial ports in microcontrollers if I make a circuit to split the signals? And, if this is possible, what are the specifics behind such a circuit?

Best Answer

  • With some software effort you can read all three sensors over the same wire: 1-wire peripherals have a unique ID.

  • Dallas 1-wire is a specific communication protocol, and using UART hardware to communicate with a 1-wire device is, well, like using a chainsaw to turn a screw? Better look for a 1-wire library that simply bit-bangs the protocol. There are bound to be many such libs, either for the Arduino or for a bare Mega 2560.

  • If you really really want to 'split' the one (UART) line you could use an analog multiplexer.