Temperature measurement system using CAN protocol.

LPC2148 based temperature measurement and transmission using CAN protocol.

Similar projects worth following
Project comprise of two LPC2148 microcontroller namely master and slave ,where master detect the temperature using on-board LM35 sensor.The detected analog signal is converted using ADC which is flashed onto the LCD.Subsequently the temperature value is sent to the receiver uC,in order to send the data SPI-CAN interface provided by the MCP 2515 CAN controller on CAN module,which stores the data into its transmit buffers and the CAN transciever sent it to the CAN module attached to the receiver board over the (HIGH-LOW) field line. The data written to the reciever's buffer of the receiver's CAN controller is read by using SPI and consequently displayed over the LCD of slave microcontroller. Based on the data received by the receiver ,it can take control action like in this project we are signalling the action through buzzer which indicates the over temperature

1 Can Protocol and Terminology

Controller Area Network (CAN) is a multi-master serial data bus which uses Carrier Sense Multiple Access/Collision Resolution (CSMA/CR) to determine access. Message transfer over CAN is controlled by 4 different types of frame: Data frames, Remote Transmit Request (RTR) frames, Overload frames and Error frames. Each CAN data frame is required to have a unique identifier. Identifiers may be 11-bit (standard format) or 29-bit (extended format).

Figure 1The identifier serves two purposes beyond simply identifying the message. First, the identifier is used as a priority to determine which message among those contending for the bus will be transmitted next. Second, the identifier may be used by receivers to filter out messages that they are not interested in, and so reduce the load on the receiver's host controller. 

1.1 Priority Based Arbitration

Priority of an Identifier defines a static message during bus access while Arbitration in CAN protocol tells us that, when the bus is free any node may start to transmit a message, if multiple nodes start transmitting at the same time the bus access conflict is resolved by bit-wise arbitration using identifier. If Data Frame and Remote Frame with the same identifier are initiated at the same time, the data Frame prevails over the Remote Frame. The CAN physical layer supports two states termed dominant (‘0’) and recessive (‘1’). If two or more CAN controllers are transmitting at the same time and at least one of them transmits a ‘0’ then the value on the bus will be a ‘0’. This mechanism is used to control access to the bus and also to signal errors. The CAN protocol calls for nodes to wait until a bus idle period is detected before attempting to transmit. If two or more nodes start to transmit at the same time, then by monitoring each bit on the bus, each node can determine if it is transmitting the highest priority message (with a numerically lower identifier) and should continue or if it should stop transmitting and wait for the next bus idle period before trying again. As the message identifiers are unique, a node transmitting the last bit of the identifier field, without detecting a ‘0’ bit that it did not transmit must be transmitting the message with the lowest numerical value and hence the highest priority that was ready at the start of arbitration. This node then continues to transmit the remainder of its message, all other nodes having backed off. The requirement for a node to be able to overwrite a recessive bit, and the transmitting node detect this change, limits the combination of physical length and speed of CAN bus. The duration of each bit must be sufficient for the signal to propagate the length of the network. This limits the maximum data rate to 1Mbit/s for a network up to 40m in length or to 125Kbit/s for a 500m long network. The arbitration mechanism employed by CAN means that messages are sent as if all the nodes on the network shared a single global priority based queue. The above high level description is a somewhat Simplified view of the timing behavior of CAN. CAN does not have a global concept of time, rather each CAN controller typically has its own clock which, within a tolerance specified by the protocol, may drift with respect to the clocks of other nodes.

The CAN protocol therefore requires that nodes re-synchronize on each message transmission. Specifically, every node must synchronize to the leading edge of the start of frame bit caused by whichever node starts to transmit first Normally, CAN nodes are only allowed to start transmitting when the bus is idle. Thus, when the bus is idle beyond the 3-bit inter-frame space and a node n starts to transmit a message beginning with the dominant start of frame bit (“0”), then all the other nodes synchronies on the leading edge of this bit and become receivers – i.e. they are not permitted to transmit until the bus next becomes idle. In this case any message that becomes ready...

Read more »



brd - 142.79 kB - 11/26/2018 at 09:50




sch - 357.02 kB - 11/26/2018 at 09:50



mcp2515 data sheet

Adobe Portable Document Format - 1.20 MB - 11/26/2018 at 05:54



Main file for CAN transmitter uC.

C Source File - 1.11 kB - 11/25/2018 at 20:29



Main file for CAN receiver uC.

C Source File - 1.14 kB - 11/25/2018 at 20:27


View all 14 files

  • 2 × LPC 2148 microcontroller
  • 2 × CAN Module(MCP 2515 controller)
  • 1 × Keil uVision
  • 16 × Jumper wires

View project log

  • 1
    CAN module

    The CAN module comprise of a CAN controller and transceiver which establish the HIGH-LOW field lines for communication.Configure the module to transmit or receive data.Although CAN controller has 114 register which is configured using 8 types of command:


      SetSS(0);    //select slave
      Send(MCP_RESET);    //write reset instruction
      SetSS(1);    //unselect the slave



    mcp2515_READ_Byte(unsigned char address)
      unsigned char res;
      res = Recive();
      return res;


    mcp2515_WRITE_Byte(unsigned char address,unsigned char data)
      unsigned char dummy;
      dummy =Send(0x02);
      dummy =Send(address);
      dummy =Send(data);
      return dummy;

    4.)BIT MODIFY:-

     mcp2515_modify(unsigned char address,unsigned char mask,unsigned char data)

    SetSS(0);//slave select
    Send(MCP_BITMOD); //0x05 ,command to modify bit
    Send(address);//address of the register
    Send(mask); //mask byte
    Send(data); //data byte
    SetSS(1); //unselect slave


    5.)READ STATUS:-

    return mcp2515_readXXStatus_helper(MCP_READ_STATUS);

    6.)Recieve Status

    7.)Read RX Buffer

    8.)Load TX Buffer

View all instructions

Enjoy this project?



pavan kumar wrote 11/26/2018 at 05:44 point

The CAN protocols are adequate solutions for modular system design. The protocols guarantee deterministic communications for the modular system to supports real-time position and direction of the applied system without major disruption on the existing system. ARM7 Controller is the emerging technology now days and it is also a step to discover the latest technological progress in the field of Serial Communication. Our project is a step put forward in this field.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates