5
votes

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.
2
They sell OBD-II bluetooth adapters like this that you can plug in your car's socket and read data from Android apps. Not sure if you can read the commands you need, but you can code an app to do it by yourself. What I mean is that you probably can skip the Arduino here.Mister Smith
What is "CAN analyzer"? The name of a software program?Peter Mortensen
Yes its a software, but its not widely used :) but does businessMartynas

2 Answers

4
votes

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.
0
votes

Here is a simple solution here in an Android-CAN bus adapter that allows an Android device to connect to a CAN bus.