Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CAN bus and Android communication advice

I would like to get advice about CAN bus communication with an Android tablet.

I am working into an electrical vehicle project with a colleague. We have CAN bus communication between BMS, inverter, and control logics. And I need to get data, like the speed to the cluster. The cluster will be an Android tablet. I have an Arduino shield for CAN and Bluetooth adapter to send data to the tablet. I am fairly new to Android.

  • What should I start looking for?
  • Would these OBD-II codes work, because I need to send data too.

  • In your opinion, should I decode on the Arduino or pass CAN data to Android and deal with it there? The data is COB ID/No. of bytes/ DATA. (601/ 8/ 22 98 60 00 22 00 00 00) And I am wondering were to deal with it. If for example the first two bytes are lights, the second are speed and so on. Or should I just split them by delimiter ' ' and the byte to int?
  • I am able to send data to the CAN bus from Android. I have CAN analyzer, and the controller accepts it.
like image 319
Martynas Avatar asked Oct 01 '22 18:10

Martynas


1 Answers

Based on your inputs, you will need to use your Arduino to connect your Android device to you vehicle. The Arduino code will translate data from CAN to Bluetooth and the other way around. Indeed your Android device can't communicate directly to your CAN bus.

Then you will have to create your Android application to send/receive data from the Arduino. To do so take a look at the Android Bluetooth guide (it could also be possible to do the same with a Wi-Fi shield or an Ethernet shield or over USB (much more difficult)).

For OBD-II codes it depends on your vehicle if those are implemented on itself.

For data decoding:

  • Decode data on the Android device. This way if you change your bridge (here the Arduino) your application still works.
  • Decode data on the Arduino and this way your Android application uses high level commands, but it will be strongly linked to your bridge implementation.
  • Decode with the language you are most at ease with.
like image 86
JEY Avatar answered Oct 11 '22 13:10

JEY