Labs / Electronic modules

GraftSense - MOSFET Switch Relay Module Based on JMSL0406 (Open Version)

Author: Li Zisheng · Source: FreakStudio open documentation, v1.3 · License: CC BY 4.0 · Driver code (misc/relay_driver): MIT License

Contents
JMSL0406
JMSL0406 U1 U2 Q1 Q2 R1 R6 C1 C2 D1

I. Module Introduction

MOSFET Switch Relay Module Based on JMSL0406 takes JMSL0406AG (an N-channel power MOS transistor with 40V withstand voltage and 4.2mΩ low on-resistance) as the core switching device, and constructs an isolated drive circuit with matching PC817 optocoupler and SS8550 triode, with control signals input from the DOUT interface. The low on-resistance (4.2mΩ) of JMSL0406 reduces conduction loss, and its 40V withstand voltage adapts to common circuit scenarios;The module also integrates a sensor interface, GATE level indicator (for displaying driver status) and a power supply filtering circuit. Meanwhile, the PC817 optocoupler achieves electrical isolation between the control side and the power side, which not only ensures control safety but also endows the relay driver with the features of low loss and high reliability.

II. Introduction to Main Chips

This module mainly uses JMSL0406AG low-power MOS transistors and PC817 optocoupler isolation chips.

2.1 Chip Overview

2.1.1 JMSL0406AG Low-power MOS transistor

JMSL0406AG is an N-channel power MOSFET with a withstand voltage of 40V and a typical on-resistance of only 4.2mΩ, which belongs to low-loss power switching devices.

It features ultra-low RDS (ON), low gate charge, high current carrying capacity and other characteristics, and has also passed 100% UIS (unclamped inductive switching) test and Rg (gate resistance) test, delivering high reliability; its applicable scenarios include power management of computing devices, current switching of DC / DC and AC / DC subsystems, as well as load switches, fast wireless charging, motor drives, etc.

The device is packaged in PDFN5x6 , with pin configurations of 1-3 for source ( S ), 4 for gate ( G ), and 5-8 for drain ( D ). The multi-pin layout can improve current carrying and heat dissipation performance.

JMSL0406AG 40V 4.2m PDFN5x6 1-3 4 5-8

2.1.2 PC817 Optocoupler Isolation Chip

PC817 is a commonly used optocoupler, whose core consists of a GaAs light-emitting diode and an NPN phototransistor. It realizes electrical isolation between circuits through the "electricity-light-electricity" signal conversion (this is the core function of an optocoupler, which can isolate high and low voltages and suppress circuit interference).

PC817 2.54mm

2.2 Pin Definition

2.2.1 JMSL0406AG Low-power MOS FET

JMSL0406AG PDFN5x6 1 2 3 4 5 6 7 8

JMSL0406AG adopts the PDFN5x6 package. Viewed from the top perspective (including the black dot alignment mark), the function allocation of its 8 pins is as follows: pins 1,2 and 3 are all source terminals (S), pin 4 is the gate terminal (G), and pins 5,6, 7 and 8 are all drain terminals (D). This multi-pin layout (parallel connection of multiple S and D pins) is designed to reduce on-resistance and improve current carrying capacity and heat dissipation efficiency; meanwhile, this MOS transistor integrates a body diode from the drain terminal (D) to the source terminal (S), which corresponds to the parasitic diode structure between D and S in the schematic diagram on the right.

2.2.2 PC817 Optocoupler Isolation Chip

PC817 1 2 3 4

PC817 the pinout definition of the optocoupler is consistent across DIP and SOP packages, with a total of 4 pins, whose functions are as follows:

In use, pins 1 and 2 are connected to a control signal (to drive the light-emitting diode to emit light), and pins 3 and 4 are connected to the load circuit (to receive the optical signal and convert it into an electrical signal for output), thereby achieving electrical isolation between the control end and the load end.

2.3 Functional Block Diagram

2.3.1 JMSL0406AG Low-power MOS transistor

None.

2.3.2 PC817 Optocoupler Isolation Chip

None.

2.4 Performance Parameters

2.4.1 JMSL0406AG Low-power MOS FET

JMSL0406AG 25 40V 20V 70A 100 44A 254A 27A 36mJ

JMSL0406AG has the following absolute maximum ratings at room temperature (25°C)(exceeding these parameters will damage the device): the maximum drain-source voltage VDS is 40V, and the gate-source voltage VGS must be limited to within ±20V; the continuous drain current ID degrades as the case temperature (Tc) rises, reaching 70A at 25°C and dropping to 44A at 100°C, and the maximum drain current under short-pulse conditions IDM is 254A;Avalanche current for inductive loads IAS is 27A, avalanche energy EAS is 36mJ (ensuring reliability during inductive switching); power dissipation PD is also affected by case temperature, being 42W at 25℃ and 17W at 100℃; the Scope of Work for device junction temperature and storage temperature ranges from -55℃ to 150℃. These parameters define the extreme operating boundaries of the device and are safety thresholds that must be strictly adhered to in circuit design.

JMSL0406AG 20A 3V 20V

These two curves illustrate the core electrical characteristics of JMSL0406AG:

These two curves collectively guide the driving design of this MOS transistor: a sufficient VGS must be provided to reduce the on-resistance, while the load-bearing capability of the gate drive circuit must be matched to optimize the switching characteristics.

JMSL0406AG 25 0V 20V 1.7V 1MHz 1204pF 10V 17.9nC

This table presents JMSL0406AG the key parameters of its electrical characteristics at 25°C, and their core significance can be understood in combination with the basic principles of MOSFETs:

Together, these parameters define the voltage endurance, conduction capability, high-frequency characteristics and switching performance of this MOS FET, and serve as the core basis for matching drivers and loads in circuit design.

JMSL0406 50 60 2.3 3.0

Thermal resistance is an indicator for measuring the heat dissipation capability of a device (unit: ℃/W, which represents the temperature rise of the corresponding region when 1 W of power is consumed):

These parameters serve as the core basis for the thermal design of circuits (the maximum allowable power dissipation shall be calculated via thermal resistance in combination with the junction temperature upper limit of 150°C), and also explain why the actual continuous current of a device is affected by the heat dissipation design.

JMSL0406AG Figure1 2.7V 10V Figure2 25 125 3V

These two curves illustrate the core electrical characteristics of JMSL0406AG, and their implications can be understood in combination with the basic principles of MOS transistors:

JMSL0406AG 4.5V 10V 15A 20A

These two curves illustrate that JMSL0406AG 's on-resistance (RDS (ON)) is affected by drain current and junction temperature, and its characteristics can be understood in combination with the conduction principle of MOS transistors:

JMSL0406AG 5 6 25 125

These two curves illustrate the body diode characteristics and parasitic capacitance characteristics of JMSL0406AG, and its function can be understood in combination with the structural principle of MOS transistors:

These two curves respectively clarify MOS the characteristics of parasitic elements (body diode, parasitic capacitance) of the transistor, and serve as the key reference for designing freewheeling circuits and high-frequency switching circuits.

JMSL0406AG 7 25 8 150 0

These two curves illustrate JMSL0406AG 's "derating characteristics"(i. e., the rated capability of the device decreases as temperature rises), and its core function can be understood in combination with the basics of thermal design:

JMSL0406AG 1.0 10 100 1.0ms 10ms

These two curves illustrate JMSL0406AG 's safe operation and pulse power characteristics. Combined with the heat accumulation and maximum operating principle of MOS FETs, its core value can be understood as follows:

JMSL0406AG 0.5 0.3 0.1

This Figure 11 illustrates JMSL0406AG 's normalized transient thermal impedance characteristics, whose core function can be understood in combination with the "time accumulation effect" of heat transfer:

Transient thermal impedance (ZθJC) is a parameter that describes "the variation of the thermal resistance from the device junction to the case with time (pulse width) under pulsed thermal load"(which differs from the "long-term thermal equilibrium" state of steady-state thermal resistance). The horizontal axis of the figure represents pulse width, the vertical axis represents the normalized transient thermal impedance (based on the steady-state junction-to-case thermal resistance RθJC), and the curves correspond to different duty cycles (Duty Cycle) and single-pulse operating conditions:

2.4.2 PC817 Optocoupler Isolation Chip

PC817 25

This table presents PC817 the maximum absolute ratings of the optocoupler at room temperature (25℃), and each parameter should be understood in combination with its structure of "light-emitting diode (input) + phototransistor (output)":

PC817

This table presents PC817 optocoupler's optoelectronic characteristics at room temperature (25°C), and the meaning of each parameter should be understood in combination with its "light-emitting diode - phototransistor" structure:

PC817 50 100 80 160 5mA 5V 25

CTR refers to the conversion efficiency of an optocoupler from "input light-emitting diode current to output photosensitive transistor current (CTR = IC/IF × 100%), and different grades correspond to different conversion efficiency ranges:

PC817 7 5mA 5V 30 0 100 65 8 20mA

These two characteristic curves reflect the influence of ambient temperature on PC817 the core parameters of the optocoupler:

PC817 8 20mA 1mA 25 0.06V 100 0.12V 9 20V

These two characteristic curves respectively reflect the influences of ambient temperature and load resistance on PC817 optocoupler's key parameters:

PC817 2V 2mA 25 0.5 500kHz

This set of diagrams illustrates PC817 the frequency response characteristics of the optocoupler and the corresponding test circuit, with analysis combined with the meaning of the parameters as follows:

These curves, together with the circuit, clearly demonstrate that: PC817 has its high-frequency transmission capability affected by the load resistance: a smaller load resistance can increase its bandwidth, and the test circuit serves as the standard configuration for verifying these dynamic characteristics.

2.5 Reference Circuit

2.5.1 JMSL0406AG Low-power MOS FET

None.

2.5.2 PC817 Optocoupler Isolation Chip

None.

2.6 Chip Configuration

2.6.1 JMSL0406AG Low-power MOS transistor

None.

2.6.2 PC817 Optocoupler Isolation Chip

None.

2.7.1 JMSL0406AG Low-power MOS transistor

None.

2.7.2 PC817 Optocoupler Isolation Chip

None.

2.8 PCB Routing Notes

2.8.1 JMSL0406AG Low-power MOS transistor

None.

2.8.2 PC817 Optocoupler Isolation Chip

None.

3. Instructions for Circuit Engineering and Module Usage

3.1 Circuit Source Engineering

To obtain the circuit source project, please follow the official account [Freak Embedded]

3.2 Module Usage Instructions

The schematic diagram is shown as follows:

SCH_MOSFET Switch Relay Module Based on JMSL0406_v1.0_2025-11-27.pdf 2.4 MB

U1 U2 Q1 Q2 Q3 PC817 SS8550 R1 R2 R3
JMSL0406 v1.0

This module provides the DOUT interface, which is used to connect to the MCU 's GPIO

When in use, we can just connect them in the following form:

LED1 D1 R1 Q1 Q2 Q3 U1 U2

The detailed analysis and explanation of the circuit principle are as follows:

Q2 PC817 U2 1 5V 2 Q1

At the same time, we also tested the relevant power:

4.87V 0.019A 0.09W 4.86V 0.031A 0.15W

3.3 Application Experiment

Here, we use the GraftPort-RP2040 development board for testing, and the MOS transistor switch relay module based on JMSL0406 uses the DIO interface on it to communicate with the main controller.

Here, we first use the HY2.0-4P connection cable to connect the module to the GraftPort-RP2040 development board's DIO1 interface:

GraftPort-RP2040 DIO1 14 HY2.0-4P

The module connections are shown in the following table:

Development Board Pins

Module Pins

Description

Pin 14

DOUT

The pins connected to the MCU output high and low levels.

Pin 15

NC

-

Here, we need to search for the relevant driver packages on uPyPI: https://upypi.net/zh/

106

Enter relay_driver to search, and the following will be displayed:

1.0.0 2020 2 12

Click to copy the local installation command:

168 1.0.0

Import the module driver library code via the mip tool. Below are the usage commands for the mpremote tool:

mpremote mip install https://upypi.net/pkgs/relay_driver/1.0.0

After importing the relay module driver - MicroPython driver code, copy the following main.py code into our project:

# Python env   : MicroPython v1.23.0
# -*- coding: utf-8 -*-
# @Time    : 2024/7/28 3:00 PM
# @Author  : Li Qingshui
# @File    : main.py
# @Description : Relay test example

# ======================================== Import Modules ========================================

# Import time-related modules
import time
# Import the relay module
from relay import RelayController

# ======================================== Global Variables ============================================

# If it is a 'normal' type relay, use GP14
RELAY_TYPE = 'normal'   # 'normal' or 'latching'
RELAY_PIN1 = 14           # Control pin 1
RELAY_PIN2 = 15           # Control pin 2

# Music rhythm definition (unit: ms)
# Each tuple represents (duration, whether to toggle at the end)
MUSIC_NOTES = [
    # Strong rhythm in the intro
    (50, True), (50, False), (50, True), (50, False),  # 4 fast consecutive beats
    (100, True), (100, False),  # Slow down for 2 beats
    (50, True), (50, False), (50, True), (50, False),  # Repeat 4 fast beats

    # Verse section
    (150, True), (50, True), (200, False),  # Strong-light-long pause
    (100, True), (100, True), (100, True), (100, False),  # Three consecutive hits
    (80, True), (80, True), (160, False),  # Double beat + long pause
    (60, True), (60, True), (60, True), (60, True), (120, False),  # Four fast consecutive hits

    # Chorus climax
    (40, True), (40, False), (40, True), (40, False),  # Ultra-fast eighth notes
    (40, True), (40, False), (40, True), (40, False),
    (200, True), (200, False),  # Strong downbeat
    (300, True), (100, True), (200, False),  # Long-short combination

    # Bridge tempo change
    (120, True), (80, True), (120, True), (80, False),
    (200, True), (50, True), (50, True), (200, False),

    # Ending slows down gradually
    (150, True), (150, False),
    (200, True), (200, False),
    (300, True), (300, False)
]
# ======================================== Functions ============================================

# Simple music playback function
def play_relay_music():
    for duration, should_toggle in MUSIC_NOTES:
        # Toggle the relay state
        relay.toggle()
        time.sleep_ms(duration)
        if should_toggle:
            # Toggle back again
            relay.toggle()
            # Add a small interval to prevent toggling too fast
            time.sleep_ms(50)

# ======================================== Custom Classes ============================================

# ======================================== Initialization ==========================================

# Power-on delay of 3 s
time.sleep(3)
# Print debug information
print("FreakStudio: Using GraftPort to control relay")

# Initialize the relay controller
if RELAY_TYPE == 'latching':
    relay = RelayController(RELAY_TYPE, RELAY_PIN1, RELAY_PIN2)
else:
    relay = RelayController(RELAY_TYPE, RELAY_PIN1)

# ========================================  Main Program  ===========================================

# Turn on the relay
relay.on()
print('relay.on')
# Delay 1s
time.sleep(5)
# Turn off the relay
relay.off()
print('relay.off')

To flash the code, open a terminal and use the mpremote tool to connect to the main controller; the output is as follows:

GraftSense - MOSFET Switch Relay Module Based on JMSL0406 (Open Version)

When the relay closes, the motor runs; after 5 seconds, the relay opens and the motor stops.

IV. Drivers

relay_driver.zip 11 KB

None.

VI. Revision History

Document Version

Date of Revision

Modifier

Modify Content

v1.0

2025-11-26

Li Zisheng

Initialize the document

The BOM sheet has not been finally checked, the driver has not been re-verified, and the 3.3 application experiment

Not yet specified.

v1.1

2025-12-29

Li Zisheng

Added application experiments and production files

v1.2

2025-12-31

Xin Ruili

Create an open version of the document based on the internal document version v1.1.

v1.3

2026-03-29

Xin Ruili

Modified the application experiment section

VII. Relevant Materials

7.1 Chip Datasheet

C2890432_MOSFET_JMSL0406AG_Datasheet_WJ329969.PDF 290 KB

C3008369_Transistor Output Optocoupler_PC817C-S_Datasheet_WJ644212.PDF 461 KB

7.2 Unique Icons for PCB Silk Screen

GraftSense - MOSFET Switch Relay Module Based on JMSL0406 (Open Version)