Touch Sensor

Function introduction

The sensor contains two touch parts (left and right) and can detect changes in capacitance when a finger approaches. This means the touch sensor will output a high level whether your finger touches lightly or presses hard. You can realize the function you want by judging the detected value (1 for high level, 0 for low level).

Hardware setup

  • NyBoard

Connecting to the NyBoard with wire as shown in the following picture, connect to the NyBoard Grove interface which include D6, D7:

  • BiBoard

For specific use, the end connected to the sensor can be fixed on the robot's head (included in Bittle's mouth, or attached to the top of Nybble's head), of course, you can also use your creativity according to your needs.

Software setup

The code using this sensor has been integrated into the OpenCat (NyBoard)/ OpenCatEsp32 (BiBoard) project. Uncomment the line #define DOUBLE_TOUCH in the OpenCat.ino / OpenCatEsp32.ino, as shown in the figure below, and then use the Arduino IDE to upload the sketch to the robot main board, which can reproduce the example function of integrating the robot action.


Prepare the Arduino UNO development environment

With NyBoard V1_*, you can simply choose Arduino Uno.


Arduino C++ demo

If you want to test the function of a touch sensor alone or want to learn more about its principles. You can use the Arduino IDE to upload the demo sketch(doubleTouch.ino), as shown below:

This demo sketch implements real-time printing of the detection values of D6 and D7 pins in the serial monitor:

The demo sketch

Mind+ Demo

If you want to use the sensor with the Mind+ program for NyBoard:

  1. You can upload the firmware via the Petoi Desktop App:

Or you can upload the OpenCat.ino as follows, uncomment the line #define GROVE_SERIAL_PASS_THROUGH in the OpenCat.ino:

For BiBoard, you can skip this step.

2. Follow the instructions to import the Petoi Coding Blocks in the app Mind+, and load the Mind+ code file.

  1. Connect the robot and computer with the USB adapter(USB uploader) or Bluetooth module.

Mind+ demo code

Last updated