Back to top

Reading Sensors Signals Over Development Boards

EN
       

Building Small Efficient and Econologic Resistors or rack of resistors in the range of a few Ohms to MegaOhms can easilly be done using ElecroFunctionnal Paper 1K or 100K.

Follow these Steps to know-how and build your first eco-friendly resistor.

1- Voltage Divider Setup

1.1- from resistance to Voltage

Development boards such as Arduinos enable to read signals voltage. Using a very simple electronic circuit called a voltage divider is the best way for using PLK sensors.

Use an ohmmeter to read the resistance range of your sensor.

Use this tool to evaluated the best resistor to use for your voltage divider.

Use the circuit template below to build the voltage divider between your sensors and the divider resistor.

1.2- Build the Voltage Divider

You can then use conventional resistors or build your own using resistive paper. Use wires, metal tape, soldering or mechanical linkage to build up the voltage divider.

Use the circuit template below to build the voltage divider between your sensors and the divider resistor.

Make sur to provide the 3 connection pads / wiring ( 5V - Vs - Gnd ) to be connected to the development board.

Arduino Web Editor

2- Development Board Setup

2.1- Board Firmware programming

Development board such as Arduinos include Input/Output Pins and a microcontroller that can easily be programmed to exploit for instance sensors signals.

Download the Open-source Arduino software or go to the on-line development software.

Use any Arduino-like board, connect it to your computer and select it on the Arduino software.

You can now program your Arduino board using available templates or your own code. We will program it here so as to read the signal coming from the analog IO Pin A0 and display the result on the serial monitor.

Open the .ino file provided here and download it into your board.

Arduino Web Editor

2.2- Plug and Play

You can now plug the 3 poles of your voltage divider ( Vin - Vs - Gnd) to the corresponding pins on your board, respectively Vin - A0 - Gnd.

Use adapted wires and connectors to connect the 3 poles of your voltage divider to the Board and Pin A0.

2.3- Serial Communication and Serial Monitor

The development board can send and receive data from and to the computer or any other devices with which he can communicate.

Serial communications are the most universal communication process and it simply takes to write a serial.print("Z") function to send the letter "Z" to the computer in real time.

This data can be displayed using the serial monitor of the Arduino Software at the appropriate baudrate.

Open your serial monitor and you should see a list of 10 bits values (0-1023) for your sensor displayed in real time.

This data can then be analysed and transformed for measurement, control, detection or any other use of an Input signal in a wide range of applications.

The following tabs will discuss the key information for getting into deeper firmware programming and provide a few basic application examples and open source mapping applications.

3- Default .ino Template & Default Setup

3.1- Default .ino Template

Many useful .ino example file can be accessed with the Arduino software. All of them have at least 2 functions called setup() and loop().

The setup function is launched once when the board is plugged or turned on or when it is reset while running. It contains specific configuration parameters such as the initialisation of the serial communication.

The loop function is a function that runs and loops constantly in background. It is used to monitor the signals data and exploit it, as performed while sending the data value to the computer at each loop.

3.2- Default Setup

Analog and Digital IO pins can be setup into a variety of behaviors, which can for instance be used to build easily multiplexed Sensor arrays.

Serial communications can also be setup for various goals such as generating MIDI sounds or generating mouse and keybord events to interact with any other softwares on your computer.

When talking to computers, it is better to have a delay(1) (or more) function inside the loop function to slow down the amount of data sent to the computer every 1ms (or more).

3- Default .ino Template & Default Setup

4.1- IO Pins Modes

Analog and Digital IO pins can be setup using the pinMode() and AnalogRead(), DigitalRead(), AnalogWrite() and DigitalWrite() functions.

pinMode() lets you control if the Pin will act as an Input or an Output.

AnalogRead() is used to read analog signals over analog Pins and DigitalRead() is used to read 2bits signals over all IO Pins.

AnalogWrite() is used for analog Pins to be used at High or Low impedance.

DigitalWrite() is used for all IO Pins to be used at High or Low impedance.

By default, Analog Pins are set to pinMode(INPUT) and analogWrite(LOW)

4.2- other programming tools

A few pins (usually pin 13) include a led wich can be used as a visual feedback in your program.

A few pins have interrupts properties, which enables to lower energy consumption using boards sleep mode.

Boards can have varying abilities (IO Pins number, microcontroller speed, memory size...)

Boards can be used with a large number of electronic components and dedicated shields (sensors, actuators, memory, displays...).

Boards can have varying ways and shields to communicate (ISP, Serial, Multi-Serial, USB, Bluetooth, WIFI, Ethernet...).

Various Serial Communication modes exists such as MIDISerial to quickly build up Digital Music Instruments and Human Computer Interface.

3- Default .ino Template & Default Setup

5.1- Demultiplex the sensors inputs

It is possible to quickly build up an array or matrix of sensors using both analog inputs and digital IO Pins as voltage input feeders.

Such a design enables to plus up to 72 sensors with a board having 6 analog and 12 digital inputs available.

5.2- Working Principle

The array is usually designed as a grid of rows and columns of force sensing elements.

The goal is to program the board so as to alternatively feed columns with an input voltage while reading the analog Signal of each corresponding sensors.

Each rows or sensors are then connected to a voltage divider as shown previously.

Thus, using the 6 analog inputs in rows and the 12 digital inputs in column of an Arduino Uno, it takes only 18 wires and 6 resistors to be plugged to build a paper-based multitouch interface

Optimised Voltage Divider IMG

5.3- Applications

This basic designs can be quickly produced and implemented and use as a great multi-touch music instrument or other computer peripheral.

5.4- Ghosting Effect

Such a design is commonly shared by most commercial keyboards.

It enables multi-touch interactions having possible unwanted behavior for specific three-finger contacts.

If you feel limited by this phenomena while building your array, you may want to consider this page for more refined designs and DIY solutions.

3- Default .ino Template & Default Setup

The signal read by the analogRead Function can be optimized through various ways along the process and depending on your applications.

6.1- Voltage Divider Resistor

The choice of the voltage divider resistor is the primary element to control the sensor's response, linearity or to maximise the signal range.

This resistance is usually in the range of the sensor's resistance rage. A Low resistance value will lead to low reactiveness but more linear response. A high resistance value will lead to high reactiveness but non-linear response between the force applied and the signal value

Use this tool to select the resistor that will best fit with your sensor.

Optimised Voltage Divider IMG

6.2- Auto-Calibration

The signal is at 0 (or at a low value ) by default, and the value will increase with the strain exerted onto the sensor up to 1023 ideally ( and usually less).

A few simple programming functions can enable you to automatically rescale the signal into a full [ 0 - 1023 ] range.

Add this function below and call it to automatically scale your value.

6.3- Physical Calibration

For measurements purpose, you may want to consider the correspondance between the signal value and the physical equivalent in terms of load applied for a force sensor, or the distance from the ground pin for linear touch potentiometers.

You will need to proceed to real measurements using graduated weights or instruments to build a function between the load applied and your signal value.

You can then use this function and other maths functions such as round to display the physical equivalent value.

6.4- Noise Filter

The next functions require to build a buffer of data so as to analyse the signal derivations.

Unwanted noises can affect the signal. Low frequency noise can be filtered using the auto-scale provided above.

High frequency noises usually correspond to fast peaks of values in the signal. These can be filtered in function of their duration when considering subsequent values in the buffer. If the signal duration is too short, the signal remains unchanged.

The choice for a critical duration can affect the signals speed.

6.5- Musical Gesture

Attack

Sustain

Decay

6.6- Touch Gesture Detection

On-Off Button or Switch

Peak Detector

Attack Detector

On-Hold Event

Double Hit Event

6.7- Multi-Touch & Pad Gesture Detection

Slide

Pattern

Zoom in / out

Rotate

3- Default .ino Template & Default Setup

7.1- Serial Keyboard Communication

TO DO

7.2- Serial Mouse Communication

TO DO

7.3- Serial MIDI Communication

TO DO

3- Default .ino Template & Default Setup

Image Télécommande fermée

MAPS-2ADA TELECOMMANDE

6.1- For iPhones and Android

App Inventor

6.2- For Windows, Linux and MacOSX

MAPS

9- Application Examples

MusicBoard 12*12-Full

PLK Matrix

Quickly build up your own Electronic Controller and use it with your phone or your laptop.

PLK Development Kits

MAPS