Creating an interactive drawing with arduino

I have to develop new arduino projects each week for my young pupil, who is passionate about electronics and hardware. For that, I found our last project creative and interesting, and I bet some of you can use it as a geek experiment.

What we need here is graphite based pencils (or directly graphite, works better), arduino, resistors, a led, a metallic clip, and a white regular paper. How does it works?

First we should know how this works. In arduino, we can use several sensors as INPUTS, such as a button, a light sensor, an humidity sensor, etc. But we can also attach home-made INPUTS using conductor materials. Steel and metal are common conductors materials (you can try this experiment with a coin, too) and so is graphite .

For making this work in arduino, we are using a special library called CapacitiveSensor04 . Once our library is added, we can start designing the circuit. This is an example with steel paper, works the same with graphite. Only draw something (very dense), attach a paper clip to the drawing (be careful, it should be a single-line drawing) and a cable to the paper pin, which is the one connected to the resistor + 4 and 2 pins.

And this is our code:

CapacitiveSensor capSensor = CapacitiveSensor(4,2);

int threshold = 1000;
const int ledPin = 12;

void setup() {

    pinMode(ledPin, OUTPUT);


void loop() {

    long sensorValue = capSensor.capacitiveSensor(30);
    if(sensorValue > threshold) {
        digitalWrite(ledPin, HIGH);
    else {
        digitalWrite(ledPin, LOW);


We might have to calibrate the threshold, in which case you will only have to open the Monitor and test. And… tadaah! interactive drawing hat lights a led. You can now do other things. Just experiment!

In case you are a tutor, teacher or parent, here ‘s the content of my class in spanish ready for the students (answers, incomplete code for them and complete code with comments for the teachers and activities).


ESP32 Arduino Websocket server: Receiving and pars... The objective of this post is to explain how to receive and parse a JSON message on a Websocket Server running on the ESP32. We will use the Arduino ...
10 Things You Always Wanted to Know About Arduino Arduino is one of the best geeky hobbies you can learn 17 Geeky DIY Hobbies You Can Learn in a Small Space 17 Geeky DIY Hobbies You Can Learn ...
Arduino Watering System: Update This is just an update on the Arduino watering system, everything seems to be going well whilst I am away (I am away for ~a month, till the end of Bla...
The LittleBits Code Kit is an easy way to play (an... I’m not a fan of educational toys. They’re usually either too educational or too toy-like and, in the end, kids get little education and little...
The $20 Nano Is the Cheapest Arduino, But Is It Wo... While there is quite an array of Arduino boards to choose from Arduino Buying Guide: Which Board Should You Get? Arduino Buying Guide: Which B...
The Practical Developer责编内容来自:The Practical Developer (源链) | 更多关于

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » Creating an interactive drawing with arduino

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录