更新您的浏览器

您的浏览器版本已经过时,这会导致网站很多功能失效。

请更新您的浏览器以获得网站最好的体验

无法从文档中提取型号,请重试

bom2buy 魔方

魔方 2.0版 已揭开它的神秘面纱

bom2buy 魔方是一个可编程设备。它虽然外在结构简单,没有可见的任何按钮或显示屏,

但其实内置了多种部件 —— 多个 LED、1 个麦克风、1 个加速计和 1 个 USB 接口。

魔方开箱即用,在您学会编程后还可以体验更多有趣的功能。

bom2buy cube

The mysteries of the cube v2.0 are unveiled

The bom2buy cube is a hackable device. While simple in form with no visible buttons or displays, there are a variety of

components -- LED's, a microphone, an accelerometer and a USB port -- on the base of the cube. You will notice that

there's functionality right out of the box, but once you learn how to hack it you will realize how much more it can do.

说明

DESCRIPTION

首先,您可以在魔方的底部看到 10 个随机闪亮的白色 LED。当拿在手里时,魔方有时会灯光闪烁。观察一会儿您就可以发现,每当有人拍手、击打或周围有很大噪声时,指示灯就会闪烁,这其实表明了魔方内部有麦克风,我们可以通过声音来控制它的 LED。

When you first see this cube, you can see that there are 10 white LEDs at the bottom, which are running randomly. The cube would also flash from time to time when you hold it in your hands. If you observe it for a while, you will find that it flashes every time when someone claps, beats, or there is any loud noise around it. This indicates that there is a microphone inside and the cube is controlled by sound.

部件

COMPONENTS

数量 部件名称
1 x 塑料外壳
蓝色 ABS
1 x 护罩
ABS
1 x 灯管
PC + 二氧化钛
1 x 印制电路板架
天然聚丙烯
1 x 金属圆柱体
1 x 柔性印刷电路板
1 x 底层电路板
QUANTITY COMPONENT NAME
1 x Plastic enclosure
Blue ABS
1 x Shroud
ABS
1 x Lightpipe
PC + Titanium dioxide
1 x PCB Rack
Natural PP
1 x Metal cylinder
1 x Flexible PCB
1 x Bottom PCB

连接计算机

CONNECTING TO THE COMPUTER

如果将魔方与计算机建立通信,就可以支持更多功能。通信通过虚拟串行端口执行,因此,如果计算机配有串口终端软件 (RealTerm 或类似软件),可以发送一个命令到魔方,它将给您返回相应的状态或数据。串口通信配置为 9600、8、N、1。这个串口用于向魔方发送命令或参数,获取状态、切换模式、开关指示灯等。不要忘记每个命令后面设置自动 CR 和 LF 字符,因为魔方的固件通过每个命令后面的这种字符进行识别。

命令行不区分大小写,可以包含一个命令字 (或缩写)、一个 (可选) 单字符操作数或一个 (可选) 数值数据,彼此之间用空格隔开。除了 HELP (帮助) 命令,所有命令缩写均为两个字符。HELP (帮助) 命令的缩写由一个问号代替。因此,如果输入“?” (然后输入 <CR> 和 <LF> ),将显示 HELP (帮助) 屏幕。

如下图所示:

左图的帮助信息可供您了解魔方可以执行的操作。当然啦,还有一些独立功能是不需要通过终端软件操作的。不过,USB 连接还是有必要的,至少您需要将魔方连接到电源。也就是说,您需要使用 USB 线将魔方连接到计算机,或者连接到 USB 充电器。

If you establish communication between the cube and computer, there's much more things we could do. The communication is performed via the virtual serial port, so if you have some serial terminal programs (RealTerm, or similar) in your computer, you can send a command to the cube then it will give you some responses. Communication parameters are 9600, 8, N, 1. This port is used to issue the command or parameters to the cube, like get the status, switch modes, turn lights on and off etc. Don't forget to set automatic CR and LF characters after every command, as the cube firmware expects it after every command.

The command line is not case sensitive, so you can use uppercase or lowercase as you wish. It should contain one command word (or its abbreviation), one (optional) single-character operand or one (optional) numeric data, separated by spaces. All command abbreviations contain two characters, except the command HELP, which is abbreviated by a single question mark. So, if you type “?” (followed by <CR> and <LF> ), you will get the HELP screen.

Like this:

This will give you an idea what the cube can do, but there are some stand-alone functions also, so you don't need to have the terminal software to operate the cube. However, USB connection is needed, at least for power supply, so you must have the USB cable connected to the computer or, at least, to the USB charger.

基本功能

FUNCTIONS

魔方内置两种指示灯。一种位于魔方底部,由 10 个 LED 组成,称为副灯;另一种位于魔方顶部,由 5 个大功率 LED 组成,称为主灯。默认状态下,底部指示灯随机闪烁,可以通过模式(MODE) 命令 关闭 (OFF) 或永久打开 (ON),可设置 R (随机)、P (永久) 或 D (熄灭)。默认状态下,顶部指示灯常亮 (MODE 1) ,它也可以被关闭 (MODE 2)、逆时针依序发亮 (MODE 3)、顺时针依序发亮 (MODE 4) 或闪烁 (MODE 5)。请注意,每个命令可输入双字符缩写代替。

您也可以拍手或拍打桌子上的物体切换模式。通过这种方式操作时,必须分别记录每个模式的拍打方式,这些方式是开关指示灯的“密码”。我们在后面的“拍打方式编程”中再谈。

状态 (STATUS) 命令用于读取魔方当前状态: 起始阈值 (Attack)、衰减阈值 (Decay)、通知时长 (Notification)、延迟系数 (Speed) 和模式 (Mode)。所有列出的参数都可以通过输入 DEFAULT 来重置默认状态,我们会在后面的“高级命令”中详谈这些参数。

魔方内置加速计 MEMS 传感器,它检测 X、Y 和 Z 轴的重力加速度,从而感知魔方的角度位置。输入 ACCEL,可以读取魔方当前位置。ACCEL_LOOP 命令以无限循环方式执行相同的操作,您可以看到魔方旋转和移动过程中,这些参数的变化。循环可通过发送字符 Q 终止 (这是唯一不需要 <CR> 和 <LF> 就可以发出的命令)。

正常操作期间,魔方每次转到新位置时发送位置更改信息。试着翻转一下魔方,它将显示‘Cube Left’ (即魔方的左面朝下放置)、‘Cube Right’、‘Cube Bottom’等信息。此外,每种模式通过拍打方式改变后,将显示“Clap 1” (即拍打方式 1 被魔方识别) 、“Clap 2” 等。两个选项都可通过 MODE N 关闭,第一个选项可通过 MODE S (Side) 打开,第二个选项可以通过 MODE C (Clap) 打开。

There are two lights inside the cube, the lower one, which employs 10 LED's at the bottom of the cube, and the main one, with 5 high power LED's at the top. The lower one blinks randomly by default, but it can be turned OFF or permanently ON by command MODE, followed by R (Random), P (Permanent) or D (Dark). The top light is ON by default (which is MODE 1), and it can be switched OFF (MODE 2), rotating CCW (MODE 3), rotating CW (MODE 4), or blinking (MODE 5). Please note that every command can be replaced by typing its two-character abbreviation.

You can also switch the mode by clapping your hands, or by beating with some object on your table. To perform this, you must record your patterns for every mode separately, and these patterns will be your "passwords" for turning lights on and off. See next PATTERN PROGRAMMING for details.

Command STATUS is used to read the current status of the cube: Attack threshold, Decay threshold, Notification period, Speed and Mode. All listed parameters can be reset to their default state by typing DEFAULT and details can be found in ADVANCED COMMAND.

Inside the cube there is an accelerometer, MEMS sensor which senses gravitational acceleration for X, Y and Z axis, and thus the angular position of the cube. By typing ACCEL, you can read the current position of the cube. Command ACCEL_LOOP does the same thing in the endless loop, so you can watch how those parameters change while you are rotating and moving the cube. The loop can be terminated by sending character Q (this is the only command that can be issued without <CR> and <LF>).

Try turning it and it will communicate ‘Cube Left’ (which means ‘Cube Left Side Down’), ‘Cube Right’, ‘Cube Bottom’ and so on. Also, after every mode change by clapping, it will communicate ‘Clap 1’ (which stands for ‘Claping Pattern 1 Recognized’), ‘Clap 2’ and so on. Both options can be switched OFF by command MODE N, and the first one can be switched on by MODE S (Side), and the another one by MODE C (Clap).

拍打方式编程

PATTERN PROGRAMMING

想要通过编程让主灯按某种拍打方式亮起 (MODE 1) ,需将魔方的左侧朝下放置。如果已连接到计算机,终端软件将显示 "Cube Left"。同时,主灯亮一段时间 (这个时间段可以通过 NOTIF 命令来设置),然后熄灭。现在,您可以拍手、打响指或用硬物或指甲轻轻敲打桌面(拍打的时间间隔才是唯一重要的参数,而不是拍打的力度)。拍打方式应该为 3 到 31 下,否则不会被接受。完成拍打方式编程后静等一会儿,直到魔方灯光重复相同的方式。然后,将魔方放回到正立位置 (底部向下),测试是否正常工作。所有可用模式最多可用五种拍打方式进行编程。以下列表是各模式对应的灯光效果和编程时需要将魔方放置的位置。

MODE1 主灯亮 左面朝下放置
MODE2 主灯灭 右面朝下放置
MODE3 主灯逆时针依序发亮 前面朝下放置
MODE4 主灯顺时针依序发亮 后面朝下放置
MODE5 主灯闪烁 上面朝下放置(倒置)
如果您忘了其中任何一种拍打方式,只需将魔方倾倒到对应的一侧,静等至少 3 秒钟, 魔方将使用灯光表示拍打方式。

如果不喜欢新的方式,可以重置魔方 (输入 PATTERN_RD,或断开然后重新连接 USB 插头),重新加载最后记录的拍打方式 (如果有通过 PATTERN_WR 命令保存的话)。当完成所有的拍打方式的编程 (或重新编程,因为可以多次编程) 后,您可能想将方式记录在内部非易失性 EEPROM 存储器中,这时您可以输入 PATTERN_WR 命令,当魔方下次连接电源时,将重新加载上次记录的拍打方式。

To program the clapping pattern for light ON (MODE 1), turn the cube to the left side down. If the terminal program is connected, "Cube Left" will be displayed. Also, the main (upper) light will be ON for some time (which can be affected by NOTIF command), and then switched off. Now you can clap your hands, fingers or beat on the table surface slightly by some hard object or by your hand nails (timings between claps are the only significant parameters, not the intensity). Pattern should contain between 3 and 31 claps, otherwise it will not be accepted. When you've finished the pattern, wait silently until the cube repeats the same pattern by light. Then you can turn the cube back to the upright position (bottom down) and test if it works. You can program up to five patterns, for all available modes. Here is the list of modes:

MODE1 main light ON LEFT SIDE DOWN position
MODE2 main light OFF RIGHT SIDE DOWN position
MODE3 running main light CCW FRONT SIDE DOWN position
MODE4 running main light CW BACK SIDE DOWN position
MODE5 blinking main light TOP SIDE DOWN (upside down) position
If you've forgotten any of these patterns, just turn the cube on the desired side, and wait silently for at least 3 seconds, and the cube will play the pattern with lights.

If you don't like your new patterns, you can reset the cube (by command PATTERN_RD, or simply disconnecting and reconnecting the USB connector) and the last recorded patterns (if they were saved by command PATTERN_WR) will be reloaded. When you've finished all patterns programming (or reprogramming, as it can be performed many times), maybe you will like to record patterns at the internal non-volatile EEPROM memory. Type the command PATTERN_WR and, when you connect the cube the next time to the power supply, it will be reloaded with your last recorded patterns.

高级命令

ADVANCED COMMANDS

  • ATTACK_TH n起始阈值 (n × 13 mV)
  • DECAY_TH n衰减阈值 (n × 13 mV)
  • *_TH n起始和衰减阈值 (n × 13 mV)

以上命令可以让您设置声音的阈值,这个阈值将决定拍打的声音是否会被魔方识别。如果阈值过高,有些拍打不会识别;如果过低,环境噪声会被误识别为拍打。因此,必须将阈值调整到最佳水平。您可以分别调整起始阈值和和衰减阈值。起始和衰减阈值默认值分别为 80 和 60。

Drawing represents the waveform of the typical clap signal
NOTIF n魔方位置变化后通知 (灯亮) 时长 (n × 13 ms)

当魔方从正立位置变动为其他位置时,例如进行拍打方式编程时将魔方倾向一侧,主灯会亮起一段时间,以表示记录拍打方式编程之前的保护期。这个时长可以使用此命令预设。默认的值是 110,也就是说 NOTIF 时长是1.4 s。

SPEED n定时功能延迟系数 (n = 延迟系数)

有些定时功能可以使用这个系数来达到延迟 (如 ACCEL_LOOP 和 MODE 5 闪烁功能)。默认延迟系数为 1。

GET_PATTERN n在屏幕上显示拍打方式的计时 (n = MODE 1...5)

以十进制 ASCII 数字列出所编程模式 n 的拍打方式的计时 (以 13 ms 为一个时段)。注意,计时数会少于拍打数,因为最后一次拍打后的计时是无限的。总共有 31 个时段,记录有若干拍打数,所有未使用的时段表示为零。

PUT_PATTERN n上传拍打方式 (n = MODE 1...5)

您可以采用十进制 ASCII 数字编写好拍打方式的计时,然后上传到魔方。编写好后上传,和用拍打方式编程 (Pattern Programming) 来编写,是一样的效果。上传的代码格式应当和 GET_PATTERN 命令中所述展示的格式相同。

MODE n设置模式和选项

MODE 命令后面只能跟一个参数。如果是数字 1…5,则会将模式 (MODE) 分别设置为 1...5。如果是字符 R、P 或 D,则会将副灯分别设置为随机、永久或熄灭 (关闭) 状态。如果是 S、C 或 N,魔方将会分别被重设为侧面亮 (Side ON)、拍打亮 (Clap ON) 或者侧面和拍打都关闭 (Side and Clap OFF)。(当魔方旋转到新位置并且识别出有效的拍打方式时,魔方不会将报告发送到终端)。

PATTERN_WR所有拍打方式写入内部 EEPROM

这个命令将所有拍打方式从易失性 RAM 复制到内部非易失性 EEPROM。执行 PATTERN_WR 命令时,以前保存的拍打方式不再使用,新方式将在下一次接通电源时加载。

PATTERN_RD从内部 EEPROM 读取所有拍打方式

将所有拍打方式从内部非易失性 EEPROM 读入 RAM。每次接通电源时自动执行这个命令。

WRITE将参数写入内部 EEPROM

将这些参数从易失性 RAM 复制到内部非易失性 EEPROM: 起始阈值 (Attack)、衰减阈值 (Decay)、通知时长 (Notification)、延迟系数 (Speed) 和模式 (Mode)。执行 PATTERN_WR 命令时, 以前保存的参数不再使用,新参数将在下一次接通电源时加载。

READ从内部 EEPROM 中读取参数

将这些参数从内部非易失性 EEPROM 读入 RAM: 起始阈值 (Attack)、衰减阈值 (Decay)、通知时长 (Notification)、延迟系数 (Speed) 和模式 (Mode)。每次接通电源时自动执行这个命令。

STATUS显示当前状态

在屏幕上显示这些状态参数:起始阈值 (Attack)、衰减阈值 (Decay)、通知时长 (Notification)、延迟系数 (Speed) 和模式 (Mode)。

DEFAULT恢复出厂默认值

所有参数将预设为默认值,并删除所有拍打方式。

查看全部 11 条命令
  • ATTACK_TH nAttack threshold level (n × 13 mV)
  • DECAY_TH nDecay threshold level (n × 13 mV)
  • *_TH nBoth attack and decay threshold level (n × 13 mV)

There is a threshold sound level which will decide if the clap occurred. If the threshold is too high, then some claps will not be registered, and if it is too low, the ambient noise will cause false claps. So it is essential to have the threshold adjusted to the optimal level. You can adjust the attack threshold and decay threshold separately. Default values for attack and decay threshold are 80 and 60, respectively.

Drawing represents the waveform of the typical clap signal
NOTIF nNotification (light ON) time after the cube position change (n × 13 ms)

When the cube is turned from the upright to some other position, e. g. when the pattern programming should be performed, the main light will be ON for some time, to signify the protection period before the pattern recording. This time can be preset using this command. Default number is 110, so default NOTIF time is 1.4 s.

SPEED nSlow-down factor for timed functions (n = slow-down factor)

Some timed functions (like ACCEL_LOOP and Blink function in MODE 5) can be slowed down using this function. Default slow down factor is 1.

GET_PATTERN nPrint pattern timings on screen (n = pattern mode 1...5)

Lists timings (in 13 ms steps) for the desired pattern n, in decimal ASCII numeric. Note that there is one timing less than the number of claps, as the timing after the last clap should be infinite. There is a total of 31 periods, followed by a number of claps. All unused periods are represented as zeros.

PUT_PATTERN nUploads the pattern which follows this command (n = pattern mode 1...5)

You can prepare the pattern timings, in decimal ASCII numeric, and upload them to the cube. It will be accapted as if it was recorded by Pattern Programming procedure. The format of the prepared pattern should be the same as described in GET_PATTERN command.

MODE nSets mode and options

There is only one parameter which can follow MODE command. If it is numeric 1...5, it will set mode to 1...5, respectively. If it is character R, P or D, it will set the bottom light to Random, Permanent or Dark (off) state. If it is S, C or N, the cube reprot mode will be set to Side ON, Clap ON or both Side and Clap OFF (the cube will not send the report to the terminal when it is rotated to the new position and when the valid clap patern is recognized).

PATTERN_WRwrite all patterns to internal EEPROM

This command copies all patterns from volatile RAM to internal non-volatile EEPROM. When the PATTERN_WR command is performed, the previously saved patterns are not available anymore, and the new patterns will be loaded at the next power-up.

PATTERN_RDread all patterns from internal EEPROM

This command copies all patterns from volatile RAM to internal non-volatile EEPROM. When the PATTERN_WR command is performed, the previously saved patterns are not available anymore, and the new patterns will be loaded at the next power-up.

WRITEwrite parameters to internal EEPROM

Copies the next parameters from volatile RAM to internal non-volatile EEPROM: Attack threshold, Decay threshold, Notification timing, Speed factor and Mode. When the PATTERN_WR command is performed, the previously saved parameters are not available anymore, and the new parameters will be loaded at the next power-up.

READread parameters from internal EEPROM

Reads the next parameters from the internal non-volatile EEPROM to RAM: Attack threshold, Decay threshold, Notification timing, Speed factor and Mode. This command is performed at every power-up automatically.

STATUSPrint the current status

The following status parameters are printed on the screen: Attack threshold, Decay threshold, Notification timing, Speed factor and Mode.

DEFAULTReturn to factory default values

All data will be preset to the default values, and all patterns deleted.

View all 11 commands

出品方

CREDITS

所有电子产品 (电路板、固件) 由 Voja Antonic 开发,外壳由 Giovanni Salinas 在加利福尼亚州帕萨迪纳 Supplyframe 设计实验室设计和开发。

All the electronics (boards, firmware) were developed by Voja Antonic, and the enclosure was designed and developed at Supplyframe's DesignLab in Pasadena, California by Giovanni Salinas.