iDrawは、ユーザーが作成したSVGファイルを使用してAxiDrawを制御するプロジェクトです。
- Raspberry Pi 4B
- Arduino Uno
- AxiDraw
- Python 3.11
注意: 以下のセットアップを行う前に、仮想環境を作成することをお勧めします。
$ python3 -m venv your_venv_name
$ source your_venv_name/bin/activate
-
リポジトリをクローンする:
$ git clone https://github.com/junseiTanaka/idraw.git
-
Inkscapeアプリケーションをインストールする:
$ sudo apt update $ sudo apt install snapd $ sudo reboot $ sudo snap install core $ sudo snap install inkscape
-
AxiDraw_API
$ python -m pip install https://cdn.evilmadscientist.com/dl/ad/public/AxiDraw_API.zip
-
必要なパッケージをインストールする:
$ cd idraw $ pip install -r requirements.txt
-
USBポートの名前を固定 ArduinoとRaspiを接続(ペンプロッターは接続しない)
$ udevadm info -a -n ttyACM0
ATTRS{idProduct}=="AAA" ATTRS{idVendor}=="BBB" の出力結果をメモする。
$ sudo nano /etc/udev/rules.d/99-usb-serial.rules
99-usb-serial.rules
SUBSYSTEM=="ttyACM*", ATTRS{idProduct}=="AAA(先ほど調べた値)", ATTRS{idVendor}=="BBB(先ほど調べた値)", SYMLINK+="arduino",MODE="0666"
ctl-Xで抜け出し、yを押して保存。 udevの再起動をするために以下を実行
$ sudo udevadm trigger
最後に
$ ls /dev/arduino
でファイルが見つかれば完了。
-
AxiDrawで描いて欲しいSVGデータを用意する。
-
SVGデータを
idraw/src/svg
ディレクトリに移動する。 -
ターミナルから以下を実行し、新しいファイルが
path_svg
ディレクトリ内に保存されていることを確認する:$ python3 SVGConverter.py
-
AxiDrawとRaspberry PiをUSB接続する。
-
Arduino UnoとRaspberry PiをUSB接続する。
-
AxiDrawで描いて欲しい文字が書かれたjsonデータを用意する。
-
jsonデータを
idraw/src/json
ディレクトリに移動する。 -
ターミナルから以下を実行し、新しいファイルが
path_svg
ディレクトリ内に保存されていることを確認する:$ python3 ~/idraw/src/SVGConverter.py
-
AxiDrawとRaspberry PiをUSB接続する。
-
Arduino UnoとRaspberry PiをUSB接続する。
注意: USB接続の順番を守ること。AxiDraw → Arduino Unoの順番でRaspberry Piに接続する。
USB接続はどちらからでも大丈夫です。
- ターミナルから以下を実行する:
$ python3 ~/idraw/src/AxiDrawController.py
①は毎度実行する必要はありません。一度PATHデータが生成されれば②だけ実行すれば大丈夫です。
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.