The operating system for USB connectable Mokugyo device.
日本語による解説記事は以下リンクより。(READMEの全てをカバーしています)
【USB木魚】叩くと光りながら般若心経が入力できるUSB接続型木魚を作ってみた【作り方解説 & ソースコード公開】 - xor
- Mokugyo
Recommendation: Amazon.co.jp: キクタニ 木魚 3寸 9cm TB-9: 楽器 - USB Standard-A(male) to Standard-A(male) cable
- USB Standard-A(female) to Micro-B(male) short cable
- Mallet (optional)
- Small Zabuton (Japanese cushion, optional)
- Microcontroller: Pro Micro - 5V/16MHz - DEV-12640 - SparkFun Electronics
- But you can choice any other ATmega32u4 based boards as main board, like Arduino Micro, Arduino Leonardo.
- This README explains in case using Pro Micro.
- Accelerometer: Adafruit Triple-Axis Accelerometer - ±2/4/8g @ 14-bit - MMA8451 : ID 2019 : $7.95 : Adafruit Industries, Unique & fun DIY electronics and kits
- Full-colored WS2812B compatible LED chip (5 pieces): Adafruit NeoPixel Digital RGB LED Strip - Black 60 LED [BLACK] : ID 1461 : $99.80 : Adafruit Industries, Unique & fun DIY electronics and kits
- No need to buy Adafruit's LED because a bit expensive. Recommend NeoPixel compatible LED, like フルカラーシリアルLEDモジュール - SWITCH-SCIENCE, NeoPixelフルカラーLEDテープ・5V版各種 – Shigezone Online, etc.
- Only 5 pieces needed.
- LED strip type is BEST, will helps making it simply.
- Microphone
(optional): SparkFun Electret Microphone Breakout - BOB-12758 - SparkFun Electronics- Required from v0.2.
Make a square hole by drill and cutter.
Put large side of USB Standard-A(female) to Micro-B(male) short cable to this hole.
Pins assign:
Sensor's Pin | Pro Micro's Pin |
---|---|
MMA8451 VIN | VCC |
MMA8451 GND | GND |
MMA8451 SDA | 2 |
MMA8451 SCL | 3 |
LED strip +5V | VCC |
LED strip GND | GND |
LED strip Din | 10 |
Microphone VCC | VCC |
Microphone GND | GND |
Microphone AUD | A0 |
Note: Current version of mokugyOS does not support microphone listening yet so implementing it is optional.
Do soldering to connect sensors to Pro Micro.
As for NeoPixel LED strip, cut 5 pixels and be careful about signal polarity at soldering (check Din pin's arrow sign direction on the strip).
- Stick LED strip on inner side of Mokugyo using double sided tape.
- Connect USB-MicroB connector to controller.
- Push sensors&controller into Mokugyo.
Look the 3-axis sign on MMA8451 and pay attension at placing this sensor.
Z-axis
: be parallel with hit direction by mallet. Z+ direction is vertically above.
Y-axis
: Y+ direction is facing Mokugyo mouth (groove) from central.
Following instructions below:
sparkfun/Arduino_Boards: Board definitions for SparkFun-manufactured AVR, ARM, and ESP-based Arduino boards.
After board installation, please set options like above on Arduino IDE.
DO SELECT "ATmega32U4 (5V, 16 MHz)", not other one "(3.3V, 8 MHz)".
Additional arduino libraries are below.
Show the repositories here but all of them can be installed by arduino IDE built-in library manager.
- FreeRTOS
feilipu/Arduino_FreeRTOS_Library: A FreeRTOS Library for all Arduino AVR Devices (Uno, Leonardo, Mega, etc)- Note: MUST BE USE VERSION OF 10.4.4-2 OR EARLIER!
NeoPixelBus by Makuna(mokugyOS v0.1 only)
Makuna/NeoPixelBus: An Arduino NeoPixel support library supporting a large variety of individually addressable LEDs. Please refer to the Wiki for more details. Please use the gitter channel to ask questions as the GitHub Issues feature is used for bug tracking.- Adafruit NeoPixel Library (mokugyOS v0.2~)
adafruit/Adafruit_NeoPixel: Arduino library for controlling single-wire LED pixels (NeoPixel, WS2812, etc.) - MIDIUSB
arduino-libraries/MIDIUSB: A MIDI library over USB, based on PluggableUSB - Adafruit MMA8451 Library
adafruit/Adafruit_MMA8451_Library: Arduino library for the MMA8451 Accelerometer sensors in the Adafruit shop- No need install Adafruit Unified Sensor Driver.
ukkz/SutraWriter: EEPROM writer for mokugyOS.
- Connect your Mokugyo to PC with USB cable.
- Clone or ZIP download ukkz/SutraWriter repository.
- Open
SutraWriter.ino
with Arduino IDE. - Open Serial Monitor window, and then click upload button to write sketch into Mokugyo.
- SutraWriter runs immediately. Check Serial Monitor to verify EEPROM data like below:
Clone or ZIP download this repository and upload to your Mokugyo.
All configurable parameters are placed in Config.h
.
Stand up and tilt left or right to change running mode.
Lay down to run the selected mode.
Default mode is "Chanting Keyboard".
LED color | Mode |
---|---|
Blue | Chanting Keyboard |
Yellow | Serial Commander |
Red | MIDI Instrument |
White | Generic Directional Pad |
Orange | Generic Mouse |
Mixed | Game Controller |
About this color variants: Buddhist flag - Wikipedia
Sends sutra phrase per beat as USB HID keyboard.
Sends beating and 4-directional tilting command as USB Serial device.
Sends Note-On and Note-Off messages as USB MIDI device.
Sends beating (Enter key click) and 4-directional tilting (Arrow keys click) as USB HID keyboard.
Sends beating (Mouse left click) and 4-directional tilting (Mouse cursor move) as USB HID mouse.
Sends beating (Mouse left click), X-directional tilting (Horizontal mouse cursor move) and Y-directional tilting (W
key or S
key click) as USB HID keyboard & mouse.
This project is licensed under the MIT License - see the LICENSE.md file for details.