bom-generator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseBOM Generator
BOM生成器
Creates comprehensive Bill of Materials for maker projects with supplier links and compatibility checks.
为创客项目创建包含供应商链接和兼容性检查的全面物料清单。
Resources
资源
- scripts/generate_bom.py - Python script for xlsx/csv/markdown BOM generation (requires openpyxl)
- references/example-bom.md - Complete example BOM
- assets/example-project.json - Sample project configuration for script
- scripts/generate_bom.py - 用于生成xlsx/csv/markdown格式BOM的Python脚本(需要openpyxl依赖)
- references/example-bom.md - 完整的BOM示例
- assets/example-project.json - 脚本的示例项目配置
Quick Start
快速开始
Generate BOM interactively:
bash
uv run --no-project scripts/generate_bom.py --interactiveGenerate from JSON configuration:
bash
uv run --no-project scripts/generate_bom.py --json assets/example-project.json --output bom.xlsxList component database:
bash
uv run --no-project scripts/generate_bom.py --listExport formats: xlsx (default), csv, md, json
交互式生成BOM:
bash
uv run --no-project scripts/generate_bom.py --interactive从JSON配置生成:
bash
uv run --no-project scripts/generate_bom.py --json assets/example-project.json --output bom.xlsx列出组件数据库:
bash
uv run --no-project scripts/generate_bom.py --list导出格式:xlsx(默认)、csv、md、json
When to Use
使用场景
- User describes a project and needs parts list
- User asks "what components do I need for X"
- User wants to order parts for a design
- User needs cost estimates
- 用户描述项目并需要零件列表
- 用户询问“做X需要哪些组件”
- 用户想要为设计订购零件
- 用户需要成本估算
Workflow
工作流程
Step 1: Gather Project Requirements
步骤1:收集项目需求
Ask user for:
1. Project description (what does it do?)
2. Target microcontroller (Arduino UNO/Nano/Mega, ESP32, RP2040)
3. Power source (USB, batteries, wall adapter)
4. Quantity (how many units to build?)
5. Budget constraints (optional)
6. Supplier preference (optional)向用户询问:
1. 项目描述(功能是什么?)
2. 目标微控制器(Arduino UNO/Nano/Mega、ESP32、RP2040)
3. 电源(USB、电池、壁式适配器)
4. 数量(要制作多少台?)
5. 预算限制(可选)
6. 供应商偏好(可选)Step 2: Generate BOM
步骤2:生成BOM
Run for guided generation, or use this template format:
scripts/generate_bom.py --interactivemarkdown
undefined运行进行引导式生成,或使用以下模板格式:
scripts/generate_bom.py --interactivemarkdown
undefinedBill of Materials: [Project Name]
物料清单:[项目名称]
Generated: [Date]
Target Board: [MCU]
Quantity: [N] unit(s)
Estimated Total: $[X.XX] - $[Y.YY] (per unit)
生成时间: [日期]
目标开发板: [MCU]
数量: [N] 台
预估总成本: $[X.XX] - $[Y.YY](每台)
Core Components
核心组件
Sensors & Input
传感器与输入设备
| Qty | Component | Specifications | Est. Price | Supplier Links |
|---|---|---|---|---|
| ... | ... | ... | ... | ... |
| 数量 | 组件 | 规格 | 预估单价 | 供应商链接 |
|---|---|---|---|---|
| ... | ... | ... | ... | ... |
Output Devices
输出设备
| Qty | Component | Specifications | Est. Price | Supplier Links |
|---|---|---|---|---|
| ... | ... | ... | ... | ... |
| 数量 | 组件 | 规格 | 预估单价 | 供应商链接 |
|---|---|---|---|---|
| ... | ... | ... | ... | ... |
Power Components
电源组件
| Qty | Component | Specifications | Est. Price | Supplier Links |
|---|---|---|---|---|
| ... | ... | ... | ... | ... |
| 数量 | 组件 | 规格 | 预估单价 | 供应商链接 |
|---|---|---|---|---|
| ... | ... | ... | ... | ... |
Passive Components
无源组件
| Qty | Component | Specifications | Est. Price | Supplier Links |
|---|---|---|---|---|
| ... | ... | ... | ... | ... |
| 数量 | 组件 | 规格 | 预估单价 | 供应商链接 |
|---|---|---|---|---|
| ... | ... | ... | ... | ... |
Mechanical & Connectors
机械部件与连接器
| Qty | Component | Specifications | Est. Price | Supplier Links |
|---|---|---|---|---|
| ... | ... | ... | ... | ... |
| 数量 | 组件 | 规格 | 预估单价 | 供应商链接 |
|---|---|---|---|---|
| ... | ... | ... | ... | ... |
Tools Required (if not owned)
所需工具(若未拥有)
- Tool 1
- Tool 2
- 工具1
- 工具2
Compatibility Warnings
兼容性警告
⚠️ [Any voltage/current/timing concerns]
⚠️ [任何电压/电流/时序相关注意事项]
Substitution Notes
替代方案说明
💡 [Alternative components if primary unavailable]
undefined💡 [若首选组件缺货时的替代组件]
undefinedComponent Database
组件数据库
Microcontrollers
微控制器
| Board | Voltage | GPIO | Flash | Price Range | Best For |
|---|---|---|---|---|---|
| Arduino UNO R3 | 5V | 14 | 32KB | $12-25 | Beginners, most tutorials |
| Arduino Nano | 5V | 14 | 32KB | $3-20 | Compact projects |
| Arduino Mega | 5V | 54 | 256KB | $15-40 | Many I/O, large programs |
| ESP32 DevKit | 3.3V | 34 | 4MB | $5-15 | WiFi, Bluetooth, IoT |
| ESP32-C3 | 3.3V | 22 | 4MB | $4-10 | Low-cost WiFi |
| RP2040 Pico | 3.3V | 26 | 2MB | $4-6 | Dual-core, PIO |
| RP2040 Pico W | 3.3V | 26 | 2MB | $6-8 | Pico + WiFi |
| 开发板 | 电压 | GPIO | 闪存 | 价格区间 | 适用场景 |
|---|---|---|---|---|---|
| Arduino UNO R3 | 5V | 14 | 32KB | $12-25 | 初学者、大多数教程 |
| Arduino Nano | 5V | 14 | 32KB | $3-20 | 紧凑型项目 |
| Arduino Mega | 5V | 54 | 256KB | $15-40 | 多I/O需求、大型程序 |
| ESP32 DevKit | 3.3V | 34 | 4MB | $5-15 | WiFi、蓝牙、物联网项目 |
| ESP32-C3 | 3.3V | 22 | 4MB | $4-10 | 低成本WiFi方案 |
| RP2040 Pico | 3.3V | 26 | 2MB | $4-6 | 双核、PIO功能 |
| RP2040 Pico W | 3.3V | 26 | 2MB | $6-8 | Pico + WiFi |
Common Sensors
常见传感器
| Sensor | Interface | Voltage | Price | Use Case |
|---|---|---|---|---|
| DHT22/AM2302 | 1-Wire | 3.3-5V | $3-8 | Temperature + humidity |
| BME280 | I2C/SPI | 3.3V | $5-15 | Temp + humidity + pressure |
| BMP280 | I2C/SPI | 3.3V | $2-8 | Temp + pressure (no humidity) |
| DS18B20 | 1-Wire | 3-5.5V | $2-5 | Waterproof temperature |
| HC-SR04 | GPIO | 5V | $1-3 | Ultrasonic distance |
| VL53L0X | I2C | 3.3V | $5-12 | Laser distance (accurate) |
| MPU6050 | I2C | 3.3V | $2-8 | Accelerometer + gyroscope |
| BNO055 | I2C | 3.3V | $25-35 | 9-DOF IMU (best accuracy) |
| VEML7700 | I2C | 3.3V | $4-8 | Ambient light (lux) |
| MAX30102 | I2C | 3.3V | $5-12 | Heart rate + SpO2 |
| 传感器 | 接口 | 电压 | 价格 | 适用场景 |
|---|---|---|---|---|
| DHT22/AM2302 | 1-Wire | 3.3-5V | $3-8 | 温湿度检测 |
| BME280 | I2C/SPI | 3.3V | $5-15 | 温湿度+气压检测 |
| BMP280 | I2C/SPI | 3.3V | $2-8 | 温度+气压检测(无湿度) |
| DS18B20 | 1-Wire | 3-5.5V | $2-5 | 防水型温度检测 |
| HC-SR04 | GPIO | 5V | $1-3 | 超声波距离检测 |
| VL53L0X | I2C | 3.3V | $5-12 | 激光距离检测(高精度) |
| MPU6050 | I2C | 3.3V | $2-8 | 加速度计+陀螺仪 |
| BNO055 | I2C | 3.3V | $25-35 | 9轴IMU(最高精度) |
| VEML7700 | I2C | 3.3V | $4-8 | 环境光强度(lux)检测 |
| MAX30102 | I2C | 3.3V | $5-12 | 心率+血氧饱和度检测 |
Displays
显示屏
| Display | Interface | Resolution | Price | Notes |
|---|---|---|---|---|
| 16x2 LCD | I2C | 16 chars | $3-8 | Need I2C backpack |
| 20x4 LCD | I2C | 20 chars | $5-12 | Larger text display |
| SSD1306 OLED | I2C | 128x64 | $3-8 | Sharp, no backlight needed |
| SSD1306 OLED | I2C | 128x32 | $3-6 | Compact OLED |
| ST7735 TFT | SPI | 128x160 | $5-10 | Color, fast refresh |
| ILI9341 TFT | SPI | 240x320 | $8-15 | Larger color display |
| E-Paper | SPI | Various | $15-40 | Low power, no refresh |
| 显示屏 | 接口 | 分辨率 | 价格 | 说明 |
|---|---|---|---|---|
| 16x2 LCD | I2C | 16字符 | $3-8 | 需要I2C转接板 |
| 20x4 LCD | I2C | 20字符 | $5-12 | 更大的文本显示区域 |
| SSD1306 OLED | I2C | 128x64 | $3-8 | 显示清晰,无需背光 |
| SSD1306 OLED | I2C | 128x32 | $3-6 | 紧凑型OLED |
| ST7735 TFT | SPI | 128x160 | $5-10 | 彩色、高刷新率 |
| ILI9341 TFT | SPI | 240x320 | $8-15 | 大尺寸彩色显示屏 |
| 电子纸屏 | SPI | 多种规格 | $15-40 | 低功耗,无需持续刷新 |
Motors & Actuators
电机与执行器
| Type | Driver Needed | Price | Notes |
|---|---|---|---|
| SG90 Servo | None (PWM) | $2-5 | 180°, weak torque |
| MG996R Servo | None (PWM) | $5-10 | Strong, metal gears |
| 28BYJ-48 Stepper | ULN2003 | $3-6 | Cheap, slow, weak |
| NEMA17 Stepper | A4988/DRV8825 | $8-15 | Strong, precise |
| DC Motor + Gearbox | L298N/TB6612 | $5-15 | High speed available |
| Linear Actuator | L298N | $15-40 | Push/pull motion |
| 类型 | 是否需要驱动器 | 价格 | 说明 |
|---|---|---|---|
| SG90舵机 | 无需(PWM控制) | $2-5 | 180°转动,扭矩较小 |
| MG996R舵机 | 无需(PWM控制) | $5-10 | 扭矩大,金属齿轮 |
| 28BYJ-48步进电机 | 需要ULN2003 | $3-6 | 低成本、低速、扭矩小 |
| NEMA17步进电机 | 需要A4988/DRV8825 | $8-15 | 扭矩大、精度高 |
| 直流电机+齿轮箱 | 需要L298N/TB6612 | $5-15 | 可实现高速运转 |
| 线性执行器 | 需要L298N | $15-40 | 推拉式运动 |
Motor Drivers
电机驱动器
| Driver | Channels | Max Current | Voltage | Price |
|---|---|---|---|---|
| L298N | 2 | 2A/ch | 5-35V | $3-8 |
| TB6612FNG | 2 | 1.2A/ch | 4.5-13.5V | $3-8 |
| A4988 | 1 stepper | 2A | 8-35V | $2-5 |
| DRV8825 | 1 stepper | 2.5A | 8.2-45V | $3-6 |
| TMC2209 | 1 stepper | 2A | 4.75-28V | $8-15 |
| 驱动器 | 通道数 | 最大电流 | 电压 | 价格 |
|---|---|---|---|---|
| L298N | 2 | 2A/通道 | 5-35V | $3-8 |
| TB6612FNG | 2 | 1.2A/通道 | 4.5-13.5V | $3-8 |
| A4988 | 1路步进 | 2A | 8-35V | $2-5 |
| DRV8825 | 1路步进 | 2.5A | 8.2-45V | $3-6 |
| TMC2209 | 1路步进 | 2A | 4.75-28V | $8-15 |
Power Components
电源组件
| Component | Specs | Price | Use Case |
|---|---|---|---|
| LM7805 | 5V 1A linear | $0.50 | Simple 5V reg |
| AMS1117-3.3 | 3.3V 1A linear | $0.30 | 3.3V from 5V |
| LM2596 Module | Adj. 3A buck | $2-4 | Efficient step-down |
| MT3608 Module | Adj. 2A boost | $1-3 | Step-up voltage |
| TP4056 Module | LiPo charger | $1-2 | Battery charging |
| 18650 Holder | 1-4 cells | $1-5 | Battery mounting |
| JST Connectors | 2-pin | $2-5/10pk | Battery connections |
| 组件 | 规格 | 价格 | 适用场景 |
|---|---|---|---|
| LM7805 | 5V 1A线性稳压器 | $0.50 | 简单5V稳压需求 |
| AMS1117-3.3 | 3.3V 1A线性稳压器 | $0.30 | 从5V转换为3.3V |
| LM2596模块 | 可调3A降压模块 | $2-4 | 高效降压转换 |
| MT3608模块 | 可调2A升压模块 | $1-3 | 升压转换 |
| TP4056模块 | 锂电池充电模块 | $1-2 | 电池充电 |
| 18650电池座 | 1-4节 | $1-5 | 电池安装固定 |
| JST连接器 | 2针 | $2-5/10个 | 电池连接 |
Passive Components (Buy Kits!)
无源组件(建议购买套件!)
| Kit Type | Typical Contents | Price | Recommendation |
|---|---|---|---|
| Resistor Kit | 600+ pcs, 1/4W | $8-15 | Get once, use forever |
| Capacitor Kit | Ceramic + electrolytic | $10-20 | Essential |
| LED Kit | 5mm various colors | $5-10 | Common needs |
| Button Kit | Tactile switches | $5-8 | Various sizes |
| Diode Kit | 1N4148, 1N4007, etc | $5-8 | Protection circuits |
| 套件类型 | 典型包含内容 | 价格 | 推荐理由 |
|---|---|---|---|
| 电阻套件 | 600+个,1/4W | $8-15 | 一次性购买,长期使用 |
| 电容套件 | 陶瓷电容+电解电容 | $10-20 | 必备组件 |
| LED套件 | 5mm多色LED | $5-10 | 满足常见需求 |
| 按键套件 | 轻触开关 | $5-8 | 多种尺寸可选 |
| 二极管套件 | 1N4148、1N4007等 | $5-8 | 保护电路必备 |
Supplier Guide
供应商指南
Speed vs Cost Trade-offs
速度与成本权衡
| Supplier | Shipping | Price | Best For |
|---|---|---|---|
| DigiKey | 1-3 days | $$$ | Precise specs, datasheets, urgent |
| Mouser | 1-3 days | $$$ | Wide selection, quality |
| Amazon | 1-2 days | $$ | Quick delivery, returns easy |
| Adafruit | 3-5 days | $$$ | Quality, tutorials, support |
| SparkFun | 3-5 days | $$$ | Breakout boards, learning |
| AliExpress | 2-6 weeks | $ | Bulk, budget, clones |
| LCSC | 1-2 weeks | $$ | Chinese components, good quality |
| 供应商 | 配送时间 | 价格 | 最佳适用场景 |
|---|---|---|---|
| DigiKey | 1-3天 | $$$ | 精准规格、 datasheet、紧急需求 |
| Mouser | 1-3天 | $$$ | 品类齐全、品质可靠 |
| Amazon | 1-2天 | $$ | 配送快速、退换便捷 |
| Adafruit | 3-5天 | $$$ | 品质可靠、配套教程、技术支持 |
| SparkFun | 3-5天 | $$$ | breakout板、学习资源 |
| AliExpress | 2-6周 | $ | 批量采购、预算有限、兼容件 |
| LCSC | 1-2周 | $$ | 国产组件、品质优良 |
Part Number Patterns
零件编号规则
DigiKey: Descriptive codes
- 1N4007-TP → 1N4007 diode
- SER0006 → Servo motor
Mouser: Manufacturer part numbers
- Search by exact MPN
Amazon: ASIN codes
- Search by product name + specs
AliExpress: Store + product ID
- Check reviews, sold countDigiKey: 描述性编码
- 1N4007-TP → 1N4007二极管
- SER0006 → 舵机
Mouser: 原厂零件编号
- 使用精确MPN搜索
Amazon: ASIN编码
- 按产品名称+规格搜索
AliExpress: 店铺+产品ID
- 查看评价、销量Compatibility Checks
兼容性检查
Voltage Level Matrix
电压电平矩阵
Can Connect To:
From: 3.3V Logic 5V Logic
─────────────────────────────────────
3.3V MCU ✅ Direct ⚠️ Level shifter
5V MCU ⚠️ Divider ✅ Direct
3.3V Sensor ✅ Direct ⚠️ May work*
5V Sensor ❌ Damage! ✅ Direct
* Some 3.3V sensors are 5V tolerant - check datasheet 可连接至:
来自: 3.3V逻辑电路 5V逻辑电路
─────────────────────────────────────
3.3V MCU ✅ 直接连接 ⚠️ 需要电平转换器
5V MCU ⚠️ 需要分压器 ✅ 直接连接
3.3V传感器 ✅ 直接连接 ⚠️ 可能兼容*
5V传感器 ❌ 会损坏! ✅ 直接连接
* 部分3.3V传感器支持5V耐压 - 请查看数据手册Current Budget Check
电流预算检查
Source Limits:
- Arduino 5V pin: 500mA max (from USB)
- Arduino GPIO: 40mA max per pin
- ESP32 3.3V: 500mA max
- ESP32 GPIO: 40mA max
- RP2040 GPIO: 16mA max
Always calculate:
Total current = Σ(component currents)
If total > source limit → external power needed电源限制:
- Arduino 5V引脚:最大500mA(来自USB)
- Arduino GPIO引脚:每路最大40mA
- ESP32 3.3V引脚:最大500mA
- ESP32 GPIO引脚:每路最大40mA
- RP2040 GPIO引脚:每路最大16mA
务必计算:
总电流 = Σ(各组件电流)
若总电流超过电源限制 → 需要外部供电I2C Address Conflicts
I2C地址冲突
Common I2C addresses to watch:
0x3C - SSD1306 OLED
0x27 - PCF8574 LCD backpack
0x3F - PCF8574A LCD backpack
0x68 - MPU6050, DS3231 RTC
0x76 - BME280 (default)
0x77 - BME280 (alternate), BMP280
0x48 - ADS1115 ADC
0x50 - AT24C32 EEPROM需要注意的常见I2C地址:
0x3C - SSD1306 OLED
0x27 - PCF8574 LCD转接板
0x3F - PCF8574A LCD转接板
0x68 - MPU6050、DS3231 RTC
0x76 - BME280(默认)
0x77 - BME280(备选)、BMP280
0x48 - ADS1115 ADC
0x50 - AT24C32 EEPROMOutput Format Options
输出格式选项
Markdown Table (Default)
Markdown表格(默认)
Best for documentation, GitHub READMEs.
最适合文档、GitHub README。
CSV Export
CSV导出
csv
Qty,Component,Specifications,Unit Price,Total,Supplier,Link
1,Arduino UNO R3,ATmega328P,15.00,15.00,Amazon,https://...csv
Qty,Component,Specifications,Unit Price,Total,Supplier,Link
1,Arduino UNO R3,ATmega328P,15.00,15.00,Amazon,https://...Shopping Cart Links
购物车链接
Provide direct "Add to Cart" links where possible.
尽可能提供直接“加入购物车”的链接。
Example BOM Output
BOM输出示例
See references/example-bom.md for complete example.
完整示例请查看references/example-bom.md。