Electrical Support

This area contains resources related to electrical components such as hardware setup and wiring details. Items in this section should be relevant regardless of which programming language your team uses.

This page is to support both our team, as well as others, with electrical guides and resources. A lot of knowledge is available across the web and we hope to collect what we find useful here. If you have a reference we should add, please feel free to contact us!

CAN Jaguars

In this tutorial we explain how to configure your Jaguar motor controllers for use in CAN mode, an advanced way to communicate with your motor controllers. We cover creating your cables and re-flashing the Jaguar firmware. These are the procedures and methods we followed to create our wiring for the 2011 season. We had zero issues/problems with our CAN wiring throughout the entire season (2 Regional competitions, 3 off season competitions, an numerous demonstration events).

What is CAN?

CAN stands for Controller Area Network and is an industry standard protocol to allow devices to communicate with one another. CAN is most commonly found on devices and sensors used in the automotive industry. CAN devices are connected to one another through a bus in a daisy chained fassion, which means each device on the CAN bus is wired sequentially to one another. Since all the devices are talking over the same wires, each devices on the bus must have a unique identification number.

CAN Vs. PWM:

The first difference between CAN and PWM is the wiring. This might seem obvious, but it's an important point to consider when deciding which mode of operation will work best for your team. All teams are familiar with PWM wiring. In this mode all motor controllers require a PWM cable to be run to them from the digital side car. Using CAN can greatly simplify this wiring since each device is linked to the next in line, only one chain of cables needs to be created. Wires only need to be as long as the next device in the chain. This can reduce the rats next of cables around the digital side car significantly.

In addition to simplifying wiring layout, creating the cables is also MUCH simpler with CAN. CAN cables are made with standard phone jacks and phone cables. You can literally create a new CAN cable in under a minute. No more splicing together PWM cables to get one long enough to fit your needs. CAN cables are also more reliable, they WILL NOT PULL OUT. When was the last time the cable on your house phone randomly pulled out or didn't seat correctly? Wiring with CAN is a wire-once and forget-it kind of operation. No more checking every PWM cable is seated before each match!

Besides wiring differences, there are a number of advantages to using the Jaguars in CAN mode as it makes a number of powerful software features available to you. It does not however change the output response of the Jaguar. In general, using the Jag in CAN or PWM mode will result in the same performance of the motor controller. CAN mode will make more features available on the software side of things.

When using a Jaguar over CAN you have the following modes of operation available to you:

Voltage Control Mode

Speed Control Mode

Position Control Mode

Current Control Mode

When controlling a Jaguar through Pulse Width Modulation you're able to manipulate its speed and direction through a PWM signal. In this mode of operation the motor controller outputs a percentage of its available input voltage to the motor. This controls the speed of the motor. The polatiry of that voltage determines whether the motor spins forward or reverse. A comparable mode of operation is available on the Jags in CAN mode. It is called Voltage Control Mode, or Percent VBus mode in LabVIEW. In this mode of operation the Jaguar takes an input from 1.0 to -1.0 similar to when it is controlled through PWM. This is the simplest mode of operation and should only require modification to initialization code.

The Jag can also locally implement closed loop control through CAN in Speed and Position control modes. In these modes, a closed loop controller is implemented directly on the Jaguar. No closed loop control need be implemented on the cRIO. In these modes position sensors need to be wired directly to the Jaguar. Wiring for both a potentiometer and quadrature encoder are shown shown in the figure below. Note: both types are shown wired, but only one type of sensor can be used at a time.

Figure 1 - External Sensors for Closed Loop Control

To use these modes the Jaguar needs to be initialized in either Speed or Position control mode, told wether a position sensor is connected, told the calibration values for that position sensor (e.g. ticks/revolution), and the PID gains for the closed loop control.

The last mode of operation is the Current Control Mode. In this mode the Jaguar will target a specific current value using its internal current sensor. No additional sensors or wiring are required to support this mode of operation. TIs manual states that small DC motors may not be suitable for use in this mode of operation. TIs datasheet states that the current sensor within the black Jag is accurate to ±1 A when motor current is ≥ 8A, and is accurate to ±2A when motor current is < 8A. The black Jaguar can supply 40A continuous max, 60A for 2 seconds, and 100A peak. The Internal PID controller will be utilized in this mode to target a commanded current value.

Note: If you plan to use the Jag in a closed loop control mode please make sure you set asside ample time to test and debug this functionality. Have a fall back plan ready!

Ordering Parts Required:

The parts required to make these cables are very common. You should be able to purchase these parts at your favorite electrical component supplier. Where possible, we have provided links to the monoprice parts which we use for our wiring. We've chosen monoprice for our cabling as they have the best prices on the components required without sacrificing quality. Do your research and planning before you buy to verify the parts you order will fit your teams needs. If you have found other options please share your findings in the comments below.

Note: 6 conductor phone cable will also work fine but is not required to make any of the cables.

You will also need to purchase a few 100Ω resistors. If you're not already placing an order with an electronics supplier, radioshack is probably your best bet.

Adjust the quantities listed to fit your teams need. This is what we ordered for our 2011 robot and this was more than enough to wire up one robot.

Create Cables:

Figure 2 - CAN Wiring

There are a few different cables that need to be made.

DB9 (serial) to RJ12 cable (with terminating resistor)

Jumper cables to go between the Jaguars

Terminating resistor

All the pinout information you need to make the cables is in the following figure:

Figure 3 - Connector Pinouts

As you can see the DB9 connector only has three wires we are interested in. Transmit (3), receive (2) and our voltage reference - ground (5). The Jaguars have two connectors on them which are used for CAN communications. If we look at the connector on the Left side of a black Jag, we see that it has six pins wired. The outside two pins are what are used to receive and transmit data over RS232. Only the back Jaguars have these pins wired, as that's what makes them special. They can act as a RS232 to CAN bridge, translating our serial communications to CAN messages. The inside four pins on each Jag connector is what is used for messages on the CAN bus (V+, CANH, CANL, GND).

1. Creating the DB9 to RJ12 Cable:

The first cable which needs to be made needs to connect the DB9 connector to the 6 pin 6 conductor (6P6C) connector on the left hand side of the Jaguar (the one labeled "IOIOI NET"). You should consider making two of these cables. One to keep with your programming laptop for configuring Jaguars and and one which will be on your robot (if you are connecting the Jaguars to the cRIO's serial port). You'll want to keep one with your programming computer in the event you need to setup a Jaguar at a competition since you'll need to configure its CAN ID # before it will work on your robot.

To make this cable you need to connect:

Pin 2 on the DB9 to pin 6 on the RJ12 connector

Pin 3 on the DB9 to pin 1 on the RJ12 connector

Pin 5 on the DB9 to pin 5 on the RJ12 connector

100Ω resistor leg1 to pin 3 on the RJ12 connector

100Ω resistor leg2 to pin 4 on the RJ12 connector

This configuration will connect the computer's serial communication lines to the Jaguars serial communication lines (the outside pair on the Jag's right hand connector). Since this will be the first device on the CAN bus, we need a terminating resistor added across the Jaguar CANH and CANL pins.

Note: If you're using 6 conductor cable, you can place the terminating resistor inside the serial jack, as described here, to simplify wiring.

This first cable is the most important and most involved. All the others are quite simple. Take your time making this cable and double check all your connections.

2. Creating the jumper cables:

If you are connecting more than one Jag to the bus, you'll need to link the devices together as shown in Figure 2. The cable required to do so is a straight through cable shown in Figure 4.

Figure 4 - CAN Jumper Cable

Only 4 conductors are required for these cables since the serial communications, on pins 1 and 6, are not carried between Jags. The following pinout can be followed to create the jumper cables:

Pin 2 to Pin 2

Pin 3 to Pin 3

Pin 4 to Pin 4

Pin 5 to Pin 5

3. Creating the terminating resistor:

The final part that needs to be made is the terminating resistor. Simply connect a 100Ω resistor to a phone jack, across the middle two pins - 3 and 4. We have found that crimping directly to the resistor legs can create unreliable conenctions and in some cases the resistors legs can short after the crimp is made. We like to solder wire to the ends of the resistor, and crimp the connector to the wires. After testing it we coat the whole thing in hot glue for strain relief. If the diameter of the resistor leads are sufficiently small enough this step may not be necessary.

Wiring Resources:

The following resources may be helpful in describing how to make the wiring:

Flashing the Jags:

Flashing the JAGs needs to be done from a computer over a serial connection. Most computers no longer have a serial (DB9) connector on them, so you may require an older computer or a USB to serial adapter (see the bill of materials above).

After you create your wiring you will need to re-flash all the Jaguar motor cntrollers you wish to use over CAN.

Flashing should be done with the BDC-COMM utility from TI. You will also need the latest firmwares for the Jags you are flashing (Black and Tan jags require different firmwares). Firmware revision 92 is the latest official version on TIs website. This is the firmware from the 2011 season. Expect a new release for the 2012 season as beta test teams were testing revision 93. Both BDC-COMM and firmwares are available from the TI website. Links are located in the "Related Products" > "TI Software" section. A mirror of the files is available here - BDC_COMM: (v92), Firmware: (v92).

To reflash your Jaguar

Note: Stay clear of the no-name serial to USB adapters on ebay. We've spent hours trying to figure out what was wrong with our Jags only to find out it was a faulty RS232 adapter. The drivers for these components are usually unreliable. It's not worth the few $ saved. This one from monoprice works reliably and is around the same price point as the cheapies. Also, if you plan to use the adapter with Windows 7, make sure reliable drivers are available or have an XP machine ready to fall back to.

Troubleshooting:

FIRST Team 2168 has made an effort over the past few years to identify and debug issues that our team and others have had with Jaguars and CAN. If you're having trouble getting things to work, using the following steps will help localize and ultimately solve CAN problems. Note: This section is actively being developed.

Not sure if your USB to RS232 adapter is working?

Run a loopback test. This will verify that your adapter, drivers, and OS are all playing nice. This is done by conencting the RX and TX lines to one another and having the computer transmit data onto the COM port.

Expect reliability issues when using off brand USB to RS232 adapters with Windows Vista and 7. Your best bet is to try to get things working in XP first, preferrably on a computer which has a serial port built in.

You should be able to hold two ends next to each other and see a mirrored wire pattern.

All metal contacts on a cable end should be crimpped such that they are fully depressed into the conductors. If you inspect closely, you should be able to see little metal spikes piercing each wire's conductor.

Verify your USB to Serial Adapter is made correctly

Verify your terminating resistor is made correctly

Measure 100 ohms across the two middle pins on the phone jack.

Verify you're plugged into the left connector (labeled IOIO) on the first Jaguar in the chain

Verify pins 1 and 6 in the left connector (labeled IOIO) are not damaged on the first Jaguar in the chain.

When connected to multiple Jaguars, one or more (not all) Jag status lights flash yellow

Verify the wiring immediately before the Jaguar in the chain thats not communicating is correct

Verify the connectors on the offending Jag are not defective

Verify the connectors on the upstream Jag are not defective.

Every other Jaguar status light flashes yellow

CAN Cables are made backwards. CAN Cables must match Figure 4.

Jaguar status light flashes Red regardless of command issued

The Jaguar is in a faulted condition. RMA the Jaguar if possible.

If these steps don't work for you, or you have a suggestion to make this guide better, please don't hesitate to contact us.