PI PIN是一个AI PIN,您可以整天佩戴24小时,记录您进行的对话,并使用生成的AI来总结并为您做笔记。
PI PIN是完全开源的,负担得起,它建在$ 15的Raspberry Pi Zero 2 W上,带有麦克风和电池。
它是完全可黑的,您可以在上面编写自己的应用程序。
PI引脚的外壳是在Raspberry Pi零,麦克风和电池周围设计的,以确保(相对)紧凑的物理尺寸。
电子设备有意保持最小(PI,麦克风,电池,电池充电模块),并且大多数零件都是3D可打印或作为现成的产品可用。
下图显示了PI PIN所需的所有接线。
| 从 | 到 |
|---|---|
| 滑动开关右销 | PI 5V(引脚2) |
| 滑动开关中销 | 电源模块5V + |
| 电源模块5V- | PI GND(引脚6) |
| 电源模块3.7V + | 电池 + |
| 电源模块3.7V- | 电池 - |
| 麦克风 | PI GND(引脚6) |
| MIC 3V | PI 3.3V(引脚1) |
| 麦克风 | PI PCM 18(引脚12) |
| 麦克风LRCL | PI PCM 19(引脚35) |
| 麦克风 | PI PCM 20(引脚38) |
电池:
我们使用3.7V 600mAh 702030锂电池,用电源模块作为电池解决方案。电源模块像电池充电控制器和DC/DC转换器一样工作。
通常,电线连接需要下面的左侧。您可以将3.7V锂电池+连接到电源模块电池+和3.7V锂电池-电源模块电池- (就像右图下方一样)。
之后,您将在功率模块5V +和-处有恒定的5V输出。
电源模块还提供了一个USB-C端口,供您为电池充电。
我们还在电源模块5V +和PI 5V标头之间添加了开关面板幻灯片开关,该开关有助于打开 /关闭整个PIN系统。
麦克风:
我们使用Adafruit I2S MEMS麦克风作为麦克风模块,下图显示了将MIC连接到Raspberry Pi的方式。该图显示了使用大覆盆子PI的MIC接线,但GPIO标头与我们在PI PIN中使用的Raspberry Pi零相同。
案例组件:
您可以在此处找到3D打印的零件(步骤文件)。顶部是在Raspberry Pi Zero周围设计的,底部的设计包含麦克风,电池,电源模块和开关。所有模块都应完美地安装在外壳内部,您也可以使用胶带或胶水稳定它们。
下面左下的图显示了情况中的模块(无接线)拟合。
下面左下的图显示了情况中的模块(接线)拟合。
然后,您可以将两个零件组合在一起,然后使用四个M1x7mm螺钉固定。
您需要从Raspbian或Raspbian Lite开始。从Raspberry Pi下载页面中获取最新版本,并按照以下说明将OS映像安装到SD卡中。
更新PI
sudo apt-get -y update
sudo apt-get -y upgradesudo pip install --upgrade adafruit-python-shell
git clone https://github.com/liltom-eth/pi-pin.git
cd pi-pin/scripts
sudo python i2smic.py运行脚本后,将为您提供配置选项。
PI模型应自动检测到。
如果您希望在启动时加载I2S MIC模块支持,请在此处选择“是”。否则,每次要使用它时,都必须手动安装模块。
您需要重新启动以进行设置才能生效。
sudo reboot使用以下命令列出可用的输入设备:
arecord -l您应该看到一个与此类似信息的卡条目:
注意卡号。在上方的屏幕截图中为0 。您可以使用此命令在单声道中记录一个6秒的WAV文件(更改-plughw参数以匹配上面的卡号):
arecord -D dmic_sv -c2 -r 44100 -f S32_LE -t wav -V mono -v file.wav --duration=6如果您的扬声器已连接到PI,则可以直接在设备上播放文件:
aplay file.wav
或者,您可以将其复制到计算机进行播放。
您可以通过ALSAMIXER和ALSA配置将卷控件添加到麦克风。
sudo apt-get install vim
vim ~ /.asoundrc并将以下内容放入:
# This section makes a reference to your I2S hardware, adjust the card name
# to what is shown in arecord -l after card x: before the name in []
# You may have to adjust channel count also but stick with default first
pcm.dmic_hw {
type hw
card sndrpii2scard
channels 2
format S32_LE
}
# This is the software volume control, it links to the hardware above and after
# saving the .asoundrc file you can type alsamixer, press F6 to select
# your I2S mic then F4 to set the recording volume and arrow up and down
# to adjust the volume
# After adjusting the volume - go for 50 percent at first, you can do
# something like
# arecord -D dmic_sv -c2 -r 48000 -f S32_LE -t wav -V mono -v myfile.wav
pcm.dmic_sv {
type softvol
slave.pcm dmic_hw
control {
name " Boost Capture Volume "
card sndrpii2scard
}
min_dB -3.0
max_dB 30.0
}现在,在更改卷之前,您需要一次使用该设备(这是ALSA的事情)
跑步:
arecord -D dmic_sv -c1 -r 48000 -f S32_LE -t wav -V mono -v file1.wav --duration=6现在您可以运行Alsamixer-按F6并选择I2S声卡
它将抱怨没有播放控件(因为它仅用于录制)。
按F4切换到捕获模式,您应该能够使用向上/向下箭头键调整音量。
有时~/.asoundrc在重新启动后消失,您需要设置raspi-config启动到控制台,而不是启动到桌面。
sudo raspi-config要通过Python脚本记录音频,您需要安装以下依赖项:
sudo apt-get install libportaudio0 libportaudio2 libportaudiocpp0 portaudio19-dev
sudo pip install pyaudiopython record_on_boot.py --output_folder ./recording我们将运行PI零作为带电池电源的可穿戴设备,因此,当零功率打开时,我们需要一种启动Python脚本的方法。
在/lib/systemd/system/ ,例如pipin.service中创建一个服务文件,其中包含以下内容:
sudo vim /lib/systemd/system/pipin.service并将以下内容放入:
Description=Record on Boot
After=sound.target alsa-state.service
[Service]
User=tom
Type=simple
ExecStart=/usr/bin/python /home/tom/projects/pi-pin/record_on_boot.py --output_folder /home/tom/projects/pi-pin/recording/
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target将User和ExecStart更改为您自己的名称和脚本路径。
更改文件权限,并在启动时启动服务。
sudo chmod 644 /lib/systemd/system/pipin.service
sudo systemctl start pipin.service
sudo systemctl enable pipin.service对于调试,您可以使用sudo systemctl status pipin.service检查状态并使用journalctl -u pipin.service检查输出日志。
要手动停止服务,请使用sudo systemctl stop pipin.service 。
在使用脚本之前,您可能需要在要获取摘要的设备上安装一些OpenAI客户端依赖。我正在使用笔记本电脑调用这些AI端点。
pip install -r requirements.txt summarize.ipynb向您展示了使用OpenAI whisper进行Seced2Text的示例,然后使用OpenAI gpt4来总结您的对话的转录。
这是我戴上Pi-pin ./recording/wav_2024_03_20-065147_PM.wav收到的摘要(可以找到录音。
The report discusses the significant comeback of tech conferences in the Bay Area, focusing on a particularly large event in downtown San Jose centered around artificial intelligence. Tens of thousands of attendees created a scene reminiscent of a major concert outside the SAP Center, highlighting the immense interest and investment in AI. NVIDIA's GTC convention is spotlighted as a major contributor to this momentum, drawing a crowd of around 20,000 people and significantly benefiting local businesses. NVIDIA CEO Jensen Wang spoke on the transformative impact of AI across various industries, emphasizing the computer as a crucial societal tool. The event has led to a notable economic boost for the area, with restaurants and venues experiencing high demand. This resurgence of tech conferences is likened to the phenomenon of "revenge travel" post-COVID lockdowns, indicating a strong desire within the tech community to reconnect, explore new technologies, and invest in the industry's future.
转录和摘要也可以在./recording/文件夹中找到。