Close
0%
0%

Arduino Macro Keyboard

Maximising efficiency.

Similar projects worth following
Our usage of computers has drastically increased over the past few years and with the ever-expanding internet the time we spend with technology will only increase. Yet, even our advanced technology can still be improved. The keyboard shortcut to take a screenshot consists of 3 buttons but what if we could reduce it down to one ? So, I decided to build a macro keyboard.

Basic functioning of this project : 

The macro keyboard consists of 6 mechanical switched which can be reprogrammed to execute any task at a click of a button. 

More about this project :

The idea for this project first came to me when I was attending online meetings. During all my meetings I tend to take several screenshots and it eventually became extremely tedious to press CTRL + SHIFT + 3 each time I had to take a screenshot. So, I decided to build a macro keyboard which would allow me to take a screenshot with the click of a single button.

I have used the other keys to carry out functions such as copy, paste, select all, save and undo. However, these keys can also be programmed to type "yes" or "no" with the press of a single button and this would be quite handy for online meetings. Furthermore, this could be used by gamers or streamers to increase productivity. 

I have used the arduino pro micro board for this project. I decided to use mechanical switches as they feel extremely comfortable and they give a satisfying "click" when they are pressed. 

  • 1 × arduino pro micro
  • 6 × Mechanical keyboard switches (blue)
  • 6 × Mechanical keyboard keycaps

  • Final Model

    Xtreme Tech12/10/2021 at 18:45 0 comments

    Finally transferred everything on to a perf board !  For the final model I used mechanical keyboard switches and keycaps.

  • The Code

    Xtreme Tech11/07/2021 at 17:20 0 comments

    The code was very simple. The first thing I did was install the keyboard library and include it into my code. Next I initialised the buttons and under void start( ) I set up the buttons and joystick. To actually make the button carry out their respective tasks I used 3 functions:

    1. Keyboard.press( )

    This function just presses the specific key that you mention in the brackets. For instance, Keyboard.press(KEY_LEFT_GUI) presses the left command button (on mac).

    2.Keyboard.write( )

    This function not only presses but also writes the specified key. This function is mostly used to press and write any letter, number or symbol on your keyboard. Like, Keyboard.write('c') writes the letter c on your screen by pressing that key. While the Keyboard.press( ) function is usually used for keys that do not write anything on your screen, like the shift and command/control keys.

    3. Keyboard.releaseAll( )

    This function releases all the keys that have been previously pressed. The Keyboard.press( ) function does what the name suggests, it only presses keys. These keys will not be released until the Keyboard.releaseAll( ) has been called too.

    To build this macro keyboard I coded all the buttons using an if statement ( in the void loop( ) ) as shown below:

    I would like to point out that I have added a delay(200) at the end of the block of code in each if statement. This is to make sure that when I press the button, the if statement does not get executed multiple times. With the delay( ) function I am able to place a time buffer to compensate for the time we spend while pressing a button. This way when the button is pressed once the statements are only executed once. The amount of time you want to delay your code by is completely customisable. Here I have delayed it by 200 milliseconds.

  • First breadboard model !

    Xtreme Tech10/17/2021 at 04:53 0 comments

    I just finished my first breadboard model for the macro keyboard. I have used the arduino pro micro board, 4 tactile push buttons and 1 joystick. In this model I have coded 4 buttons; one for copy, one for paste, one for save and finally one for taking a screenshot of your full screen. 

    The code was simple, all I used was the Keyboard.press() function to press the required keys, Keyboard.write() function to write certain keys and the Keyboard.releaseAll() function to release all the pressed keys. However, one of the problems I faced was that only my copy button was working and no other button seemed to function. I soon realised that was because I wrote Keyboard.press(KEY_LEFT_CTRL) when I was suppose to write Keyboard.press(KEY_LEFT_GUI) because I was using a mac. After I changed that everything worked fine. So, if you want to build this macro keyboard for a mac then your command button would be 'KEY_LEFT_GUI' and if you want to build this for windows then your control button would be 'KEY_LEFT_CTRL'.

    Furthermore, I coded the joystick to act as my arrow keys.

    My next step would be to transfer all of this onto a perf board and solder them there and I will probably dive deeper into the code in my next log !

View all 3 project logs

Enjoy this project?

Share

Discussions

dearuserhron wrote 04/17/2022 at 09:17 point

Good job. Every hacker should make a custom keyboard. I did #Wrong keyboard 

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

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