Introduction: Rug With Sensors/ RF Communication With Arduino Micro

About: My name is Sabina Stan. I am a visual artist based in Romania. I work with rope, paper and recycled aluminium cans and I can do just about anything (figurative or abstract) in the technique I use, which is an …

I recently finished the installation Equally diverse, which is made of a series of lamps that react to the sensors placed in a rug underneath the lamps.
Here is how I made the rug with pressure sensors.
I hope you will find it useful. :)

Step 1: How to Make the Sensors

For the pressure sensors, I used piezo sensors because they are cheap, effective and easy to use.
To create the RF communication, I used an Arduino Micro and a RF transmitter.

Because the sensors connect to the analog pins, you can use only four sensors for each Arduino. Since two sensors cannot emit a signal at the same time, that is not really a problem.

To connect the transmitter to the Arduino, you have to connect, from right to left as you look at it:

  • The first pin to the ground of the micro-controller
  • The second to the VCC of the Arduino Micro
  • The last pin to the data pin (10, in my case)

To connect the piezo sensors, first, you have to cut a wire long enough, and connect:

  • The part that goes to the middle of the piezo to the analog pin of the microcontroller
  • The part that is wired to the edge of the sensor to the ground of the Arduino

My advice is to connect all the grounds of the sensors and then connect one wire to the ground of the Arduino.

Step 2: How to Put the Sensors in the Rug

Take a fluffly, for the lack of a better word, rug and place the micro-controller next to one of its edges with the sensors placed on the rug.

Make sure the micro-controller is somewhere safe from being stepped on or in a box that can be seen.

Arrange the sensors so that they will be in different parts of the rug.

Hide the sensors under the fibres of the rug, while using them to secure the wires that connect the sensors to the micro-controller.

That's all! ^.^

Step 3: Code

#include <VirtualWire.h> 
const char *message = ""; int piezo0 = A0; int piezo1 =A1; int piezo2 =A2; int piezo3 =A3; int sensorReading0 = 0; int sensorReading1 = 0; int sensorReading2 = 0; int sensorReading3 = 0;void setup() { pinMode(piezo0,INPUT); pinMode(piezo1,INPUT); pinMode(piezo2,INPUT); pinMode(piezo3,INPUT); vw_set_ptt_inverted(true); vw_set_tx_pin(10); vw_setup(4000); }void loop(){ sensorReading0 = analogRead(piezo0); if (sensorReading0 < 100) { ; message="Z"; vw_send((uint8_t *)message, strlen(message)); vw_wait_tx(); delay(2000); } sensorReading1 = analogRead(piezo1); if (sensorReading1 < 100) { message="X"; vw_send((uint8_t *)message, strlen(message)); vw_wait_tx(); delay(2000); } sensorReading2 = analogRead(piezo2); if (sensorReading2 < 100) { message="Y"; vw_send((uint8_t *)message, strlen(message)); vw_wait_tx(); delay(2000); } sensorReading3 = analogRead(piezo3); if (sensorReading3 < 100) { message="W"; vw_send((uint8_t *)message, strlen(message)); vw_wait_tx(); delay(2000); } }

Step 4: Final Result

To see the result of stepping on the rug, you need something to receive the messages... like an installation of lamps. :)

Arduino Contest 2019

Participated in the
Arduino Contest 2019