This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Sensor Data into Matlab

I am using a photo detector to sense heart beat data. That sensor data is being sent to my nRF51 DK's ADC and then transmitted out via Bluetooth. I want to collect that data in real(ish) time, in Matlab, so that my team can start running some DSP analysis on the data. For our project we cannot work with past data, it needs to be current data -- within a second or two.

So, I am receiving the nRF 51 DK packets in a nRF dongle in my computer's USB port. I downloaded Master Control Panel and it's great, but my information is trapped inside! Right now I'm writing scripts that will parse the log.txt file that the MCP generates, but I fear this is going to be inefficient.

I am hoping that there is someone here who can point me in a better direction. I'm trying to create this data path.. sensor -> 51DK -> dongle -> matlab, all streaming. At this point I have the voltages I want showing up in the MCP log.txt, I am just not sure that opening and closing files 100's of times a second is the most effective means of streaming my packet data into matlab.

Parents Reply Children
  • As Vidar said: sensor --> nrf51 ---(uart over usb)---> PC would be the simplest way to collect the data.

  • Thank you for the replies. I just want to clarify a bit. Would this mean that I go sensor -> nrf51 -> nrf dongle -> (use PC-BLE-DRIVER lib to handle nrf dongle output) -> matlab (reads from some program I'd write for this). Or, does that library remove the need for the dongle? I couldn't really tell by looking at the README.

    If the dongle is creating a UART bridge, isn't the output (the USB end) of the dongle just a serial UART data signal? If it is, I think I should be able to plug this directly into matlab. As I understand it, matlab is able to interface with com ports by opening then, reading them, closing them ect. I just don't think I understand the format of the data by the time it hits the com port (after being received by the nrf dongle).

  • You have two solutions:

    1. Two nRF51 (lets say both are nrf51 dk). First nrf51 has sensor connected and it gets data from sensor. Through special created service, or pseudo-uart (ble-nus) it sends the data to second DK which is connected to PC. Second DK is shown on PC as j-link device with uart capabilities so you can open it as a normal serial port (ex. in putty or matlab). program on second nrf51 displays received data on that port.

    2. Simple version: one nrf51 (ex. nrf51-DK with on-board segger chip). you connect sensor to it, write program that takes data from sensor and displays it on serial port (with segger chip help). you read it from serial port on PC. (putty, matlab etc...)

Related