Introduction: Self-clicking Pen

For this project, you will need the following components:

- A pen with a clicking mechanism (with a hole in the top of the clicker preferably)

- A servo

- An Arduino nano or micro

- A Prototype PCB (like this one:

- A button

- A small breadboard

- 5 male/male wires

- 2 female/male

- A resistor (at least 13Ω)

- Glue and blue tack

Here is a video demonstrating how the pen works.

Step 1: Gluing the Components

In this step, we will glue the pen and the servo to the PCB. I used some super glue for this. First, I glued the pen about 2 centimeters from the right side of the PCB. Then I glued the servo so that it was vertically centered and attached to the pen. Ignore for the moment the buttons on the right side of the PCB.

Lastly, in order to make the pen click when the servo motor moves, we will tie a bit of wire to the end of the servo and attach it to the clicker. My pen had a hole in the top of the clicker so I just inserted the wire in there and there was enough resistance to make it stay.

Step 2: Adding the Arduino and Breadboard and the Button

Firstly, we will just insert the Arduino into the breadboard and then stick the breadboard to the left of the servo motor as you can see in the first image. Ignore for the moment the wires that are attached to the breadboard.

Now, we are going to add the button that will, when clicked, activate the clicker of the pen. This button will be located where your index usually meets the pen (image 2). First, let's solder two wires to the button that will be connected to the Arduino later. Strip the female end of the wire and solder that to a pin of the button. Do the same for the second pin of the button that is located on the same side of the button as the fist pin. You can now stick the button as shown in the image 2 with some blue tack (or some glue if you wish).

Step 3: Wiring

We can now connect all the wires to the Arduino before uploading the code. Start by connecting the VCC (red wire) of the servo to 5v on the Arduino and the ground (black wire) of the servo to ground on the Arduino. Then, the third wire of the servo (probably white) should be connected to the D9 (digital 9) pin on the Arduino.

For the button, one wire should be connected to 5v on the Arduino and the other wire to D7 (digital 7). The role of each wire of the button doesn't matter. And to finish the wiring, connect the resistor (at least 13Ω) between D7 and ground. This is so that the D7 pin doesn't receive any other charges from the breadboard or even the air which would make the Arduino think that digitalRead(7) is equal to HIGH (if you don't understand this, it doesn't matter because I don't really anyway)

Step 4: Code

Download the code and upload it to your Arduino. You may have to tweak the angles to get the pen to click but you should normally have a self-clicking pen!

Step 5: Going Further

Here are some ideas if you wish to go further with this project:

- Adding a 9v battery to make the pen portable. All you have to to is connect the 9v to the VIN pin on the Arduino and the ground to the ground on your Arduino

- Adding extra buttons that can accomplish other tasks. On the small space left on the right side of the PCB, you could solder some other buttons. I have already done this and you can see it in the image of the first step. - If you are using an Arduino micro like me, you could make use of its capability to simulate a keyboard and mouse to make it into a hacking tool. Here is a youtube video demonstrating this:

If you enjoyed this project, please vote for it in the microcontroller contest! Thanks! :)

Microcontroller Contest 2017

Participated in the
Microcontroller Contest 2017