İçten yanmalı motorların j1939 canbus'tan alınan bilgilerinin ve hata mesajlarının işlenmesi ve mobil uygulamada görüntülenmesi
Processing and monitoring  information and error messages taken from  j1939 canbus line of internal combustion engine on mobile application
Yazar: CANER FİL
Danışman: DOÇ. DR. OSMAN KAAN EROL
İstanbul Teknik Üniversitesi / Fen Bilimleri Enstitüsü / Kontrol ve Otomasyon Mühendisliği Ana Bilim Dalı / Kontrol ve Otomasyon Mühendisliği Bilim Dalı
Derece: Yüksek Lisans, 2019
Konu: Mekatronik Mühendisliği = Mechatronics Engineering

Özet:
(Controller Area Network,CAN) 1983 yılında Robert Bosch GmbH'ta otomotiv sektörü için geliştirilmiştir. Önceleri Avrupa'da üretilen arabalar için geliştirilmişse de, mobil otomasyon ve diğer pek çok sektörde kullanılan  bir ağ olmuştur. Veri iletişimi, farklı elektronik CAN modülleri arasında elektriksel gürültüden etkilenmeyecek CAN High ve CAN Low olarak adlandırılan birbirinin aynası şeklinde bilgi ileten çok güvenli bir protokol vasıtasıyla sağlanır.
Kontrol Alan Ağı'nın otomotiv endüstrisinde yaygınlaşmasıyla modüler yapıdaki elektronik kontrol üniteleri (ECU) içten yanmalı elektronik motorlarda kullanılmaya başlanmıştır.  Elektronik motorlarda kullanılan ECU'ların sayısının artmasıyla birlikte hata tespit sistemleri gelişmiştir. Elektronik motorlarda kullanılan ECU'lardan biri hata verdiği zaman kullanıcı, gösterge paneli üzerindeki motor uyarı ikazı ile uyarılır ve aracın servise götürülmesi gerekir.
Bu tez çalışmasında kamyon,otobüs  gibi ağır iş araçlarının (heavy-duty, HD) CANbus hattında J1939 standartında bulunan verileri alınıp işlenmiş ve mobil uygulamada görüntülenmiştir. Mobil uygulamada motor hata kodları ve motorun devir değeri, motor soğutma suyu gibi önemli bilgileri görüntülenmiştir.
Bu tezin amacı, araçlarına motor arıza ikazı gelen araç sürücülerine araçlarını servise götürmeden, motor arıza nedenini ve motorun CANbus hattında bulunan tüm bilgilerini kullanıcıya anlık olarak uygulama üzerinden göstermek ve giderilen motor hatalarını silmektir. Motor arızaları yakıt borusu tıkanıklığı, filtre tıkanıklığı gibi kullanıcının dahi düzeltebileceği basit arızalardan meydana gelebilmektedir. Motor arızası giderildikten sonra arıza CANbus hattından yine servis tarafından silinmektedir. Ayrıca motorda anlık oluşan sorunlar sonucunda motor rölantide kalabilmekte ve bu durum servis bu hatayı sildiğinde çözülmektedir. 
Tezin birinci bölümünde Kontrol Alan Ağı (Controller Area Network,CAN) hakkında genel bilgi verilmiştir. Ardından tezin amacı sunulmuştur.  Kontrol Alan ağı hakkında literatürde yapılan çalışmalardan bahsedilerek birinci bölüm tamamlanmıştır.
Tezin ikinci bölümünde CANbus hattının fiziksel özellikleri, çerçeve çeşitleri, mesaj önceliklendirmesi anlatılmıştır. Ardından uygulamada kullanılan CANbus protokolünün J1939 standartı hakkında teorik bilgi verilmiştir. 
Tezin üçüncü bölümünde uygulamada kullanılan elektronik elemanlar tanıtılarak tasarlanan devre hakkında bilgi verilmiştir. Ardından mobil uygulama geliştirme ortamı tanıtılarak, tasarlanan uygulama tanıtılmıştır. CANbus hattında yapılan çözümleme işlemlerinin nasıl gerçekleştiği denklemlerle açıklanmıştır. Yapılan deneyler görselleriyle birlikte açıklanarak bölüm bitirilmiştir.
Tezin dördüncü bölümünde yapılan çalışmalar irdelenmiştir. Gelecekte yapılacak çalışmalar hakkında bilgiler verilmiştir.

Abstract:
(Controller Area Network, CAN) was developed in 1983 by Robert Bosch GmbH for the automotive industry. Although it was originally developed for cars manufactured in Europe, it has been used in mobile automation and many other sectors. 
Data communication consists of CAN-high and CAN-low lines line which will not be affected by different electrical noise. The CAN high and CAN low lines are mirror-shaped and are transmitted by a very secure protocol. Bosch published several versions of the CAN specification and the latest is CAN 2.0 published in 1991. This specification has two parts; part A is for the standard format with an 11-bit identifier, and part B is for the extended format with a 29-bit identifier. A CAN device that uses 11-bit identifiers is commonly called CAN 2.0A and a CAN device that uses 29-bit identifiers is commonly called CAN 2.0B.
Today, there are up to 150 processors in vehicles running with internal combustion engine. The CAN protocol, which only communicates between processors over 2 lines, provides great convenience in data transfer. If there is a problem in the operation of any of these processors, an error message is sent to the CAN line to alert the user. In addition, if the messages sent by the faulty processor are found to be faulty, the faulty processor is prevented from sending messages and the CAN line is prevented from being damaged. Thanks to its error-prevention structure, the CAN protocol continues to be widely used in automotive.
Each node is able to send and receive messages, but not simultaneously. A message or Frame consists primarily of the ID (identifier), which represents the priority of the message, and up to eight data bytes. A CRC, acknowledge slot [ACK] and other overhead are also part of the message. The improved CAN FD extends the length of the data section to up to 64 bytes per frame. The message is transmitted serially onto the bus using a non-return-to-zero (NRZ) format and may be received by all nodes.
All nodes on the CAN network must operate at the same nominal bit rate, but noise, phase shifts, oscillator tolerance and oscillator drift mean that the actual bit rate may not be the same as the nominal bit rate. Since a separate clock signal is not used, a means of synchronizing the nodes is necessary. Synchronization is important during arbitration since the nodes in arbitration must be able to see both their transmitted data and the other nodes' transmitted data at the same time. Synchronization is also important to ensure that variations in oscillator timing between nodes do not cause errors.
One of the important features of the CAN line is message arbitration. When sending a message to CAN network in CANBUS, the order of priority is evaluated and an assessment is made to determine which message will be sent first. Thanks to message arbitration, CANbus ensures that the desired message reaches the target processor in case of an emergency. Especially CANbus is used in automotive sector instead of other communication methods because of arbitration feature.
Another important feature of the CAN protocol is synchronization.Each node connected to the CAN line has an oscillator and an internal CAN clock. The master synchronization and resynchronization are used for the simultaneous operation of all nodes on the CAN line. The main synchronization occurs when the start bit reaches the receiving node. Resynchronization takes place during the transition from recessive to dominant.
SAE standard J1939 is used for communication and troubleshooting between vehicle components. The J1939 protocol, which was first used in the USA in heavy goods trucks and commercial vehicles, was later spread throughout the world. SAE J1939 uses CAN (Controller Area Network, ISO11998) as the physical layer. 
J1939 protocol uses the CAN frame with a 29-bit extended identifier. 
The J1939 protocol is widely used today in trucks, buses and industrial applications. The data on the CAN line of all vehicles using the J1939 standard are identical.
In addition to modern vehicles, the CAN Bus is also used in industrial vehicles that keep pace with developing technology. Unlike vehicles used in daily use, the necessary damping and driving elements can be added to the systems. After processing the information from the sensors on the external processors, it can communicate with other processors on the vehicle with the same CAN line.
As control area network became common in automotive industry, modular electronic control unit (ECU) has been used in Internal Combustion Engine. Error detection systems improved with more and more ECU being used in electronic motors. When one of the ECU in the electronic motors detect fault, motor warning signal appear on user interface and vehicle needs to be taken to service. This causes time and money loss for users.
In this thesis, data in J1939 standard coming from CANbus line of heavy-duty vehicles such as trucks and buses has been processed and monitored on mobile application. Important parameter motor error codes and motor rpm value, motor cooling water has been monitored on mobile application interface.
The aim of this thesis is to develop a mobile application through which user can monitor instantly the data coming from CANbus line of the motor and understand the fault code without taking it to service. Motor fault codes can appear in simple cases such as congestion in fuel lines and filters. In these cases, user can repair his car on his own.  After motor fault reason is solved in service, fault code is removed from CANbus line. Also, motor can even stay in idle mode in case of fault conditions and this situation is solved when error code is removed from CANbus line.
In the first part of this thesis, general information is given about Control Area Network. After that, the aim of the thesis is given. Finally, literature review related to Control Area Network is investigated.
In the next part, physical characteristics of CANbus line, frame types and bus arbitration is explained. Important features of the CAN line such as message prioritization, synchronization and fill bit are examined. After that, theoretical information related to J1939 standard of CANbus protocol used in the mobile application is given.
In the third part of the thesis, information about components used to design electronic circuit is given. After that, software development environment together with developed mobile application is shown. This section is ended with explanation about how the data coming  from CANbus line is processed.
In the last part of this thesis, the results is investigated. Also, research will be made as continuation of this thesis is given in this section.