Part 5: Imaging

In this part you’ll install all the software you need, and collect your first SFDI image. This section is broken up into the following steps:

  1. Making electrical connections
  2. Programming Arduino
  3. Getting the DMD ready
  4. Labview

a) Making electrical connections

Circuit diagram of openSFDI electronics
  1. The LEDs will be switched on and off by sending a TTL signal from the Arduino to the “modulation” pin of the LED drivers. Start by inserting the 3 LED drivers on the electrical breadboard. Connect the modulation pin for the 630 nm driver to Pin 5 of the Arduino using a piece of solid core wire. Connect the 660 nm driver to Pin 6, and the 850 nm driver to Pin 7.
  2. If you followed along you should already have power and ground from the 12 V supply running along the rails of the breadboard. Connect all of the driver V+ pins to the 12 V rail and the driver V- pins to the ground rail.
  3. Connect the ground (GND) pin of the Arduino to the ground rail of the breadboard
  4. Connect the red wires from the LEDs to the LED+ pins on the driver, and the black wires from the LEDs to the LED- pins.
  5. Plug the Arduino USB into your computer
  6. Plug one end of the USB3 cable into the camera and the other into a USB3 port of the computer
  7. Plug the USB2 cable into the DMD control board USB port, and hook the other end up to the computer
  8. Plug the HDMI cable into the mini-HDMI port of the DMD and the other end into the HDMI port of the computer

b) Programming and testing the Arduino

The Arduino controls the LEDs by sending a TTL signal to the modulation pin of the LED drivers. The computer communicates with the Arduino using serial commands communicated via the USB.

Screenshot of Arduino code with Serial monitor open for testing
  1. Download the Arduino code here
  2. Open the code in the Arduino IDE browser
  3. Make sure the Arduino is detected and the port is correct
  4. Click the “Upload” button
  5. When uploading is complete press the “Serial Monitor” button on the IDE
  6. Set the baud rate for the connection as 115200
  7. Type “1” into the command line in the serial monitor and press “Enter” to send it. The 660 nm LED should come on. Try also pressing “2”, “3”, and “0” to turn on the 730 nm LED, the 850 nm LED, and turn off all the LEDs respectively. If those commands work as expected your wiring was correct and the Arduino is working as it should

c) Preparing the DMD

In this step you’ll configure the DMD to stream patterns from the PC over the HDMI cable without doing any preprocessing to the images. If the preprocessing is included the images will be distorted and you’ll run into demodulation errors.

Screenshot of Keynote software
Screenshot of the DMD control software after step ‘k’ with boxes outlining areas that were changed.
  1. Open the control GUI that came with the DMD
  2. Click the “Pattern Sequence” radio button
  3. Click the “Pattern Sequence” tab
  4. Click the “Sequence Settings” tab
  5. Select “White” as the color from the pull-down menu
  6. Select “8” as the bit-depth from the pull-down menu
  7. Click on the G0-G7 block
  8. Click “Video Port” for the Pattern Source
  9. The “Trigger Mode” should automatically set itself to “Vsync”, but if it doesn’t then click that
  10. Set both the “Pattern Period” and the “Pattern Exposure” to 16667 microseconds
  11. Click “Add Pattern To Sequence”
  12. Click “Send”
  13. You will be taken automatically to the “Pattern Sequence Start/Stop/Pause tab
  14. Click “Validate Sequence” and wait for the green light to appear under “Sequence Validated”
  15. Click “Play” At this point an image of your Desktop background should appear on the DMD. If not, make sure the computer sees the DMD as an external display and the display mode is set to “extend”
  16. Click “Save Solution” to save an .ini file with the correct configuration for SFDI
  17. Click the “Image/Firmware” tab
  18. Click the “Firmware Build” tab
  19. Use the “Browse” button to select the existing firmware .bin file. It should be in the install directory for the GUI
  20. Add a firmware tag along the lines of “OpenSFDI”
  21. Click the “Select .ini File” button and choose the .ini file you created a few steps ago
  22. Click “save updates” and name the new file with the extension .bin
  23. Click the “Firmware Upload” tab.
  24. Click the “Browse” button and select the .bin file you just created
  25. Make sure “Skip bootloader” is checked and click “Upload”
  26. Wait for the upload to complete (ca. 2 minutes)
  27. You can now unplug the USB. When the DMD boots up it will be correctly configured to stream patterns over the HDMI port.

d) Installing LabView code

The openSFDI platform currently runs on LabView which is, alas, not open source. It should be relatively easy to port over to Python, but I haven’t had the time to do it yet. If anyone out there wants to take it on, shoot me an e-mail at:

Front panel of the Open SFDI LabView Software
  1. Download the LabView software from here
  2. Open the “testLED” file
  3. Set the COM port associated with the Arduino and the Baud rate (115200).
  4. Type 1, 2, or 3 into the box and click “Send.” One of the LEDs should turn on. Test all the LEDs to make sure they can be controlled via LabView
  5. If everything worked open the “Main” VI
  6. Make sure the hardware constant for the USB and camera are set correctly
  7. Press “Start”
  8. Enter “.05” for the first element of “SFDI Spatial Freq (1/mm)”, “.1” for the second, and “.2” for the third. “Go”
  9. Make sure striped patterns appear on the DMD

If no patterns appear, one potential problem might be that the DMD is being detected as an external monitor to the left of the main monitor. If you switch it around so the DMD is to the right of the main monitor, it should work.

That’s it for this section. At this point you should be ready to acquire an SFDI data set. Click on Acquisition for a walkthrough of that process.