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/文件夾中找到。