datasheet-interpreter
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDatasheet Interpreter
数据手册解析工具
Extracts actionable specifications from component datasheet PDFs.
从组件数据手册PDF中提取可直接使用的规格参数。
Resources
资源
Scripts
脚本
- scripts/extract_specs.py - Downloads datasheet PDFs from URLs and extracts specs using pattern matching
- scripts/extract_specs.py - 从URL下载数据手册PDF,并通过模式匹配提取规格参数
References
参考资料
- references/common-parameters.md - Guide to understanding datasheet parameters
- references/common-parameters.md - 数据手册参数理解指南
Quick Start
快速开始
bash
undefinedbash
undefinedExtract specs from a datasheet URL
从数据手册URL提取规格参数
uv run --no-project scripts/extract_specs.py --url "https://www.sparkfun.com/datasheets/Sensors/Temperature/DHT22.pdf"
uv run --no-project scripts/extract_specs.py --url "https://www.sparkfun.com/datasheets/Sensors/Temperature/DHT22.pdf"
Extract specs with markdown output
提取规格参数并以Markdown格式输出
uv run --no-project scripts/extract_specs.py --url "https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf" --format markdown
uv run --no-project scripts/extract_specs.py --url "https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf" --format markdown
Extract from local PDF file
从本地PDF文件提取
uv run --no-project scripts/extract_specs.py --file "local_datasheet.pdf"
uv run --no-project scripts/extract_specs.py --file "local_datasheet.pdf"
Interactive mode
交互模式
uv run --no-project scripts/extract_specs.py --interactive
---uv run --no-project scripts/extract_specs.py --interactive
---When to Use
使用场景
- "What's the I2C address for this chip?"
- "How do I connect this sensor?"
- "What pins do what on this module?"
- User shares a PDF datasheet URL
- Need timing specs or register info
- Quick reference without full driver generation
- "这款芯片的I2C地址是什么?"
- "我该如何连接这个传感器?"
- "这个模块的各个引脚功能是什么?"
- 用户分享了PDF数据手册链接
- 需要时序规格或寄存器信息
- 无需生成完整驱动,仅需快速参考
Relationship to Other Skills
与其他工具的关系
- datasheet-parser: Full driver library generation (lexus2k-style)
- datasheet-interpreter (this): Quick spec extraction for immediate use
- datasheet-parser: 生成完整驱动库(lexus2k风格)
- datasheet-interpreter(本工具): 快速提取规格参数以供即时使用
Information Extraction Workflow
信息提取流程
Step 1: Request Datasheet
步骤1:获取数据手册
Please provide:
1. Component name (e.g., "BME280", "MPU6050")
2. Datasheet PDF file or URL (manufacturer version preferred)
3. What specific information you need:
□ Pin assignments / pinout
□ I2C/SPI address and protocol
□ Operating conditions (voltage, current)
□ Timing requirements
□ Register map
□ Example circuit
□ All of the above请提供以下信息:
1. 组件名称(例如:"BME280", "MPU6050")
2. 数据手册PDF文件或链接(优先选择官方制造商版本)
3. 您需要的具体信息:
□ 引脚分配/引脚定义
□ I2C/SPI地址及通信协议
□ 工作条件(电压、电流)
□ 时序要求
□ 寄存器映射
□ 示例电路
□ 以上全部Step 2: Validate PDF Quality
步骤2:验证PDF质量
Check For:
- Searchable text (not scanned image)
- Official manufacturer datasheet (not clone/distributor summary)
- Revision/version number noted
- Complete document (includes register tables if applicable)
If PDF Issues:
⚠️ This appears to be a [scanned image | partial datasheet | third-party summary].
For best results, please provide the official manufacturer datasheet from:
- [Manufacturer website link]
- Or search: "[component] datasheet pdf site:manufacturer.com"检查项:
- 可搜索文本(而非扫描图片)
- 官方制造商数据手册(非仿品/分销商摘要)
- 标注了版本/修订号
- 完整文档(若适用,需包含寄存器表)
若PDF存在问题:
⚠️ 该文件似乎是[扫描图片 | 不完整数据手册 | 第三方摘要]。
为获得最佳效果,请提供官方制造商数据手册,可通过以下途径获取:
- [制造商官网链接]
- 或搜索:"[组件名称] datasheet pdf site:manufacturer.com"Extraction Templates
提取模板
Quick Reference Card
快速参考卡片
Generate this for any component:
markdown
undefined为任意组件生成以下内容:
markdown
undefined[Component Name] Quick Reference
[组件名称] 快速参考
Basic Info
基本信息
- Manufacturer: [name]
- Part Number: [full part number with variants]
- Datasheet Version: [rev/date]
- Description: [one-line description]
- 制造商: [名称]
- 型号: [完整型号(含变体)]
- 数据手册版本: [版本/日期]
- 描述: [一句话描述]
Electrical Characteristics
电气特性
| Parameter | Min | Typ | Max | Unit |
|---|---|---|---|---|
| Supply Voltage (VDD) | V | |||
| Operating Current | mA | |||
| Sleep Current | µA | |||
| Operating Temp | °C |
| 参数 | 最小值 | 典型值 | 最大值 | 单位 |
|---|---|---|---|---|
| 供电电压(VDD) | V | |||
| 工作电流 | mA | |||
| 休眠电流 | µA | |||
| 工作温度 | °C |
Communication Interface
通信接口
- Protocol: [I2C / SPI / UART / GPIO]
- Address: [0xNN (7-bit)] or [selectable via pin]
- Max Clock: [frequency]
- Logic Levels: [3.3V / 5V tolerant]
- 协议: [I2C / SPI / UART / GPIO]
- 地址: [0xNN(7位)] 或 [可通过引脚选择]
- 最大时钟频率: [频率]
- 逻辑电平: [3.3V / 5V 兼容]
Pinout
引脚定义
| Pin | Name | Type | Description |
|---|---|---|---|
| 1 | VDD | Power | Supply voltage |
| 2 | GND | Power | Ground |
| ... | ... | ... | ... |
| 引脚号 | 名称 | 类型 | 描述 |
|---|---|---|---|
| 1 | VDD | 电源 | 供电电压 |
| 2 | GND | 电源 | 接地 |
| ... | ... | ... | ... |
Key Registers (if applicable)
关键寄存器(若适用)
| Address | Name | R/W | Description |
|---|---|---|---|
| 0x00 | WHO_AM_I | R | Device ID (expect 0xNN) |
| ... | ... | ... | ... |
| 地址 | 名称 | 读/写 | 描述 |
|---|---|---|---|
| 0x00 | WHO_AM_I | 读 | 设备ID(预期值0xNN) |
| ... | ... | ... | ... |
Arduino Wiring
Arduino接线
| Component Pin | Arduino Uno | ESP32 | Pico |
|---|---|---|---|
| VCC | 3.3V | 3.3V | 3V3 |
| GND | GND | GND | GND |
| SDA | A4 | GPIO21 | GP4 |
| SCL | A5 | GPIO22 | GP5 |
| 组件引脚 | Arduino Uno | ESP32 | Pico |
|---|---|---|---|
| VCC | 3.3V | 3.3V | 3V3 |
| GND | GND | GND | GND |
| SDA | A4 | GPIO21 | GP4 |
| SCL | A5 | GPIO22 | GP5 |
Important Notes
重要说明
- [Critical warnings from datasheet]
- [Application notes]
---- [数据手册中的关键警告]
- [应用提示]
---Common Component Categories
常见组件分类
I2C Sensors
I2C传感器
Extract:
□ I2C address (7-bit format, note if configurable)
□ WHO_AM_I register address and expected value
□ Configuration register settings
□ Data registers (where to read measurements)
□ Resolution and range options
□ Conversion time / measurement rateI2C Address Quick Reference:
| Component | Address (7-bit) | Config Pin | Alt Address |
|---|---|---|---|
| BME280 | 0x76 | SDO→GND | 0x77 (SDO→VDD) |
| BME680 | 0x76 | SDO→GND | 0x77 (SDO→VDD) |
| MPU6050 | 0x68 | AD0→GND | 0x69 (AD0→VDD) |
| SHT30 | 0x44 | ADDR→GND | 0x45 (ADDR→VDD) |
| BH1750 | 0x23 | ADDR→GND | 0x5C (ADDR→VDD) |
| VL53L0X | 0x29 | - | Configurable via software |
| INA219 | 0x40 | A0,A1 | 0x40-0x4F |
| ADS1115 | 0x48 | ADDR→GND | 0x49-0x4B |
需提取的信息:
□ I2C地址(7位格式,标注是否可配置)
□ WHO_AM_I寄存器地址及预期值
□ 配置寄存器设置
□ 数据寄存器(测量值读取位置)
□ 分辨率及量程选项
□ 转换时间/测量速率I2C地址快速参考:
| 组件 | 7位地址 | 配置引脚 | 备选地址 |
|---|---|---|---|
| BME280 | 0x76 | SDO→GND | 0x77 (SDO→VDD) |
| BME680 | 0x76 | SDO→GND | 0x77 (SDO→VDD) |
| MPU6050 | 0x68 | AD0→GND | 0x69 (AD0→VDD) |
| SHT30 | 0x44 | ADDR→GND | 0x45 (ADDR→VDD) |
| BH1750 | 0x23 | ADDR→GND | 0x5C (ADDR→VDD) |
| VL53L0X | 0x29 | - | 可通过软件配置 |
| INA219 | 0x40 | A0,A1 | 0x40-0x4F |
| ADS1115 | 0x48 | ADDR→GND | 0x49-0x4B |
SPI Devices
SPI设备
Extract:
□ SPI mode (CPOL, CPHA)
□ Max clock frequency
□ Data order (MSB/LSB first)
□ Command format
□ Chip select behavior (active low?)需提取的信息:
□ SPI模式(CPOL、CPHA)
□ 最大时钟频率
□ 数据顺序(高位/低位优先)
□ 命令格式
□ 片选引脚行为(低电平有效?)Motor Drivers
电机驱动
Extract:
□ Logic voltage (VCC)
□ Motor voltage range (VM)
□ Current per channel (continuous/peak)
□ Control interface (PWM frequency, step/dir)
□ Protection features (thermal, overcurrent)
□ H-bridge or half-bridge需提取的信息:
□ 逻辑电平电压(VCC)
□ 电机电压范围(VM)
□ 单通道电流(持续/峰值)
□ 控制接口(PWM频率、步进/方向)
□ 保护功能(过热、过流)
□ H桥或半桥Display Modules
显示模块
Extract:
□ Resolution (width x height)
□ Controller IC (SSD1306, ILI9341, etc.)
□ Interface (I2C, SPI, parallel)
□ Memory map / pixel format
□ Initialization sequence
□ Refresh rate需提取的信息:
□ 分辨率(宽×高)
□ 控制芯片(SSD1306、ILI9341等)
□ 接口(I2C、SPI、并行)
□ 内存映射/像素格式
□ 初始化序列
□ 刷新率Critical Spec Finder
关键规格查找指南
For Power Planning
电源规划
Search datasheet for:
- "Electrical Characteristics" table
- "Power Consumption" or "Current Consumption"
- "Typical Operating Conditions"
- Sleep/standby modes and their currentsTemplate Output:
markdown
undefined在数据手册中搜索以下内容:
- “电气特性”表格
- “功耗”或“电流消耗”
- “典型工作条件”
- 休眠/待机模式及其电流模板输出:
markdown
undefinedPower Specs for [Component]
[组件名称] 电源规格
Operating Modes
工作模式
| Mode | Typical Current | Conditions |
|---|---|---|
| Active | XXX mA | [freq, voltage, etc.] |
| Idle | XXX µA | |
| Sleep/Standby | XXX µA | |
| Deep Sleep | XXX nA |
| 模式 | 典型电流 | 条件 |
|---|---|---|
| 工作中 | XXX mA | [频率、电压等] |
| 空闲 | XXX µA | |
| 休眠/待机 | XXX µA | |
| 深度休眠 | XXX nA |
Wake-up Time
唤醒时间
- From sleep: XXX ms
- From deep sleep: XXX ms
undefined- 从休眠唤醒:XXX ms
- 从深度休眠唤醒:XXX ms
undefinedFor Timing Requirements
时序要求
Search datasheet for:
- "Timing Characteristics"
- "AC Characteristics"
- Setup/hold times
- Clock specifications在数据手册中搜索以下内容:
- “时序特性”
- “交流特性”
- 建立/保持时间
- 时钟规格For Pin Tolerance
引脚电平兼容性
Search datasheet for:
- "Absolute Maximum Ratings"
- "ESD protection"
- "5V tolerant" mentions
- Input voltage specifications在数据手册中搜索以下内容:
- “绝对最大额定值”
- “ESD保护”
- “5V兼容”相关描述
- 输入电压规格Register Map Extraction
寄存器映射提取
Structured Format
结构化格式
cpp
// [Component] Register Definitions
// Extracted from datasheet v[X.Y], p.[N]
// === REGISTER ADDRESSES ===
#define REG_NAME 0x00 // Description
// === BITFIELD DEFINITIONS ===
// REG_NAME (0x00) - [Description]
// Bit 7-6: FIELD_A - [description]
// Bit 5: FIELD_B - [description]
// Bit 4-0: FIELD_C - [description]
#define REG_NAME_FIELD_A_MASK 0xC0
#define REG_NAME_FIELD_A_POS 6
#define REG_NAME_FIELD_B_BIT 5
#define REG_NAME_FIELD_C_MASK 0x1Fcpp
// [组件名称] 寄存器定义
// 提取自数据手册版本v[X.Y],第[N]页
// === 寄存器地址 ===
#define REG_NAME 0x00 // 描述
// === 位域定义 ===
// REG_NAME (0x00) - [描述]
// 第7-6位: FIELD_A - [描述]
// 第5位: FIELD_B - [描述]
// 第4-0位: FIELD_C - [描述]
#define REG_NAME_FIELD_A_MASK 0xC0
#define REG_NAME_FIELD_A_POS 6
#define REG_NAME_FIELD_B_BIT 5
#define REG_NAME_FIELD_C_MASK 0x1FCommon Register Patterns
常见寄存器模式
Configuration Register:
- Enable/disable features
- Set operating mode
- Configure interrupt behaviorStatus Register:
- Data ready flags
- Error/fault indicators
- Interrupt sourcesData Registers:
- Usually consecutive addresses
- Note byte order (MSB first or LSB first)
- Signed vs unsigned interpretation配置寄存器:
- 启用/禁用功能
- 设置工作模式
- 配置中断行为状态寄存器:
- 数据就绪标志
- 错误/故障指示
- 中断源数据寄存器:
- 通常为连续地址
- 注意字节顺序(高位/低位优先)
- 有符号/无符号数值解读Wiring Diagram Generator
接线图生成工具
Generate text-based wiring diagrams:
[Component] [Arduino Uno]
┌─────────┐ ┌───────────┐
│ VCC ────┼─────────┤ 3.3V │
│ GND ────┼─────────┤ GND │
│ SDA ────┼─────────┤ A4 (SDA) │
│ SCL ────┼─────────┤ A5 (SCL) │
│ INT ────┼─────────┤ D2 (INT0) │
└─────────┘ └───────────┘
Notes:
- Add 4.7kΩ pull-ups on SDA/SCL if not on module
- INT is open-drain, needs pull-up生成基于文本的接线图:
[组件] [Arduino Uno]
┌─────────┐ ┌───────────┐
│ VCC ────┼─────────┤ 3.3V │
│ GND ────┼─────────┤ GND │
│ SDA ────┼─────────┤ A4 (SDA) │
│ SCL ────┼─────────┤ A5 (SCL) │
│ INT ────┼─────────┤ D2 (INT0) │
└─────────┘ └───────────┘
说明:
- 若模块未自带上拉电阻,需在SDA/SCL引脚添加4.7kΩ上拉电阻
- INT引脚为开漏输出,需要上拉电阻Example Code Generator
示例代码生成器
Based on extracted specs, generate minimal working example:
cpp
/*
* [Component] Basic Example
* Generated from datasheet interpretation
*
* Wiring:
* - VCC → 3.3V
* - GND → GND
* - SDA → A4 (Arduino Uno) / GPIO21 (ESP32)
* - SCL → A5 (Arduino Uno) / GPIO22 (ESP32)
*/
#include <Wire.h>
#define COMPONENT_ADDR 0x00 // From datasheet p.X
#define REG_WHO_AM_I 0x00 // Expected: 0xNN
#define REG_CTRL 0x00 // Configuration
#define REG_DATA 0x00 // Data output
void setup() {
Serial.begin(115200);
Wire.begin();
// Verify communication
Wire.beginTransmission(COMPONENT_ADDR);
if (Wire.endTransmission() != 0) {
Serial.println("Component not found!");
while(1);
}
// Read device ID
uint8_t id = readReg(REG_WHO_AM_I);
Serial.print("Device ID: 0x");
Serial.println(id, HEX);
// Initialize
writeReg(REG_CTRL, 0x00); // [Configuration value from datasheet]
}
void loop() {
// Read data
int16_t data = readReg16(REG_DATA);
Serial.println(data);
delay(100);
}
uint8_t readReg(uint8_t reg) {
Wire.beginTransmission(COMPONENT_ADDR);
Wire.write(reg);
Wire.endTransmission(false);
Wire.requestFrom(COMPONENT_ADDR, (uint8_t)1);
return Wire.read();
}
void writeReg(uint8_t reg, uint8_t val) {
Wire.beginTransmission(COMPONENT_ADDR);
Wire.write(reg);
Wire.write(val);
Wire.endTransmission();
}
int16_t readReg16(uint8_t reg) {
Wire.beginTransmission(COMPONENT_ADDR);
Wire.write(reg);
Wire.endTransmission(false);
Wire.requestFrom(COMPONENT_ADDR, (uint8_t)2);
int16_t val = Wire.read() << 8; // MSB first (check datasheet!)
val |= Wire.read();
return val;
}基于提取的规格参数,生成最简可运行示例:
cpp
/*
* [组件名称] 基础示例
* 基于数据手册解析结果生成
*
* 接线方式:
* - VCC → 3.3V
* - GND → GND
* - SDA → A4(Arduino Uno)/ GPIO21(ESP32)
* - SCL → A5(Arduino Uno)/ GPIO22(ESP32)
*/
#include <Wire.h>
#define COMPONENT_ADDR 0x00 // 来自数据手册第X页
#define REG_WHO_AM_I 0x00 // 预期值:0xNN
#define REG_CTRL 0x00 // 配置寄存器
#define REG_DATA 0x00 // 数据输出寄存器
void setup() {
Serial.begin(115200);
Wire.begin();
// 验证通信连接
Wire.beginTransmission(COMPONENT_ADDR);
if (Wire.endTransmission() != 0) {
Serial.println("未检测到组件!");
while(1);
}
// 读取设备ID
uint8_t id = readReg(REG_WHO_AM_I);
Serial.print("设备ID: 0x");
Serial.println(id, HEX);
// 初始化组件
writeReg(REG_CTRL, 0x00); // [数据手册中的配置值]
}
void loop() {
// 读取数据
int16_t data = readReg16(REG_DATA);
Serial.println(data);
delay(100);
}
uint8_t readReg(uint8_t reg) {
Wire.beginTransmission(COMPONENT_ADDR);
Wire.write(reg);
Wire.endTransmission(false);
Wire.requestFrom(COMPONENT_ADDR, (uint8_t)1);
return Wire.read();
}
void writeReg(uint8_t reg, uint8_t val) {
Wire.beginTransmission(COMPONENT_ADDR);
Wire.write(reg);
Wire.write(val);
Wire.endTransmission();
}
int16_t readReg16(uint8_t reg) {
Wire.beginTransmission(COMPONENT_ADDR);
Wire.write(reg);
Wire.endTransmission(false);
Wire.requestFrom(COMPONENT_ADDR, (uint8_t)2);
int16_t val = Wire.read() << 8; // 高位优先(请确认数据手册!)
val |= Wire.read();
return val;
}Quick Lookup Database
快速查询知识库
Common Questions Answered
常见问题解答
"What voltage does [component] need?"
→ Check "Absolute Maximum Ratings" and "Recommended Operating Conditions"
"Is it 3.3V or 5V?"
→ Look for "VDD" or "VCC" in electrical characteristics
→ Check if I/O pins are "5V tolerant"
"How fast can I run the I2C?"
→ Find "I2C Clock Frequency" in timing specs (usually 100kHz standard, 400kHz fast)
"How do I wake it from sleep?"
→ Look for "Power Management" or "Operating Modes" section
"Why won't it respond at the address I expected?"
→ Check address selection pins (AD0, ADDR, SA0)
→ Some datasheets show 8-bit address (divide by 2 for 7-bit)
“[组件]需要什么电压?”
→ 查看“绝对最大额定值”和“推荐工作条件”章节
“它是3.3V还是5V兼容?”
→ 在电气特性章节查找“VDD”或“VCC”参数
→ 查看I/O引脚是否标注“5V兼容”
“I2C总线最高能跑多快?”
→ 查看时序规格中的“I2C时钟频率”(通常标准模式100kHz,快速模式400kHz)
“如何将它从休眠模式唤醒?”
→ 查找“电源管理”或“工作模式”章节
“为什么它没有响应我预期的地址?”
→ 检查地址选择引脚(AD0、ADDR、SA0)
→ 部分数据手册显示的是8位地址(需除以2得到7位地址)
Datasheet Reading Tips
数据手册阅读技巧
Where to Find Key Info
关键信息位置
| Information | Section Name |
|---|---|
| I2C Address | "Serial Interface" or "Communication" |
| Voltage/Current | "Electrical Characteristics" |
| Pinout | "Pin Configuration" or "Package Information" |
| Registers | "Register Map" or "Memory Map" |
| Timing | "Timing Characteristics" or "AC Characteristics" |
| Example Circuit | "Application Information" or "Typical Application" |
| 信息类型 | 章节名称 |
|---|---|
| I2C地址 | “串行接口”或“通信” |
| 电压/电流 | “电气特性” |
| 引脚定义 | “引脚配置”或“封装信息” |
| 寄存器 | “寄存器映射”或“内存映射” |
| 时序 | “时序特性”或“交流特性” |
| 示例电路 | “应用信息”或“典型应用” |
Red Flags in Datasheets
数据手册中的红色警告信号
- 🚩 Missing absolute maximum ratings
- 🚩 No version/revision number
- 🚩 Inconsistent register descriptions
- 🚩 Machine-translated text
- 🚩 Missing timing diagrams for protocols
→ If you see these, try to find a better quality datasheet from the original manufacturer
- 🚩 缺少绝对最大额定值
- 🚩 无版本/修订号
- 🚩 寄存器描述不一致
- 🚩 机器翻译文本
- 🚩 缺少协议时序图
→ 若遇到以上情况,请尝试从原始制造商处获取质量更好的数据手册