Optical Power Meter (with SFP and DDM protocol)

DIY Optical Power Meter with SFP (Small Form-factor Pluggable transceiver) and DDM (Digital diagnostics monitoring ) protocol

Similar projects worth following
To build DIY optical power meter with standard SFP module and Arduino
- Can measure optical power in dbm and watt
- Can Enable/Disable TX power output (laser source)
- Can debug via UART

And Arduino Library
- a lib for SFP/DDM interfacing (not only optical sfp transceiver
- to interface and interpret DDM (Digital Diagnostics Monitoring ) protocol (which used in most optical fiber communication) scheme and format
- to debug, monitor, detect alarm and control SFP via DDM
- to extend the capability of handling data TX/RX interface (Arduino data over optical fiber)

Initial concept

- Most optical fiber module in today communication used from factor called SFP (small form-factor pluggable) physical interfacing. SFP is widely used in many switches, routers and many telecom devices. SFP modules comes with various transceivers option from electrical to optical interfaces such as Ethernet, Giga-bit Ethernet, optical fiber , SONET, STM, etc.

- Although transceivers are different, all SFP modules are controllable with a standard protocol named DDM (Digital Diagnostics Monitoring).

- DDM is The operating and diagnostic information is monitored and reported by a microcontroller inside the transceiver, which is accessed via a 2-wire serial bus (also known as "I2C" or "I2C" protocol).

- I2C bus interfacing is easily done by Arduino

- So, initial idea is to build an Optical Power Meter from scratch by using Arduino and Optical SFP modules + LCD + keypad

Possibility and future potential

- Other type of SFP modules such as Ethernet Electrical, STM, SONET and ATM are easily exchangeable to diagnoses different types of communication interfacing system

- Optical to Arduino direct interfacing is possible via optical SFP modules. Speed Limitation may depend on Arduino processing and peripheral throughput. The ability of simple Arduino to Optical interfacing will be advantages in some cable network and noisy environment like factory automation.

DIY Optical Power Meter Block Diagram


DIY Optical Power Meter V1.3 Schamatic

Adobe Portable Document Format - 74.28 kB - 05/01/2017 at 05:59


My DDM Lib file,

x-zip-compressed - 10.00 kB - 05/01/2017 at 05:27



F i n i s a r , Application Note AN-2030, Digital Diagnostic Monitoring Interface for SFP Optical Transceivers

Adobe Portable Document Format - 241.46 kB - 04/30/2017 at 14:25



F i n i s a r , Application Note AN-2030 Digital Diagnostic Monitoring Interface for SFP and SFP+ Optical Transceivers

Adobe Portable Document Format - 644.46 kB - 04/30/2017 at 14:23


  • 1 × Mikrotik S-31DLC20D SFP Transciver a 1.25G SFP transceiver with a 1310nm Dual LC connector
  • 1 × Arduino Pro Mini
  • 1 × Nokia 5110 LCD
  • 1 × FT232 USB-UART module
  • 1 × Push Button Key

View all 8 components

  • Phase-5# Final Touch

    oakkar707/09/2017 at 15:48 0 comments

    Prepare cover template with visio and hand cut Sandwich chassis by acrylic sheet. Installed the cover and tested for final result.

    Finally, tested and calibrated with commercial optical power meter. The reference model is Anritsu, SLT35-FU. The test result show that build meter is +/- 0.03 dbm accuracy. Anyway, it is the best result for DIY optical fiber telecommunication test device.


    Oak Kar


    1- Cover template and hand cut acrylic plates.

    2- installed M3 plastic footing nuts.

    3- Assembled.

    4- Power up.

    5-Calibrated with commercial Anritsu power meter.

    that all :D

  • Phase4# Building Hardware

    oakkar705/01/2017 at 05:59 0 comments

    Next part is to build working prototype. I choose Arduino Pro Mini for some reasons, its compact and cheap, more IO than normal UNO board. And it can be run with 3.3V and not need level shifter for SFP interface.

    There are some limitations in Arduino Pro Mini. I realize that pin count is not enough for my requirements. I need 6 x GPIO pins for 6 push button switches. After using 10 pins for SFP and 5 Pins for LCD, 3 pins for LEDs, there is not much pins left for switches.

    1) issues and workarround

    Analog pin 6 and 7 are analog only input pins. Problem is these two pins not work reading as digital IO. After using mu GFu, someone shows the trick to use analog only pins as digital I/O. Here is code snip.

    EN_sw = analogRead(A7) > 256 ? 0 : 1;

    2) UART debug

    For debugging and future extension such as PC or phone application interfacing, I added debug function in lib.

    3) Menu

    There are 6 Switches and main menu + sub-menu system in system.

    • Splash Page
    • About Page
    • Main Menu
      • TX/RX Sub-menu
      • TX Sub-Menu
      • RX Sub-Menu
      • Detailed
      • System Setup Sub-Menu

    Key functions are as follows.


    4) Schematic

    Splash Welcome page, CAN I HAZ POWER

    About Page

    Main Menu

    And RX/TX power, TX enable, TX status and Alarm

  • Phase-3# Arduino DDM Library

    oakkar705/01/2017 at 05:26 0 comments

    Not only building hardware, I like to develop a simple library for SFP/DDM interface. Library supports the following functions.

    - Raw Reading DDM Registers (96-117)

    - Read TX, RX power in watt and dbm

    - Modules Voltage, Current

    - control TX enable/disable, mode

    - alarm and event monitoring

    - Calibration (not work for now, I have to figure out or you may)

    - Debug raw, hex and bin string

    Library was added to my github repo. It also included a project for working Optical Power Meter.

    I am an engineer who wrote the code as my own need and hobby. So, you can used it as your own risk or you may contribute for better results. Any comments, suggestions and correction are welcome.

  • Phase-2# Hello SFP from Arduino

    oakkar704/30/2017 at 14:21 1 comment

    The first trial is using existing Lib for DDM interfacing. But there is not much such library and the only one in my eye is SloMusti, Arduino library for interfacing SFP modules and reading DDM.

    Unluckily, lib is not work in the first try. SloMusti Github page said that “For communication the specified I2C library is internally initialized, the default Arduino I2C library is not reliable enough and can not be used. Please obtain and install the I2C library by Wayne Truchsess”.

    Anwyaw, SloMusti Lib is very informative and structurally formatted and it help me alot how to do things.

    So, I try to write my own I2C code snaps with Arduino building lib and it worked. So, I developed by own SFPDDM Lib from scratch. My idea is keep it simple and forward. The first step is to read raw data format from SFP/DDM registers (96-117). These reg are used for monitoring, alarm, control and debugging. Each function of these register and explanations are worth to read from Finisar Application note.

    Connection pin outs <--> Arduino UNO are as follow. Be sure to use 5V-3.3V level shifter board.

    VeeTs - GND

    VeeRs - GND

    VccRs - 3.3V

    VccTs - 3.3V

    MOD-DEF(2) - SDA (4)

    MOD-DEF(2) - SDA (5)

    MOD-DEF(2) - GND

    Then, I tried to read reg(96) with normal I2C Lib (Arduino buildin) and print it out to UART. Then, phrase and formatted.

    The first trial output, output from reading DDM register. Look promising.

  • phase-1# Preparing SFP for Initerfacing

    oakkar704/30/2017 at 13:40 2 comments

    The first and tricky step is to solder SFP modules. The module pin outs is as follows. I need to solder 20 connectors with 20 wires to a standard 1.5mm pin outs. I used Mikrotik S-31DLC20D, a 1.25G SFP transceiver with a 1310nm Dual LC connector, for up to 20 kilometer Single Mode fiber connections, with DDM. But you may use any SFP module without problem.

    Another reason I used Dual connector (TX and RX are different fiber interfaces) is to control TX function as additional. Thus, meter can transmit laser source and enable and disable this.

    A good ref for SFP modules pin outs from finisar is here:

    1) Standard SFP pinouts is as follows.

    2) Soldering and result is as follow. We can omitted Data TX/RX pair pins for now.

    Next is interfacing with Arduino

View all 5 project logs

Enjoy this project?



islmbk wrote 03/22/2022 at 08:53 point

good day, mr oakkar7! I want to clarify, I'm going to do this with a socket for the SFP module. the question is, do all sfp modules have the same ddm register?

  Are you sure? yes | no

Agung Setyo Nugroho wrote 03/07/2022 at 05:52 point

Hi, Oakkar!

I want to ask you about your project with SFP. Currently, I build the same project like you but I still have some difficulties. In my setup is not having button, but I just copy all the code from your project on your GitHub. In my purpose project is just to read the measurement continously from SFP which are the power transmitter (TX) and the receiver power (RX). When I run it, I get TX and RX always inf even I use fiber optic patch cord with bending. Could you help me to solve my problem? Thank you

  Are you sure? yes | no

tribunskiy wrote 01/08/2019 at 11:27 point

What is the need in the circuit resistor R7?

  Are you sure? yes | no

fcornelissen wrote 05/04/2018 at 11:02 point

Oakkar, please let me know if you are open for another projet, I think you could help me for some similar projet, we are open to pay you a fee let me know if you could be interesting

  Are you sure? yes | no

Aleksejs wrote 04/16/2018 at 13:53 point

Cool project! And thanks for inspiration for my project #Fiber optic Power/Link tester 

  Are you sure? yes | no

David wrote 01/29/2018 at 08:14 point

I have little experience with this technology.  I am interested in sending up to 100kHz signals for driving a high power supply (to interface with a MOSFET or IGBT gate driver circuit).  Is it possible to use the 10Mbps channel on this device to transmit this lower bandwidth signal? 

  Are you sure? yes | no

Pyrofer wrote 09/15/2017 at 06:43 point

I did this a couple years ago, I think we could both help each other a lot!

For instance, would you be interested in a PCB for an SFP cage socket I designed? It breaks the socket out to a pin header. No soldering directly to the SFP for me! I can insert and remove optics at wil..

I used a tiny OLED screen and built wireless charging into mine. Also, I did 2 way comms over the fibre link so the remote end tester (it's a pair) can send the remote RX back, so both ends see the RX power from the other end as well as their own.

  Are you sure? yes | no

oakkar7 wrote 07/22/2017 at 09:13 point

Find google "TTL to ECL" and you will see several chip. I never tested it but it should be work theoretically.

  Are you sure? yes | no

oakkar7 wrote 07/22/2017 at 09:12 point

One consideration, this Fiber SFP are designed to drive 10/100/1000 Mbps bit rate. So, the minimum speed for module is 10mbps. Normal 8bits Arduino/UNO/Mini/Mega digital pin bits rate is about 2 mbps. So, you should select MCU with more data driven capability like 32bits platform, DUE, Tensy, MKR etc..

  Are you sure? yes | no

kunnachai wrote 07/13/2017 at 09:33 point

could you recommend me about make a connection between two modules sfp with 2 arduinos, and with which I make the communication. what should i do about code.can i use ddm lib for do that ?

  Are you sure? yes | no

leandro.orieta wrote 07/04/2017 at 19:52 point

Hi, I would like to know if you could make a connection between two modules sfp with 2 arduinos, and with which I make the communication

  Are you sure? yes | no

oakkar7 wrote 07/22/2017 at 09:15 point

to send/receive data over sfp/fiber, you will need TTL/CMOS to ECL translator chip.

  Are you sure? yes | no

Pyrofer wrote 09/15/2017 at 06:45 point

In theory, but the issue is you can't do slow communications as these are designed for 100meg or gig comms and the modules just don't like low speed data. I couldn't get it to work at serial speeds. I did cheat with a hacky bodge method and finally do have serial comms, but nobody will like how I did it :)

  Are you sure? yes | no

Pyrofer wrote 09/15/2017 at 06:43 point

Yes. I made this a couple years ago and did just that. I send serial data over the fibre link. It's a hacky messy bodge, but it works.

  Are you sure? yes | no

oakkar7 wrote 09/16/2017 at 07:07 point

A hacky bodge method ??, how  did you do that?  Yes, like you said, the interface may not work well in low bits rate. 100MHz and a several kbs are a quite difference.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates