Introduction: Key-Macro

About: I am a professor at the Faculty of Sciences of the National Autonomous University of Mexico. I teach Computational Physics and Basic Computing. My students and I have a lot of fun with Arduino!

This project consists of an auxiliary eight key keyboard that sends macros (text strings) to the computer. Up to 64 macros can be previously stored in a text file saved in a microSD card. These macros are organized in eight pages which can be selected with a keys combination.

One of the 3D printed parts of this project is based on:

0.96" 128x64 OLED Snapfit case by TAz00, licensed under the Creative Commons -Attribution license. https://www.thingiverse.com/thing:2176764

Step 1: Components:

    You will need the following:

  • Pro Micro Leonardo Atmega32u4 Arduino.
  • Oled Display Module Ssd1306 0.96” 128 × 64.
  • Micro Sd Card Reader.
  • TTP226 Capacitive Touch Sensor Module.
  • 2× Push Button Micro Switch 6 × 6 × 9 mm
  • 3D printed case (4 parts).

Step 2: Wiring

Connect the pins of the components to Arduino as follows:

  1. Push Buttons:
    • SEL to Arduino GND and A2
    • RES to Arduino GND and RST
  2. SD Reader:
    • CS to Arduino D10
    • MISO to Arduino D14
    • SCK to Arduino D15
    • MOSI to Arduino D16
    • Vcc to Arduino Vcc
    • GND to Arduino GND
  3. Touch Sensor Module:
    • From OUT 8 to 1 to Arduino D4, D5, D6, D7, D8, D9, A1, A0 (in this sequence).
    • Vcc to Arduino Vcc
    • GND to Arduino GND
  4. OLED Display:
    • SDA to Arduino D2
    • SCL to Arduino D3
    • Vcc to Arduino Vcc
    • GND to Arduino GND

I recommend following this sequence to solder the components. This makes the wiring process easier.

Step 3: Assembling

Once all the components are wired, fit and glue the push buttons into place, as well as the touch-sensor module and the Arduino to the 3D-printed base. Then, do the same with the keyboard cover and fit the MicroSD reader and its cover to the same piece. Finally, fit and glue the OLED display to the lid and glue it to the keyboard cover.

Step 4: The Arduino Sketch

The sketch works with English keyboards. The Spanish version will be available soon!

Attachments

Step 5: The Macros Text File

The file with the macros (macros.txt) must be stored in the MicroSD card and organized as follows:

-/Page1/-NamePage1
-/Macro1/-NameMacro1
.
.
-/Macro2/-NameMacro2
.
.
-/Macro3/-NameMacro3
.
.
-/Page2/-NamePage2
-/Macro1/-NameMacro1
.
.
-/Page8/-NamePage8
-/Macro8/-NameMacro8
.

The names of macros and pages are optional and only appears in the OLED display to identify these. If you omit the macro name, the first characters of it will appear.

You can download the macros.txt file as an example of common macros for LaTeX, Arduino, C, and Python.

Step 6: How to Use the KeyMacro:

Connect the Key-Macro to the USB port of the computer using a micro USB cable. The computer will recognize it as a keyboard. Press the Select button of the Key-Macro and wait until the screen is updated, then press a page number on the touch keyboard. The list of macros in the selected page will appear on the display. Press a number on the touch keyboard and the Key-Macro will send the string to the computer. To change the macros page, press the Select button followed by the number of the desired page.

First Time Author Contest 2018

Participated in the
First Time Author Contest 2018