bom-generator

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

BOM 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 --interactive
Generate from JSON configuration:
bash
uv run --no-project scripts/generate_bom.py --json assets/example-project.json --output bom.xlsx
List component database:
bash
uv run --no-project scripts/generate_bom.py --list
Export 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
scripts/generate_bom.py --interactive
for guided generation, or use this template format:
markdown
undefined
运行
scripts/generate_bom.py --interactive
进行引导式生成,或使用以下模板格式:
markdown
undefined

Bill 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

核心组件

QtyComponentSpecificationsEst. PriceSupplier Links
1[MCU Board][specs]$X.XXDigiKey / Amazon
...............
数量组件规格预估单价供应商链接
1[MCU开发板][规格参数]$X.XXDigiKey / Amazon
...............

Sensors & Input

传感器与输入设备

QtyComponentSpecificationsEst. PriceSupplier Links
...............
数量组件规格预估单价供应商链接
...............

Output Devices

输出设备

QtyComponentSpecificationsEst. PriceSupplier Links
...............
数量组件规格预估单价供应商链接
...............

Power Components

电源组件

QtyComponentSpecificationsEst. PriceSupplier Links
...............
数量组件规格预估单价供应商链接
...............

Passive Components

无源组件

QtyComponentSpecificationsEst. PriceSupplier Links
...............
数量组件规格预估单价供应商链接
...............

Mechanical & Connectors

机械部件与连接器

QtyComponentSpecificationsEst. PriceSupplier 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
💡 [若首选组件缺货时的替代组件]
undefined

Component Database

组件数据库

Microcontrollers

微控制器

BoardVoltageGPIOFlashPrice RangeBest For
Arduino UNO R35V1432KB$12-25Beginners, most tutorials
Arduino Nano5V1432KB$3-20Compact projects
Arduino Mega5V54256KB$15-40Many I/O, large programs
ESP32 DevKit3.3V344MB$5-15WiFi, Bluetooth, IoT
ESP32-C33.3V224MB$4-10Low-cost WiFi
RP2040 Pico3.3V262MB$4-6Dual-core, PIO
RP2040 Pico W3.3V262MB$6-8Pico + WiFi
开发板电压GPIO闪存价格区间适用场景
Arduino UNO R35V1432KB$12-25初学者、大多数教程
Arduino Nano5V1432KB$3-20紧凑型项目
Arduino Mega5V54256KB$15-40多I/O需求、大型程序
ESP32 DevKit3.3V344MB$5-15WiFi、蓝牙、物联网项目
ESP32-C33.3V224MB$4-10低成本WiFi方案
RP2040 Pico3.3V262MB$4-6双核、PIO功能
RP2040 Pico W3.3V262MB$6-8Pico + WiFi

Common Sensors

常见传感器

SensorInterfaceVoltagePriceUse Case
DHT22/AM23021-Wire3.3-5V$3-8Temperature + humidity
BME280I2C/SPI3.3V$5-15Temp + humidity + pressure
BMP280I2C/SPI3.3V$2-8Temp + pressure (no humidity)
DS18B201-Wire3-5.5V$2-5Waterproof temperature
HC-SR04GPIO5V$1-3Ultrasonic distance
VL53L0XI2C3.3V$5-12Laser distance (accurate)
MPU6050I2C3.3V$2-8Accelerometer + gyroscope
BNO055I2C3.3V$25-359-DOF IMU (best accuracy)
VEML7700I2C3.3V$4-8Ambient light (lux)
MAX30102I2C3.3V$5-12Heart rate + SpO2
传感器接口电压价格适用场景
DHT22/AM23021-Wire3.3-5V$3-8温湿度检测
BME280I2C/SPI3.3V$5-15温湿度+气压检测
BMP280I2C/SPI3.3V$2-8温度+气压检测(无湿度)
DS18B201-Wire3-5.5V$2-5防水型温度检测
HC-SR04GPIO5V$1-3超声波距离检测
VL53L0XI2C3.3V$5-12激光距离检测(高精度)
MPU6050I2C3.3V$2-8加速度计+陀螺仪
BNO055I2C3.3V$25-359轴IMU(最高精度)
VEML7700I2C3.3V$4-8环境光强度(lux)检测
MAX30102I2C3.3V$5-12心率+血氧饱和度检测

Displays

显示屏

DisplayInterfaceResolutionPriceNotes
16x2 LCDI2C16 chars$3-8Need I2C backpack
20x4 LCDI2C20 chars$5-12Larger text display
SSD1306 OLEDI2C128x64$3-8Sharp, no backlight needed
SSD1306 OLEDI2C128x32$3-6Compact OLED
ST7735 TFTSPI128x160$5-10Color, fast refresh
ILI9341 TFTSPI240x320$8-15Larger color display
E-PaperSPIVarious$15-40Low power, no refresh
显示屏接口分辨率价格说明
16x2 LCDI2C16字符$3-8需要I2C转接板
20x4 LCDI2C20字符$5-12更大的文本显示区域
SSD1306 OLEDI2C128x64$3-8显示清晰,无需背光
SSD1306 OLEDI2C128x32$3-6紧凑型OLED
ST7735 TFTSPI128x160$5-10彩色、高刷新率
ILI9341 TFTSPI240x320$8-15大尺寸彩色显示屏
电子纸屏SPI多种规格$15-40低功耗,无需持续刷新

Motors & Actuators

电机与执行器

TypeDriver NeededPriceNotes
SG90 ServoNone (PWM)$2-5180°, weak torque
MG996R ServoNone (PWM)$5-10Strong, metal gears
28BYJ-48 StepperULN2003$3-6Cheap, slow, weak
NEMA17 StepperA4988/DRV8825$8-15Strong, precise
DC Motor + GearboxL298N/TB6612$5-15High speed available
Linear ActuatorL298N$15-40Push/pull motion
类型是否需要驱动器价格说明
SG90舵机无需(PWM控制)$2-5180°转动,扭矩较小
MG996R舵机无需(PWM控制)$5-10扭矩大,金属齿轮
28BYJ-48步进电机需要ULN2003$3-6低成本、低速、扭矩小
NEMA17步进电机需要A4988/DRV8825$8-15扭矩大、精度高
直流电机+齿轮箱需要L298N/TB6612$5-15可实现高速运转
线性执行器需要L298N$15-40推拉式运动

Motor Drivers

电机驱动器

DriverChannelsMax CurrentVoltagePrice
L298N22A/ch5-35V$3-8
TB6612FNG21.2A/ch4.5-13.5V$3-8
A49881 stepper2A8-35V$2-5
DRV88251 stepper2.5A8.2-45V$3-6
TMC22091 stepper2A4.75-28V$8-15
驱动器通道数最大电流电压价格
L298N22A/通道5-35V$3-8
TB6612FNG21.2A/通道4.5-13.5V$3-8
A49881路步进2A8-35V$2-5
DRV88251路步进2.5A8.2-45V$3-6
TMC22091路步进2A4.75-28V$8-15

Power Components

电源组件

ComponentSpecsPriceUse Case
LM78055V 1A linear$0.50Simple 5V reg
AMS1117-3.33.3V 1A linear$0.303.3V from 5V
LM2596 ModuleAdj. 3A buck$2-4Efficient step-down
MT3608 ModuleAdj. 2A boost$1-3Step-up voltage
TP4056 ModuleLiPo charger$1-2Battery charging
18650 Holder1-4 cells$1-5Battery mounting
JST Connectors2-pin$2-5/10pkBattery connections
组件规格价格适用场景
LM78055V 1A线性稳压器$0.50简单5V稳压需求
AMS1117-3.33.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 TypeTypical ContentsPriceRecommendation
Resistor Kit600+ pcs, 1/4W$8-15Get once, use forever
Capacitor KitCeramic + electrolytic$10-20Essential
LED Kit5mm various colors$5-10Common needs
Button KitTactile switches$5-8Various sizes
Diode Kit1N4148, 1N4007, etc$5-8Protection 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

速度与成本权衡

SupplierShippingPriceBest For
DigiKey1-3 days$$$Precise specs, datasheets, urgent
Mouser1-3 days$$$Wide selection, quality
Amazon1-2 days$$Quick delivery, returns easy
Adafruit3-5 days$$$Quality, tutorials, support
SparkFun3-5 days$$$Breakout boards, learning
AliExpress2-6 weeks$Bulk, budget, clones
LCSC1-2 weeks$$Chinese components, good quality
供应商配送时间价格最佳适用场景
DigiKey1-3天$$$精准规格、 datasheet、紧急需求
Mouser1-3天$$$品类齐全、品质可靠
Amazon1-2天$$配送快速、退换便捷
Adafruit3-5天$$$品质可靠、配套教程、技术支持
SparkFun3-5天$$$breakout板、学习资源
AliExpress2-6周$批量采购、预算有限、兼容件
LCSC1-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 count
DigiKey: 描述性编码
  - 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 EEPROM

Output 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