WowWeeLabs/MiP-BLE-Protocol

Lack of UART protocol documentation

Closed this issue · 5 comments

MiP has an inbuilt serial port which can be accessed by opening up the MiP and connecting an Arduino or Raspberry Pi to the serial pins.

It's not clear how to make this work, documentation needs to be updated.

Hi. I have found that using 115200 baud with 8N1 works when connecting a Raspberry Pi Model A+ to the MIP.

You also need to wait for a short while after sending the init code 0xFF. If you send actual commands too soon then they are ignored.

In Python I use time.sleep(0.1) between the init and the actual command.

Here is my Python test code:

import serial
import time
ser = serial.Serial('/dev/ttyAMA0', 115200)
time.sleep(0.1)

init MIP in serial mode

ser.write(b'\xFF')

set front LED to flashing GREEN

time.sleep(0.1)
ser.write(b'\x89')
ser.write(b'\x00')
ser.write(b'\xFF')
ser.write(b'\x00')
ser.write(b'\x01')
ser.write(b'\x10')
time.sleep(10)

now send MIP to sleep

ser.write(b'\xFA')
ser.flush()

Thank you very much, I've included your python code into the Readme. Looks like people have got this working, so I'm marking this as closed.

If you want to change the Readme, please feel free to submit a pull request.

Here is some simple arduino code for a Arduino Mega that uses Serial1 to init, make chest blink green, then sleep. The delay after sending the init is needed..

//Setup Serial1 for correct baud rate

Serial1.begin(115200);

//Send init command
Serial1.write(0xFF);
delay(30); // delay in between reads for stability

//Send command to blink chest green
Serial1.write(0x89);
Serial1.write(0x00);
Serial1.write(0xFF);
Serial1.write(0x00);
Serial1.write(0x01);
Serial1.write(0x10);
delay(30000);

//Send command to sleep
Serial1.write(0xFA);

Thanks!! I will update the Readme with this info and added your code samples. Please keep them coming if you have any more samples in different languages.

Hi All, just wanted to point you to this excellent blog post by Sparkfun
https://learn.sparkfun.com/tutorials/hacking-the-mip---proto-back

I've added a link to the readme which links to this, but just wanted to point your attention to it, it gives some great instructions on how to connect a serial port to MiP.