androidraspberry-pi3android-things

MPPT 751 15 connect via VE.Direct to Raspberry Pi 3 (Android of Things) but data is unreadable


In the buffer i got values that can´t convert to text or hex, [98 63 65 -128 3 0 -94 ....]

Somebody knows some Java/Android reading example or results converter to text?

Thanks in advance.

while ((count = uart.read(buffer, buffer.length)) > 0) {
    Log.d(TAG, "Read " + count + " bytes from peripheral");
    byte[] lectura=new byte[count];

    for(int i=0;i<count;i++){
        lectura[i]= (buffer[i]);
        Log.w(TAG,lectura[i] + " | " + buffer[i]);
    }

Solution

  • You need not only read raw data from Raspberry UART, but implement VE.Direct protocol (receive and parse whole message) link1 link2 (both links from Solar Controller Hacks and Arduino Integration article). Also check this official documentation, FAQ and examples like that. Actually you need to convert something like SerialRead.ino to Android Things Java.

    UPD: Here also is a good example (you need to convert VEDirect.cpp file into java).