I initially planned to make a touch-sensitive resin table to sense motion and imitate light accordingly. Also, It can change colors using a Bluetooth module and RGB light source.
As a woodworker, I am excited to be able to do out-of-the-box and fun ideas in my future design, and a product that serves more than one purpose.
Touch Sensitive Tables
Touch Sensitive Tiles
After discussing my idea with my instructors, we decided to simplify the process by making separate cells of light to come out with an output in the limited time and materials of the final project.
We plan to make a small sample of the table with separate cells that in the future could be included in an actual piece of furniture.
Overview
The design mainly consists of laser-cut plywood parts with supportive 3D-printed brackets.
Now, I'll walk you through the design process.
CAD Design Tools
Fusion 360
is a software used to design 3d and 2d designs for 3d printers and laser cutters respectively.
GrabCAD
is a website that offers a library of free CAD designs for many electronic components.
Laser Cut and 3D-Printed Design
The design progress on Fusion 360
Starting with the base, a rectangle 106x106.
After extortion, join the FSR in the center of the base.
Toping the FSR with another 106x106 rectangle with
4 Screw openings to fix the 2 rectangles together
2 Screw openings to fix 3D Printed brackets
1 20x5 rectangle for wiring
Insert the brackets we used in Week 3 practice videos and edit the sketch for it to be 20x20.
Drawing 1 side with side finger joints and spaces for upcoming layer's taps.
Moving up to the Arduino Base Layer with
20x5 rectangle opening for wiring
2 20x3 taps on each side
4 Screw openings to hold the Arduino in place
then we added the components in place.
Moving up to the Neopixel Ring Base Layer, we projected the Arduino Base outline adding T-Slots and a 15mm circle for the wiring.
Then we added the components in place.
Coping the Side and joining them to the remaining 3 sides with editing the opening for the Arduino ports, screws, and copper wire connection (a nice-to-have feature we're going to discuss later).
Then we added the components in place.
Finishing off with the Top and the Top Shaft that will hold the Top in place.
Laser Cut Fabrication
After finishing the design on Fusion 360, using the extension "Save DXF For Laser Cutting"
Prepare the files on RD Works for the cutting on 3mm plywood
The power is set to 45 and the speed is 40
3D Printing Fabrication
After finishing the design on Fusion 360, saving it as mesh
Prepare the files on Ultimaker Cura to print with PLA on Prusa 3D Printer
Electronic Components
Arduino UNO board
will be connected to the inputs and the outputs and power them. It is also going to run the code on the components.
Neopixel Ring
RGB light source which is going to be the output in the circuit.
It connects through DI (Digital Input), 5V & GND
Breadboard
To fix the components and connect them.
Jumper wires
Connecting the components.
47 K-Ohm Resistor
Adjusts the current passing through the FSR
Electronic Connection
I found the FSR on Fritzing to make the circuit connection, and I replaced the Neopixel Ring with 16 LED Ring for demonstration since the Neopixel Ring was not available on Fritzing.
FSR terminal 1 connected to A0 and GND through a 47 k ohm resistor.
FSR terminal 2 connected to 5V.
Neopixel Ring DI Pin connected to pin 3.
Neopixel Ring 5V Pin connected to Arduino's 5V.
Neopixel Ring DI Pin connected to Arduino's GND.
Power Source
The Power Source I needed was a 5-volt Adapter to power up the Arduino board and the components connected with it.
5-volt Adapter
Before using this code we had a problem with the FSR readings as it was not stable and It changed readings dramatically even without interaction.
The code reads an analog sensor value, smooths it using both moving average and exponential moving average techniques and activates a random LED on the NeoPixel ring if there’s a significant change in the readings. The program continuously prints the moving averages to the Serial Monitor for monitoring purposes.
Libraries and Constants
Adafruit_NeoPixel.h: This library allows control of NeoPixel LEDs.
Constants: SENSOR_PIN, NEOPIXEL_PIN, and NUM_LEDS define the pins and the number of LEDs.
strip: An object to manage the NeoPixel ring.
Moving Average Variables
Moving Average: This section prepares for calculating a moving average from sensor readings. It stores the last numReadings readings to smooth out noise.
Exponential Moving Average Variables
Exponential Moving Average: Uses a smoothing factor alpha to weigh the latest reading more heavily.
Setup Function
Setup: Initializes serial communication, the NeoPixel strip, and the readings array. The initial values for filteredValue and previousReading are set.
Loop Function
Loop: Continuously reads the sensor value, updates both moving averages, checks for significant changes, and prints the results to the Serial Monitor.
If the difference between the moving average and the exponential average exceeds 5, it calls the randomSpark() function.
Random Spark Function
randomSpark(): This function randomly selects an LED in the NeoPixel ring and sets it to a random color for a brief moment before turning it off.
Text Code
#include <Adafruit_NeoPixel.h>
#define SENSOR_PIN A0 // Pin connected to the analog sensor
#define NEOPIXEL_PIN 3 // Pin connected to the NeoPixel ring
#define NUM_LEDS 24 // Number of LEDs on your NeoPixel ring
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, NEOPIXEL_PIN, NEO_GRB + NEO_KHZ800);
const int numReadings = 5; // Number of readings for moving average
int readings[numReadings]; // Array to store readings
int index = 0; // Current index in the array
long total = 0; // Sum of readings
long average = 0; // Average value
const long baseline = 650; // Baseline value for drift correction
const int ledPin = 13; // Internal LED pin
// Exponential Moving Average Parameters
float alpha = 0.2; // Smoothing factor (adjust for quicker response)
float filteredValue = 0; // Filtered value
long previousReading = 0; // Previous reading for sudden change detection
bool ledState = false; // LED state
void setup() {
Serial.begin(9600); // Initialize serial communication
pinMode(ledPin, OUTPUT); // Set LED pin as output
strip.begin(); // Initialize the NeoPixel ring
strip.show(); // Turn off all pixels by default
for (int i = 0; i < numReadings; i++) {
readings[i] = 0; // Initialize readings array
}
filteredValue = analogRead(A0); // Initialize filtered value with first reading
previousReading = analogRead(A0); // Initialize previous reading
}
void loop() {
// For Moving Average Filter
total = total - readings[index]; // Subtract oldest reading
readings[index] = analogRead(A0); // Read new value
total = total + readings[index]; // Add new reading to total
index = (index + 1) % numReadings; // Move to next index
average = total / numReadings; // Calculate average
// For Exponential Moving Average Filter
float newValue = analogRead(A0); // Read new value
filteredValue = alpha * newValue + (1 - alpha) * filteredValue; // Apply filter
// Check for sudden change in the current reading
long currentReading = analogRead(A0);
long movingAvg = average - baseline;
long expAvg = filteredValue - baseline;
if (abs(movingAvg - expAvg) > 5) {
randomSpark();
}
// Update previous reading
previousReading = currentReading;
// Print the values corrected for baseline drift
Serial.print("Moving Avg: ");
Serial.print(movingAvg); // Subtract baseline for moving average
Serial.print(" | Exp Avg: ");
Serial.println(expAvg); // Subtract baseline for exponential average
delay(100); // Wait before the next reading
}
void randomSpark() {
int ledIndex = random(0, NUM_LEDS); // Random LED position
uint32_t color = strip.Color(random(0, 255), // Random Red value
random(0, 255), // Random Green value
random(0, 255)); // Random Blue value
strip.setPixelColor(ledIndex, color); // Set the color of the random LED
strip.show();
delay(100); // Brief delay before turning off the LED
strip.setPixelColor(ledIndex, 0); // Turn off the LED
strip.show();
}
In the video below, we will see the process of integrating the electronic circuit in the fabricated enclosure and the testing results.
The Lid is 3mm plywood with epoxy resin poured in the pattern with a little bit of pigment to act as a light diffuser.
I had trouble visualizing the design and with the help of my instructor, we came up with the final design.
The FSR was a very new component for me to work with. I had some trouble trying to make it work, but again with the help of my instructor, we figured it out.
In this video, we can see I have two problems.
The first one was the design, it was not optimum with the idea of touching connect between several boxes since it had a lot of edge barriers. With the help of Mego my instructor, we reached a very satisfying final design.
The second one was the unstably of the FSR, where again Mego suggested we add an average reading to the FSR to the code to make the FRS reading more sensitive, responsive, and stable.
The goal is to add more units next to each other through the copper wires attached to the side of the existing unit
5V
GND
Pin A0 for the FSR
Pin 3 for the Neopixel Ring
Hopefully I can make a real coffee table out of these units.