Review of the ams OSRAM AS1170 High Power LED and Vertical Cavity Surface Emitting Laser (VCSEL) Evaluation Kit

View table of contents ...  

RoadTest: Apply to review the ams OSRAM AS1170 Evaluation Kit

Author: rsc

Creation date:

Evaluation Type: Evaluation Boards

Did you receive all parts the manufacturer stated would be included in the package?: False

What other parts do you consider comparable to this product?: Most high power laser modules have a driver board, however, they don't allow user configuration and control to this level.

What were the biggest problems encountered?: A lack of basic code flowchart and an AS1170 state diagram made it difficult to follow the software functions at first. The AS1170 GUI PC app is ok as a start, but can be frustrating when it doesn't work properly.

Detailed Review:

Review of the ams OSRAM AS1170 High Power LED and Vertical Cavity Surface Emitting Laser (VCSEL) Evaluation Kit

I received the following so far:

  • ams OSRAM AS1170 WL EVM EB Evaluation Kit, including:
    • ams OSRAM AS1170 EVK
    • 2 x ams OSRAM IR LED Break-out board
    • ESP32 S2 DevKit M1
    • 1m USB 2.0A to USB2.0 Micro-B Cable

I did not yet receive:

  • 2 x OSRAM OSLON Black SFH 4726 BS A01 LEDs
  • 2 x OSRAM SYNIOS P2720 SFH 4795BS LEDs

I downloaded and installed 

  • ams AS1170 PC GUI Software V1.1

Here is the kit.

imageimage

The initial attempt at evaluating the kit was a bit frustrating. 

The AS1170-GUI PC software has a few problems.  It works sometimes, sometimes not at all.  To diagnose what the problem is, I need to dive deeper into the software interface.

imageimage

The AS1170 IC is a LED driver with two outputs that can source up to 1A on each output.  The basic AS1170 IC block diagram is shown below.

image

The AS1170 is controlled using the I2C bus by loading various registers per the following table.

image

The AS1170-GUI PC program talks to the ESP32 through the USB serial interface using read and write commands, and then the ESP32 transfers the register data to/from the OSRAM board via the I2C bus.

image

image

image

I soldered up a small interface board to plug into the OSRAM board via the 8-pin header so I could connect some visible LEDs and disconnect the IR on-board LEDs.

image

image

My intent is to eventually connect the OSRAM AS1170 board to some CNC laser modules.

Below is the current CNC laser driver board.

image

The AS1170 user manual isn't totally clear as to how the register settings control the driver output modes.

In the AS1170 EVK manual there are a few example configurations.

AS1170_EVK_QG001040_2-00.pdf

\https://look.ams-osram.com/m/1ad89354fc528e75/original/AS1170-EVK-QG001040-Guide-2-00.pdf

In the AS1170 IC datasheet there is much more information about all the registers and values.

AS1170-High-current-LED-VCSEL-driver.pdf

https://look.ams-osram.com/m/360a4e139e632474/original/AS1170-High-current-LED-VCSEL-driver.pdf

To give myself a jumpstart on how the OSRAM GUI PC app was configuring the board, I used wireshark to monitor the USB bus and log the data transfers.

_ws.col.info == "URB_BULK out"
_ws.col.info == "URB_BULK out"
OUT_on
0000   1b 00 e0 01 56 57 85 a9 ff ff 00 00 00 00 09 00   ....VW..........
0010   00 01 00 06 00 02 03 0e 00 00 00 77 72 69 74 65   ...........write
0020   2c 36 2c 32 35 2c 2d 31 0a                        ,6,25,-1.
OUT_off
0000   1b 00 e0 89 2d 50 85 a9 ff ff 00 00 00 00 09 00   ....-P..........
0010   00 01 00 06 00 02 03 0e 00 00 00 77 72 69 74 65   ...........write
0020   2c 36 2c 31 37 2c 2d 31 0a                        ,6,17,-1.
Auto_strobe off
0000   1b 00 a0 1a fe 2a 85 a9 ff ff 00 00 00 00 09 00   .....*..........
0010   00 01 00 07 00 02 03 0d 00 00 00 77 72 69 74 65   ...........write
0020   2c 36 2c 31 2c 2d 31 0a                           ,6,1,-1.
Auto strobe off
0000   1b 00 a0 5a 2b 52 85 a9 ff ff 00 00 00 00 09 00   ...Z+R..........
0010   00 01 00 07 00 02 03 0e 00 00 00 77 72 69 74 65   ...........write
0020   2c 36 2c 31 37 2c 2d 31 0a                        ,6,17,-1.
LED_on time = 1280ms
0000   1b 00 a0 2a 1e 5a 85 a9 ff ff 00 00 00 00 09 00   ...*.Z..........
0010   00 01 00 07 00 02 03 0f 00 00 00 77 72 69 74 65   ...........write
0020   2c 35 2c 32 35 35 2c 2d 31 0a                     ,5,255,-1.
0000   1b 00 a0 2a 29 74 85 a9 ff ff 00 00 00 00 09 00   ...*)t..........
0010   00 01 00 08 00 02 03 0e 00 00 00 77 72 69 74 65   ...........write
0020   2c 35 2c 33 35 2c 2d 31 0a                        ,5,35,-1.
0000   1b 00 a0 8a 3a 74 85 a9 ff ff 00 00 00 00 09 00   ....:t..........
0010   00 01 00 08 00 02 03 0f 00 00 00 77 72 69 74 65   ...........write
0020   2c 37 2c 31 39 32 2c 2d 31 0a                     ,7,192,-1.
0000   1b 00 a0 0a 3b 74 85 a9 ff ff 00 00 00 00 09 00   ....;t..........
0010   00 01 00 08 00 02 03 0e 00 00 00 77 72 69 74 65   ...........write
0020   2c 36 2c 31 37 2c 2d 31 0a                        ,6,17,-1.


0000   1b 00 70 6a 0e 4f 85 a9 ff ff 00 00 00 00 09 00   ..pj.O..........
0010   01 01 00 09 00 82 03 40 00 00 00 45 53 50 2d 52   .......@...ESP-R
0020   4f 4d 3a 65 73 70 33 32 73 32 2d 72 63 34 2d 32   OM:esp32s2-rc4-2
0030   30 31 39 31 30 32 35 0d 0a 42 75 69 6c 64 3a 4f   0191025..Build:O
0040   63 74 20 32 35 20 32 30 31 39 0d 0a 72 73 74 3a   ct 25 2019..rst:
0050   30 78 31 20 28 50 4f 57 45 52 4f                  0x1 (POWERO
0000   1b 00 70 6a 0e 4f 85 a9 ff ff 00 00 00 00 09 00   ..pj.O..........
0010   01 01 00 09 00 82 03 40 00 00 00 4e 29 2c 62 6f   .......@...N),bo
0020   6f 74 3a 30 78 38 20 28 53 50 49 5f 46 41 53 54   ot:0x8 (SPI_FAST
0030   5f 46 4c 41 53 48 5f 42 4f 4f 54 29 0d 0a 53 50   _FLASH_BOOT)..SP
0040   49 57 50 3a 30 78 65 65 0d 0a 6d 6f 64 65 3a 44   IWP:0xee..mode:D
0050   49 4f 2c 20 63 6c 6f 63 6b 20 64                  IO, clock d
0000   1b 00 70 6a 0e 4f 85 a9 ff ff 00 00 00 00 09 00   ..pj.O..........
0010   01 01 00 09 00 82 03 40 00 00 00 69 76 3a 31 0d   .......@...iv:1.
0020   0a 6c 6f 61 64 3a 30 78 33 66 66 65 35 31 31 30   .load:0x3ffe5110
0030   2c 6c 65 6e 3a 30 78 31 32 32 38 0d 0a 6c 6f 61   ,len:0x1228..loa
0040   64 3a 30 78 34 30 30 34 61 30 30 30 2c 6c 65 6e   d:0x4004a000,len
0050   3a 30 78 61 30 63 0d 0a 6c 6f 61                  :0xa0c..loa
0000   1b 00 70 6a 0e 4f 85 a9 ff ff 00 00 00 00 09 00   ..pj.O..........
0010   01 01 00 09 00 82 03 2b 00 00 00 64 3a 30 78 34   .......+...d:0x4
0020   30 30 34 65 30 30 30 2c 6c 65 6e 3a 30 78 33 35   004e000,len:0x35
0030   37 63 0d 0a 65 6e 74 72 79 20 30 78 34 30 30 34   7c..entry 0x4004
0040   61 31 35 63 0d 0a                                 a15c..
0000   1b 00 70 6a 0e 4f 85 a9 ff ff 00 00 00 00 09 00   ..pj.O..........
0010   01 01 00 09 00 82 03 40 00 00 00 50 57 4d 20 61   .......@...PWM a
0020   6e 64 20 49 6e 64 69 63 61 74 6f 72 20 28 69 6e   nd Indicator (in
0030   63 6c 5f 70 77 6d 29 3a 20 30 0d 0a 43 75 72 72   cl_pwm): 0..Curr
0040   65 6e 74 20 73 65 74 20 4c 45 44 31 20 28 6c 65   ent set LED1 (le
0050   64 20 63 75 72 72 65 6e 74 20 31                  d current 1
0000   1b 00 70 6a 0e 4f 85 a9 ff ff 00 00 00 00 09 00   ..pj.O..........
0010   01 01 00 09 00 82 03 40 00 00 00 29 3a 20 31 30   .......@...): 10
0020   30 31 31 31 30 30 0d 0a 43 75 72 72 65 6e 74 20   011100..Current 
0030   73 65 74 20 4c 45 44 32 20 28 6c 65 64 20 63 75   set LED2 (led cu
0040   72 72 65 6e 74 20 32 29 3a 20 31 30 30 31 31 31   rrent 2): 100111
0050   30 30 0d 0a 46 6c 61 73 68 20 74                  00..Flash t
0000   1b 00 70 6a 0e 4f 85 a9 ff ff 00 00 00 00 09 00   ..pj.O..........
0010   01 01 00 09 00 82 03 40 00 00 00 69 6d 65 72 20   .......@...imer 
0020   28 66 6c 61 73 68 20 74 69 6d 65 6f 75 74 29 3a   (flash timeout):
0030   20 31 30 30 30 31 31 0d 0a 53 74 72 6f 62 65 20    100011..Strobe 
0040   73 69 67 6e 61 6c 69 6e 67 20 28 73 74 72 6f 62   signaling (strob
0050   65 20 6f 6e 29 3a 20 31 31 30 30                  e on): 1100
0000   1b 00 70 6a 0e 4f 85 a9 ff ff 00 00 00 00 09 00   ..pj.O..........
0010   01 01 00 09 00 82 03 40 00 00 00 30 30 30 30 0d   .......@...0000.
0020   0a 53 74 72 6f 62 65 20 73 69 67 6e 61 6c 69 6e   .Strobe signalin
0030   67 20 28 73 74 72 6f 62 65 20 74 79 70 65 29 3a   g (strobe type):
0040   20 31 31 30 30 30 30 30 30 0d 0a 43 6f 6e 74 72    11000000..Contr
0050   6f 6c 20 28 6d 6f 64 65 20 73 65                  ol (mode se
0000   1b 00 70 6a 0e 4f 85 a9 ff ff 00 00 00 00 09 00   ..pj.O..........
0010   01 01 00 09 00 82 03 40 00 00 00 74 74 69 6e 67   .......@...tting
0020   29 3a 20 31 30 30 30 30 0d 0a 43 6f 6e 74 72 6f   ): 10000..Contro
0030   6c 20 28 6f 75 74 5f 6f 6e 29 3a 20 31 30 30 30   l (out_on): 1000
0040   30 0d 0a 43 6f 6e 74 72 6f 6c 20 28 61 75 74 6f   0..Control (auto
0050   73 74 72 6f 62 65 29 3a 20 31 30                  strobe): 10
0000   1b 00 70 6a 0e 4f 85 a9 ff ff 00 00 00 00 09 00   ..pj.O..........
0010   01 01 00 09 00 82 03 40 00 00 00 30 30 30 0d 0a   .......@...000..
0020   46 61 75 6c 74 20 28 66 61 75 6c 74 20 75 76 6c   Fault (fault uvl
0030   6f 29 3a 20 30 0d 0a 46 61 75 6c 74 20 28 66 61   o): 0..Fault (fa
0040   75 6c 74 29 3a 20 30 0d 0a 46 61 75 6c 74 20 28   ult): 0..Fault (
0050   66 61 75 6c 74 20 6f 76 65 72 74                  fault overt
0000   1b 00 70 6a 0e 4f 85 a9 ff ff 00 00 00 00 09 00   ..pj.O..........
0010   01 01 00 09 00 82 03 40 00 00 00 65 6d 70 74 29   .......@...empt)
0020   3a 20 30 0d 0a 46 61 75 6c 74 20 28 6c 65 64 20   : 0..Fault (led 
0030   73 68 6f 72 74 29 3a 20 30 0d 0a 46 61 75 6c 74   short): 0..Fault
0040   20 28 66 61 75 6c 74 20 6f 76 70 29 3a 20 30 0d    (fault ovp): 0.
0050   0a 46 69 78 65 64 20 49 44 20 28                  .Fixed ID (
0000   1b 00 70 6a 0e 4f 85 a9 ff ff 00 00 00 00 09 00   ..pj.O..........
0010   01 01 00 09 00 82 03 15 00 00 00 66 69 78 65 64   ...........fixed
0020   20 69 64 29 3a 20 31 30 31 31 30 31 30 30 0d 0a    id): 10110100..


To help figure out the correct software flow, I started writing a Matlab app to interface with the ESP32 directly through the USB serial port and parse the output similar to the AS1170-GUI program.

image

The basic configuration protocol is as follows:

Connect to the ESP32 through a USB serial port interface.

The ESP32 side Arduino GUI code and the AS1170 GUI PC executable are available online

https://github.com/ams-OSRAM/AS1170-GUI

#include <Wire.h>
#include <SD.h>  // Include the SD library
#include <HardwareSerial.h>

#define _slaveaddress 0x30  // 7-bit I2C address
#define SDA_PIN 12
#define SCL_PIN 13
#define CLOCK_SPEED 400000  // 400 kHz
#define CONTROL 0x6
#define PWM_INDICATOR_REGISTER 0x9
#define CURRENT_SET_LED1_REGISTER 0x1
#define CURRENT_SET_LED2_REGISTER 0x2
#define FLASH_TIMER_REGISTER 0x5
#define STROBE_SIGNALING_REGISTER 0x7

// Define a structure to hold register information
struct Register {
  String name;
  int address;
  int defaultValue;
  String fields[8];
};

Register registers[10];  // Array to hold register objects
int numRegisters = 0;    // Number of registers loaded



// Define a function to read a register
int readRegister(Register reg, int bit = -1) {
  Wire.beginTransmission(_slaveaddress);  // START, SLAVEADDR
  Wire.write(reg.address);                // Register address
  Wire.endTransmission(false);            // Repeated START
  Wire.requestFrom(_slaveaddress, 1);
  byte content = Wire.read();

  // If a specific bit is not specified, read the whole register
  if (bit == -1) {
    return content;
  } else {
    // If a specific bit is specified, read only that bit
    return bitRead(content, bit);
  }
}


int writeRegister(Register* reg, int value) {
  Wire.beginTransmission(_slaveaddress);  // START, SLAVEADDR
  Wire.write(reg->address);               // Register address
  byte newContent = value;                // Use bitwise OR to keep old bits and change only the specified bits
  Wire.write(newContent);
  Wire.endTransmission();  // STOP
  return newContent;
}

// Define a function to load registers from a CSV file
int loadRegisters(String filename, Register regs[]) {
  // Open the file
  File file = SD.open(filename);

  // Read the file line by line and create Register objects
  // Add the Register objects to an array

  // Close the file
  file.close();

  // Return the number of Register objects loaded
  return numRegisters;
}

void printRegisterValue(String name, int address, int startBit, int endBit, String label) {
  static byte prevValue = 0;           // Store the previous value
  static unsigned long lastCheck = 0;  // Store the last time the register was checked
  Register reg;
  reg.name = name;
  reg.address = address;
  byte value = readRegister(reg);  // Read the whole byte

  Serial.print(name);
  Serial.print(" (");
  Serial.print(label);
  Serial.print("): ");
  Serial.println(value, BIN);  // Print the whole byte in binary

  // Get the current time
  unsigned long now = millis();

  // Only check the value of the register once a second has passed
  if (now - lastCheck >= 1000) {
    // If the register is a "Fault" register and the value has changed, print the new value and update prevValue
    if (name.startsWith("Fault") && value != prevValue) {
      Serial.print(name);
      Serial.print(" (");
      Serial.print(label);
      Serial.print("): ");
      Serial.println(value, BIN);  // Print the whole byte in binary
      prevValue = value;           // Update the stored value
    }
  }
}
void pollserial(void) {
  // Check incoming serial chars

  while (1) {
    int ch = Serial.read();

    if (ch == -1) break;
  }
}

void setup() {

  Wire.begin(SDA_PIN, SCL_PIN, CLOCK_SPEED);  // Initialize I2C bus with SDA on pin 6, SCL on pin 11 and preferred frequency
  Serial.begin(115200);


  Register reg;


  // Load registers from the CSV file
  numRegisters = loadRegisters("field_map.csv", registers);

  // Read the register at address 0

  printRegisterValue("PWM and Indicator", 0x9, 0, 1, "incl_pwm");
  printRegisterValue("Current set LED1", 0x1, 0, 7, "led current 1");
  printRegisterValue("Current set LED2", 0x2, 0, 7, "led current 2");
  printRegisterValue("Flash timer", 0x5, 0, 7, "flash timeout");
  printRegisterValue("Strobe signaling", 0x7, 7, 7, "strobe on");
  printRegisterValue("Strobe signaling", 0x7, 6, 6, "strobe type");
  printRegisterValue("Control", 0x6, 0, 1, "mode setting");
  printRegisterValue("Control", 0x6, 3, 3, "out_on");
  printRegisterValue("Control", 0x6, 4, 4, "autostrobe");
  printRegisterValue("Fault", 0x8, 0, 0, "fault uvlo");
  printRegisterValue("Fault", 0x8, 4, 4, "fault");
  printRegisterValue("Fault", 0x8, 5, 5, "fault overtempt");
  printRegisterValue("Fault", 0x8, 6, 6, "led short");
  printRegisterValue("Fault", 0x8, 7, 7, "fault ovp");
  printRegisterValue("Fixed ID", 0x0, 3, 7, "fixed id");
  pollserial();
}

void loop() {


  Register reg;

  // Check if data is available to read
  if (Serial.available()) {
    // Read the entire line
    String line = Serial.readStringUntil('\n');


    // Split the line into parts
    int commaIndex1 = line.indexOf(',');
    int commaIndex2 = line.indexOf(',', commaIndex1 + 1);
    int commaIndex3 = line.indexOf(',', commaIndex2 + 1);

    // Parse the command, register address, value, and bit
    String command = line.substring(0, commaIndex1);
    int address = line.substring(commaIndex1 + 1, commaIndex2).toInt();
    int value = line.substring(commaIndex2 + 1, commaIndex3).toInt();


    command.trim();  // Remove any trailing whitespace

    // Check if the command is the reset command
    if (command == "reset") {
      ESP.restart();  // Perform a software reset
      pollserial();
    }

    else if (command == "read") {
      printRegisterValue("PWM and Indicator", 0x9, 0, 1, "incl_pwm");
      printRegisterValue("Current set LED1", 0x1, 0, 7, "led current 1");
      printRegisterValue("Current set LED2", 0x2, 0, 7, "led current 2");
      printRegisterValue("Flash timer", 0x5, 0, 7, "flash timeout");
      printRegisterValue("Strobe signaling", 0x7, 7, 7, "strobe on");
      printRegisterValue("Control", 0x6, 0, 1, "mode setting");
      printRegisterValue("Fault", 0x8, 0, 0, "fault uvlo");
      printRegisterValue("Fault", 0x8, 4, 4, "fault");
      printRegisterValue("Fault", 0x8, 5, 5, "fault overtempt");
      printRegisterValue("Fault", 0x8, 6, 6, "led short");
      printRegisterValue("Fault", 0x8, 7, 7, "fault ovp");
      printRegisterValue("Fixed ID", 0x0, 3, 7, "fixed id");

    }


    // Check if the command is "write"
    else if (command == "write") {
      Register reg;
      reg.address = address;
      writeRegister(&reg, value);
      delay(0.1);


      pollserial();
    }
  }
  pollserial();
}

Program what mode you want the IC to be in:

  • Standby/Off  - Control register 0x06 bit 3
  • Indicator Mode - Control register 0x06 bits 0 and 1 and Indicator/PWM register 0x09 
  • Assist Mode - Control register 0x06 bits 0 and 1
  • Flash Mode - Strobe register 0x07 bits 6 and 7
  • Strobe Mode - Strobe register 0x07 bits 6 and 7

If Indicator Mode:

  • Only bits 0-6 are used on registers 0x01 ad 0x02 to set the LED currents

If Assist mode:

  • Bits 0-7 are used on registers 0x01 ad 0x02 to set the LED currents

If Flash or Strobe Mode:

  • Set LED on timer value register 0x05

There is also a current boost register 0x81 used with a password register 0x80 for an extra %11 current output drive

(I haven't tried this yet - an external power supply must be used for this because normal USB ports can't source high currents)

There are several fault protection circuits inside the AS1170 and the fault codes can be read from register 0x08

  • Under_voltage
  • Over_Voltage
  • LED_Short
  • Flash_Timeout
  • Over_Temp

Here's my Matlab code so far:

classdef OSRAM_Serial_rsc16apr2026 < matlab.apps.AppBase

    % Properties that correspond to app components
    properties (Access = public)
        UIFigure                      matlab.ui.Figure
        SystemStatusPanel             matlab.ui.container.Panel
        Label                         matlab.ui.control.Label
        ovpCheckBox                   matlab.ui.control.CheckBox
        led_shortCheckBox             matlab.ui.control.CheckBox
        overtempCheckBox              matlab.ui.control.CheckBox
        timeoutCheckBox               matlab.ui.control.CheckBox
        tx_maskCheckBox               matlab.ui.control.CheckBox
        uvloCheckBox                  matlab.ui.control.CheckBox
        DriverEnablePanel             matlab.ui.container.Panel
        StrobeSwitch                  matlab.ui.control.ToggleSwitch
        StrobeSwitchLabel             matlab.ui.control.Label
        OutputSwitch                  matlab.ui.control.ToggleSwitch
        OutputSwitchLabel             matlab.ui.control.Label
        Panel                         matlab.ui.container.Panel
        ListBox                       matlab.ui.control.ListBox
        ListBoxLabel                  matlab.ui.control.Label
        OSRAMRegistersListBox         matlab.ui.control.ListBox
        OSRAMRegistersListBoxLabel    matlab.ui.control.Label
        ReadRegistersButton           matlab.ui.control.Button
        ConfigurationPanel            matlab.ui.container.Panel
        NotConnectedCheckBox          matlab.ui.control.CheckBox
        RefreshButton                 matlab.ui.control.Button
        DisconnectButton              matlab.ui.control.Button
        ConnectButton                 matlab.ui.control.Button
        BaudrateDropDown              matlab.ui.control.DropDown
        BaudRateLabel                 matlab.ui.control.Label
        SerialportDropDown            matlab.ui.control.DropDown
        SerialportDropDownLabel       matlab.ui.control.Label
        LEDDriversOutputCurrentPanel  matlab.ui.container.Panel
        LED2CurrentSlider             matlab.ui.control.Slider
        LED2Label                     matlab.ui.control.Label
        LED1CurrentSlider             matlab.ui.control.Slider
        LED1CurrentSliderLabel        matlab.ui.control.Label
        LED1CurrentEditField          matlab.ui.control.NumericEditField
        LED1CurrentEditFieldLabel     matlab.ui.control.Label
        LED2CurrentEditField          matlab.ui.control.NumericEditField
        LED2CurrentEditFieldLabel     matlab.ui.control.Label
    end

    
    properties (Access = private)
                SerialPort  % Serial port
                myByte = uint8(255);
                numBytes = uint8(255);
    end
    
    
    
    methods (Access = private)
        
        function func(app)
                count = numel(app.OSRAMRegistersListBox.Items);
                for countindex = 1:count
                    mystring = app.OSRAMRegistersListBox.Items{countindex};
                    app.ListBox.Items{end+1} = mystring;
                    index = strfind(mystring, ':');
                    app.ListBox.Items{end+1} = sprintf('%d',index);
                    nameStr = extractBefore(mystring,':');
                    app.ListBox.Items{end+1} = nameStr;
                    if matches(nameStr,'Fault (fault uvlo)')
                       dataStr = extractAfter(mystring,':');
                       app.ListBox.Items{end+1} = sprintf('UVLO Fault data = %s',dataStr);
                       %bindataStr = extractBefore(dataStr,'\n');
                       app.Label.Text = dataStr;
                       if (str2double(dataStr) == 1)
                         app.uvloCheckBox.Value = true;
                       else
                         app.uvloCheckBox.Value = false; 
                       end
                    end
                end   
        end  
    end
   

    % Callbacks that handle component events
    methods (Access = private)

        % Code that executes after component creation
        function startupFcn(app)
           app.SerialportDropDown.Items = cellstr(["" serialportlist]); 
        end

        % Button pushed function: RefreshButton
        function RefreshButtonPushed2(app, event)
             app.SerialportDropDown.Items = cellstr(["" serialportlist]);  
        end

        % Button pushed function: ConnectButton
        function ConnectButtonPushed(app, event)
            % Validate selected serial port device
            try
                app.SerialPort = serialport(app.SerialportDropDown.Value,str2double(app.BaudrateDropDown.Value));
            catch ME
                uialert(app.UIFigure,ME.message,"Serialport Connection Error",Interpreter="html")
                return
                
            end 
            if isvalid(app.SerialPort)
                flush(app.SerialPort);
                app.NotConnectedCheckBox.Value = true;
                app.NotConnectedCheckBox.FontColor = [0.23,0.67,0.20];
                app.NotConnectedCheckBox.Text = "Connected";
                app.LED1CurrentSlider.Enable = true;
                app.LED2CurrentSlider.Enable = true;
                app.OSRAMRegistersListBox.Value = {};
                app.ReadRegistersButton.Enable = true;
                app.OutputSwitch.Enable = true;
                app.ReadRegistersButtonPushed();
                app.LED1CurrentSliderValueChanged();
                app.LED2CurrentSliderValueChanged();
            end
        end

        % Button pushed function: ReadRegistersButton
        function ReadRegistersButtonPushed(app, event)
            %flush(app.SerialPort);
            app.OSRAMRegistersListBox.Items = cellstr("");
            writeline(app.SerialPort,"read");
            SerialnumBytes = app.SerialPort.NumBytesAvailable;
            while (SerialnumBytes ~= 0)
                readbytes = readline(app.SerialPort);
                app.OSRAMRegistersListBox.Items(end+1) = cellstr(readbytes);
                SerialnumBytes = app.SerialPort.NumBytesAvailable;
            end
            app.func();
        end

        % Button pushed function: DisconnectButton
        function DisconnectButtonPushed(app, event)
            delete(app.SerialPort);
            app.NotConnectedCheckBox.Value = false;
            app.NotConnectedCheckBox.FontColor = 'red';
            app.NotConnectedCheckBox.Text = "Not Connected";
        end

        % Value changed function: OutputSwitch
        function OutputSwitchValueChanged(app, event)
            
            value = app.OutputSwitch.Value;
            if (value == "On")
               writeline(app.SerialPort,"write,6,25,-1"); 
            else
               writeline(app.SerialPort,"write,6,17,-1");  
            end
            app.ReadRegistersButtonPushed();
        end

        % Value changed function: LED1CurrentSlider
        function LED1CurrentSliderValueChanged(app, event)
            
            app.LED1CurrentEditField.Value = app.LED1CurrentSlider.Value;
            Slider1Value = round(app.LED1CurrentSlider.Value);
            app.LED1CurrentEditField.Value = Slider1Value;
            outline1 = sprintf('write,1,%d',Slider1Value);
            writeline(app.SerialPort,outline1);
            

        end

        % Value changed function: LED2CurrentSlider
        function LED2CurrentSliderValueChanged(app, event)
            Slider2Value = round(app.LED2CurrentSlider.Value);
            app.LED2CurrentEditField.Value = Slider2Value;
            outline2 = sprintf('write,2,%d',Slider2Value);
            writeline(app.SerialPort,outline2);
            
        end
    end

    % Component initialization
    methods (Access = private)

        % Create UIFigure and components
        function createComponents(app)

            % Get the file path for locating images
            pathToMLAPP = fileparts(mfilename('fullpath'));

            % Create UIFigure and hide until all components are created
            app.UIFigure = uifigure('Visible', 'off');
            app.UIFigure.Color = [0.149 0.549 0.8667];
            app.UIFigure.Position = [100 100 948 806];
            app.UIFigure.Name = 'OSRAM LED Driver Interface';
            app.UIFigure.Icon = fullfile(pathToMLAPP, 'bugsmall.jpg');
            app.UIFigure.Theme = 'light';

            % Create LEDDriversOutputCurrentPanel
            app.LEDDriversOutputCurrentPanel = uipanel(app.UIFigure);
            app.LEDDriversOutputCurrentPanel.Title = 'LED Drivers Output Current';
            app.LEDDriversOutputCurrentPanel.Position = [442 665 492 126];

            % Create LED2CurrentEditFieldLabel
            app.LED2CurrentEditFieldLabel = uilabel(app.LEDDriversOutputCurrentPanel);
            app.LED2CurrentEditFieldLabel.HorizontalAlignment = 'right';
            app.LED2CurrentEditFieldLabel.Position = [258 69 78 22];
            app.LED2CurrentEditFieldLabel.Text = 'LED2 Current';

            % Create LED2CurrentEditField
            app.LED2CurrentEditField = uieditfield(app.LEDDriversOutputCurrentPanel, 'numeric');
            app.LED2CurrentEditField.Editable = 'off';
            app.LED2CurrentEditField.Position = [351 69 100 22];

            % Create LED1CurrentEditFieldLabel
            app.LED1CurrentEditFieldLabel = uilabel(app.LEDDriversOutputCurrentPanel);
            app.LED1CurrentEditFieldLabel.HorizontalAlignment = 'right';
            app.LED1CurrentEditFieldLabel.Position = [14 68 78 22];
            app.LED1CurrentEditFieldLabel.Text = 'LED1 Current';

            % Create LED1CurrentEditField
            app.LED1CurrentEditField = uieditfield(app.LEDDriversOutputCurrentPanel, 'numeric');
            app.LED1CurrentEditField.Editable = 'off';
            app.LED1CurrentEditField.Position = [107 68 100 22];

            % Create LED1CurrentSliderLabel
            app.LED1CurrentSliderLabel = uilabel(app.LEDDriversOutputCurrentPanel);
            app.LED1CurrentSliderLabel.HorizontalAlignment = 'right';
            app.LED1CurrentSliderLabel.Position = [15 33 35 22];
            app.LED1CurrentSliderLabel.Text = 'LED1';

            % Create LED1CurrentSlider
            app.LED1CurrentSlider = uislider(app.LEDDriversOutputCurrentPanel);
            app.LED1CurrentSlider.Limits = [0 63];
            app.LED1CurrentSlider.ValueChangedFcn = createCallbackFcn(app, @LED1CurrentSliderValueChanged, true);
            app.LED1CurrentSlider.Enable = 'off';
            app.LED1CurrentSlider.Position = [72 42 150 3];

            % Create LED2Label
            app.LED2Label = uilabel(app.LEDDriversOutputCurrentPanel);
            app.LED2Label.HorizontalAlignment = 'right';
            app.LED2Label.Position = [259 33 35 22];
            app.LED2Label.Text = 'LED2';

            % Create LED2CurrentSlider
            app.LED2CurrentSlider = uislider(app.LEDDriversOutputCurrentPanel);
            app.LED2CurrentSlider.Limits = [0 63];
            app.LED2CurrentSlider.ValueChangedFcn = createCallbackFcn(app, @LED2CurrentSliderValueChanged, true);
            app.LED2CurrentSlider.Enable = 'off';
            app.LED2CurrentSlider.Position = [316 42 150 3];

            % Create ConfigurationPanel
            app.ConfigurationPanel = uipanel(app.UIFigure);
            app.ConfigurationPanel.BorderWidth = 3;
            app.ConfigurationPanel.TitlePosition = 'centertop';
            app.ConfigurationPanel.Title = 'Configuration';
            app.ConfigurationPanel.BackgroundColor = [1 0.9098 0.3922];
            app.ConfigurationPanel.Position = [34 665 399 126];

            % Create SerialportDropDownLabel
            app.SerialportDropDownLabel = uilabel(app.ConfigurationPanel);
            app.SerialportDropDownLabel.HorizontalAlignment = 'right';
            app.SerialportDropDownLabel.Position = [1 70 61 22];
            app.SerialportDropDownLabel.Text = 'Serial Port';

            % Create SerialportDropDown
            app.SerialportDropDown = uidropdown(app.ConfigurationPanel);
            app.SerialportDropDown.Items = {};
            app.SerialportDropDown.Placeholder = 'Select..';
            app.SerialportDropDown.Position = [76 70 133 22];
            app.SerialportDropDown.Value = {};

            % Create BaudRateLabel
            app.BaudRateLabel = uilabel(app.ConfigurationPanel);
            app.BaudRateLabel.HorizontalAlignment = 'right';
            app.BaudRateLabel.Position = [1 34 62 22];
            app.BaudRateLabel.Text = 'Baud Rate';

            % Create BaudrateDropDown
            app.BaudrateDropDown = uidropdown(app.ConfigurationPanel);
            app.BaudrateDropDown.Items = {'115200'};
            app.BaudrateDropDown.Position = [77 34 76 22];
            app.BaudrateDropDown.Value = '115200';

            % Create ConnectButton
            app.ConnectButton = uibutton(app.ConfigurationPanel, 'push');
            app.ConnectButton.ButtonPushedFcn = createCallbackFcn(app, @ConnectButtonPushed, true);
            app.ConnectButton.Position = [75 5 100 23];
            app.ConnectButton.Text = 'Connect';

            % Create DisconnectButton
            app.DisconnectButton = uibutton(app.ConfigurationPanel, 'push');
            app.DisconnectButton.ButtonPushedFcn = createCallbackFcn(app, @DisconnectButtonPushed, true);
            app.DisconnectButton.BackgroundColor = [1 1 1];
            app.DisconnectButton.Position = [228 5 100 23];
            app.DisconnectButton.Text = 'Disconnect';

            % Create RefreshButton
            app.RefreshButton = uibutton(app.ConfigurationPanel, 'push');
            app.RefreshButton.ButtonPushedFcn = createCallbackFcn(app, @RefreshButtonPushed2, true);
            app.RefreshButton.Icon = fullfile(pathToMLAPP, 'refresh.png');
            app.RefreshButton.IconAlignment = 'center';
            app.RefreshButton.Position = [227 69 34 23];
            app.RefreshButton.Text = '';

            % Create NotConnectedCheckBox
            app.NotConnectedCheckBox = uicheckbox(app.ConfigurationPanel);
            app.NotConnectedCheckBox.Text = 'Not Connected';
            app.NotConnectedCheckBox.FontColor = [1 0 0];
            app.NotConnectedCheckBox.Position = [228 34 102 22];

            % Create Panel
            app.Panel = uipanel(app.UIFigure);
            app.Panel.Title = 'Panel';
            app.Panel.BackgroundColor = [0.851 0.851 0.851];
            app.Panel.Position = [35 110 677 537];

            % Create ReadRegistersButton
            app.ReadRegistersButton = uibutton(app.Panel, 'push');
            app.ReadRegistersButton.ButtonPushedFcn = createCallbackFcn(app, @ReadRegistersButtonPushed, true);
            app.ReadRegistersButton.BackgroundColor = [1 0.9098 0.3922];
            app.ReadRegistersButton.Enable = 'off';
            app.ReadRegistersButton.Position = [274 473 100 23];
            app.ReadRegistersButton.Text = 'Read Registers';

            % Create OSRAMRegistersListBoxLabel
            app.OSRAMRegistersListBoxLabel = uilabel(app.Panel);
            app.OSRAMRegistersListBoxLabel.BackgroundColor = [0.902 0.902 0.902];
            app.OSRAMRegistersListBoxLabel.HorizontalAlignment = 'right';
            app.OSRAMRegistersListBoxLabel.Position = [108 465 103 22];
            app.OSRAMRegistersListBoxLabel.Text = 'OSRAM Registers';

            % Create OSRAMRegistersListBox
            app.OSRAMRegistersListBox = uilistbox(app.Panel);
            app.OSRAMRegistersListBox.Items = {};
            app.OSRAMRegistersListBox.BackgroundColor = [0.902 0.902 0.902];
            app.OSRAMRegistersListBox.Position = [53 18 258 448];
            app.OSRAMRegistersListBox.Value = {};

            % Create ListBoxLabel
            app.ListBoxLabel = uilabel(app.Panel);
            app.ListBoxLabel.HorizontalAlignment = 'right';
            app.ListBoxLabel.Position = [495 465 48 22];
            app.ListBoxLabel.Text = 'List Box';

            % Create ListBox
            app.ListBox = uilistbox(app.Panel);
            app.ListBox.Items = {};
            app.ListBox.Position = [392 18 260 438];
            app.ListBox.Value = {};

            % Create DriverEnablePanel
            app.DriverEnablePanel = uipanel(app.UIFigure);
            app.DriverEnablePanel.Title = 'Driver Enable';
            app.DriverEnablePanel.BackgroundColor = [1 0.9098 0.3922];
            app.DriverEnablePanel.Position = [736 444 192 203];

            % Create OutputSwitchLabel
            app.OutputSwitchLabel = uilabel(app.DriverEnablePanel);
            app.OutputSwitchLabel.HorizontalAlignment = 'center';
            app.OutputSwitchLabel.FontWeight = 'bold';
            app.OutputSwitchLabel.FontColor = [0 0 0];
            app.OutputSwitchLabel.Position = [33 29 44 22];
            app.OutputSwitchLabel.Text = 'Output';

            % Create OutputSwitch
            app.OutputSwitch = uiswitch(app.DriverEnablePanel, 'toggle');
            app.OutputSwitch.ValueChangedFcn = createCallbackFcn(app, @OutputSwitchValueChanged, true);
            app.OutputSwitch.Enable = 'off';
            app.OutputSwitch.FontWeight = 'bold';
            app.OutputSwitch.FontColor = [0 0 0];
            app.OutputSwitch.Position = [44 87 20 45];

            % Create StrobeSwitchLabel
            app.StrobeSwitchLabel = uilabel(app.DriverEnablePanel);
            app.StrobeSwitchLabel.HorizontalAlignment = 'center';
            app.StrobeSwitchLabel.FontWeight = 'bold';
            app.StrobeSwitchLabel.Position = [119 29 43 22];
            app.StrobeSwitchLabel.Text = 'Strobe';

            % Create StrobeSwitch
            app.StrobeSwitch = uiswitch(app.DriverEnablePanel, 'toggle');
            app.StrobeSwitch.Enable = 'off';
            app.StrobeSwitch.FontWeight = 'bold';
            app.StrobeSwitch.Position = [130 87 20 45];

            % Create SystemStatusPanel
            app.SystemStatusPanel = uipanel(app.UIFigure);
            app.SystemStatusPanel.Title = 'System Status';
            app.SystemStatusPanel.Position = [737 184 195 228];

            % Create uvloCheckBox
            app.uvloCheckBox = uicheckbox(app.SystemStatusPanel);
            app.uvloCheckBox.Text = 'uvlo';
            app.uvloCheckBox.Position = [3 183 44 22];

            % Create tx_maskCheckBox
            app.tx_maskCheckBox = uicheckbox(app.SystemStatusPanel);
            app.tx_maskCheckBox.Text = 'tx_mask';
            app.tx_maskCheckBox.Position = [4 162 67 22];

            % Create timeoutCheckBox
            app.timeoutCheckBox = uicheckbox(app.SystemStatusPanel);
            app.timeoutCheckBox.Text = 'timeout';
            app.timeoutCheckBox.Position = [5 141 61 22];

            % Create overtempCheckBox
            app.overtempCheckBox = uicheckbox(app.SystemStatusPanel);
            app.overtempCheckBox.Text = 'overtemp';
            app.overtempCheckBox.Position = [118 183 72 22];

            % Create led_shortCheckBox
            app.led_shortCheckBox = uicheckbox(app.SystemStatusPanel);
            app.led_shortCheckBox.Text = 'led_short';
            app.led_shortCheckBox.Position = [118 162 71 22];

            % Create ovpCheckBox
            app.ovpCheckBox = uicheckbox(app.SystemStatusPanel);
            app.ovpCheckBox.Text = 'ovp';
            app.ovpCheckBox.Position = [119 141 41 22];

            % Create Label
            app.Label = uilabel(app.SystemStatusPanel);
            app.Label.Position = [57 183 25 22];
            app.Label.Text = '?';

            % Show the figure after all components are created
            app.UIFigure.Visible = 'on';
        end
    end

    % App creation and deletion
    methods (Access = public)

        % Construct app
        function app = OSRAM_Serial_rsc16apr2026

            % Create UIFigure and components
            createComponents(app)

            % Register the app with App Designer
            registerApp(app, app.UIFigure)

            % Execute the startup function
            runStartupFcn(app, @startupFcn)

            if nargout == 0
                clear app
            end
        end

        % Code that executes before app deletion
        function delete(app)

            % Delete UIFigure when app is deleted
            delete(app.UIFigure)
        end
    end
end

Now that I understand better how the AS1170 registers are configured, my next project is to use the OSRAM board and the ESP32 to trigger a PIV camera and control a scanning laser module in the lab.

I'll write up another blog for that project.

If the other OSRAM IR LEDS arrive, I will evaluate them with the EVK.

Anonymous