Home Consumer Electronics Make A Easy Capacitive Contact Keyboard With Arduino | DIY Challenge

Make A Easy Capacitive Contact Keyboard With Arduino | DIY Challenge


Sure shortcuts in your keyboard akin to copy, paste or print can positively simplify your work. And what in the event you can create these completely different keyboard operations by yourself? Have you ever ever thought of this?

This straightforward DIY challenge explains how one can make a conveyable machine that performs completely different keyboard operations like copy and house bar. It’s a small single keypad machine that works on Arduino and capacitive contact sensor. The sensor may be made utilizing any metallic object like aluminium foil, coin, and so forth. The creator’s prototype wired on a breadboard is proven in Fig. 1.

Author’s prototype wired on a breadboard
Fig. 1: Creator’s prototype wired on a breadboard

{Hardware} elements embrace Arduino Micro, 1-mega-ohm resistor, jumper wires, and aluminium foil.

Arduino Micro is the smallest board of the household of ATmega32U4 Arduino. It’s simple to combine with on a regular basis objects to make them interactive. It’s based mostly on the ATmega32U4 microcontroller (MCU) that includes a built-in USB, which makes the Micro recognisable as a mouse or keyboard. Be aware that you need to use solely the Arduino boards that use ATmega32U4 akin to Micro, Leonardo, Leonardo ETH, and so forth.

Circuit and dealing

The circuit diagram of the capacitive contact keyboard utilizing Arduino is proven in Fig. 2. Digital pins 2 and 4 of Arduino are used to interface with the sensor.

Circuit diagram of the capacitive touch keyboard
Fig. 2: Circuit diagram of the capacitive contact keyboard

The sensor setup features a medium to high-value resistor, some jumper wires, a small piece of aluminum foil. You should use any resistor worth between 100-kilo-ohm and 50-mega-ohm. Be aware that at greater resistor worth, it behaves like a proximity sensor.

The circuit requires a capacitive sensor library in Arduino IDE. The library turns two or extra Arduino pins right into a capacitive sensor, which may sense {the electrical} capacitance of the human physique. Capacitive sensor can detect something that’s conductive or that has a considerably completely different permittivity than air, such because the human physique or hand.

The challenge was examined utilizing a 1-mega-ohm resistor. If you’re utilizing a distinct resistor worth, use this system (capturing_sensor_value.ino) to seek out the sensor worth earlier than importing the primary Arduino sketch to Arduino board.

Software program program

Software program is written in Arduino programming language. The capturing_sensor_value.ino code is used to decode the sensor worth. The copy_operation.ino code is used for copy operation and the space_bar.ino code is used for house bar operation on the capacitive contact keyboard.

After putting in Arduino IDE in your PC, launch Arduino IDE Software program, join Arduino Micro to your PC, choose the board (Arduino/Genuino Micro) and COM port. Then set up capacitive sensor library, which may be downloaded from the hyperlink https://github.com/arduino-libraries/CapacitiveSensor/zipball/grasp

For acquiring the sensor values, open capturing_sensor_value.ino from Arduino IDE, compile and add to Arduino board with the sensor linked to the board. Subsequent, open serial monitor of Arduino IDE and observe the values. The default sensor values obtained on the serial monitor with out touching the sensor are proven in Fig. 3.

Sensor values without touching sensor
Fig. 3: Sensor values with out touching sensor

Everytime you contact the sensor, the worth will increase. With 1-mega-ohm resistor, at each contact, the sensor worth goes up by 1000. So, a situation assertion in Arduino sketch is used such that each time sensor worth goes over 1000, a keyboard operation is carried out.
Sensor values after touching the sensor are proven in Fig. 4. You may change the sensor values by altering the resistor worth and use appropriate sensor values in the primary codes (copy_operation.ino and space_bar.ino)

Sensor values after touching sensor
Fig. 4: Sensor values after touching sensor

Obtain Source Code

Testing steps

  1. Add capturing_sensor_value.ino code to Arduino board
  2. Open the serial monitor and observe the values with and with out touching the sensor. Whenever you contact the sensor, the worth is available in between 3700 and 4052 as proven in Fig. 4. For instance, allow us to take a price of 3800.
  3. Subsequent, open copy_operation.ino code, insert the worth 3800 on this code as sensor1 3800. Compile and add it to Arduino board
  4. Now open any doc file. Choose a line of textual content from this doc file. Whenever you contact the sensor it can carry out the copy operation, equal to ctrl+c operation on the traditional keyboard.
  5. Equally, open space_bar.ino code and use 1000 within the code as sensor1 1000 and Keyboard.write(32) for house bar operation. After compiling and importing the code into the Arduino board, contact the sensor. It performs house bar operation by merely transferring the cursor in the direction of proper on every contact.

Amal Mathew is an electronics hobbyist


Please enter your comment!
Please enter your name here