User Tools

Site Tools


lego_nxt_rs485

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
lego_nxt_rs485 [2018/11/02 14:18] – [Software] jkreitzlego_nxt_rs485 [2018/11/02 14:47] (current) – [Connecting NXT and Computer via Breadboard] jkreitz
Line 10: Line 10:
 ===== How Does RS-485 Work ? ===== ===== How Does RS-485 Work ? =====
  
-RS485 is a high speed data communication standard that provides the 10 mbps data rate upto 50 feets. It can also extended upto 4000 feets with the speed of 100 mbps. RS485 allows multiple communication device (up-to 32) at half duplex rate on single wire.+RS485 is a high speed data communication standard that provides the 10 mbps data rate up to 50 feets. It can also extended upto 4000 feets with the speed of 100 mbps. RS485 allows multiple communication device (up-to 32) at half duplex rate on single wire.
  
 In RS485, Data is transmitted differentially via twisted pair cable because this wire have specific properties such as high noise immunity as well as long distance capabilities. RS485 network is further categorized into parts:  In RS485, Data is transmitted differentially via twisted pair cable because this wire have specific properties such as high noise immunity as well as long distance capabilities. RS485 network is further categorized into parts: 
Line 23: Line 23:
  
 Implementation cost of two wire network is less but it is limited up to half duplex. four wire network allows the full duplex communication.The main features of the RS485 software helps to configure and handle the addressing and turn around delay for the devices. Implementation cost of two wire network is less but it is limited up to half duplex. four wire network allows the full duplex communication.The main features of the RS485 software helps to configure and handle the addressing and turn around delay for the devices.
 +===== Software =====
 +
 +  - Bricx Command Center(Download:https://sourceforge.net/projects/bricxcc/files/bricxcc/
 +  - Windows terminal program, in this tutorial I used Hercules 3.2.8 program (Download: https://www.hw-group.com/software/hercules-setup-utility)
 +
 +
 ===== Hardware components ===== ===== Hardware components =====
 (links are at the bottom of tutorial) (links are at the bottom of tutorial)
Line 46: Line 52:
  
   * NXT Breadboard adapter:    {{:nxt_adapter.jpg?linkonly|}}   * NXT Breadboard adapter:    {{:nxt_adapter.jpg?linkonly|}}
-    ===== Software ===== 
  
-  - Bricx Command Center(Download:https://sourceforge.net/projects/bricxcc/files/bricxcc/ 
-  -  
-  - Windows terminal program, in this tutorial I used Hercules 3.2.8 program (Download: https://www.hw-group.com/software/hercules-setup-utility) 
  
-===== Connections ===== 
  
-{{:wiki:rs485connect.png?nolink|}} +===== Connection Block =====
-Connection Block Diagram for RS485 AND RS232+
  
 +This section will show the two ways to create the connection block - making a new cable and using a breadboard.
  
  
- +{{:wiki:rs485connect.png?nolink|}} 
- +Connection Block Diagram for RS485 AND RS232
-{{:wiki:connection.jpg|}} +
-Connection Diagram between  NXT adapter and RS-485 +
  
  
 {{:485.jpg?900|}} {{:485.jpg?900|}}
 Internal Connection Diagram  Internal Connection Diagram 
-In this Diagram, we show that "How DB-9 Connector is connect with Lego" 
   * T/R+ --- Logic level RS485 in +ve polarity   * T/R+ --- Logic level RS485 in +ve polarity
   * T/R- --- Logic Level RS485 in -ve polarity   * T/R- --- Logic Level RS485 in -ve polarity
- 
- 
 {{:db-9_connector.jpg?nolink}} {{:db-9_connector.jpg?nolink}}
  
Line 83: Line 79:
  
 * Step-1 * Step-1
-Firstly cut the cable with the help of stripper.+Firstly cut the cable with the help of stripping tool.
          
 * Step-2  * Step-2 
Line 96: Line 92:
 New wire is created !!! New wire is created !!!
 {{:dsc_0444.jpg?nolink}} {{:dsc_0444.jpg?nolink}}
-===== Video ===== 
-{{youtube>QOPqjnf6bgI?medium}}{{youtube>zZAOAO25ulQ?medium}}{{youtube>uRswb2zzrvw?medium}}\\  
  
-===== Commands for RS485=====+ 
 +To use the wire, insert one side into port 4 on the NXT Brick. Insert the other side into your computer's USB port. 
 + 
 + 
 +===== Connecting NXT and Computer via Breadboard ===== 
 + 
 +{{:wiki:connection.jpg|}} 
 + 
 +Connection Diagram between NXT adapter and RS-485. The end of the usb gets plugged into the computer.  
 + 
 + 
 +===== Using Hercules ===== 
 + 
 +Download Hercules and install. 
 + 
 +Plug in the NXT using the wire we created above. 
 + 
 +Open Hercules and go to the Serial tab. Choose an open port under the "Name" section. If you do not know how to check which ports are open, go to the Windows device manager and check under the "ports" section. You can update baud rate and port by right clicking the specific device and selecting "properties." 
 + 
 +Set the baud rate to 115200, then click open. Now you will be able to interface with your NXT Brick via RS485. 
 + 
 +{{:hercules_gui.png?nolink&400|}} 
 + 
 + 
 + 
 + 
 + 
 + 
 + 
 +===== Commands for Brick=====
  
   *  **void UseRS485 (void)**    *  **void UseRS485 (void)** 
Line 111: Line 134:
   * **char RS485Read (byte & buffer[ ])**   * **char RS485Read (byte & buffer[ ])**
     Read data from RS485 hi-speed port.buffer [] means a byte array which contains data.     Read data from RS485 hi-speed port.buffer [] means a byte array which contains data.
 +
  
 ===== Code ===== ===== Code =====
Line 213: Line 237:
  
 </code> </code>
 +
 +
 +===== Video =====
 +{{youtube>QOPqjnf6bgI?medium}}{{youtube>zZAOAO25ulQ?medium}}{{youtube>uRswb2zzrvw?medium}}\\ 
 +
 ===== Final Words ===== ===== Final Words =====
 The baud rate was set up in NXT and Windows terminal program ( Hercules ) should be the same.   The baud rate was set up in NXT and Windows terminal program ( Hercules ) should be the same.  
lego_nxt_rs485.1541193535.txt.gz · Last modified: 2018/11/02 14:18 by jkreitz