Serial communication between two Nano over USB

I guess if you are dead set on using a specially made micro-usb cable you may be able to re-program the 16U2 microprocessor (that normally does the USB-TTL conversion) so it just becomes a TTL pass through device.

But then you would need to use the ICSP pins to program the Nano (not really difficult) as you would not be able to use the regular USB cable from a PC to program the nano .

...R

Robin2:
I guess if you are dead set on using a specially made micro-usb cable you may be able to re-program the 16U2 microprocessor (that normally does the USB-TTL conversion) so it just becomes a TTL pass through device.

But then you would need to use the ICSP pins to program the Nano (not really difficult) as you would not be able to use the regular USB cable from a PC to program the nano .

…R

Hmm. I see. Is your solution addressing my last image ? (The one with additional usb-ttl)
I was thinking maybe I can use that usb-ttl as a breakout board for the micro-usb connector. Guess I’m wrong ?

The drawing in reply #19 will not work. You will end up with the same situation as with two Nanos (two slaves); unless the one is a host adapter.

For 5 meters, TX/RX will probably too much. Seeing that your going to use additional hardware (reply #9 and #19), I would suggest RS485 adaptors; e.g. 2Pcs 5V MAX485 TTL To RS485 Converter Module Board For Arduino (just to give you the idea). Use e.g. RJ11 panelmount connectors and let the chinese make RJ11 cables.

sterretje:
The drawing in reply #19 will not work. You will end up with the same situation as with two Nanos (two slaves); unless the one is a host adapter.

For 5 meters, TX/RX will probably too much. Seeing that your going to use additional hardware (reply #9 and #19), I would suggest RS485 adaptors; e.g. 2Pcs 5V MAX485 TTL To RS485 Converter Module Board For Arduino (just to give you the idea). Use e.g. RJ11 panelmount connectors and let the chinese make RJ11 cables.

What if I use 2 additional micro-usb breakouts (not usb-ttl, since you are saying that might not work): something like this

Then I can connect RX/TX to D+/D- on one side, and RX/TX to D-/D+ on the other side. This would be basically connecting the 2 Nanos with RX/TX/GND (3 wires as Robin said), but going through the micro-usb connector for easy connection

sterretje:
You can't connect TX/RX to D+/D-.

Serial uses one line for comms from A to B and one line in the other direction. USB uses both lines for both directions.

Give up the idea of USB slave to USB slave.

I understand. I guess I'll start researching adding a 3rd BLE in the system. Appreciate your thoughts.

Sorry, just removed my post. Glad you quoted.

I misunderstood what the boards were doing. Your problem now will be 5 meters of TTL signal; communication will more than likely be unreliable.

What's against the idea is RS485?

@unstopp, why don't you tell us what you are actually trying to make and then maybe someone can make a useful suggestion.

At the moment this is just the usual XY problem

...R

sterretje:
Sorry, just removed my post. Glad you quoted.

I misunderstood what the boards were doing. Your problem now will be 5 meters of TTL signal; communication will more than likely be unreliable.

What's against the idea is RS485?

Ok great, then I will try that see how it goes.
RS485 is a bit too large and bulky - I need something slick (design purposes). It might not be 5m, it's a cable that runs from the dash of a car to the trunk (3m let's say)

Robin2:
@unstopp, why don’t you tell us what you are actually trying to make and then maybe someone can make a useful suggestion.

At the moment this is just the usual XY problem

…R

Sure no problem. Bear with me a little.

I already have a product, an ECU (car-related) that installs usually in the trunk of a car. You are able to control some functions of the car from the phone, by using my App connecting to my ECU - via BLE.

Now, I want to add an additional controller, a remote (that I will fabricate, with a Nano inside, buttons and all that), that will sit inside the car, on the dash or near the gear shifter, somewhere driver-accessible. This is an extra part that does almost the same thing as the App - it connects to the ECU and controls the same functions as the App. I add this controller for comfort and aesthetics - it looks good, it’s handy, you don’t have to pull out your phone, connect, and all that.

I can do this “controller-ecu connection” in two ways:

  • Either micro-usb, my initial thought, thinking it might be the easiest way and also cost-efficient (since I was thinking I can use Nano’s micro-usb connector - but it seems not, I will need an additional micro-usb breakout board in this case). On the flip side, there is a bit more hassle - wires, fixed positioning of the controller, running that wire from dash to trunk, etc.
  • Or, doing it by bluetooth. This means no more cables, less hassle (you don’t need to take the car apart from dash to trunk for that 3 or 5m micro-usb wire), you can keep the controller wherever, whenever. This sounds great.
    However, my fear is that I’m not sure how to handle 3 BLEs in this ecosystem. I haven’t looked too much into this. Now I have App - ECU communication via BLE, so 2 BLEs. I have to figure out how to handle 3 BLEs. The master would be the ECU, the controller and the app are slaves. I’m not sure if the ECU (the BLE) can handle 2 BLE connections (App + controller) at the same time, or if when App connects, the controller disconnects, or if when the App is connected, then the controller is not discoverable, things like that. I have to research a bit more and figure out an user-friendly flow.

This communication is nothing more than sending data back and forth (chars and sensor data).

Hope this makes sense. I really appreciate your guys thoughts!

I don't know enough about Bluetooth to know if what you want to do might get complicated with multiple devices. However if it works with Bluetooth with a phone that seems to be a direction worth exploring.

There are also other wireless options. If Bluetooth works in the environment where you need it then a pair of nRF24L01+ wireless modules should work.

I can see that a wired connection might be more reliable in a car but what I don't understand is your insistence on using the micro-usb connection rather than another (simpler) wired connection. I just can't see what advantage it offers even if it was simple to implement.

...R

I've tried my initial test with usb-ttl to integrated micro-usb (default one) and indeed it doesn't work. It also seems pins 0 and 1 are not bridged to the USB, oh well..

This is the last test I'm going to try. I've ordered 2x micro-usb breakout boards: these

Here is the circuit schematic:

If this fails, I'll have to make it work via BLE, which is the best-case scenario anyway.

Well, I guess you learn something new every day :slight_smile:

Robin2:
I don’t know enough about Bluetooth to know if what you want to do might get complicated with multiple devices. However if it works with Bluetooth with a phone that seems to be a direction worth exploring.

There are also other wireless options. If Bluetooth works in the environment where you need it then a pair of nRF24L01+ wireless modules should work.

I can see that a wired connection might be more reliable in a car but what I don’t understand is your insistence on using the micro-usb connection rather than another (simpler) wired connection. I just can’t see what advantage it offers even if it was simple to implement.

…R

nRF24L01+ sounds like a good idea. I can make a separate connection only between controller-ecu and leave alone the initial one - via BLE (app-ecu). App-controller connection is not necessary.
Do I have to get 2 of these wireless modules so they can talk to each other ? Can it act as a receiver as well ? I’ll look into it.

Regarding why I was pushing for micro-usb, is because I wanted to use a “pre-defined” connector (micro-usb is the slickest, most appealing one). If I simply use a standard wired connection, then I need to add connectors myself, because I need modularity - trying to avoid this overhead. I’m already dealing with connectors and wiring that I’m building from scratch (crimping, etc.) on the ECU side and it’s such a pain in the ass.

Sorry. I forgot to post this link
Simple nRF24L01+ Tutorial

and, yes, you do need a module at each end, And they are transceivers, so bi-directional.

...R

Robin2:
Sorry. I forgot to post this link
Simple nRF24L01+ Tutorial

and, yes, you do need a module at each end, And they are transceivers, so bi-directional.

...R

Thank you Robin. So it seems the transceiver uses 5 pins ? I'm way out of pins on the ECU side.

unstopp:
Thank you Robin. So it seems the transceiver uses 5 pins ? I'm way out of pins on the ECU side.

What Arduino are you using on the ECU side and how are its pins used?

...R

Robin2:
What Arduino are you using on the ECU side and how are its pins used?

...R

I'm currently using Mini Pro. I will use Nano in the next version. Pins from 2 to 13 are taken, including A0 to A4 for 5 sensors. However, if I switch to I2C sensors, then it's fine.

unstopp:
I'm currently using Mini Pro. I will use Nano in the next version. Pins from 2 to 13 are taken, including A0 to A4 for 5 sensors. However, if I switch to I2C sensors, then it's fine.

If pins 11, 12 and 13 are being used for SPI then they can be shared with the nRF24

If you are using them for some other purpose then I'm out of ideas - apart from switch to a Mega or use a second Nano for the wireless.

...R

Robin2:
If pins 11, 12 and 13 are being used for SPI then they can be shared with the nRF24

If you are using them for some other purpose then I’m out of ideas - apart from switch to a Mega or use a second Nano for the wireless.

…R

Right. I have to figure out a design solution to incorporate all the needs. Do you know any other wireless modules that I might be able to use ?

There are various 433MHz modules (including HC12 modules) that just communicate with the Arduino using Serial. I have never used them myself.

...R

Robin2:
There are various 433MHz modules (including HC12 modules) that just communicate with the Arduino using Serial. I have never used them myself.

...R

Thank you. For anyone interested, this seems like a good HC12 tutorial: Arduino and HC-12 Long Range Wireless Communication Module - HowToMechatronics

I will redirect my energy into researching a wireless solution, since it's the best solution, rather than micro-usb and cables.

Appreciate you guys for your guidance, thank you!