RSL10 smartshot camera saving images on local PC instead of RSL10 mobile application

Right now RSL10 smartshot camera streams images to the mobile application RSL10Smartshot. What is the best possible way to transfer all the frames to a local PC with bluetooth so that I can save all the individual frames? What are the things I need to modify in smartshot_demo_cam source code to make this happen?
Please let me know.

Hello @sdas32,

Given the RSL10 Smartshot Firmware makes use of a custom service to negotiate the exchange of the image data over the BLE link, you will be required to develop a custom application on the PC side that is able to decode the BLE Notifications back into image data.

By making use of a generalized BLE central on the PC side (onsemi’s BLE Explorer USB for example) you will be able to discover the services of the Smartshot and even received the notification containing the picture information, but these notifications will simply be streams of data until they are decoded back into pixel information and reconstructed.

The picture encoding used to transfer the information over BLE in described in detail within the “PTS_V1.0.1.pdf” that is included within the Smartshot CMSIS Pack documentation. By implementing the other end of this Custom Service within your Central software and recompiling the pixel data within the Notifications back into a full image, you will be able to stream the frames onto your PC.

In short, the RSL10 Smartshot will already stream the image data to your PC using a generic BLE Central software via Notifications without any modifications, but a custom implementation on the Central/PC side will be necessary to turn these data streams back into images.

Please let us know if you have any additional questions, and thank you for contributing to our Community Forums!

1 Like

Thanks for the reply. I am trying to develop a MATLAB code on the PC end and every time I try to connect the RSL10 smartshot camera with the command ble(“Smartshot_demo_cam”), the MATLAB just keeps on running without any proper established connection with the board(ss attached). Blelist command of MATLAB identifies Smartshot_demo_cam but it never connects to it. Do I really need the RSL10 usb dongle for all RSL10 boards? because my PC already has bluetooth. Please let me know why MATLAB commands are not able to connect to the device.

Hello @sdas32,

You should be able to connect with any BLE Central device given the RSL10 supports a standard BLE implementation.

Unfortunately I cannot provide feedback regarding what the MATLAB code must implement as I am not familiar with the extension.

What I can recommend is using the onsemi IDE debug tools or UART Terminals to observe what sort of interactions are taking place on the RSL10 side of the negotiation.

The first thing to check is if the ‘GAPC_CONNECTION_REQ_IND’ Stack message is being triggered within the message handler, as this will inform us if the RSL10 is receiving a connection request from the MATLAB code. Assuming this is received, the next best step will be to watch for the ‘GAPC_DISCONNECT_IND’ Stack message handler to trigger, as this will also contain a status code indicating the cause of the Disconnect.

Can you please run the Smartshot demo firmware via the onsemi IDE debugger, or enable UART/RTT Logging within the firmware, and share the behavior seen on the RSL10 side so we can try and determine why this is occurring?

1 Like

For getting into the debugging mode with RSL10 smartshot camera, I have to connect the board over bluetooth through the RSL10 smartshot app. Without connecting the board through the mobile application, it gives me error problem1(ss attached). While trying to establish a connection with the board through MATLAB, it gives me the same error with the board continuously blinking(video of board when MATLAB tries to establish connection). With MATLAB trying to connect, neither the IDE debugger or the RTT viewer can connect to the target board. Only when I connect the board through the app, RSL10 wakes up and lets me debug.


Hi @sdas32

The camera enters deep sleep mode to save energy, which also interrupts any ongoing debug sessions.

For SmartShot firmware projects you can open the RTE/Board_Support/onsemi_smartshot_config.h file
and disable the Enable Deep Sleep (CFG_SMARTSHOT_APP_SLEEP_ENABLED) setting for debugging.
This way the device will never enter deep sleep and allow you to run debug session and RTT without interruption.

1 Like

When I am trying to connect with the eval board through MATLAB,
GAPC_CONNECTION_REQ_IND ’ Stack message is being triggered within the message handle. The disconnect reason is 19. SS is attached. Can you please let me know why is this occurring?

The Disconnection reason is REMOTE USER TERMINATED CONNECTION (0x13) per BLE Core specification.
This means that the other device decided to disconnect for some reason.

Since the disconnect happens right after connection parameter update it is possible that your device is not able to handle the request and decides to disconnect but it is hard to tell without knowing the timing between the messages.

Does the disconnection happen immediately or is there a 30 second window between parameter update and disconnection?

Excerpt from the README file for the Smartshot Firmware

BLE Connection Parameters

BLE connection parameters are automatically updated by device depending on the state of application.

Low Power BLE Connection Parameter update is initiated 30 seconds after connection is established.
This is to ensure low power consumption of device when peer device is connected, but high data throughput is not required.
Low Power BLE Connection Parameter update is also initiated 1 second after any picture transfer is done.

Low Latency BLE Connection Parameter update is initiated as soon as image transfer request is received to increase maximum data transfer rate.
This is done to ensure that image data are transfered to peer device as fast as possible.

  • Low Power BLE Connection Parameters

    • Connection Interval Min: 60 ms
    • Connection Interval Max: 150 ms
    • Connection Latency: 3
  • Low Latency BLE Connection Parameters

    • Connection Interval Min: 11.25 ms
    • Connection Interval Max: 26.25 ms
    • Connection Latency: 0

It seems to be a Windows 11 and MATLAB version issue. When I restore windows 11 back to windows 10 and MATLAB 2022 to MATLAB 2020, MATLAB2020 on windows10 was able to connect with the RSL10 smart shot camera and I can now extract the characteristics out.

I am now getting image data over bluetooth to my MATLAB. As indicated in the pdf PTS_V1.0.1.pdf, I am getting chunks of 242 bytes of image data. How can I reconstruct it back to a 544*544 image ? Because I am not getting (544*544)/242 number of chunks of data. So I am guessing the image data I am receiving are not actual pixel values. While looking at the RTT viewer, ss is attached.

Please let me know

Hi @sdas32

As noted in the documentation, each notification from Image Data Characteristic starts with 4 data offset bytes.
So from all notifications you remove the first 4 bytes, join all the data that remains in correct order.
This will give you complete JPEG image data that you can either directly write into a file with .jpg extension or load in Matlab.

1 Like

The excel file contains the image data received over bluetooth from the board. As you can see it contains 52 columns and each has 242 values. Without the 4 data offset byte, that will be 52 columns with 238 values. What is the correct order to join all of them into a 544*544 image? I can concatenate adjacent columns to make a single column of 476 but then there would be only 26 columns then. I don’t see any form of image when I saved it as jpeg. Also I made sure that I am not loosing any bytes by comparing the RTT viewer which shows the image size when the camera takes an image and the image size info send to me over bluetooth in the info characteristic.

The image size is 12447 decoded from the image size info and I am getting 12655 bytes including data offset. Is this image compressed? Is there a decompression mechanism that the RSL10 smartshot app uses that I have to implement? Please let me know.
image_from_smartshot.xlsx (65.9 KB)

The data in the Excel file does not seem right.
I do not see the JPG file magic numbers at the start or end which are part of the JPG Signature.
The first 3 data bytes should always be 0xFF 0xD8 0xFF and last 2 bytes should be 0xFF 0xD9.

The last Data Notification should also be shorter than 242 bytes as the image size of 12447 gives 51 full packets and the last one with only 105 bytes of data.

You can try to copy some of the images saved to phone from the mobile app for comparison.

1 Like

I found the jpeg signature and was able to decode the data back to an image. But I am getting the images over bluetooth at a very low bits per second . A 13 KB of image data takes around 600 ms for transfer from eval board to my laptop. So the rate of transfer is 20-21 KBps. But RSL10 can operate at 2 Mbps. Where in the smartshot_demo_cam firware do I have the change the speed to let RSL10 operate at 2 Mbps? Please let me know.

Hi, that seems about right for the transfer speed.

Assuming your device chooses lowest (best) connection interval of 11.25 ms as outlined in readme you can transfer 242 bytes of image every 11.25 ms. Assuming ideal conditions and no packet loss that is about 21.5 KBps.

2 Mbps is the symbol rate on the radio when the 2 Mbps PHY is used.
BLE devices spend very little time actually transmitting in this 1 second window for various reasons so 2 Mbps transfer rate is not achievable by any BLE device.