Touch Board Troubleshooting
This tutorial will show you how to debug the Touch Board and get started with your project
If you have just started using the Touch Board, you might not be familiar with how to debug or troubleshoot any issues you might be having. Perhaps the electrodes of your board are not responding to touch. In this tutorial, we are going to show you how to debug the Touch Board with the Serial Monitor in the Arduino IDE, and what to do if the electrodes aren’t responding to touch.
Step 1 Serial Monitor
All of the programming for the Touch Board takes place in the Arduino IDE. The IDE also contains the Serial Monitor, which you can find in the top right corner of the IDE, when you have your sketch open. We have highlighted the Serial Monitor in the image on the right. This monitor is incredibly useful when it comes to debugging your Touch Board. When you have a look at the “Touch_MP3” code, you can see that the commands “Serial.println” or “Serial.print” are found multiple times in the sketch. Each time either of these commands is executed, the Serial Monitor prints out the command’s content that is written in the brackets.
This is really helpful when you are debugging the Touch Board. With the “Serial.println” or “Serial.print” command you can see, for example, the value of a variable or you can place the command in your code after an “if” statement, to see if the “if” statement is being executed. This is what we do in the “Touch_MP3” sketch; after many “if” statements we write to the Serial Monitor to see what is happening in the code. On the right-hand side, you can see an output example of the Serial Monitor.
Step 2 Setting up the Serial Monitor
Setting up the Serial Monitor is straightforward. If you have a look at the “Touch_MP3” sketch, on line 95 you will see the command “Serial.begin(57600);”. This will set the Baud Rate, or speed, at which rate the code is sent from the Touch Board to the Serial Monitor. If you now include “Serial.println” or “Serial.print”, then these commands write to the Serial Monitor.
If you have a look at line 99, you can see a line of code with “while (!Serial);” that is commented out. By removing the two slashes you can uncomment the line. With this lime uncommented, your code won’t execute until you open the Serial Monitor. This is an extra step of debugging you can use, in order to have full control over when the code starts running.
Step 3 Tidy set-up
When you connect crocodile clips or wires to the Touch Board, you need to ensure that the wires don’t cross over each other. You can do this by securing the wires with masking tape. Crossing wires cause interference and the board might register unintentional “touch” events. Also, if you are only using a couple of the electrodes, it helps to use electrodes that aren’t directly next to each other. For example, if you use only three electrodes, it’s easier to use electrode E0, E5 and E11, instead of electrodes E0, E1, and E2.
If you are using very long wires to connect to the electrodes, consider using shielded cable. This will help avoid accidental touch triggers. We also have a tutorial on how to use a shielded cable.
Step 4 Grounding the GND pin
The Touch Board requires a Ground reference for its sensors, which is especially important if the sensors are set up as proximity sensors. When you use a laptop, this isn’t a problem, because the laptop acts as the Ground reference. However, other power sources, like LiPo batteries or portable power banks, don’t have this Ground reference, so the proximity sensors might not respond well. In this case, try connecting the GND pin, located next to the power switch, to a Ground source, like a radiator or large metal plate.
Step 5 Grapher
If you are running into issues with your touch sensors and they are not triggering, its worth having a look at the Grapher. Our Grapher is a Processing sketch, written to visualise and plot data that is passed to it from a Touch Board, running our Datastream code. It visualises the raw proximity data captured from each electrode and displays touch and release events. You can also check out the grapher tutorial for more information.
If you still have difficulties debugging your Touch Board, feel free to email us with your issue: email@example.com.