Rug With Sensors/ RF Communication With Arduino Micro

by SabinaStan in Circuits > Arduino

2142 Views, 7 Favorites, 0 Comments

Rug With Sensors/ RF Communication With Arduino Micro

GIF-190421_181217.gif
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. :)

How to Make the Sensors

IMG_20190330_091758.jpg
IMG_20190330_091831.jpg
IMG_20190330_092156.jpg
IMG_20190330_092224.jpg
IMG_20190330_094505.jpg
IMG_20190330_131318.jpg

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.

How to Put the Sensors in the Rug

IMG_20190331_145444.jpg
IMG_20190331_145936.jpg
IMG_20190331_150030.jpg
IMG_20190331_150037.jpg

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! ^.^

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); } }

Final Result

1.gif

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