Super Mini-Node Interface Card (SMINI) - Part 2
Click HERE to download a printable copy of Chapter 4.
Super Mini-Node Interface Card (SMINI) - Part 1Super Mini-Node Interface Card (SMINI) - Part 2 <- You are HERE
Super Mini-Node Interface Card (SMINI) - Part 3
USER'S MANUAL v3.1: CHAPTER 4
SUPER MINI-NODE INTERFACE CARD (SMINI): Part 2
SMINI PARTS
Because it is possible that the SMINI might be your first C/MRI circuit card assembly, I will describe it in more detail than I will provide for the rest of the C/MRI cards. Ready-to-assemble SMINI circuit boards are available from JLC Enterprises and fully assembled-and-tested boards and complete kits are available from SLIQ Electronics.
For easy reference and assembly, a component overlay is printed on the PC card. However if you have not yet purchased your card, you can refer to Fig. 4-2 for a copy of the parts layout on the top side of the SMINI card. Table 4-5 is the parts list.
Table 4-5. SMINI parts list (in order of recommended assembly)
Qnty. |
Symbol |
Description |
2 |
- |
4-40 x 1/4” long pan head machine screws (Digi-Key H142) |
2 |
- |
4-40 hex nuts (Digi-Key H216) |
1 |
R1 |
10KΩ resistor [brown-black-orange] |
4 |
R2-R5 |
330Ω resistors [orange-orange-brown] |
1 |
D1 |
1A, 100V 1N4002 diode (Jameco 76961 or Mouser 625-1N4002-E3/73) |
1 |
S1 |
40-pin DIP socket (Jameco 112311) |
1 |
S2 |
14-pin DIP socket (Jameco 112214) |
3 |
S3-S5 |
20-pin DIP sockets (Jameco 112248) |
6 |
S9-S14 |
20-pin DIP sockets (Jameco 112248) |
1 |
RN1 |
2.2KΩ 7-element SIP resistor network (Mouser 652-4608X-1LF-2.2K) |
1 |
RN2 |
2.2KΩ 5-element SIP resistor network (Mouser 652-4606X-1LF-2.2K) |
3 |
RN3-RN5 |
2.2KΩ 9-element SIP resistor networks (Jameco 97893) |
6 |
RN6-RN11 |
470Ω 8-elemenet DIP resistor networks (Jameco 108581) |
6 |
RN12-RN17 |
4.7KΩ 9-element SIP resistor networks (Jameco 24660) |
1 |
SW1 |
7-segment DIP switch (Digi-Key CT2067) |
1 |
SW2 |
4-segment DIP switch (Digi-Key CT2064) |
3 |
H4-H6 |
24-pin right angle headers (Mouser 538-26-48-1242) |
15 |
C0-C14 |
.1µF, 50V monolithic capacitors (Jameco 332672) |
2 |
C15, C16 |
18pF, 100V monolithic ceramic disk capacitors (Digi-Key 490-9076-3) |
2 |
C17, C18 |
10µF, 16V tantalum capacitors (Jameco 94060) |
48 |
Q1-Q48 |
2N4401 NPN small signal transistors (Jameco 38421) for standard current-sinking or 2N4403 PNP small signal transistors (Jameco 38447) when using current-sourcing |
6 |
J1-J6 |
Jumpers (make from excess resistor leads and install either long jumper for current-sinking or short jumper when using current-sourcing – see text for details) |
1 |
L1 |
Diffused green T1¾ size LED (Jameco 334086) |
1 |
L2 |
Diffused yellow T1¾ size LED (Jameco 334108) |
1 |
L3 |
Diffused red T1¾ size LED (Jameco 333973) |
1 |
XL1 |
18.432mHz crystal (Digi-Key X179) |
1 |
U1 |
Microcontroller PIC16F877-20/P with USIC programmed FLASH Memory (JLC U1B) |
1 |
U2 |
74LS04 hex inverter (Jameco 46316) |
3 |
U3-U5 |
74LS540 octal buffer/line drivers – inverting (Jameco 47861 or Jameco 250915) |
6 |
U9-U14 |
74HCT573 octal D-type latched flip-flops (Jameco 45090) |
Used only for RS-485 and RS422
2 |
S6, S7 |
8-pin DIP sockets (Jameco 112206) |
2 |
H1, H2 |
5-pin straight headers (cut from 24-pin straight header - Mouser 538-26-48-1241) |
2 |
U6, U7 |
RS485 transceivers MAX487CPA (Mouser 700-MAX487CPA) |
Used only for RS-232
1 |
S8 |
16-pin DIP socket (Jameco 112222) |
5 |
C19, C23 |
1.0µF, 35V tantalum capacitors (Jameco 33662) |
1 |
H3 |
3-pin straight header (cut from 24-pin straight header – Mouser 538-26-48-1241) |
1 |
U8 |
Dual RS232 transmitter & receiver (Jameco 24811) |
Mating connectors for cable to computer, to next node and to external hardware
1 or 2 |
— |
One 3-pin terminal housing for RS232 or two 5-pin terminal housings for RS485/RS422 (cut from 12-pin terminal housing Mouser 538-09-50-3121) |
6 |
— |
12-pin terminal housings (Mouser 538-09-50-3121) |
82 |
— |
Crimp terminals (Mouser 538-08-50-0106 for wire sizes 18-20 or 538-08-50-0108 for wire sizes 22-26) |
Table 4-5. SMINI Parts List – Continuation
Fixed resistor and most popular alternate capacitors for different levels of filtering (see text)
24 |
R6-R29 |
100Ω resistors [brown-black-brown] |
24 |
C24-C47 |
.1µF, 50V monolithic capacitors (Jameco 332672) |
24 |
C24-C47 |
1.0µF, 35V tantalum capacitors (Jameco 33662) |
24 |
C24-C47 |
10µF, 16V tantalum capacitors (Jameco 94060) |
24 |
C24-C47 |
22µF, 16V radial lead electrolytic capacitors (Digi-Key P6224) |
24 |
C24-C47 |
47µF, 16V radial lead electrolytic capacitors (Digi-Key P6226) |
Note: Lead spacing for capacitors should be between .079”(2mm) and .1”(2.5mm)
Author’s recommendations for suppliers given in parentheses above with part numbers where applicable. Equivalent parts may be substituted. Resistors are ¼W, 5 percent and color codes are given in brackets.
Refer to the parts layout as you select and mount parts. Keep the card oriented the same way as the drawing while you work, to help place each part in its proper holes with correct orientation. Ensure that you are installing the right components. Sometimes the markings are so small you may need a magnifying glass to read them, but extra effort at this stage is well worthwhile. Check resistors against the color codes included in the parts list and if still in doubt use the ohms range on your VOM to verify the required resistance.
Insert all components from the component or A side of the board, the side with the printed component overlay. Do all soldering on the back or B side. For many parts the correct orientation on the card is extremely important. These are diode D1, resistor networks RN1 through RN17, DIP switches SW1 and SW2, capacitors C17 through C23, the three LEDs L1-L3, the transistors Q1-Q48, all IC sockets and the ICs themselves. To remind you to check this as you build your SMINI, I have marked the orientation-critical parts with a plus sign in brackets [+] in the instructions below.
Double-check your selection and location of each component before soldering it in place. It is a lot easier to remove an incorrect component before you have soldered it to the card! This is especially true with plated-through-holes since as you solder the part in place, the solder flows all the way through the hole.
The basic skill for building the SMINI is PC card soldering. If that is new to you, make doubly sure that you have thoroughly digested the section on PC Card Soldering in Chapter 1, to acquaint you fully with the tools and techniques of good soldering. I have updated the descriptive material on good soldering practice to include the newly recommended use of special electronic low-flux content solders and improved commercial flux removers. I find using these new products makes life much easier, so if you have not done so already, please reread this important section covering PC Card Soldering!
Note that U1, the PIC16F877, is static-sensitive. Before handling it you should ground your hands by touching them to a large metal object. This helps discharge any static charge on your body that could damage the chip.
SMINI ASSEMBLY
The order of assembly is not critical, but for the sake of having a plan, follow the steps in order and check mark the boxes as you complete each one. I list the common steps first, then the unique steps to configure your SMINI for one of the two interface standards.
Card inspection. Each SMINI card is factory tested for correct continuity between pads and to ensure that no shorts exist between traces that should be isolated. It is still a good idea to look over both sides of your card to make sure that no scratches have occurred during shipment and handling that may result in a short or open circuit. If there is a questionable area, use your VOM (Volt-Ohm Meter: review the Test Meters section of Chapter 1). You will seldom find a problem in a card that has been factory tested, but if you do find one and correct it first you will save time in later debugging. If you find an open-circuit trace, scrape away the solder mask coating and then solder a small piece of wire across the damaged section. If you find a short circuit, use a knife to scrape away the offending material. Each new card is guaranteed against manufacturing defects. Therefore, if you suspect your new card has a defect, you may send it back to JLC Enterprises for replacement.
Power terminals. Insert 4-40 screws in the +5Vdc and GND connection holes from the top or component side of the card. Add 4-40 hex nuts on the trace side, tighten firmly, and solder the nuts to the circuit pads. Use spade lugs when you attach your power supply wires to these screws for the best heavy duty connection.
R1-R5. Match the color code of each resistor to the parts list. Make 90-degree bends in the leads of each resistor so it is centered between its two holes and the leads just fit. Insert and solder while holding the part flat against the card, then trim its leads flush with the tops of the solder tents on the back side of the card. Additionally, if you are unsure of the resistor values or have difficulty in reading the color coding bands, as might be the case if substituting 1 percent resistors, which have extra bands or because color recognition may not be clear, it is a good idea to use a VOM set to its resistance range to check the resistor values before insertion.
D1[+]. Make 90-degree bends in the leads of the diode so it is centered between its two holes and the leads just fit. Making sure that the banded end of the diode is oriented as shown in the parts layout. Insert and solder while holding the part flat against the card. Then trim its leads flush with the tops of the solder tents on the back side of the board.
S1-S14[+]. To avoid mixing them up, install 40-pin IC socket S1 first, then 14-pin socket S2 followed by 20-pin sockets S3-S5 and S9-S14. To make certain that Pin-1 orientation is correct for each socket, the notch on the end of the socket should correspond to the notch printed on the parts legend. The Pin 1 hole also has the square pad for easy identification. As for any multi-pin part, solder only a couple pins first, i.e. on opposite corners of each socket. Reheat as necessary to make certain that the socket is firmly against the board. Then solder the remaining pins.
RN1-RN5[+] and RN12-RN17[+]. Install these SIP (Single In-line Package) resistor networks, making sure you have the lead common to each resistor, typically marked with a dot or small vertical line, in the hole with the square pad and marked with the numeral ‘1’. You can also use your VOM to locate the common lead. Solder the two ends first. Once you have checked that the part is firmly against the board, solder the remaining pins.
RN6-RN11. Install these DIP (Dual In-line Package) resistor networks. Orientation is not important but I still like to keep the end-notch on the part lined up with the notch printed on the parts legend. Solder two corner pins first. Once you have checked that the part is firmly against the board, then solder the remaining pins.
Note: The following assembly step can be a frequent source of error. The ON-OFF labeling printed on DIP switches from different manufacturers varies. Some label some of their switches ON when the switch circuit is closed and others are labeled ON when the switch circuit is open. Some switches have their segments numbered from right to left while others are numbered left to right. It is easy for us to totally circumvent all this potential confusion if you simply ignore all the labeling printed on the switches and use your VOM to insure correct switch orientation as described in the following step.
SW1, SW2[+]. Mount the two DIP switches using your VOM to be sure they are oriented so their contacts are closed when the switches are thrown toward the ON label as shown on the parts layout and printed on the SMINI card. Solder two corners first. Check that the part is firmly against the board, then solder the remaining pins.
H4-H6. Install the 24-pin right angle headers and hold them tightly against the card as you solder. It is best to first solder only one pin located near each header end. Then place the board and header over a screwdriver clamped in a vice with the blade protruding up. Lay the board bottom side up with the plastic part of the header resting on the screwdriver blade next to a soldered pin. Reheat the pin while pressing firmly down on the board and the header will tend to “snap” in place. Repeat for the second pin. Repeat the process for a couple more pins if required to get the complete bottom surface of the connector firmly seated. Once verified that the header’s bottom surface is pressed flat and tight against the board, then solder the remaining pins.
C0-C14. Insert with capacitor disk standing perpendicular to the card, solder, and trim. These capacitors typically have a number 104 marking otherwise they can appear very similar to C15 and C16. To avoid possible error, ensure that you have the C15 and C16 parts separated out for the next step and that each of the C0-C14 parts have the correct markings before installation.
C15, C16. Insert with capacitor standing perpendicular to the card, solder, and trim. These parts typically have a unique bend in their leads so they stand up a short distance from the card when installed.
C17, C18[+]. Make sure that the + leads (typically the longer of the two leads and marked with a small + sign) go into the + holes as shown in the parts layout and printed on the circuit board. The ‘plus’ hole also has the square pad for easy identification. Incorrect polarity will damage these capacitors. Solder and trim. These capacitors are different in value from C19-C23 so make certain that you have the correct values installed before you solder and trim.
L1-L3[+]. Install the LEDs with the + leads, typically the longer of the two leads, in the + holes, i.e. those closest to U13 and with the square pad. Check that you have the correct colored LED in the correct position before you solder and trim.
XL1. Hold case firmly against card while soldering leads and trim.
Note: Before installing jumpers J1-J6 and transistors Q1-Q48 you must decide if you want each output port to be set up for standard current-sinking or the alternative current-sourcing. Almost all applications will use standard current-sinking with the 2N4401 transistors. However, you may have a few special applications requiring current-sinking where 2N4403 transistors must be fitted. If you are not sure at this point simply postpone the following two steps until we develop a better understanding of how railroad devices are connected to the SMINI.
J1-J6. Make these jumpers from excess resistor leads and install only one jumper, long or short, at each location. Install only the long jumper for each port being setup for standard current-sinking i.e. using the 2N4401 transistors. Install only the short jumper for each port being setup for the current-sourcing alternative , i.e. using the 2N4403 transistors.
Warning: Each location J1-J6 should have only 1 long or 1 short jumper installed. Installing both long and short jumpers at any given jumper location results in a direct short between the +5Vdc supply and ground.
Q1-Q48[+]. These transistors are in groups of eight per output port. For each port that is configured for standard current-sinking (long jumper installed), install 8 of the 2N4401 transistors. For each port that is configured for alternative current-sourcing (short jumper installed), install 8 of the 2N4403 transistors.
In each case slightly bend the leads of each transistor to fit its holes, and orient each with its flat side facing the direction shown in the parts layout drawing and as printed on the card. The transistor’s center, or base, lead needs to be inserted in the hole farthest from the flat side. Push each transistor into its corresponding holes until there is about 3/16 inch of space between the board and the bottom of the transistor. Once all the transistors are lined up evenly, I solder only one lead of each transistor first and then recheck their alignment. I then solder the next lead of every transistor. After again rechecking the alignment, I then trim the leads that have been soldered. Finally I solder and trim the remaining leads.
U2-U5, U9-U14[+]. See Fig. 1-7 for IC insertion and extraction procedures. Be sure you have the ICs specified, that you put them in the right sockets with correct Pin-1 orientation and that all pins go into the socket. The notch in the end of each IC should line up with the notch in the end of the IC socket and the notch printed on the parts legend.
That completes the general SMINI assembly. Next you need only install the parts for the specific interface standard you have chosen, i.e. either RS232 or RS485. Alternatively, you may elect to install the passive components for both interface standards. This makes it easy to switch your interface back and forth between RS232 and RS485 if the need should arise.
Note: If you do install the passive components for both standards, make sure you always leave the ICs out of their respective sockets for the standard not being used. |
RS485:
S6, S7[+]. Install these 8-pin IC sockets making certain that the end notches line up for correct Pin-1 orientation. Push each socket tightly against the card and hold it that way as you solder.
H1, H2, Cut off two sets of 5-pins from a 24-pin straight header. Insert and solder following the procedure used for H4-H6 noted above, except that only solder the center pin first.
U6, U7[+]. Be sure you have the ICs specified, that you install them with the notches lined up for correct Pin-1 orientation and that all pins go into the socket. Do not install these ICs if you intend using RS232.
Skip down to Input Line Filtering unless you are also installing the RS232 components.
RS232:
S8[+]. Install the 16-pin IC socket making certain that the end notches line up for correct Pin-1 orientation. Push the socket tightly against the card and hold it that way as you solder.
C19-C23[+]. Make sure that the + leads go into the + holes as shown in the parts layout drawing and printed on the PC board. Incorrect polarity will damage these capacitors. Solder and trim.
H3. Cut off 3-pins from a 24-pin straight header. Insert and solder following the procedure used for H4-H6 noted above, except that only solder the center pin first.
U8[+]. Be sure you have the IC specified, that you install it with the notches lined up for correct Pin-1 orientation and that all pins go into the socket. Do not install this IC if you intend using RS485.
Input Line Filtering:
Note: I find that many C/MRI applications do not require the use of input line filtering. Some C/MRI Users however swear by it and think its incorporation is an important C/MRI feature. To skip this feature, simply proceed directly to U1 installation. As presented in the text on input line filtering, unless you are sure you want it, I recommend that you first build up the cards without filtering. Then if you decide that filtering is desired you can incorporate it by implementing the next four steps.
To implement input line filtering, cut the narrowed-down traces on the bottom side of the board in the area under the center of each resistor in the locations for R6-R29, choosing only those traces for the lines you require to filter. Use an X-ActoÔ knife or a cut-off wheel in a DremelÔ-type hand power tool. The cut should be at least 1/32-in wide and need not be any deeper than the trace itself.
Use your VOM to make sure that you have an open circuit across each of the cuts.
R6-R29. Match the color code of each resistor to the parts list and install them as you did for R1-R5.
C24-C47[+]. Install with the value of your choice per Table 4-4 and corresponding text discussion. For those that are polarity sensitive (tantalum and electrolytic) make sure their plus (+) leads go into the plus holes.
U1[+]. The PIC16F877 is a static-sensitive chip that must be handled with care. Avoid unnecessary handling, and keep it protected in its conductive wrapper until ready to insert it. Before touching it, ground your hands by touching a large metal object, to help discharge any static charge on your body that could damage the chip. Make sure you have the correct Pin-1 orientation and that all pins go into the socket.
Cleanup and Inspection. For a professional-looking job and to help ensure your card functions properly, follow the specific steps covered in Chapter 1 regarding cleanup and inspection. This is a vital step so do not shorten it!
That is all there is to assembling an SMINI card.
MAKING COMPUTER CONNECTIONS
Computers vary in their serial I/O capabilities. For example, earlier PCs tended to feature one or two RS232 Serial I/O ports, frequently providing one 9-pin and one 25-pin connector. Later designs, and the majority of the computers sold today, feature multiple USB ports. Generally, computers sold in the transition period retained a single RS232 port, almost exclusively the 9-pin connector, and multiple USB ports. These transitional models tend to be good choices for C/MRI applications. Additionally, connection requirements can vary as a function of whether you are implementing a single node or a multiple node system. With all these options in mind, I’ll cover the most common connections for the single node first and then we’ll look at the connection options for handling multiple nodes.
Single Node Applications
When you have a single node and your computer has an RS232 Serial Port, a “straight through” RS232 to RS232 cable is the simplest approach. As indicated in Fig. 4-7a, one end needs a standard 9-pin or 25-pin RS232 connector, to mate with the connecter on your computer. The opposite end requires a 3-pin Molex Shell connector to mate with the 3-pin header on the SMINI and SUSIC. Any 3-wire stranded cable will work. However, I typically use 2-pair AWG 22 stranded communication cable leaving one spare wire.
If your computer provides USB only, then you need to use a USB to RS232 Converter Cable to plug into the computer’s USB and use the aforementioned RS232 cable to connect between the converter cable and the 3-pin RS232 header on the SMINI or SUSIC as shown in Fig. 4-7b.
There are a large number of USB to RS232 Converter Cables on the market from which to choose and typical prices range between $15 and $50. Each of these adapters, or converters, contains electronics, and the success rate depends on the capabilities of the electronics and the device driver software that is supplied with the converter to communicate with the electronics over the USB bus. The real challenge is in selecting which converter is best suited to a given application. Sometimes, the adapter that works well for one user’s application does not function as well or it functions even better for another user’s application. Consequently, which converter is best is a frequent discussion topic on the C/MRI User’s Group. The end result, however, is an ever increasing number of C/MRI applications successfully using USB converter cables.
Just as a personal note, based upon the limited testing of three different USB to RS232 Converter Cables, the one we have found that works best for the SVOS application is the Keyspan Model USA-19HS (www.Keyspan.com). However, as we continue to explore other selections we may discover that there is another converter that we like even better.
In contrast to the USB arrangement, the connection in Fig. 4-7a is just about as easy and straightforward as one can achieve. Once determined that you have made use of the correct RS232 pinouts, as defined in Table 4-1, you have a functional connection. Additionally, the setup has minimum software and hardware overhead resulting in maximized real-time system performance.
Multiple Node Applications
Connecting your computer for multi-node applications requires using the SMINI and SUSIC RS485 5-pin headers. Different connection possibilities are summarized in Fig. 4-8.
As illustrated in Fig. 4-8a, the simplest setup for computers having RS232 is to use the JLC provided RS232 to RS485 Converter Card to be covered in detail shortly. Simply use the aforementioned RS232 cable for connecting between your computer’s RS232 serial port and the RS485 card. Then use a 4-wire communications cable to connect between the RS485 card and the SMINI or SUSIC.
Alternatively, for computers having only USB, you can use the same USB to RS232 Converter Cable as used in the previous subsection followed by the JLC provided RS232 to RS485 Converter Card as illustrated in Fig. 4-8b. However, for applications where you have not acquired the USB to RS232 Converter Cable or the RS232 to RS485 Conversion Card, one option is to purchase a USB to RS422/485 Converter Cable as indicated in Fig. 4-8c.
There are many different USB to RS422/485 Converter Cables on the market. Prices range somewhat higher than their RS232 counterparts but are still typically less than $80. However, a little extra care is required when purchasing USB to RS485 Converter Cables. This is because some suppliers fail to include in their advertising that their USB to RS485 Converter Cable is capable of handling the “Full Duplex” implementation of RS485, i.e. the 4-wire option where separate RS485 transceivers are used for output and input. This 4-wire adaptation is a requirement for use with the C/MRI. Standard RS485 Half Duplex will not work with the C/MRI.
It is important to point out that the multiple node connections shown in Fig. 4-8 are the more general in terms of capability. That is, all the multiple node examples can be used to connect to a single node system. However, the converse is not true; you cannot use either of the single node examples, as illustrated in Fig. 4-7, to connect to a multi-node application. Therefore, if you are starting out using a single node system but have plans to expand later on to multiple nodes, then it is prudent to start by using one of the connection schemes illustrated in Fig. 4-8.
For testing purposes, I selected two different USB to RS485 Converter Cables. Both are from www.usconverters.com with model numbers UT890 and U485G. The U485G, being designed for industrial applications, is optoisolated with an approximately 1/3 higher cost. Both units include the desirable data flow display LEDs.
Initial testing proved that both converters worked perfectly when interfacing to a single SUSIC node that I use for testing I/O cards. However, to date, both have failed when connecting to the 7-node, 3800 I/O line C/MRI system used on the SVOS. That is, they initialize and communicate properly with some nodes but not others. I should point out however, that the SVOS with its extensive amount of I/O, represents a severe test for any distributed system. Thus the problems I detect with it probably will never be seen by other users. Conversely, if something works on the SVOS it will most likely work everywhere.
The source of our problem might just be limited drive capability resulting from both of the USB to RS422/485 Converter Cables under test receiving their 5Vdc power from the PCs USB port which is typically limited to 100ma. If this is the case, then utilizing a converter that has its own built-in power supply or is connectable to an external supply may well solve our problem. Bob Jacobsen, the founding creator of JMRI, helped confirm our rationale by informing me that his JMRI users have certainly seen RS-485 adapters that don’t have enough drive for handling large C/MRI systems
Encouraging Trend Using USB Converter Cables
Tom Gordon, one of the C/MRI Users exploring the application of VB.net is very successfully using the same USConverters’ Model UT890 for connecting to three SMINIs. His application program uses VB.net running on an Intel i7 processor operating at 2.67GHz with Windows 7/64. The drivers for his USB-based virtual RS485 serial port came as part of a Windows 7 update.
While the performance numbers for Tom’s application, which we will look at shortly, are very encouraging, it’s important to emphasize that Tom’s application is programmed in VB.net which is significantly different than programming in VB6. For example, the VB version of the Serial Protocol Subroutine Package (SPSVBM) introduced with the V3.0 User’s Manual will not function with VB.net.
For this reason, Tom converted them to operate with VB.net and his results can be found in the “files” section of the C/MRI User’s Group.
The overriding point to make about Tom’s setup is that, using a baud rate of 28800, his real-time loop iteration rate ranges between .030 and .031 seconds, where the slower time occurs when he is using the same computer to surf the net, play music and read/write email in addition to simultaneously interfacing with the three SMINI cards on his railroad.
The .030s cycle time that Tom is achieving using the USConverters’ Model UT890 USB to RS485 Converter Cable is very good. Why do I say that? Well, first off, it has no problems keeping up with pushbutton presses. However, it is really more than that. Communicating with 3 SMINIs requires that 810 bits (calculated as 270 data bits + 540 overhead bits) be transmitted to and from the railroad every pass through the real-time loop. At a transmission rate of 28800 bits/sec, the theoretical serial I/O time is calculated as 810/28800 or .028 seconds. This means that the railroad oriented processing time within Tom’s PC plus any USB overhead time is .030 - .028 or .002 seconds, or 2 milliseconds. Certainly, not much time is being wasted in Tom’s USB to RS485 Converter.
However, even at this point, Tom’s results appear to confirm a desirable trend that with faster computers and with the even faster USB3.0 becoming available on an increasing number of such computers, we can expect continuing improvement in making use of USB for real-time applications such as the C/MRI.
RS485 CONVERSION CARD
Assuming your selected connection method makes use of the JLC provided RS485 card, then this section is of importance. However, if you do not have need for such a card, then feel free to skip ahead to RS232 and RS485 Wiring Connections.
Fundamentally, if you want to use RS485 I/O with a computer not equipped for it, then assembling an RS232 to RS485 Conversion Card, as shown in Fig. 4-9, can be a wise investment.
Ready-to-assemble conversion printed circuit cards are available from JLC Enterprises and fully assembled-and-tested cards and complete kits are available from SLIQ Electronics.
The RS485 card contains many of the same parts as used with the SMINI and the SUSIC. The 3-pin right angle header connector on the left provides the RS232 cable connections to your computer. The 5-pin right angle header connector on the right provides the RS485 cable connection to your SMINI, or SUSIC. The fifth pin, used for connecting to the cable’s shield is also connected to a screw terminal enabling easy shield grounding. Also, two terminal screws are provided for connecting the required +5Vdc and ground for powering the card.
Two LEDs are employed to monitor the card’s operation. The L1 yellow LED blinks when data is being converted from RS232 to RS485, that is going from the PC to the SMINI, or SUSIC. The red L2 LED blinks when data is being converted from RS485 to RS232, that is going from the SMINI, or SUSIC, to the PC. These come in handy for checking out system operation.
The schematic for the RS485 conversion card is shown as Fig. 4-10.
Resistors R6 and R7 are line termination resistors for the RS485 cable. These match the typical impedance of the transmission cable to minimize reflections, to help reduce serial transmission errors at the higher baud rates. Resistors R8-R11 act as pull-up and pull-down resistors to help maintain the differential voltages on the transmission line in their idle state (an absolute value less than 200mV) when no data is being handled. Table 4-7 provides the parts list.
The RS485 assembly steps are much like those for the SMINI, and SUSIC, so I will only comment on the highlights as follows:
Card inspection:
J1-J5. Make these jumpers from excess resistor leads and install, solder and trim
R1-R11. Check the color codes for each resistor against those listed in the parts lists before installing
Terminals. Insert 4-40 screws into each of the 3 terminal holes from the top or component side of the board. Add 4-40 hex nuts on the bottom side, tighten firmly, and solder the nuts to the circuit pads.
S1-S4[+]. Make certain that the notch at the end of each socket lines up with the notch printed on the parts legend.
Table 4-7. RS485 conversion card parts list (in recommended order of assembly)
Qnty. |
Symbol |
Description |
5 |
J1-J5 |
Jumpers - make from spare resistor leads |
2 |
R1, R2 |
330Ω resistors [orange-orange-brown] |
3 |
R3-R5 |
2.2KΩ resistors [red-red-red] |
2 |
R6, R7 |
120Ω resistors [brown-red-brown] |
4 |
R8-R11 |
1.0KΩ resistors [brown-black-red] |
3 |
- |
4-40 x ¼” pan-head machine screws (Digi-Key H142) |
3 |
- |
4-40 hex nuts (Digi-Key H216) |
2 |
S1, S2 |
8-pin DIP sockets (Jameco 112206) |
1 |
S3 |
14-pin DIP socket (Jameco 112214) |
1 |
S4 |
16-pin DIP socket (Jameco 112222) |
4 |
C1-C4 |
.1µF, 50V monolithic capacitors (Jameco 332672) |
5 |
C5-C9 |
1µF, 35V tantalum capacitors (Jameco 33662) |
1 |
C10 |
2.2µF, 16V tantalum capacitor (Jameco 94001) |
1 |
H1 |
3-pin Waldom right angle header (make from 24-pin right angle header Mouser 538-26-48-1242 – see text) |
1 |
H2 |
5-pin Waldom right angle header (make from 24-pin right angle header Mouser 538-26-48-1242 – see text) |
1 |
L1 |
Diffused yellow T1¾ size LED (Jameco 334108) |
1 |
L2 |
Diffused red T1¾ size LED (Jameco 333973) |
2 |
U1, U2 |
Dual RS485/RS422 transceivers (Jameco 244195) |
1 |
U3 |
7407 hex buffer/driver open collector, non-inverting (Jameco 49120) |
1 |
U4 |
Dual RS232 transmitter & receiver (Jameco 24811) |
Author’s recommendations for suppliers given in parentheses above with part numbers where applicable. Equivalent parts may be substituted. Resistors are ¼W, 5 percent and color codes are given in brackets.
C1-C4. Polarity is not important. Insert, solder and trim.
C5-C10[+]. These capacitors are polarity sensitive so be sure to insert the + lead into the + hole which has the square pad. Note that C10 is a different value so you might want to identify it and install it first before installing C5-C9.
H1-H2. Cut off the required number of pins from a 24-pin right angle header. Install and hold them tightly against the card as you solder. It is best to first solder only one pin near the center. Then place the board and header over a screwdriver clamped in a vice with the blade protruding up. Lay the board bottom side up with the plastic part of the header resting on the screwdriver blade next to a soldered pin. Reheat the pin while pressing firmly down on the board and the header will tend to “snap” in place. Having verified that the header’s bottom surface is pressed flat and tight against the board, solder the remaining pins.
L1, L2 [+]. Make sure you have the correct color LED and that the + lead, typically the longer one, is inserted into the + hole which has the square pad.
U1-U4[+]. Make sure that you have the correct part number for each location and that the ICs are inserted with their end notch lined up with the notch at the end of the socket and printed on the legend.
That is all there is to assembling the RS485 conversion card.
RS232 AND RS485 WIRING CONNECTIONS
Fig. 4-11 summarizes the wiring connections between your computer and the SMINI or SUSIC. It also shows connections to and from the RS485 Conversion Card for supporting multi-node applications.
It is important to note when connecting RS232, that the transmit data out of the PC connects to the RS232 IN terminal on the SMINI and SUSIC or on the RS485 Conversion Card. Similarly, the receive data into the PC connects to the RS232 OUT terminal on the SMINI and SUSIC or on the RS485 Converter Card. Regarding the RS485 connections, the +OUT connects to the +IN and the -OUT connects to the -IN. Quite rationally, the output of one device becomes the input to the next.
RS485 LAST NODE TERMINATION RESISTORS
Serial transmission cables or lines operating at high speed data rates can generate signal reflections, whereby the pulses being sent over the line, on reaching the opposite end, can bounce or reflect back toward the transmitter. The reflection problem is particularly troublesome for data rates above 1Mbps and frequently, commercial systems run up to 600Mbps or higher. Fortunately, at the relatively low bit rates used with the C/MRI, which are up to a maximum of 115200, or .1152Mbps, reflections are not a serious issue.
A good design rule of thumb is that as long as the bit width is 40 or more times greater than the transmission delay through the cable, any reflections will have settled by the time the receiver reads the bits. Using the relationship that an electrical signal travels through copper wire at approximately 1.5hs (1.5 x 10-9 seconds) per foot, one can calculate the maximum cable length as a function of baud rate before line termination resistance is important. This relationship is summarized in Table 4-8. This shows that at the lower baud rates, say 28800bps and below, we need not be concerned about adding line termination resistors, that is, unless your RS485 cable becomes greater than 600 feet.
Table 4-8. Maximum cable length before require line termination resistors
Baud rate (bps) |
9600 |
19200 |
28800 |
57600 |
115200 |
Bit width (μsec) |
104 |
52 |
34.7 |
17.3 |
8.6 |
Max cable length w/o line termination (feet) |
1736 |
867 |
595 |
289 |
144 |
However, at 57600bps and above, and with long cables, adding termination resistors at the far end of the RS485 cable (i.e. at the last node) can become important. Should you desire to add such termination resistors, you can easily do so by assembling a termination resistor connector as shown in Fig. 4-12. Once assembled, simply plug the connector onto an open set of RS485 header connector pins on your very last node, i.e. the furthest from the computer. This node can be either an SMINI or SUSIC.
Make sure the connector is on the 4-signal lines and not the shield pin. Normally however, you will not need this connector. For example, for testing purposes, I have run the SV Oregon System’s 7-node system for a very long time both with and without the plug installed, with no noticeable performance difference.
The higher baud rates provided by an all new SMINI and/or SUSIC distributed node systems can provide a great speed advantage. The higher baud rates can be especially important in keeping serial I/O times in line with response time requirements when creating distributed systems with a large number of nodes.
Because most serial interfaces do not begin to approach the 128 node capacity of the C/MRI and because of the high-speed capabilities of computers and the relatively low speed requirements of our railroads, most C/MRI users need not be concerned about serial I/O time. However for those that do, I cover Serial I/O processing time and writing large C/MRI programs in the Railroader’s C/MRI Applications Handbook.
Additionally, if you are not interested in pursuing USB applications, I recommend that you jump ahead to the next chapter. However, for those interested, I’ll add some closing sections covering my personal experience, and what I have observed from others, applied to USB C/MRI applications.
Continued in Part 3