introduction to can scripts

Upload: karim-al

Post on 02-Jun-2018

228 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/10/2019 Introduction to CAN Scripts

    1/33

    Introduction to CAN Scripts

    Page 1 of 33

    Slide One Hello my name is Bones Hewitt,

    today I will be taking you through an introduction to CAN Bus astypically found on motor vehicles.Those of you that are well versed in CAN, may find this introductorycourse a little easy in that you already know a lot of the information

    that I am about to present, but spare a thought for those who arecoming through as this is their first taste so to speak of CAN.The objectives of the course are to deliver a basic understanding ofhow CAN works, how CAN benefits us as we connect the CAN enabledFM units and finally how to set up CAN in the back end software andthe unit.

    Slide Two The purpose of this course is take you on a journey of discovery sothat by the end you will not only have a working understanding ofwhat CAN is, where it is used but also how we at MiX Telematics useCAN to supply information to our in vehicle equipment. In addition wewill cover the actual setting up of a MiX FM3000 CAN enabled unit sothat you will feel comfortable when connecting a FM Unit to CAN andharvesting the required information.

  • 8/10/2019 Introduction to CAN Scripts

    2/33

    Introduction to CAN Scripts

    Page 2 of 33

    As CAN is a rather large and detailed subject I will cover it in two

    modules this one being Introduction to CAN and the later course Advanced CAN will cover the more theoretical and advancedfeatures of CAN.

    The content of this course is as follows: A Brief history of CAN, helps you understand where CAN

    originated and who set it in motion

    CAN basics, in this section I will walk you through the concept ofCAN and how we use CAN Practical CAN, deals with the actual physical equipment that is

    used to make up and operate a CAN network CAN protocols essentially the language of CAN CAN messages, here I will introduce you to the way CAN creates

    a message and then decides who speaks first.

    Use of Script, in this section I will tell you about the specificscripts that are developed by the MiX Engineers and why. Setting up the FM unit, this section deals with the back end

    software settings and how these are transferred into the FM unit Connection of the FM unit will show you some practical aspects

    of connecting the FM unit to the vehicles CAN network.

  • 8/10/2019 Introduction to CAN Scripts

    3/33

    Introduction to CAN Scripts

    Page 3 of 33

    SlideThree

    Harnesses

    The FM3000 series harnesses are pre-wired with the various inputsand outputs.

    As there are two harnesses it is worth taking a moment to sort outwhich harness hosts which inputs and outputs.

    The Main Harness supplied as standard with the unit kit has thefollowing connecting wires as standard:

    Two frequency lines speed & RPM, you will recall that we coveredthese in Module one.

    Three Input lines I1, I2 & I3

    And finally two outputs, Positive Drive & Relay Drive.The IO Harness is not supplied with the kit and needs to be orderedseparately, this harness has five input wires I4 I8

    An additional Frequency line F4 is available on this harness and is ashared line with I8

  • 8/10/2019 Introduction to CAN Scripts

    4/33

    Introduction to CAN Scripts

    Page 4 of 33

    Slide Four Frequency Connections

    For those of you that completed Module one, you will be familiar withF1 & F2 as these were covered in that Module. If that is the case youcan benefit from a little refresher as we again cover these veryimportant inputs in module two.

    Two of the key parameters monitored by the FM3000 series unitsare:Speed and RPM, I will deal with them separately even though theyare often both connected at the rear of the instrument cluster. Bothof these input wires are found in the main harness which as you willrecall is supplied with the kit.

    The Blue wire with a White trace found in the main harness is theinput which when connected to a VSS line or a gearbox mountedspeed sender which both supply a pulse signal to the FM unit toenable the monitoring of speed.

    In many instances speed will be derived either from CAN or fromGPS. GPS being the least accurate and therefore the least desirable

  • 8/10/2019 Introduction to CAN Scripts

    5/33

    Introduction to CAN Scripts

    Page 5 of 33

    connection. In these instances the F1 input is not used, when this

    happens roll up the excess wire and secure with a cable tie to aconvenient spot.

    The plain Green wire connects to the RPM of the vehicle and againoften times one can locate a RPM signal behind the instrumentcluster, but dont be fooled in many instances even though you cansee the Rev counter working you just cannot locate a viable RPM

    signal. In instances such as these you may be force to look elsewherein the vehicle, places that have long yielded a RPM signal areinjectors, and if fitted a W terminal on the alternator. This Wterminal can be added by most good auto electricians but is often anexpensive option.

    In the graphic on screen you will see that F3 is indicated as a GPSInternal input, and that is just what it is. There is no externalconnection i.e. a wire in the harness. You will not have to concernyourself with connecting this as it is a manufactured input from theunit s internal GPS receiver.

    Finally F4 which shares the white wire with I8. What this means isthat I8 can be set up to record frequency F4 or analogue & digital I8

  • 8/10/2019 Introduction to CAN Scripts

    6/33

    Introduction to CAN Scripts

    Page 6 of 33

    whichever is required. Typically when used for connection as F4 it

    would be used for items such as external GPS or fuel flow meters etc.

    Now is most probably a good time to remind you about planning yourinstall as we learned in Module One. Before starting to connect any ofthe inputs or outputs, be sure that you have gathered as muchinformation as possible to assist you as you complete the install.

    Slide Five Frequency Explained

    Frequency can be defined as the number of occurrences (or pulses)within a given time period. In electronics frequency is the number ofcomplete cycles per second in the direction of the alternating current.

    The pulses can take many different forms; however, the two mostcommonly encountered when installing FM products are the Squarewave and the Sine wave. As can be seen in the diagram it is easy tosee why they are named as such. It does not impact on you in thiscourse but worth knowing all the same, that all wave forms are aproduct of Sine waves.

  • 8/10/2019 Introduction to CAN Scripts

    7/33

    Introduction to CAN Scripts

    Page 7 of 33

    The standard unit of frequency is the hertz , abbreviated as Hz. Thediagram now showing shows a single square wave cycle, now if thatcycle is completed within one second then it will be cycling at 1 Hz.Now that we know this and if we were to look at a reading where 60cycles were completed in 1 second the frequency would be 60 Hz. Oklet s see if you understand this. If your reading was over two secondsand the value was 200 cycles, what would the Hz value be?

    Thats right 100 Hz. Because it was measured over two seconds youwould divide the number of cycles with the number of seconds 200/2= 100hz

    The frequency inputs on the FM3000 series of units can be configuredto monitor any device that generates a change in frequency (in otherwords any input that produces pulses)

    Examples are: Speed Sender (pulses per km), RPM Counter (pulsesper second at 1000RPM) and electronic fuel consumptionmeasurement (EDM, pulses per liter) to name a few.

    Slide Six Typical Frequency Connection Points

  • 8/10/2019 Introduction to CAN Scripts

    8/33

    Introduction to CAN Scripts

    Page 8 of 33

    Generally installations will take place in newer vehicles so the

    frequency connections can be made to existing sensors already in thevehicle. In this situation the most common location for the variousfrequency signals you will be looking for is behind the instrumentcluster. However, do not think for one minute that this is always thecase, often you may have to locate the various frequency carryingwires elsewhere in the vehicle.

    Once again I am going to remind you of the need to do some pre-planning i.e. get as much information on the vehicle that you areinstalling to before attempting the install. You can save yourself awhole heap of work with this tactic.

    Some older vehicles may not have electronic sensors, especially withregard to the speedometer. In cases such as this you will be requiredto install a gearbox mounted pulse generator. This device is installedbetween the gearbox and the cable drive leading to the speedometerand converts the rotation of the cable into a pulse which can beinterpreted by the FM unit on one of the frequency input lines. Laterin the course you will see a diagram which depicts this type of pulsegenerator.

  • 8/10/2019 Introduction to CAN Scripts

    9/33

    Introduction to CAN Scripts

    Page 9 of 33

    Slide

    Seven

    Testing the Signal Using an Oscilloscope

    When no information exists on a particular vehicle the safest andbest way to locate the correct frequency inputs is by using anoscilloscope. There are some excellent hand held automotive unitsavailable and these can reduce your levels of frustration and give youvery definite results. They can also be used to authenticate theinformation you are using.

    An oscilloscope can be used for many things but typically in theinstallation environment it can deliver a very good view of the type amagnitude of the signal on any wire tested. It will also give you agood view of any noise or voltage spikes that may influence theaccuracy of data at a later date.

    As much as I recommend that you have one of these in your tool kit,it is expensive and not critical, as there are good value multimetersavailable and some other tricks to getting to the correct wiring, whichI shall cover a little later. However, none of these options deliver thedetailed quality information you will get from an oscilloscope.

    Slide

  • 8/10/2019 Introduction to CAN Scripts

    10/33

    Introduction to CAN Scripts

    Page 10 of 33

    Eight

    Finding Speed Signal Using a Calibration Plug

    In many instances you may find yourself without any formalequipment i.e. oscilloscope etc. and it is here that you want to beable to use the basics at hand.

    So what I am going to do is walk you through the procedure of usinga manual speed calibration plug and the unit itself to check if youhave found the correct VSS signal wire.

    Firstly you need to have the installation at a point where the unit canbe turned on by inserting a blue driver plug and then turning on theignition. This test is best done with the ignition on and the engineNOT running.

    Once you are at this point temporarily connect the F1 (the blue &

  • 8/10/2019 Introduction to CAN Scripts

    11/33

    Introduction to CAN Scripts

    Page 11 of 33

    white wire) to the wire that you think is the VSS signal wire.

    With these connected and the FM unit still in drive mode insert theviolet speed calibration plug. Now with the calibration plug stillinserted move the vehicle about 10 meters and remove thecalibration plug once moved. If you do have a VSS signal the unit willindicate this with three confirming beeps when the calibration plug isremoved. If there are no beeps or less than the required numberbeeps then it is necessary to test another wire using the same

    procedure. It is worth noting that the vehicle can be moved either ina forward or reverse direction and so you can repeat the test anumber of times without moving the vehicle any great distance.

    Note that the vehicle is not calibrated at this point as all you havedone is to locate the VSS wire.

    Once the vehicle is calibrated as per the calibration method describedin module one there still remains one important check and that is tocarefully check the maximum speed during the test drive to what isshowing in the data. It is possible to find and connect to a wire whichis not fully linked to speed and you will find this out as calibrationissues i.e. data mismatch, the test trip speed does not align with therecorded speed.

  • 8/10/2019 Introduction to CAN Scripts

    12/33

    Introduction to CAN Scripts

    Page 12 of 33

    If this occurs you may need to redo the test to locate an alternative

    VSS supply.

    Slide Nine Finding RPM Signal Using a Calibration Plug

    As with speed you can use an RPM calibration plug to assist youfinding a viable RPM signal.

    So lets go through the procedure of using a manual RPM calibrationplug and the unit itself to check if you have found a viable RPMsource wire.

    Firstly you need to have the installation at a point where the unit canbe turned on by inserting a blue driver plug and then turning on theignition. This test is best done with the ignition on and the enginerunning unlike the previous procedure which was done with theignition on but the engine not running.Once you are at this point, temporarily connect the F2 (the greenwire) to the wire that you think is the RPM signal wire.With these connected and the FM unit still in drive and the enginerunning insert the violet RPM calibration plug. After a short period10-20 seconds remove the calibration plug and if you do have a RPM

  • 8/10/2019 Introduction to CAN Scripts

    13/33

    Introduction to CAN Scripts

    Page 13 of 33

    signal the unit will indicate this with three confirming beeps when the

    calibration plug is removed. If there are no beeps or less than therequired number beeps then it is necessary to test another wire usingthe same procedure.Note that the vehicle is not calibrated at this point as all you havedone is to locate the RPM wire.

    Once the vehicle is calibrated as per the calibration method described

    in module one there still remains one important check and that is tocarefully check the maximum RPM during the test drive to what isshowing in the data. It is possible to find and connect to a wire whichis not fully linked to RPM and you will find this out as calibrationissues i.e. data mismatch, the test trip RPM values will not align withthe recorded speed.

    If this occurs you may need to redo the test to locate an alternativeRPM supply.

    Slide Ten Testing the Signal Using a Multimeter

    So far I have covered the use of an oscilloscope, violet calibrationplugs and now it is worth mentioning the most valuable electrical tool

  • 8/10/2019 Introduction to CAN Scripts

    14/33

    Introduction to CAN Scripts

    Page 14 of 33

    in your tool kit and that is the multimeter.

    Certain categories of multimeters have an ability to record a Hz valueas can be seen in the graphic, and these can give you a goodindication which wires have pulses or a Hz value but bear in mindthat you will have to follow a similar procedure as that followed whenusing a calibration plug to get the line you are testing to have a valueon it, with the exception that as you are not using the unit to assist

    you it need not be activated in either test speed or RPM.Now when selecting a multi meter for your tool kit be sure to get onein this category so as not to have to repeat the purchase later as youbegin to find the need pressing.

    SlideEleven

    CAN Connections

    This course does not set out to teach CAN even though CAN is aninput, CAN will be covered in detail a later course.However there are a few pearls of wisdom you need to know even atthis early stage.

  • 8/10/2019 Introduction to CAN Scripts

    15/33

    Introduction to CAN Scripts

    Page 15 of 33

    If you do connect CAN then remember that both harnesses are

    twisted at a pre-determined rate and are already cut to the optimumlength for their particular protocol, so do not rewind, cut or extendeither of these twisted pair harnesses during the installation.

    What this means is that when locating your unit and you intendconnecting to CAN be sure that the CAN wires will reach yourintended connection point once the unit is secured. If not you will

    have to relocate the unit so as not to have to extend the wires.Again a little pre-planning goes a long way.

    SlideTwelve

    Input Lines I1 I3

    Firstly these three input lines are found in the main harness so areavailable for connection with the standard kit.

    They also differ from I4 I8 insofar as they are able to record tachodata. What this means is that the activity of whatever they areconnected to can reflect on the tacho chart if the input is selected atchart level.

  • 8/10/2019 Introduction to CAN Scripts

    16/33

    Introduction to CAN Scripts

    Page 16 of 33

    What they do have in common with all input lines is that they are

    able to record both analogue and digital signals. I will deal with thedifferences in some detail later in the course.In addition they are able record voltage variations within two ranges.

    High voltage in the range 0 38 volts in increments of 0.15 volts.Low voltage in the range 0 5 volts in increments of 0.02 volts.

    So with this in mind it is important that you check the relativevoltage variations using a good quality multimeter or even youroscilloscope before setting up the event on the backend.

    SlideThirteen

    Input Lines I4 I8

    The connection harness for these input lines is the IO Harness whichis an auxiliary harness that is ordered separately to the main kit. Soonce again planning is required in that if your intention is to connectmore than the three lines included in the standard kit, you shouldensure that an IO harness is ordered along with the standard kit.

    As with I1 I3, I4 I8 record voltage variations within two ranges:

  • 8/10/2019 Introduction to CAN Scripts

    17/33

    Introduction to CAN Scripts

    Page 17 of 33

    High voltage in the range 0 38 volts in increments of 0.15 volts.

    Low voltage in the range 0 5 volts in increments of 0.02 volts.

    And record both analogue and digital signals.All connect in the same way with the exception of I8 which will recordfrequency, analogue & digital the specific setup being carried out inthe backend software.

    SlideFourteen Digital ExplainedWell now we get to the essence of this particular course, and that is,understanding the difference between analogue and digital and howwe locate and connect each.

    To kick off let s look at Digital.

    Digital inputs are easy to understand and are either on or off muchlike a switch, switching a light on or then off as shown in the graphicdemonstrates a digital sequence. It only has two positions on (1) oroff (0) the relative voltage between these two states is irrelevant asthe values are the same on each changeover.

  • 8/10/2019 Introduction to CAN Scripts

    18/33

    Introduction to CAN Scripts

    Page 18 of 33

    There is usually one voltage when the switch is off, normally 0 volts

    and another when the switch is on this is whatever the operatingvoltage is. In the case of a motor vehicle this will invariably be 12 or24 volts.

    It is this change that is recorded by the unit and interpreted as anevent based on whether the condition is true or false.

    Let s watch the demonstration one more time, when the switch ismoved to on the light illuminates and when the switch is turned offthe light extinguishes or turns off.

    SlideFifteen

    Typical Digital Inputs

    There are a large number of digital inputs that can be connected tothe FM3000 Series units.

    The three most common inputs are:Brakes - The foot brake is a digital signal in that when the brake isapplied then a voltage is allowed to pass a switch which illuminatesthe brake lights.

  • 8/10/2019 Introduction to CAN Scripts

    19/33

    Introduction to CAN Scripts

    Page 19 of 33

    Doors - When a door is left ajar a switch makes contact with the

    body in effect grounding the circuit which illuminate the the warninglight on the dash. Note that later we will speak of negative switchingand it is this warning light that act as the load that we will speak of.

    Seat Belts - As this is a safety issue the monitoring of non-use ofseatbelts when driving is a very common connection. Be careful hereas there are no standard as some seat belts are negative switching

    and others positive switching with some other variations for goodmeasure.There are a number other items that can be connected to such asCargo doors, Hazard warning, dash tamper, headlights etc.

    SlideSixteen

    Analogue explained

    As we now know what digital is, let s look at what analogue is.If you look at the graph now showing on your screen you will see thatthere is a direct relationship between the Voltage and theTemperature. This graph represents the operation of a temperaturesensor as the temperature rises then the voltage reading increasesand vice versa. You will notice that the increase or decrease is linearin other words a straight line and therefore directly proportional.

  • 8/10/2019 Introduction to CAN Scripts

    20/33

    Introduction to CAN Scripts

    Page 20 of 33

    By aligning the upper voltage to a recorded temperature value andthe lower voltage to a recorded value the temperature values can bepredicted based on the voltage reading at the time and it is this thatthe FM uses when an input line is set up as an analogue inputrecording the input voltage and interpreting it at the calculated value.

    In this example the FM will be set up in the 0 5 volt range and

    deliver temperature values between -20 & 5 degrees.The reverse of this can be seen when a dimmer switch is operated, inthis case the red indicator will rise up the voltage graph as thedimmer is rotated. And you will notice that the light will becomeprogressively brighter as it receives higher and higher voltages.

    Analogue is not restricted to temperature but can relate to manydifferent sensors such as: degrees (temperature), Bar (Pressure),Tons (weight), ride height (measurement) etc.

    SlideSeventeen

    FM3000 Series Analogue Options.

    As we have seen leading up to this point the various input lines areable to be set to monitor to different voltage ranges:

  • 8/10/2019 Introduction to CAN Scripts

    21/33

    Introduction to CAN Scripts

    Page 21 of 33

    1. Upper range 0-38volts in increments of 0.15volts.

    2. Lower range 0-5 volts in increments of 0.02Use a multimeter to establish which range is required for the devicebeing monitored. Usually this will have been preset during databasecreation.

    The voltage readings are linked to a device parameter or unit ofmeasure, for example on a refrigeration temperature device thevoltage reading resembles a temperature (degree) value.Analogue readings mean that as the sensors increase or decrease sodoes the voltage on the input line either directly or indirectlyproportional ( temperature sensor refer to NTC or PTC sensors whichis negative or positive temperature coefficient )

    SlideEighteen

    Typical Analogue Inputs

    Oil Pressure An oil pressure gauge if installed will receiveinformation from the oil pressure switch which converts actualpressure to a representative voltage.

    Water Temperature The water temperature gauge if installed willreceive information from the water temperature switch.

  • 8/10/2019 Introduction to CAN Scripts

    22/33

    Introduction to CAN Scripts

    Page 22 of 33

    Unlike Oil pressure this is a relatively easy sender to test by placingin boiling water and observing the results using a multimeter.

    Note: As with other warning devices oil and temperature senders canbe connected to a warning which is usually a digital input i.e.situation OK light off or warning light on.

    Cargo Temperature generally this would be a third partycomponent which monitors the cargo area or the actual coretemperature of the goods and delivers a continuous reading (variablevoltage) based on the temperature in the area being monitored.

    Again there are a large number of devices in the automotiveenvironment which can be connected to these inputs either by way ofdigital or analogue.

    SlideNineteen

    Digital Positive Switching

    Now I said that digital switching is easy to understand and it is, but itdoes have a twist in the tail as there are two types:Positive switching and Negative switching and to assist you to

  • 8/10/2019 Introduction to CAN Scripts

    23/33

    Introduction to CAN Scripts

    Page 23 of 33

    understand the difference and how to deal with these I want you to

    carefully watch as I demonstrate using the following circuit diagrams.

    What we have is:An FM unit with a positive line and a groundAn input lineA switchIn addition there is a voltmeter which we will use to tell us whenthere is power on the input line.

    Now when the probe is placed input line side of the switch there willbe no voltage recorded. This is because the switch is open and sovoltage can be present as the input line is just that and does notoutput any voltage.

    Now when the switch is closed, immediately there is a voltage on theinput line and as it is set to record voltages greater than 6 volts theFM unit records the event.

    When the switch is released the voltage is lost and the input linereturns to zero volts.

  • 8/10/2019 Introduction to CAN Scripts

    24/33

    Introduction to CAN Scripts

    Page 24 of 33

    Examples of this type of switch are:

    Panic switches such as the one you see on the graphic; this type ofswitch is a normally open switch.

    And dash tamper switches again as demonstrated as you can see thisswitch has three connectors and so can be wired either as normallyopen or normally closed be sure that the correct setup has beenloaded to the backend software.

    It is worth pointing out that it is good practice to place a fuse inlinebetween the power source and the switch and that the value of thisfuse should be lower than that of the primary power supply i.e. if themain fuse is 7.5 amps the switch fuse value should be no more than2 amps.

    SlideTwenty

    Digital input Negative Switching.

    The graphic on screen has been set up to assist you in understandinghow negative switching works and where you will encounter this in avehicle.

    The components to watch are:

  • 8/10/2019 Introduction to CAN Scripts

    25/33

    Introduction to CAN Scripts

    Page 25 of 33

    An FM unit with a positive line and a ground

    An input lineA LoadA switchIn addition there is a voltmeter which we will use to tell us whenthere is power on the input line.

    To begin with we will attach the probe to the circuit on the vehicleside of the switch and you will notice that the voltmeter value is 24volts even with the switch open. It is this very reason that thereading is 24 volts. The meter is measuring the voltage in the circuitwhich is equal on both sides of the load, no ground.

    Now when the switch is closed and a ground is established thevoltage will drop to zero as the probe is positioned on the negativeside of the load and a direct connection to ground has been made. Ifwe were to move the probe to the positive side of the load then itwould register 24 volts even with the switch closed. It is in this waythat if the load is a lamp the lamp would illuminate as there is apotential difference of 24 volts.

    This is an important piece of information because if you had

  • 8/10/2019 Introduction to CAN Scripts

    26/33

    Introduction to CAN Scripts

    Page 26 of 33

    connected to a circuit that was driving a warning light i.e. a seat belt

    and the light was not working you would never get an event toregister until the warning light was repaired or a load was added.

    When adding a load a resistor in the value range 5 10 k wouldsuffice.

    Finally it makes no difference if the switch is a normally open or anormally closed in that the FM will record the voltage as eithergreater than a specific threshold >6 volts or less than a threshold