diff --git a/README.md b/README.md index 5bd4d68..f892387 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,29 @@ -Circuit diagram, firmware source code and Romaji table for physical input devices for Google Japanese Input announced on April 1st. +Circuit diagram, firmware source code and Romaji table for physical input devices for Google Japanese Input and Gboard announced on **April 1st**. -Mozc-Morse originates from Google Japanese Input Morse version announced on April 1st 2012. -http://www.google.co.jp/ime/-.-.html +This is not an officially supported Google product. - +# Products +Please refer to the README in each directory for more details. -Mozc-Flap originates from Google Japanese Input Patapata version announced on April 1st 2013. -http://www.google.co.jp/ime/patapata/ +* [Google Japanese Input Morse version](http://www.google.co.jp/ime/-.-.html), [blog post](https://japan.googleblog.com/2012/04/google.html) (Apr 1, 2012) + * /third_party/mozc-morse +* [Google Japanese Input Patapata version](http://www.google.co.jp/ime/patapata/), [blog post](https://japan.googleblog.com/2013/04/google-patapata.html) (Apr 1, 2013) + * /mozc-flap +* [Google Japanese Input Piropiro version](https://www.google.co.jp/ime/___o/), [blog post](https://japan.googleblog.com/2015/04/piropiro.html) (Apr 1, 2015) + * /mozc-piropiro +* [Google Japanese Input Physical Flick version](https://www.google.co.jp/ime/furikku/), [blog post](https://japan.googleblog.com/2016/04/furikku.html) (Apr 1, 2016) + * /mozc-furikku +* [Google Japanese Input Puchi Puchi version](https://landing.google.co.jp/ime/ooooo/), [blog post](https://japan.googleblog.com/2017/04/ooooo.html) (Apr 1, 2017) + * /third_party/mozc-puchi +* [Gboard Physical Handwriting version](https://landing.google.co.jp/tegaki/), [blog post](https://japan.googleblog.com/2018/04/tegaki.html) (Apr 1, 2018) + * /mozc-nazoru +* [Gboard Spoon Bending version](https://landing.google.co.jp/---o/), [blog post](https://japan.googleblog.com/2019/04/mageru.html) (Apr 1, 2019) + * /mozc-mageru for firmware, schematics, and PCB layout. + * /third_party/mozc-mageru for 3D model. - +# Background stories (in Japanese) - -These devices showed in the videos are actually connected to a PC via USB. This project hosts the source code and technical documents of those devices. - -Background stories (in Japanese): * Morse version - http://googledevjp.blogspot.jp/2012/06/google.html * Flip version - http://googledevjp.blogspot.jp/2013/10/google.html - -For Mozc-morse, the romaji table decodes dits-dahs to hiragana. By using resource in this project, you can reproduce a physical morse key and try typing text with Mozc and Google Japanese Input. - + * Physical Handwriting version - https://developers-jp.googleblog.com/2018/04/tegaki.html diff --git a/README.txt b/README.txt deleted file mode 100644 index b0d9f94..0000000 --- a/README.txt +++ /dev/null @@ -1,60 +0,0 @@ -Copyright 2013 Google Inc. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, -MA 02110-1301, USA. - - -===================================== - Summary -===================================== - -Circuit diagram and firmware of physical input devices -for Google Japanese Input. - -This document describes the directory structure of the project. - - -===================================== - Files -===================================== - -* USB Morse Key for Google Japanese Input (2012) -./mozc-morse/ - -* Split-flap display input device for Google Japanese Input (2013) -./mozc-flap/ - -* V-USB library files -./third_party/usbdrv/ - -The directory and files were copied from V-USB files available at -http://www.obdev.at/vusb/ - - -===================================== - Build instructions -===================================== - -See Readme.txt in each directory. - - -================== - References -================== - -The firmwares and circuit diagrams have been developed based on V-USB. - -* V-USB -http://www.obdev.at/vusb/ diff --git a/mozc-mageru/README.md b/mozc-mageru/README.md new file mode 100644 index 0000000..4ac4c41 --- /dev/null +++ b/mozc-mageru/README.md @@ -0,0 +1,83 @@ +# Gboard Spoon Bending Version + +This contains programs, schematics and board layouts for Gboard Spoon Bending Version, which is released on **Apr 1, 2019**. + +This is not an officially supported Google product. + +# Contents + +Directory structure is as follows. + +- wireless/ + - firmware/ + - Firmware for the wireless version. (coming soon) + - board/ + - Schematic and PCB layout made by EAGLE. +- wired/ + - firmware/ + - Arduino sketch for the wired version. +- ../third_party/mozc-mageru/spoon_stl/ + - Spoon shape data for 3D printing. + +# Wired Version + +## The spoon + +Print the spoon under /third_party/mozc-mageru/spoon_stl/ using a 3D printer. +This is an example design of a flexible spoon that has a slot to embed a +flex sensor into. +We have tried it with PLA, but it will probably work with ABS as well. + +## Electronic circuit + +- Arduino Micro +- 22k-ohm resistor +- Flex sensor: FS-L-0055-253-ST (Spectra Symbol) + +``` + Arduino Micro + + 5V ---[22k ohm]-------+ + | + A5 -------------------+ + | + GND ---[Flex sensor]---+ +``` + +## How to use the firmware + +1. Open the sketch on Arduino IDE. +2. Choose "Arduino/Genuino Micro" in the [Tools]-[Board] menu. +3. If you are making Japanse-hiragana version, add ```#define JAPANESE_``` to the first line of the sketch +4. Upload to board. + +## Sensor calibration + +1. Open Serial Monitor. +2. (the home position, which decides when to commit a character) + Bend the sensor slightly and send '0'. Make sure the LED turns off when the spoon is not bent by external force. +3. (the position for the first letter) + Bend the sensor slightly a bit more and send '1'. +4. (the position for the last letter) + Bend the sensor to the end and send '2'. +5. Send 'w' to save the configuration to EEPROM. + +# Wireless Version + +Coming soon. + +# License + +``` +Licensed under the Apache License, Version 2.0 (the "License"); you may +not use this file except in compliance with the License. You may obtain +a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +``` diff --git a/mozc-mageru/wired/firmware/firmware.ino b/mozc-mageru/wired/firmware/firmware.ino new file mode 100644 index 0000000..0b8ec15 --- /dev/null +++ b/mozc-mageru/wired/firmware/firmware.ino @@ -0,0 +1,185 @@ +// +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include + +#ifdef JAPANESE_ + +// Japanese (hiragana) mode. Must be used with romaji input mode. +#define ROWS 5 +#define COLS 10 +#define N_KEYS (ROWS * COLS) + +// clang-format off +const char* characters[N_KEYS] = { + "a", "i", "u", "e", "o", + "ka", "ki", "ku", "ke", "ko", + "sa", "si", "su", "se", "so", + "ta", "ti", "tu", "te", "to", + "na", "ni", "nu", "ne", "no", + "ha", "hi", "hu", "he", "ho", + "ma", "mi", "mu", "me", "mo", + "ya", "ya", "yu", "yu", "yo", + "ra", "ri", "ru", "re", "ro", + "wa", "wo", "nn", ",", "." +}; +// clang-format on + +#else + +// English alphabet mode. +#define N_KEYS 27 +const char* characters[N_KEYS] = {"a", "b", "c", "d", "e", "f", "g", "h", "i", + "j", "k", "l", "m", "n", "o", "p", "q", "r", + "s", "t", "u", "v", "w", "x", "y", "z", " "}; + +#endif + +const int kAnalogInPin = A5; +const int kLedPin = 13; +const uint8_t kMagicNumber = 0xa5; + +// Decay ratio of the low-pass filter for smoothing the sensor input. +// Between 0.0 and 1.0. +const float kFilterDecay = 0.9; + +struct Configuration { + int min; + int max; + int home; +}; + +Configuration config; +float filtered = 0; +float max_bend = 0; +int prev_key = 0; +bool active = false; +bool enable_key_output = true; + +void LoadDefaultConfig() { + config.min = 612; + config.max = 757; + config.home = 580; +} + +void setup() { + Serial.begin(115200); + LoadConfig(); + pinMode(kLedPin, OUTPUT); + digitalWrite(kLedPin, LOW); +} + +void SetupKeyboard() { + enable_key_output = true; + Keyboard.begin(); +} + +void OutputKey(const char* str) { + if (!enable_key_output) { + Serial.print(str); + return; + } + Keyboard.print(str); +} + +uint8_t Checksum(uint8_t initial_value, void* data, size_t size) { + uint8_t result = initial_value; + for (size_t i = 0; i < size; i++) { + result += ((uint8_t*)data)[i]; + } + return result; +} + +void SaveConfig() { + eeprom_write_block(&config, (void*)0, sizeof(config)); + int8_t checksum = Checksum(kMagicNumber, &config, sizeof(config)); + eeprom_write_block(&checksum, sizeof(config), 1); +} + +void LoadConfig() { + eeprom_read_block(&config, (void*)0, sizeof(config)); + uint8_t checksum_in_eeprom; + eeprom_read_block(&checksum_in_eeprom, sizeof(config), 1); + if (Checksum(kMagicNumber, &config, sizeof(config)) != checksum_in_eeprom) { + Serial.print("No data in EEPROM. Loading default config."); + LoadDefaultConfig(); + } + Serial.print("home="); + Serial.print(config.home); + Serial.print(" min="); + Serial.print(config.min); + Serial.print(" max="); + Serial.println(config.max); +} + +void loop() { + int sensor_value = analogRead(kAnalogInPin); + float normalized_bend = + (sensor_value - config.min) / (float)(config.max - config.min); + filtered = (filtered * kFilterDecay + normalized_bend * (1 - kFilterDecay)); + if (Serial.available()) { + int key = Serial.read(); + switch (key) { + // Sensor calibration commands. + case '0': + config.home = sensor_value; + break; + case '1': + config.min = sensor_value; + break; + case '2': + config.max = sensor_value; + break; + case 'w': + SaveConfig(); + break; + case 'r': + LoadConfig(); + break; + + // Other debug commands. + case '!': + SetupKeyboard(); + break; + case ' ': + // Show sensor status for debugging. + Serial.print(sensor_value); + Serial.print("\t"); + Serial.print(normalized_bend); + Serial.print("\t"); + Serial.print(filtered); + Serial.println(); + } + } + if (sensor_value < config.home && active) { + active = false; + filtered = 0; + max_bend = 0; + } else if (filtered > 0) { + max_bend = max(max_bend, filtered); + int new_key = min(N_KEYS - 1, (int)(max_bend * N_KEYS)); + if (new_key != prev_key) { + if (active) { + OutputKey("\b"); + } + OutputKey(characters[new_key]); + prev_key = new_key; + } + active = true; + } + digitalWrite(kLedPin, active); + delay(2); +} diff --git a/mozc-mageru/wireless/board/board-bottom.png b/mozc-mageru/wireless/board/board-bottom.png new file mode 100644 index 0000000..0a6ccf3 Binary files /dev/null and b/mozc-mageru/wireless/board/board-bottom.png differ diff --git a/mozc-mageru/wireless/board/board-top.png b/mozc-mageru/wireless/board/board-top.png new file mode 100644 index 0000000..1340339 Binary files /dev/null and b/mozc-mageru/wireless/board/board-top.png differ diff --git a/mozc-mageru/wireless/board/board.brd b/mozc-mageru/wireless/board/board.brd new file mode 100644 index 0000000..649591b --- /dev/null +++ b/mozc-mageru/wireless/board/board.brd @@ -0,0 +1,927 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +AF2019 +mageru-wireless +ON + + + + + +<b>TAIYO YUDEN tiny BT module</b> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + +Metric Code Size 1005 + + +>NAME +>VALUE + + + + + + +Metric Code Size 1608 + + +>NAME +>VALUE + + + + + + + +>NAME + + + + + + + + + + + + + + +>NAME +>VALUE + + +Metric Code Size 3216 + + +>NAME +>VALUE + + + + + + + + + + + + + + + + + +<b>Design Rules for p-ban.com</b><p> +Material : FR-4<br> +Copper : 35um<br> +Layer: 4<br> +<br> +Design:<br> +Minimum track width/space : 0.127mm<br> +Minimum drill size: 0.3mm<br> +Minimum pad : 0.6mm<br> +<br> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Since Version 8.5, EAGLE supports locking for holes, vias, wires and polygons. +The locking property on all objects of these types will not be understood in this version. + + + diff --git a/mozc-mageru/wireless/board/board.sch b/mozc-mageru/wireless/board/board.sch new file mode 100644 index 0000000..9d07851 --- /dev/null +++ b/mozc-mageru/wireless/board/board.sch @@ -0,0 +1,1742 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<b>TAIYO YUDEN tiny BT module</b> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + +<b>RESISTOR</b><p> +type 0204, grid 5 mm + + +>NAME +>VALUE + + + + + + + + + + + + + + + + + + + + + + +<b>RESISTOR</b><p> +type 0204, grid 7.5 mm + + +>NAME +>VALUE + + + + + + + + + + + + + + + + + + + + + + +<b>RESISTOR</b><p> +type 0204, grid 2.5 mm + + +>NAME +>VALUE + + + + + + +<b>RESISTOR</b><p> +type 0207, grid 10 mm + + +>NAME +>VALUE + + + + + + + + + + + + + + + + + + + + + + +<b>RESISTOR</b><p> +type 0207, grid 12 mm + + +>NAME +>VALUE + + + + + + + + + + + + + + + + + + + + + + + + + + +<b>RESISTOR</b><p> +type 0207, grid 15mm + + +>NAME +>VALUE + + + + + + + + + + + + + + + + + + + + + + + + + + +Metric Code Size 1005 + + +>NAME +>VALUE + + + + + + +Metric Code Size 1608 + + +>NAME +>VALUE + + + + + + +Metric Code Size 2012 + + +>NAME +>VALUE + + + + + + +Metric Code Size 3216 + + +>NAME +>VALUE + + + + + + +Metric Code Size 3225 + + +>NAME +>VALUE + + + + + + +Metric Code Size 4532 + + +>NAME +>VALUE + + + + + + +Metric Code Size 5650 + + +>NAME +>VALUE + + + + + + + + + + + + + + +>NAME +>VALUE + + + + +>NAME +>VALUE + + + + + + +Cement Resistor +Width=48mm, Depth=10mm, Height=10mm + + +>NAME +>VALUE + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + +>NAME + + + +>NAME + + + +>NAME + + + +>NAME + + +<b>SLIDING SWITCH</b><p> +distributor Buerklin, 11G810 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + + + +>NAME +>VALUE + + +<b>CAPACITOR</b><p> +grid 2.5 mm, outline 2.4 x 4.4 mm + + +>NAME +>VALUE + + + + + + + + + + + + + + +<b>CAPACITOR</b><p> +grid 5 mm, outline 2.4 x 4.4 mm + + +>NAME +>VALUE + + + + + + + + + + + + + + + + + + +<b>CAPACITOR</b><p> +grid 7.5 mm, outline 3.2 x 10.3 mm + + +>NAME +>VALUE + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + +>NAME + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + + + + + + + + + +>NAME + + + + + + + + + +>VALUE + + + + + + + +>VALUE + + + + + +>NAME +>VALUE + + + + + + + +>VALUE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<strong>OSXX1608C1A</strong> +<p> +Features: +<ul> +<li>1.6mm x 0.8mm x 0.6mm +<li> Vf @ 5mA +</ul> +</p> +Datasheet is avaliable <a href="http://akizukidenshi.com/download/ds/optosupply/OSXX1608C1A_ver_a_10.pdf">here</a> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<h3>Slide Switch</h3> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<b>SUPPLY SYMBOL</b> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mozc-mageru/wireless/board/schematic.png b/mozc-mageru/wireless/board/schematic.png new file mode 100644 index 0000000..2322ef4 Binary files /dev/null and b/mozc-mageru/wireless/board/schematic.png differ diff --git a/third_party/.gitignore b/third_party/.gitignore new file mode 100644 index 0000000..f002b9f --- /dev/null +++ b/third_party/.gitignore @@ -0,0 +1,27 @@ +# Object files +*.o +*.ko +*.obj +*.elf + +# Libraries +*.lib +*.a +*.la +*.lo + +# Shared objects (inc. Windows DLLs) +*.dll +*.so +*.so.* +*.dylib + +# Executables +*.exe +*.out +*.app +*.i*86 +*.x86_64 +*.hex + +_build diff --git a/third_party/mozc-mageru/spoon_stl/LICENSE b/third_party/mozc-mageru/spoon_stl/LICENSE new file mode 100644 index 0000000..7521d12 --- /dev/null +++ b/third_party/mozc-mageru/spoon_stl/LICENSE @@ -0,0 +1,4 @@ +Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) + +https://creativecommons.org/licenses/by-sa/4.0/ +https://creativecommons.org/licenses/by-sa/4.0/legalcode \ No newline at end of file diff --git a/third_party/mozc-mageru/spoon_stl/README.md b/third_party/mozc-mageru/spoon_stl/README.md new file mode 100644 index 0000000..02a9ab5 --- /dev/null +++ b/third_party/mozc-mageru/spoon_stl/README.md @@ -0,0 +1,7 @@ +A spoon shape file for 3D printing which has a slot to embed flex sensor in. + +- slotted_spoon.stl + +This is a modified version of spoon.stl included in +"Fork, Knife & Spoon" by hacklabnobo +https://www.thingiverse.com/thing:226875 diff --git a/third_party/mozc-mageru/spoon_stl/slotted_spoon.stl b/third_party/mozc-mageru/spoon_stl/slotted_spoon.stl new file mode 100644 index 0000000..9debf7f Binary files /dev/null and b/third_party/mozc-mageru/spoon_stl/slotted_spoon.stl differ