Close
0%
0%

PastePal

A simple two-button macropad for copy and paste commands, we have added a display that outputs the keypress.

Similar projects worth following
Greetings everyone and welcome back.

Introducing PastePal, a miniature macropad featuring two buttons and a display. One button is designated for the copy command, while the other is used for the paste command. Which command is selected is shown on the display.
Here, we are using a straightforward circuit made up of an SSD1306 128x32 display, two SMD push buttons, and a Seeed XIAO SAMD21 microcontroller.

Three layers were used to prepare the device: the top layer, which acts as a cover and switch holder; the mid layer, which houses the electronics, which includes the display, XIAO, and switches; and the bottom layer, which is added to the structure to add a little height.

Design

In the beginning, we built the PastPal model utilizing three PCB layers stacked together with eight PCB STANDOFFS: four for connecting the top layer to the mid layer and another four for connecting the mid layer to the base layer.

Three openings have been made on the top layer: two are for the addition of the switch actuator, and one is for the display.

The mid layer has an XIAO microcontroller on the bottom face of the board and SMD switches and a display on the top face.

To enclose the model from the bottom, there is a third layer dubbed the bottom layer.

The switch actuators are modeled and positioned between the switch actuator slots on the top layer and on top of the SMD switch knob.

Since the switch actuator and the switch knob are positioned exactly on top of one another, pressing the switch actuator also presses the knob, resulting in a registered switch click.

PCB Design

The PCB design for this project was quite easy to interpret; we included an XIAO SAMD21 Microcontroller, whose D0 and D1 I/O Pins are used to connect it to two SMD switches. Additionally, we integrated an OLED display using XIAO's I2C Pins.

Since the SAMD21 microcontroller inside the XIAO is registered as a human interface device (HID), we can create a tiny two-switch keyboard using the Arduino keyboard library.

We made two boards using the model's dimensions: the top layer board and the mid layer board. Since the mid layer board and the bottom layer have the same outline and mounting holes, we will use it for the bottom layer.

HQ NextPCB Service

After completing the PCB design, we export the Gerber data and send it to HQ NextPCB for samples.

For the mid and top layer boards, two orders were placed. We ordered Black Solder mask with White Screen for the Mid and Top Layer Board.

After placing the order, the PCBs were received within a week, and the PCB quality was pretty great.

In addition, I have to bring in HQDFM to you, which helped me a lot through many projects. Huaqiu’s in-house engineers developed the free Design for Manufacturing software, HQDFM, revolutionizing how PCB designers visualize and verify their designs.

HQDFM: Free Online Gerber Viewer and DFM Analysis Tool

Also, NextPCB has its own Gerber Viewer and DFM analysis software.

Your designs are improved by their HQDFM software (DFM) services. Since I find it annoying to have to wait around for DFM reports from manufacturers, HQDFM is the most efficient method for performing a pre-event self-check.

Here is what online Gerber Viewer shows me. Would not be more clear. However, for full function, like DFM analysis for PCBA, you, need to download the software. The online version only provides a simple PCB DFM report.

With comprehensive Design for Manufacture (DFM) analysis features, HQDFM is a free, sophisticated online PCB Gerber file viewer.

It provides insights into advanced manufacturing by utilizing over 15 years of industry expertise. You guys can check out HQ NextPCB if you want great PCB service at an affordable rate.

SCH.pdf

Adobe Portable Document Format - 155.48 kB - 09/28/2024 at 08:32

Preview

Micropad v6.step

step - 413.37 kB - 09/28/2024 at 08:32

Download

Micropad v6.f3d

fusion - 1.03 MB - 09/28/2024 at 08:32

Download

SW.stl

Standard Tesselated Geometry - 202.62 kB - 09/28/2024 at 08:32

Download

  • 1
    PCB Assembly Process
    • Using a solder paste dispenser needle, we begin the PCB assembly process by putting solder paste on each component pad.
    • Next, we pick and place the SMD Switch in its location using an ESD Tweezer.
    • Subsequently, we remove the board and set it on our Reflow Hotplate, which raises the PCB's temperature from below to the point at which the solder paste melts and the SMD components are all connected to their pads.
    • We attached the pads of the two CON7 Female Header Pin connectors that we inserted from the back side of the PCB to the location of the XIAO Microcontroller.
    • We soldered the OLED into place after adding it from the top side.

    Board assembly is now complete.

  • 2
    Layer Assembly process
    • Connecting the 9mm PCB standoffs to the top layer of the board via its four mounting holes is how we begin the layer assembly procedure.
    • Next, we placed XIAO in its proper spot on the bottom side of the Mid Board.
    • The top layer board was flipped, and the two 3D printed switches were inserted into their designated slots. Next, the mid layer was positioned from the bottom of the top layer, and the top and mid layer boards were joined together using four 12mm PCB standoffs.
    • Finally, we position the bottom layer PCB on the standoffs connecting it to the mid layer and fasten it in place with four M3 bolts.

    Assembly is now completed.

  • 3
    Main Code

    Here's the code we used in this project and its a simple one.

    #include <Wire.h>
    #include <Adafruit_GFX.h>
    #include <Adafruit_SSD1306.h>
    #include <Keyboard.h>
    #define SCREEN_WIDTH 128
    #define SCREEN_HEIGHT 32
    #define OLED_RESET    -1
    Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
    const int buttonCopyPin = 1; // Pin for the copy button
    const int buttonPastePin = 0; // Pin for the paste button
    void setup() {
    // Initialize the OLED display
    if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
    Serial.println(F("SSD1306 allocation failed"));
    for(;;);
    }
    display.display();
    delay(2000);
    display.clearDisplay();
    // Initialize the buttons
    pinMode(buttonCopyPin, INPUT_PULLUP);
    pinMode(buttonPastePin, INPUT_PULLUP);
    // Initialize the Keyboard library
    Keyboard.begin();
    }
    void loop() {
    if (digitalRead(buttonCopyPin) == LOW) {
    display.clearDisplay();
    display.setTextSize(3);
    display.setTextColor(SSD1306_WHITE);
    display.setCursor(20, 5);
    display.print("Copy");
    display.display();
    Keyboard.press(KEY_LEFT_CTRL);
    Keyboard.press('c');
    delay(100);
    Keyboard.releaseAll();
    delay(500); // Debounce delay
    }
    if (digitalRead(buttonPastePin) == LOW) {
    display.clearDisplay();
    display.setTextSize(3);
    display.setTextColor(SSD1306_WHITE);
    display.setCursor(20, 5);
    display.print("Paste");
    display.display();
    Keyboard.press(KEY_LEFT_CTRL);
    Keyboard.press('v');
    delay(100);
    Keyboard.releaseAll();
    delay(500); // Debounce delay
    }
    }

    This sketch uses the Adafruit_SSD1306 library to control a small OLED screen and the Keyboard library to send keyboard inputs. Here, this macropad sends copy (Ctrl + C) and paste (Ctrl + V) commands when the respective buttons are pressed. The OLED display is used to show "Copy" or "Paste" for visual feedback whenever the respective button is pressed.

View all 4 instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates