Labs / Electronic modules

GraftSense - Serial Port Gyroscope Module Based on JY60 (Open Version)

Author: Li Zisheng · Source: FreakStudio open documentation, v1.4 · License: CC BY 4.0 · Driver code (sensors/serial_imu_driver): MIT License

Contents
JY60
JY60 LED1 R1 C1 U1 C2 C3 v1.0

I. Module Introduction

JY60-based Serial Port Gyroscope Module Designed based on the JY60 six-axis inclination sensor module, this product integrates a gyroscope circuit, filter capacitors, serial port terminals and a power indicator, and is equipped with GND, VCC, MTX, and MRX interfaces; it can output Euler angle data such as pitch, roll and yaw angles via the serial port, and is suitable for projects including attitude measurement, human motion tracking and drones, providing a precise 3D attitude sensing solution for devices.

II. Introduction to Main Chips

JY60 is a high-performance 3D motion attitude measurement system based on MEMS technology. It integrates a three-axis gyroscope and a three-axis accelerometer. Compared with the MPU6050 six-axis gyroscope module, JY60 performs quaternion calculation and Kalman filtering via its built-in microcontroller, and supports communication via UART and IIC interfaces. It adopts custom protocol frames during communication, and supports operations such as angle zeroing, calibration and sleep of the sensor by sending command packets through the serial port.

2.1 Chip Overview

JY60 0.2 3.3 5V 3.3V/5V 600bps 20Hz

2.2 Pin Definition

JY60 1 12 15.24mm 2.54mm 12.7mm 2.8mm 2.2
JY60 1 D0 2 3.3 5V 3 4 2.2

2.3 Functional Block Diagram

None.

2.4 Performance Parameters

GraftSense - Serial Port Gyroscope Module Based on JY60 (Open Version)
JY60 2000 0.061 0.005 0.5 1 0.015 5 256Hz 2.4
JY60 180 90 0.2 0.0055 40 85 0.5 1
JY60 180 6 0.5 0.0055

2.5 Reference Circuit

JY60 3.3V 3.3 5V 1 2 3 4 5 6

2.6 Chip Configuration

None.

Here, we only provide a detailed introduction to JY60 's serial port Communication Protocol. JY60 adopts the WT61 custom serial port Communication Protocol to communicate with the main controller.

2.7.1 Data Reading

It starts working immediately after power-on, and cyclically transmits 1 frame of data (which contains 11 data packets) via the serial port. The format of the data frame is as follows:

Protocol Header

Data Types

Data 0

lower 8 bits

Data 0

Upper 8 bits

Data 1

lower 8 bits

Data 1

Upper 8 bits

Data 2

lower 8 bits

Data 2

Upper 8 bits

Data 3

lower 8 bits

Data 3

Upper 8 bits

checksum

HEADER

0x55

TYPE[1]

DATA0L

[7:0]

DATA0H

[15:8]

DATA1L

[7:0]

DATA1H

[15:8]

DATA2L

[7:0]

DATA2H

[15:8]

DATA3L

[7:0]

DATA3H

[15:8]

SUMCRC[2]

The parameters are defined as follows:

SUMCRC is of char type, taking the lower 8 bits of the checksum

It should be noted here that:

2.7.2 Command Transmission

When sending commands, please transmit in accordance with the following protocol, and note that the data shall be sent in hexadecimal format:

Protocol Header

Protocol Header

command

OxFF

0xAA

CMD

The following commands are available for sending:

Note: When calibrating and zeroing the z-axis angle, the sensor must remain stationary in a horizontal/vertical position!

JY60 0xFF 0xAA 0x52 52

Note: When calibrating and zeroing the z-axis angle, the sensor must remain stationary in a horizontal/vertical position!

JY60 0xFF 0xAA 0x67 67
0xFF 0xAA 0x60
JY60 0xFF 0xAA 0x61 61
JY60 0xFF 0xAA 0x62 62
JY60 0xFF 0xAA 0x63 115200 100Hz 63
JY60 0xFF 0xAA 0x64 9600 20Hz 64
JY60 0xFF 0xAA 0x81 256Hz 0x82 188Hz 0x83 98Hz 0x84
JY60 0xFF 0xAA 0x65 65
JY60 0xFF 0xAA 0x66 66

2.8 PCB Routing Notes

No special requirements.

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 of this module is shown below:

SCH_JY60-Based Serial Gyroscope Module_v1.1_2025-11-04.pdf 2.1 MB

JY60 U1 U2 R1 C1 C2 C3
v1.0 JY60

This module provides serial communication interfaces: MRX and MTX, in which MTX is actually SRX (the RX of the gyroscope module), while MRX is actually STX (the TX of the gyroscope module). In use, the TX pin of the main control chip needs to be connected to MTX, and the RX pin connected to MRX.

3.3 Application Experiment

Here, we use the GraftPort-RP2040 development board for testing, and the JY60-based serial port gyroscope module uses the UART interface 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 UART1 interface:

JY60 GraftPort-RP2040 8 9 HY2.0-4P UART1

The module connections are shown in the following table:

Development Board Pins

Module Pins

Description

Pin 8

MTX

UART data transmission line, corresponding to the transmit pin of the development board

Pin 9

MRX

UART data transmission line, corresponding to the receive pin of the development board

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

106

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

1.0.0

Click to copy the local installation command:

GraftSense - Serial Port Gyroscope Module Based on JY60 (Open Version)

Here, we can use the mip tool to import module driver library code. Below are the usage commands for the mpremote tool:

mpremote mip install github:FreakStudioCN/GraftSense-Drivers-MicroPython/sensors/serial_imu_driver

Import the MicroPython driver code for the JY60-based serial port gyroscope module, then copy the following main.py code into our project:

# Python env   : MicroPython v1.23.0              
# -*- coding: utf-8 -*-        
# @Time    : 2024/6/24 10:32 AM
# @Author  : Li Qingshui
# @File    : main.py       
# @Description : Serial IMU experiment, mainly obtains JY61 IMU data over the serial port, then prints the data with the print function

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

# Hardware-related modules
from machine import UART, Pin
# Time-related modules
import time
# Garbage collection module
import gc
# IMU module
from imu import IMU

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

# Program run time variable
run_time: int = 0
# Program start time variable
start_time: int = 0
# Program end time variable
end_time: int = 0

# ======================================== Functions ============================================

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

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

# Power-on delay of 3 s
time.sleep(3)
# Print debug information
print("FreakStudio : Using UART to communicate with IMU")

# Create the serial port object, set the baud rate to 115200
uart = UART(1, 115200)
# Initialize the uart object: 8 data bits, no parity bit, 1 stop bit
# Set the UART timeout to 5 ms
uart.init(bits=8,
          parity=None,
          stop=1,
          tx=8,
          rx=9,
          timeout=5)

# Create a UART object with a baud rate of 115200, used to send three-axis angle data to the host computer
uart_pc = UART(0, 115200)
# Initialize the uart object: 8 data bits, no parity bit, 1 stop bit, UART timeout set to 5 ms
uart_pc.init(bits=8,
             parity=None,
             stop=1,
             tx=0,
             rx=1,
             timeout=5)

# Set GPIO 25 as the LED output pin, pull-down resistor enabled
LED = Pin(25, Pin.OUT, Pin.PULL_DOWN)

# Initialize an IMU object
imu_obj = IMU(uart)

# ========================================  Main Program  ============================================
try:
    while True:
        # Turn on the LED
        LED.on()
        # Receive gyroscope data
        imu_obj.RecvData()
        # Turn off the LED
        LED.off()

        # Print the x-axis angle
        print(" X-axis angle : ", imu_obj.angle_x)
        # Print the y-axis angle
        print(" Y-axis angle : ", imu_obj.angle_y)
        # Print the z-axis angle
        print(" Z-axis angle : ", imu_obj.angle_z)
        # Return the number of bytes of available heap RAM
        print(" the number of RAM remaining is %d bytes ", gc.mem_free())

        # Format the three-axis angle data into a string
        angle_data = "{:.2f}, {:.2f}, {:.2f}\r\n".format(imu_obj.angle_x, imu_obj.angle_y, imu_obj.angle_z)
        # Send the angle data to the host computer via UART 0
        uart_pc.write(angle_data)

        # When the available heap RAM is less than 80000 bytes, manually trigger garbage collection
        if gc.mem_free() < 220000:
            # Manually trigger garbage collection
            gc.collect()
except KeyboardInterrupt:
    # Handling when a keyboard interrupt (Ctrl+C) is caught
    print("程序被用户中断")
finally:
    # This runs whether the program ends normally or is interrupted, ensuring the LED is turned off
    LED.off()
    print("LED已关闭,程序退出")

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

GraftSense - Serial Port Gyroscope Module Based on JY60 (Open Version)

You can see that as we continuously shake the module, the angle value output in the terminal changes:

IV. Drivers

serial_imu_driver.zip 13 KB

None.

VI. Revision History

Document Version

Date of Revision

Modifier

Modify Content

v1.0

2025-08-13

ben0i0d

Initialize the document

v1.1

2025-11-04

Li Zisheng

Added 2.8 PCB routing precautions

Revised Section 3, Circuit Source Project and Module Usage Instructions, and added a secondary heading:

3.1 Circuit Source Engineering, 3.2 Module Usage Instructions, 3.3 Application Experiments

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

Not yet specified.

v1.2

2025-12-29

Li Zisheng

Added application experiments and production files

v1.3

2025-12-31

Xin Ruili

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

v1.4

2026-03-29

Xin Ruili

Modified the application experiment section

VII. Relevant Materials

7.1 Chip Datasheet

7.2 PCB Silkscreen Specific Icons

JY60 v1.2