I need to send command/set of commands from G400 to G120 and get response when G120 finish processing these commands. The distance between boards could be up to 30 feet away.
What are my options?
UART, SPI, Wireless?
I need to send command/set of commands from G400 to G120 and get response when G120 finish processing these commands. The distance between boards could be up to 30 feet away.
What are my options?
UART, SPI, Wireless?
@ EvoMotors - Use the UARTs (serial ports). They use flow control to mitigate against data loss, and they are unaffected by CPU load.
i2c is out of the question anyway as the distance could be 10 meters away. Also I think Bluetooth is overkill and still not going to be reliable at this distance.
So you are saying the UART is best for my purpose? Does it reliably work with long wires?
@ EvoMotors - I think you should use RS 232 Modules. This should work with 9600 baud or 19200 baud.
Or you could use this:
https://www.ghielectronics.com/community/creations/entry/12
Can you explain how RS232 module will help? I’m not familiar as I only started to exploring the hardware.
RS232 is just a UART hardware implementation. It’s designed for reliable longer distance communication between the two ends of the connection. It uses differential signalling and higher voltages to help protect signal integrity. At the micro end, it just looks like a standard digital signal to the UART.
Thank you guys! Now I just need to decide if I want to use 33ft DB9 cable or RF Pipes ;D
RF pipes are a good solution with short messages. Last time I used rf pipes, the packet size was 12 bytes. If there is an error in a received packet, nothing appears at the output port.
In any situation, you will need to be able to recognize missing packets. with messages longer than 12 bytes, you will have to implement a protocol layer to recognize missing packets.
I started to develop a protocol for the rf pipe which handled larger messages and errors, but the small packet size, and the necessary overhead, made for a very inefficient protocol.
rf pipes are great for a constantly reporting sensor, where a missed packet is acceptable. but for a reliable connection, there are better solutions.
@ EvoMotors - You can try just straight wires for the UART first, to see if you do need RS232 for your solution.
EDIT: Sorry not straight, use a twisted pair.
@ EvoMotors -
Where I worked we had very long RS232 connections that were terminated (Like the old Apple Talk).
I really don’t remember what was used though so I am of no help. I think they just used a small value resistor.
I found this that may help.
It is my understanding that RS232 is a Single Ended device, and rule of thumb, less than 50 feet.
RS485 is a Differential device, which allows for much larger distance transmissions than straight Uart, or RS232.
(Programming wise, RS232 & RS485 are identical, its just the physical hardware that changes).
CAN bus is also a differential signal, which has been gaining more & more acceptance in Industrial applications, and removes the requirement for Master / Slave configurations.
In addition both RS485 & CAN allow for multidrops, where RS232 & Uart are typically point to point connections.
If you are working in an environment with any noise, I would definitely advise going with a differential signal, as I’ve done a fair amount of work around VFD’s on 30hp+ motors, which tend to be very noisy, and a differential signal has proven to be much more reliable.
After thinking about it for a bit, given the horsepower of the G120 & the G400 would it not make more sense just to add an Ethernet module to the device and send the information back & forth via a web query?
I understand its a bit more work to include the webserver / webclient, but it also removes any of the hassles of retries, CRC’s, packet lengths, the data just flows. I’ve found it to be a very very robust, and very fast solution for communicating between a Fez Cobra to a Fez Spider.
I already have WiFi on G400, not sure if WiFi and Ethernet can be on the same module.
It’s not gadgeteer, so I’m not too trilled to use gadgeteer modules. I’ll have to add it to PCB.
I looked on the schematics RS232 and RS485 Gadgeteer modules. RS232 is using 4 wires and RS485 is 2… Will I need 2 RS485s on each side?
You only need two lines for RS485. You can make it full duplex with 4 wires, but you don’t need to.
RS232 can use 2-wires if you don’t care about flow control. Well actually you need three, GND, but that can be a common ground if you can control the power sources at both ends (use a fully earthed power supply for example that means there’s no potential difference between GND and EARTH) or more likely you use shielded cable and the shield is terminated on to GND.
Not strictly correct. You do need the ground connection if you want a reliable connection and to avoid a higher ground potential difference.
I saw this recently when trying to talk to a variable speed drive in a noisy environment. Without the ground it would not work. With the ground it was rock solid.
@ Evomotors
If you want a bi-directional link with FULL DUPLEX then simply use 2 RS485 drivers to connect RX to TX and TX to RX. This is similar to RS422.
For your 30 meters and not using a very high data rate, RS232 will be more than good enough for your application.
I assume the I don’t need a DB9 cable and both RS232 and RS485 will work using 10 meters 4 cores 20GA shielded cable. Is my assumption correct?
So the RS232 is full-duplex and single channel RS485 is half-duplex and I can still communicate both ways but not simultaneously?
@ Evomotors
I assume the I don’t need a DB9 cable and both RS232 and RS485 will work using 10 meters 4 cores 20GA shielded cable. Is my assumption correct?
So the RS232 is full-duplex and single channel RS485 is half-duplex and I can still communicate both ways but not simultaneously?
The RS485 module from GHI is half duplex, and you are correct you can still communicate both ways, but not simultaneously. Their are Uart - 485 drivers that are full duplex, but you would need to make your own.
That said, there are lots of off the shelf RS232 - 485 converters at full duplex available, so If you designed with RS232 as Dave suggests, and found that their was problems, you could simply drop in an off the shelf converter at each end and have a RS485 link with no changes to your code.
The same drop in replacement from RS232 holds true for industrial wireless modems from Laird / Microhard ect, In my designs I’ve used RS485 up to approximately 300m, but have found that moving to wireless solutions, often provides a more robust connection than wired designs.
Still if you already have wireless Ethernet on one module, I would go with adding wireless on the G120, and simply communicate over the network.