Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Multiple Sensors To Single Serial Port

Sensor JST Serial

  • Please log in to reply
10 replies to this topic

#1 sfx

sfx

    Advanced Member

  • Members
  • PipPipPip
  • 52 posts

Posted 14 May 2014 - 04:19 AM

Hello,

In reading the fact sheets for certain sensors, Ive found that some of them claim to be able to link multiple sensors through a single serial port as long as each sensor has a different address. This raises some confusing questions for me and so I am wondering if I may pose the following further questions to people here who are more experienced and knowledgeable than I am:

  1. If the sensor has a 3 or 4 Pin JST connection, how do I link multiple cables to a Netduino Plus 2 serial port?
  2. Is there some type of intermediary shield that can be used to join multiple cables to a single serial port?
  3. How do I go about assigning different addresses to multiple sensors if they are all connected to a single serial port?

Im sorry if these questions appear to be annoyingly trivial, but Im only new at all of this and was hoping that someone could either assist me in answering these questions or point me to relevant resources that do or both.

Any help you could provide would be greatly appreciated.

Regards,

Nathan



#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 14 May 2014 - 04:29 AM

Hi Nathan,

Is it possible that the sensors are I2C serial, not UART ("SerialPort") serial? IF they're I2C then they will have addresses and can share the same data line.

Welcome to the Netduino community,

Chris

#3 sfx

sfx

    Advanced Member

  • Members
  • PipPipPip
  • 52 posts

Posted 14 May 2014 - 05:41 AM

Hi Chris,

 

Thanks so much for your swift reply - and thanks for the welcome! It's good to be here.

 

The sensor that I'm looking at is the SRF01, the details of which are here:

 

http://www.robot-ele...m/srf01tech.htm

 

The site mentions that the sensor supports a standard TTL level UART format, however there is a table outlining I2C actions as commands as well. Now I'm even more confused. Do you know of any resources that might help clarify these questions?

 

Thanks again.

 

Nathan



#4 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 14 May 2014 - 06:50 PM

Hi Nathan,

From that page, it appears that the rangefinder does indeed use traditional SerialPort communication--albeit in one direction only. So you could wire up several of them to pin D1 (COM1 TX) for instance, and then address each one with the address byte in commands.

The reason that you can't connect multiple devices to a single UART usually is because they each need exclusive use of the return data line (COM1's RX pin for instance). But since these are only using the sending part of the serial port, they can share.

For purposes of that page, I'm going to just ignore the I2C references. The rangefinder either has an alternate I2C mode or they really mean "address" instead of "I2C address".

When you wire up the rangefinder, you'll connect 3.3V from your Netduino's 3V3 header to its voltage input pin, ground from your Netduino's GND pin to its GND pin, and serial port TX from one of your Netduino's serial port pins (D1 = COM1 TX for instance) to the Serial I/O pin of the rangefinder.

Does that get you on the right path?

Chris

#5 sfx

sfx

    Advanced Member

  • Members
  • PipPipPip
  • 52 posts

Posted 14 May 2014 - 10:09 PM

Hi Chris,

This is fantastic! Especially for a newbie like me, this type of explanation really helps me to understand what connections go where and why. Very much appreciated!

If I may, can I trouble you for one more explanation? Id like to know how I might go about wiring up multiple of the aforementioned sensors to pin D1 (COM1 TX) on the Netduino? Would this need to be done through some type of extender module, bread board, soldering, or something else? Im just not sure how many serial I/O pins on a sensor should fit into a single Netduino serial port.

Best regards,

Nathan



#6 sfx

sfx

    Advanced Member

  • Members
  • PipPipPip
  • 52 posts

Posted 16 May 2014 - 10:43 AM

Hi Chris,

 

I just received a reply from the manufacturer who had this to say in relation to my inquiry concerning the range finder in question:

 

"The SRF01s are just connected in parallel. But before you do that you need to change the addresses to give each one a unique address." (underline mine)

 

Unfortunately, this doesn't help me much. Do you know of any resources that you could point me toward that show how to connect multiple serial I/O pins in parallel on a Netduino?

 

Thanks again,

 

Nathan



#7 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 16 May 2014 - 11:07 AM

+-------+   +-------+       +-------+
| SRF01 |   | SRF01 |  ...  | SRF01 |
+-------+   +-------+       +-------+
    |           |               |
    |           |               |
    +-----------+----- ... -----+   Serial I/O
                |
                | TX
          +-----+----+
          | Netduino |
          +----------+
The physical connection depends on what connectors or wires are you using. You might be able to put a few wires into the Netduino female header if they are thin enough, otherwise you can simply twist them around, use a breadboard, or some kind of connector extender etc.

#8 sfx

sfx

    Advanced Member

  • Members
  • PipPipPip
  • 52 posts

Posted 16 May 2014 - 11:21 AM

Hi CW2,

 

Thank you for the clarification and the diagram. I definitely appreciate it. I'm guessing that a breadboard would be the best option for prototyping then. If it's not too much trouble, would you be able to draw a diagram (similar to your first) that demonstrates this process on a breadboard instead? Otherwise, might you know of a resource that could visually show such a parallel configuration?

 

I'm sorry for sounding like such a novice, but it is because I am; and I'm not sure where else I should go to get help with Netduino questions. :(

 

Take care,

 

Nathan



#9 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 16 May 2014 - 01:29 PM

Click to see larger version...

Attached Files



#10 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 16 May 2014 - 01:58 PM

Dear Nathan,

CW2 is "almost" right, but I'm not sure you'll be able to make the sensor working with that pattern. That's for two reasons...

 

The protocol of the sensors is leveraging the normal UART, but sharing a single wire for both outgoing and incoming data. This trick is allowed by a so-called "wired-AND" pattern, which is the same of the I2C. This circuit is based on open-drain (e.g. three-state) outputs.

The Netduino serial port (as usual) is not open-drain, but push-pull: that will collide with the expected pattern.

 

When you want to send data to a sensor, the UART output should drive the signal wire. However, when you want to receive something, you should use another pin, which is the serial input.

 

I believe you should use at least a transistor (or a mosfet) so to convert the push-pull UART TXD to a "wired-AND". The same signal wire should be connect to the RXD pin as well.

 

Nothing expensive at all, though!

Good luck


Biggest fault of Netduino? It runs by electricity.

#11 sfx

sfx

    Advanced Member

  • Members
  • PipPipPip
  • 52 posts

Posted 17 May 2014 - 08:58 AM

CW2,

Wow! Im blown away. Thanks so much for taking your own time to diagram that for me. It definitely helped me to understand the connections much better than when I was simply reading about them using the vendors documentation.

Mario,

Thank you also for explaining how these types of connections can work. Im still a little puzzled, however. The documentation for the range finder has this to say:
 

Communication with the SRF01 is with both serial input and serial output on a single pin. The SRF01 will be listening at all times except when it is actually sending data, and will go back to listening as soon as its finished. To communicate with the SRF01, you simply need to send a "break", followed by two bytes, the address of the SRF01 (factory default is 1) and the command.

 

What I find confusing is the statement above that specifies that serial input and output is on a single pin. Additionally, the device appears to be listening for commands as opposed to continuously attempting to stream data. Have I got this wrong? If so, does this mean that I would need to connect the range finder up to a second pin in order to receive data?

Thanks guys. All of you have been extremely helpful.

Take care,

Nathan






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.