This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DLPNIRNANOEVM: How to go about controlling DLPNIR Nano EVM with Python?

Part Number: DLPNIRNANOEVM

Hi,

Kindly guide how to control DLP NIR Nano EVM with Python?

Kind regards

  • Hello,

    We do not support this directly. The GUI is open source though. Also maybe someone from our community will chime in to help.


    Best,
    ~Danny W
  • I have used the Cython Extension of the HID API to send the commands directly to the EVM. Unfortunately, the pxd takes a list of integers that is converted to a string (of bytes). I did this on 2.7 because I was not sure of the issues with string verses byte arrays when using the extension module    

    Here is a simple class to turn on the LEDS.

    class LED:
        def __init__(self):
            ReportIDByte = int(0x00)
            WriteFlagByte = int(0x40)
            SeqByte = int(0x00)
            LengthByteLSB = int(0x03)  # this is defined as short in API c struct nnoMessageStruct
            LengthByteMSB = int(0x00)
            CmdByte1 = int(0x0B)
            CmdByte2 = int(0x01)
            DataByte0 = int(0x00)
            self.msg = [ReportIDByte, WriteFlagByte, SeqByte, LengthByteLSB, LengthByteMSB, CmdByte1, CmdByte2,0]

    Getting the spectrum is quite a bit more difficult....

    In order to grab scan data , you will have to deserialize the serialized file sent over USB HID, which is done is several packets. (max data size of HID packet is 64bytes).  If you are using a fixed scan configuration, then this packet size will be the same each time and it is pretty easy to figure where your data is. You will need to use the sting formatting  in the tpl serialization library  to deserialize the structures for the serialized data send over USB. (essentially serialized C structures)

    I would suggest you grab the Wireshark and associated USB sniffer so you can get a rough idea of what is coming over in each packet. 

    This appears to be a common question, it would be nice to get  a deserialize function in python to deserialize the different files. 

    I have currently only deserialized the adc values from the scan data file (what out for those background readings).

  • Hi Can you help us personally to resolve our issue as a professional, like we provide you cpp code and functions to call from our python script... and you gives some working solution.
  • So there are many APIs that are pretty easy to implement. 

    The issue with getting an application running is grabbing the  serialized structures from the NIRScan Nano that are returned by the APIs. 

    My method for picking out the adc values in the serialized string using I# (tpl format for array of integers), is not a method I would feel comfortable having someone deploy. 

    I did this more for a demo,

    The real solution is to create a Cython wrapper around either the tpl library or dlp spectrum library.

    I think part of this decision is the licensing for the dlp spectrum library which I would need to review before going down that avenue,

    Unfortunately, I am not really able to pick up a job like this, but I am pretty sure that  there are many people who could do this once pointed the right direction

    Jim