Touch-sensitive Pencil Art With RGB Light and Pico Synthesizer

by tjaap in Circuits > Art

721 Views, 9 Favorites, 0 Comments

Touch-sensitive Pencil Art With RGB Light and Pico Synthesizer

drawing2.jpg
IMG_20241011_170911.jpg
Touch-sensitive pencil art

Using a Raspberry Pico microcontroller you can make anything touch-sensitive, from plants and fruit to metal sculptures and... pencil drawings. If you also connect an RGB LED and a loudspeaker, you will have a real interactive art installation that is visually and audibly loud :-)

I started this project as a way to show art students how easy and fun making art with electronics can be. As an introduction workshop I have them make these interactive artworks during a two-hour workshop. This Instructable is basically the step-by-step guide they have been following (see the PDF attached to this step). All of the students told me they thought it was great fun :-)

If you look at Sofia Aronovs interactive painting 'Awake' you can see what great art is possible with this technique.

Supplies

supplies.jpg

This is what you need to make your own touch-sensitive artwork:

  1. Raspberry Pi Pico with pin headers
  2. breadboard (half-size)
  3. 4x 1MegaOhm resistor
  4. 3x M-M jumper wire (preferably one red, two black)
  5. loudspeaker with an audio jack
  6. 3x AA batteries in a battery holder (I crimped connectors to the battery pack's wires that push directly into the breadboard, but with a bit of care their thinner wires can be pushed into the breadboard too).
  7. 6x alligator to male jumper cables
  8. Neopixel LED (through-hole 8mm)
  9. paper


You also need a graphite pencil or graphite crayon that is as soft as possible, so 9B or 12B. Soft means there is a lot of graphite in the pencil. Graphite, a form of carbon, conducts electricity well. Harder pencils also contain clay, which is not conductive.

To put the software on the Pico you also need

  1. a computer
  2. USB cable for the Pico (USB-A to micro-USB).

Using a Raspberry Pi Pico on a Breadboard

pico_breadboard.png
F27WS8WM23B8D70.png

To make things touch-sensitive, we will use this green circuit board, a Pico microcontroller. It has a lot of pins on its sides. As you can see in the schematic, some pins have specific functions like input/output of power (those are marked red) and some are ‘general purpose’ (the green labels). Those can be used to connect lots of electronic components like sensors or motors.

The breadboard is the white thing with all the small holes. The holes on the breadboard are connected to each other in rows of five, like the ones in the orange rectangle in the schematic.

If we want to connect wires and components to each other, we only have to push them into holes on the same row.

The holes along the red and blue lines are connected to each other vertically. Red is for plus and blue for minus, like on a battery.

Most breadboards have numbered rows. Place the breadboard in front of you with the 1s at the top. Go ahead and push the Pico into the breadboard in exactly the same position as in the schematic: two holes on either side of the Pico and no free holes above it. (The other parts in the schematic we will add to the breadboard in a moment.)

Putting the Software on the Pico

picos.png
Pico_USB.png
thonny.png

When doing my workshop I prepare a Pico by flashing the software on it and pushing it into a breadboard. Participants only have to make drawings, connect everything up and have fun. You will have to do it yourself :-)

First step is to connect the USB cable to the Pico. Push and hold the white 'BOOTSEL' button on the Pico while you insert the other end of the USB cable into your computer. When the cable is in you can let go of the button.

Pico should now show up as a flash drive named 'CIRCUITPY'.


Now you have two options. The easiest is to flash your Pico with my fully prepared UF2 file, but it only works if you are using a Pico that does not have wi-fi (those have a metal square on them).

If you have a 'regular' Pico, then download the UF2 file here. Once downloaded onto your computer, copy it to the Pico drive, wait for the Pico to eject itself and you are done.


Flashing Circuitpython

If that does not work for you, you can also flash your Pico with Circuitpython and put all libraries and files on it yourself.

Download the Thonny software, install it and start it.

In the bottom right-hand corner of the Thonny window, you will see the current version of Python Thonny is using. Click on it and choose ‘Install CircuitPython’ from the list that appears. If you don’t see this option, check that your Raspberry Pi Pico is plugged in.

In the next screen, it should say ‘RPI-RP2’ as the target volume. Set the CicuitPython variant to ‘Pico/Pico H’ (or ‘Pico W/Pico WH’ if you have that one) and click ‘Install’. Wait until it is done and then click ‘Close’. Now you should be able to select 'CircuitPython (Raspberry Pi Pico)’ from the list.

Now download the zip-file from here to your computer. Unzip it and copy the contents to the Pico.

The last thing to do is to delete the file 'code.py' from the Pico. After that you can unplug it.

Start Drawing!

IMG_20241011_162320.jpg
image8-28.png

Let’s start with drawing a first ‘button’. It can be a simple shape. Leave room for three more drawings.

It should go to the edge of the paper so you can connect an alligator cable to it, like in the photo.

Put the graphite on really thick. Basically you are drawing electrical wires: if you make lines that are too thin then the drawing will not form a good connection to the microcontroller.

Connecting the First Drawing

IMG_20241011_162339.jpg
Pico synth_GP15-80.png

Make all connections just like in the schematic:

  1. Get a crocodile cable with a male connector. Push its pin into the breadboard, right next to the last pin on the left side of the Pico
  2. Push one leg of a resistor (the stripey thingie) in the same row
  3. Push the resistor’s other leg in one of the holes next to the blue line
  4. Use a male-male wire (preferably black or blue) to connect both blue line columns of the breadboard with each other. Make sure NOT to put it into a hole next to the red line!
  5. Clamp the alligator cable coming from your breadboard onto the drawing.

Powering the Pico

Scherm­afbeelding 2024-10-11 om 09.55.48.png
blink.gif
Scherm­afbeelding 2024-10-11 om 09.54.56.png

One way to power the Pico is using a battery pack (one with 3 AA batteries). We will connect it to the Pico via the power rails on the sides of the breadboard.

MAKE SURE YOU GET THE FOLLOWING RIGHT or the Pico might break:

  1. use one jumper wire (preferably a black one) to connect a GND pin (third pin from the top right of the Pico) to the blue column on the breadboard.
  2. use another jumper wire (preferably red) to connect the VSYS pin (second pin from the top-right) to the red column on the breadboard.
  3. connect the red wire from the battery pack to a hole next to the red line on the breadboard
  4. the black wire should go to a hole somewhere next to the blue line.

If you hadn't already, push the batteries into the battery pack. Their flat sides go onto the springs.

Once it gets power, the LED light on the Pico should blink a few times. If it doesn’t, then check if all wires are in the right columns and rows.

Now you should be able to touch your drawing and see the LED on the board change when you do!

Adding More Touch-sensitive Drawings

heks.jpg
Pico synth_battery-84.png
IMG_20241011_162326.jpg

Let’s add three more touch-sensitive areas to your artwork.

First, take out one wire of the battery for a second (make sure that wire does not touch the Pico or something else).

Add three sets of resistors and cables to the breadboard, like in this schematic. The new resistors connect the 1st pin, the 7th and the 12th pin of the Pico to the blue line. (Those numbers are also printed on the breadboard.)

Now draw the extra ‘buttons’. Your drawing can be anything, as long as there are four separate parts in total. The parts should have at least one finger’s width between them.

Each part needs a connection to the edge so you can connect an alligator cable to it. It’s easiest if all of them start at the same side of the paper, or you will need more/longer cables.

Once you have made the drawings, connect the alligator clamps to them.

Power up the Pico again by putting the wire from the battery pack back in.

Now test if the new parts work! Each pin should have the on-board LED blink in different patterns. (Check all connections if not all drawings make the LED blink. The top-left pin of the Pico may only sense touching when you are also touching the Pico's USB connector at the same time. More on that later.)

More Colour!

neopixel_o.gif
Neopixel_LED-filtered-92.jpeg

We can make your interactive artwork more interesting by adding another output: a Neopixel LED. It will be able to respond to each separate part of your drawing with different colours!

Take one of the wires from the battery out of the breadboard (make sure they do not touch the Pico or other things while you continue).

The Neopixel LED has four legs. You may have to bend them a little to fit the breadboard. Hold the LED in front of you so the longest leg is the third one.

Push the LED into the breadboard so that

  1. the first leg (the left one) is in the same row as pin 14 of the Pico,
  2. the second leg is in the red column,
  3. the third (longest) leg is in the blue column.
  4. The last leg we will not use, so just bend it so it sticks out over the edge of the breadboard.
  5. Double-check to see if the legs of the LED are not touching each other.


Re-attach the battery. Once the Pico has started up (wait for the blinks), touching your touch-sensitive drawing should now make you see colours! Holding the drawing for longer changes the lights (again, for the drawing connected to the top-left pin you may also need to touch the USB connector).

Making Sounds

audio_plug-96.jpg
Scherm­afbeelding 2024-10-11 om 09.57.12.png

Let's try a different output: sound! We'll connect a small amplified speaker to the Pico.

  1. Take two cables with alligator clips on one end and male connectors on the other end.
  2. Connect one alligator clip to the top of the plug from the speaker and one to the bottom part, like in the photo.
  3. Take the other end of the cable connected to the tip of the plug and push it into the breadboard, in the row next to the bottom right pin of the Pico.
  4. Plug the other cable into a hole next to the blue line.
  5. Turn the speaker on. You should now hear different sounds when you touch your drawing!


Pressure-sensitive

The drawing you connected to the top-left pin is not just touch-sensitive but also pressure-sensitive. Or rather, the sound changes with how much of your skin is in contact with the drawing.

You may need to touch the USB connector at the same time as touching the drawing, because this part is more sensitive and needs a good ground connection.

So How Does This All Work??

The way this works is called 'capacitive touch'. It's an electronics trick that relies on our bodies being able to store a tiny bit of electricity. What happens is that the Pico's software is turning the power on on each of those pins that we are using. It then immediately turns the power off again. We have connected these pins to ground, which is another word for the minus of the battery, via large resistors. I mean, the resistors are very small, but we are using resistors with a very high value resistance value of 1 million Ohms. They resist the flow of electricity going from the Pico's pins to ground, so after the pins turn off it takes a while for the electric charge to flow away and for the pin to be fully 'empty'.

Now if we touch a pin, or our drawing that is connected to that pin, then our bodies store a bit of electric charge too when the pin is 'on'. That means that when the pin turns off when we are touching, there is more electricity to flow away and it takes even longer before the pin is completely off. (This is all happening many, many times a second because the Pico is very fast.) The Pico is timing how long it takes for the pin to empty out, and based on that duration it knows the difference between someone touching the pins or not.

What's Next?

image10-43.png

Did you have fun making your drawing touch-sensitive? If so, then you might be happy to know that there are a lot more things you can turn into interactive artworks by making them touch-sensitive.

You can make your own conductive paint and put it on anything you can think of. You could also use copper tape, metal wire, tin foil or even conductive fabric.

Water and metal objects also conduct electricity, so those work well too. Plants and flowers contain a lot of water, so you can even make plants touch-sensitive! See this video of a singing plant by Mads Hobye (the photo at this step is also from his Instructable).

In addition to all those inputs, there is also a world of possible outputs. You can project an animation onto a drawing or painting, just like in the aforementioned artwork Awake (Sofia used the Processing programming language to make the wonderful animations that are projected on the painting). You could also have a video start and stop when people touch something, or lights turn on or off, or mechanics start to move, or a smoke machine starts…