Introduction: Arduino Capacitive Interactive Touch Map

This is a smart map which can help people navigate complex places and maximize their time. It also can help reduce labor cost because it works automatically. It is more convenient than a paper map for anyone who wants to get to a specific location quickly in a place that is dizzying and disorienting, such as amusement parks or university campuses. Also, it is more environmentally friendly since paper maps will no longer be needed. I will use our school as an example because of it's complicated, mountainous campus and its unclear signage which often makes navigating between buildings confusing. Thus, this Touch Map can help. In addition to school campuses, this map can be used for many other purposes, like large seminars and exhibitions. You just need to have a bird's-eye view of the place and knowledge of the useable paths.

Step 1: Material: What Will You Need...

Make sure to purchase all the necessary materials before you start the project. However, you can use other materials to help you and you can also use different tools to achieve the same purpose.
Materials are listed below:

  • A4 thick cardboard*2(21cm*29.7cm)
  • 29.7cm*7cm thick cardboard*2
  • 21cm*7cm thick cardboard*2
  • A4 Tracing paper*1
  • Your Map
  • paper*1
    ( you can use any size because of it just the connection between crocodile clips and the thick cardboard)
  • Arduino Leonardo*1
  • USB transmission line*1
  • Crocodile clip*5
  • different color of 5mm LEDs*5
  • 1/4W, 82 ohms resistor*5
  • 10M ohm resistor*5
  • Jumper wire M-M ad M-F*several
  • (General size 840 pin) Breadboard*1
  • box cutter (knife)*1
  • scissor*1
  • electrical tape*1
  • 30cm ruler*1
  • pencil*1
  • Black marker*1
  • Hot melt gun*1
  • hot melt glue stick*some

Step 2: Assembling the Parts (Connecting Circuit)

Tips: Jumper wires should not be plugged too densely, otherwise it is easy to confuse.

LEDs parts: You can begin with an unpowered Arduino, then connect an M-M wire between the GND of your Arduino and the negative (blue, -) rail of your breadboard first. This allows the entire negative rail to be useable. Second, plug one of the legs of an 82-ohm resistor into the rail so that your LED won't receive too much electricity and be burned out. Repeat this four times. Third, plug your M-F wires into both lines. Also, you have to add M-M wire to the corresponding pin of your Arduino in the second line. Next, plug the shorter leg (ground) of your LED, where is connected to the resistor, into the F side wire. Then, plug the longer leg into the other Female side. Repeat this four times as well.

Remarks: You are free to add more LEDs, but remember to add to the corresponding resistor in the same line.

Sensors parts: Connect pin 4 on the Arduino to the positive rail (red) on the breadboard. Then, in the same rail, plug in one leg of the five 10M ohm resistors separately. Next, connect pin 5, 6, 7, 8, and 9 with the other leg of the same five 10M ohm resistors. Last, plug in the crocodile clip in the same line.

Important!!!: The blue wires in the picture represent crocodile clips.

Remarks: Remember that five of the resistors have one common leg connected to the send pin(4) and the other legs have to be in different lines of the breadboard. If you follow all the instructions in STEP 2, your circuits should now look similar to the image above.

Step 3: Coding


First, unzip it, then move the whole folder to the folder ”library” in the folder Arduino. Follow the link to download or copy the code to your Arduino Arduino touch map code

Also, check to make sure that “capacitive sensor” in the first line of your code is orange. If yes, it means that you have included the capacitive sensor in the library and are ready to move on to the next step.

(p.s. Other details, line by line explanations are all in the codes)

<p>//include the CapactiveSensor library which tells arduino to look for a new library<br>//it introduce the complex code and give you a simpler way to use their functions
#include <Capacitive Sensor.h>
//Set the signal input and output pin of the capacitivehsensor touch
//create an instance of the CapactiveSensor library and identify what pins it will use
//pin 4 is the send pin, the pins after 4 are the sensor pin
//the two kinds of pins will connect to the resistor and pin
CapacitiveSensor   cs_4_5 = CapacitiveSensor(4, 5);
CapacitiveSensor   cs_4_6 = CapacitiveSensor(4, 6);
CapacitiveSensor   cs_4_7 = CapacitiveSensor(4, 7);
CapacitiveSensor   cs_4_8 = CapacitiveSensor(4, 8);
CapacitiveSensor   cs_4_9 = CapacitiveSensor(4, 9);</p><p>int threshold = 2000;//Sensing capacitance threshold;
//variable to decide threshold at which LED will turn on
//this value has to be determine through your experiment</p><p>//create a constant
const int LED1 = 1;//pin for LED1
const int LED2 = 2;//pin for LED2
const int LED3 = 3;//pin for LED3
const int LED4 = 10;//pin for LED4
const int LED5 = 11;//pin for LED5</p><p>void setup() {
  //opening a serial connection to your device
  //it opens a communication channel with your device at 9600 per sec.
  //setting LED pin as an output
  pinMode(LED1, OUTPUT);
  pinMode(LED2, OUTPUT);
  pinMode(LED3, OUTPUT);
  pinMode(LED4, OUTPUT);
  pinMode(LED5, OUTPUT);
//30 means to read 30 samples from sensor to filter out unwanted reading
void loop() {
  long total1 =  cs_4_5.capacitiveSensor(30);
  long total2 =  cs_4_6.capacitiveSensor(30);
  long total3 =  cs_4_7.capacitiveSensor(30);
  long total4 =  cs_4_8.capacitiveSensor(30);
  long total5 =  cs_4_9.capacitiveSensor(30);
  // print the sensor value so you can visualize it with a serial monitor
  Serial.print("   total1= ");
  Serial.print(total1);</p><p>  Serial.print("   total2= ");
  Serial.print(total2);</p><p>  Serial.print("   total3= ");
  Serial.print(total3);</p><p>  Serial.print("   total4= ");
  Serial.print(total4);</p><p>  Serial.print("   total5= ");
  Serial.println(total5);//"ln" means to change a line</p><p>  // If the capacitance of the touch point,
  //sensor value is greater than the threshold,
  //the LED is illuminated.
  //That is, deciding the LED has to been on or off
  if (total1 > threshold) {
    digitalWrite(LED1, HIGH);
  } else {
    digitalWrite(LED1, LOW);
  }</p><p>  if (total2 > threshold) {
    digitalWrite(LED2, HIGH);
  } else {
    digitalWrite(LED2, LOW);
  }</p><p>  if (total3 > threshold) {
    digitalWrite(LED3, HIGH);
  } else {
    digitalWrite(LED3, LOW);
  if (total4 > threshold) {
    digitalWrite(LED4, HIGH);
  } else {
    digitalWrite(LED4, LOW);</p><p>  }  if (total5 > threshold) {
    digitalWrite(LED5, HIGH);
  } else {
    digitalWrite(LED5, LOW);

Step 4: Breadboard Testing

Remember to wire the USB line first, then upload the code to Arduino. Then try to see if your LEDs will light up when you touch the sensor. If not, check your code and wires in STEP 2 and 3 again.

Also, check the serial monitor. When you approach any sensor with your hand, the number should increase. When the number is bigger than certain threshold, for instance 5000 (you can modify this number yourself). When the number surpasses the threshold, the LED turns on. If it doesn’t work, you can open the serial monitor and calculate the median value by touching the sensors. Then, type the value of your threshold in the code.

You can use the following link if you can't see the video at the top of this step.

testing video (your breadboard test should look like this)

Step 5: Building the Package

Creating the Map
First, print your bird's-eye view map and trace it with a pencil onto a piece of tracing paper. Second, locate where you want Arduino touch map to be placed in on the tracing paper’s map. Also, remember to draw the paths to different destinations.

BOX part1

Use the hot melt gun to stick your A4, 29.7cm*7cm thick cardboard*2, and 21cm*7cm thick cardboard*2 together in order to form a box. Also, cut a small hole on the side of the box of the 21cm*7cm thick cardboard to allow your USB cable to pass through.

BOX part2

Take your map and place it on top of the other A4 cardboard. Draw the map on the cardboard with a pencil. Then, cut off the paths you drew on the thick cardboard by using box cutter(knife). As a result, you can have hollow paths that allow LED’s to go through in order to point out the right directions for people. You have to make sure that all the drawing must be correct, then use a marker to trace it again. Next, cut off the paths on tracing paper map and use the hot melt gun to glue it on the hollow paths in order to make the lights more even.

Step 6: Combine the Package With Arduino, and the Final Result...

If you follow all the steps above, you will have three parts: a finished wired Arduino, thick cardboard with the map(cover of the box), and a box without a cover. Now, you are going to combine your Arduino, the box, and the cover. First, use the electrical tape to stick your LED and corresponding M-F wires together to make them stronger. Also, stick your LED to your paths separately. Second, glue your crocodile clip on the cover according to the order of your building paths by using electrical tape or hot melt gun. Third, draw the middle part of your white paper, then flip it upside down to stick it on to your cover and clamp with the clips. Last, put your Arduino with circuits into the box and plug in the USB transmission line to your computer.

Step 7: Dig Deeper

How does it work? You can learn more about the principle behind it, its applications, library methods, resistor options, and other known issues are in the following link

More about Arduino CapactiveSensor Library