The following equipment from the evaluation kit is required:
- 1 x zForce AIR Touch Sensor
- 1 x FPC cable with connector
- 1 x Interface board
Additional required equipment:
- For a sensor of the 90° type: double-sided adhesive tape.
An Arduino-compatible board. The I2C library described here supports the following MCUs: ATmega168, ATmega8, ATmega328P. If you wish to use another MCU, make sure to use an I2C library that works with your hardware.
Examples of boards with a supported MCU:
- Arduino Uno
- Adafruit Pro Trinket
- Arduino Nano
- An Arduino development environment, for example the Arduino IDE.
- Connect the FPC cable to the interface board:
- Lift the flip lock on the interface board.
Insert the FPC cable into the end of the connector, with the connector pads facing down, towards interface board. The yellow piece of PCB of the connector on the other side of the cable is facing upwards. Make sure the direction is straight into the connector and the pads have reached the end of the connector.
Make sure the connector pads of the FPC cable are facing downwards, towards interface board. The sensor risks damage if the FPC cable is connected in wrong direction.
Press down the flip lock.
- Connect the FPC cable to the sensor:
- Place the sensor so that the sensor connector pads of the sensor are facing downwards (steel surface upwards).
- Insert sensor into the connector on FPC cable (yellow piece of PCB of the FPC connector still facing upwards).
- Make sure the direction of the pads is straight into the connector, and the pads have reached the end of the connector.
- Wire the pads of +5V, DR-B0, I2C-D, I2C-C, and GND on the interface board to the corresponding pins on the host system. For details, refer to Electrical Integration. Do not connect power until the following steps have been performed.
If the sensor is of the 0° type: place the sensor on a table with the steel surface facing downwards and with the optical surface facing towards you.
Make sure no object is within the touch active area of the sensor before connecting power to the sensor through I2C. The sensor calibrates itself when powered on and an object within the touch active area may interfere with the calibration.
- If the sensor is of the 90° type: use double-sided adhesive tape to fasten the steel surface of the sensor to the edge of a table, with the optical surface facing towards you. For further information refer to Mechanical Integration.
- Connect power to the sensor through the I2C.
- The green LED on the interface board lights up when connected.
Downloading and Installing the zForce AIR Interface Library for Arduino
- Download the repository as a .zip file or clone it.
- Open the example program provided in the repository in an Arduino development environment, for example the Arduino IDE.
- Compile the program.
- Flash the Arduino with the example program.
Example Program Pseudocode
The following procedure is executed when you flash the Arduino with the example program:
- Call Serial.begin() in order to print to the console window.
- Initialize the I2C communication: call zforce.Start and provide which physical pin that is used for the Data Ready signal
- Read the bootcomplete message.
- Print the message.
- Destroy the message by calling zforce.DestroyMessage.
- Set the desired settings in the sensor. (In this case enable).
- Call zforce.Enable.
- Wait for the response to arrive.
- Print the response.
- Delete the message.
- Repeat step 4 for all settings.
- Go into the main loop.
- Pull zforce.GetMessage for touch notifications.
- Check if a touch message is NOT null.
- Print the contents of the message.
- Destroy the message.
- End of loop.