Aishwarya's Double Transducer: The potentiometer on the left controls the speed of the DC fan, which pushes the ball up the ramp. The ultrasonic sensor measures the ball’s distance, altering the voltage and generating more heat as the ball moves closer to the bulb on the right. Pressing the switch (next to the potentiometer) bypasses the sensor, allowing the potentiometer to directly control the heat output of the bulb.
Jaden Singh's Double Transducer: Begins with the potentiometer on the left, which controls the speed of a DC fan. The airflow pushes a ball up a ramp, and its position is measured by an ultrasonic sensor. This distance affects the heat generated by the incandescent bulb on the right. Pressing the switch next to the potentiometer skips the middle step here and directly allows the potentiometer to control the heat output of the bulb.
The ramp allows the lightweight ball, made of expanded polystyrene (thermocol), to move up and down, with one end equipped with an ultrasonic sensor that measures the ball's distance.
The ultrasonic sensor at the end of the ramp faces the ball to measure its distance, but the ball’s shape causes occasional inconsistencies in the readings.
The DC motor (fan) is positioned at the opposite end of the ramp, blowing the ball forward.
The incandescent bulb glows brightest when the ball is closest to the sensor. It operates with the help of a transistor, which regulates the varying voltages supplied to it.
Jaden Singh's Double Transducer: Turning the potentiometer starts the fan, but the fan needs to build enough speed to push the ball forward. Since the ball is lightweight, it moves quickly up the ramp, requiring careful adjustments to the potentiometer to keep the speed slow enough to observe clear changes in the bulb’s brightness. When the ball moves closer to the distance sensor, the bulb dims and produces less heat. When the ball is near the fan, farther from the sensor, the bulb shines brighter, generating more heat.
Aishwarya Shetty's Double Transducer: Turning the potentiometer sends electricity to the fan, which spins faster as the knob is turned. The fan pushes the ball forward, allowing it to move easily up the ramp. However, the ultrasonic sensor takes a moment to provide stable readings. These readings determine the bulb's brightness, which can appear jittery due to the sensor’s difficulty detecting the ball’s spherical shape. As the ball moves closer to the ultrasonic sensor, the bulb's brightness increases, and as it moves farther away, the brightness decreases.
Turn the knob, and the fan begins to spin. As it spins faster, it pushes the ball up the ramp with more force. A sensor keeps an eye on the ball, measuring how far it has traveled. The closer the ball gets to the sensor, the more the light glows, warming up the space around it. There's also a button that lets you control the light in a different way. Normally, the light changes based on how far the ball has moved. But when you press the button, the light stops depending on the ball and instead follows the knob directly. The more you turn the knob, the brighter and warmer the light becomes.
Combining the potentiometer (input) and the distance sensor (laser distance sensor) to work together in the system.
Connecting the fan required an external power source and a transistor (MOSFET) to control it. Figuring out how to connect the transistor was a bit tricky at first.
For our first attempt at building a ramp, we used paper to test if the ball would move up when blown by the fan. However, the ramp wasn’t sturdy enough, and the paper kept fluttering, which interfered with the fan’s airflow and affected its speed.
Next, we built a sturdier ramp using foil. However, the surface wasn’t smooth enough, causing the ball to get stuck in certain spots instead of rolling up smoothly.
The laser distance sensor frequently timed out, possibly due to difficulty detecting the ball, so we replaced it with an ultrasonic sensor. We also experimented with a swinging plate instead of the ball and ramp, but it produced little variation in the output.
An appreciation for the mess!! We varied the sizes of the ball to see which ones are better detected by the ultrasonic sensor.
What really surprised us was how much time it took. It was far more than we anticipated. The process involved significant trial and error, not just with the sensors but also with the structural design of the middle step.
The potentiometer controlling the fan was the easiest part. It worked as expected, and adjusting the airflow to push the ball was straightforward. However, the distance sensor controlling the bulb was the hardest part, mainly due to inconsistent readings. The laser distance sensor frequently timed out, likely because it struggled to detect the spherical ball. We replaced it with an ultrasonic sensor, which worked better but still had issues with jitter, especially with certain units. Interestingly, we found that ultrasonic sensors with the pin labels printed backward on the back produced significantly more jitter than those with correctly labeled pins. We also had to revise the ramp multiple times. Our first paper ramp wasn’t sturdy enough and fluttered with the fan’s airflow, affecting its performance. We then switched to a foil ramp for stability, but it wasn’t smooth enough, causing the ball to get stuck. We even experimented with a swinging plate instead of the ramp, but it didn’t provide enough variation in output.
Looking back, we could have used a sliding wheel with an attached plate instead of a ball. We didn’t explore this due to time constraints, but it would have likely worked better since the distance sensors are more reliable at detecting flat surfaces than spherical ones. Another challenge was soldering, which took longer than expected. While not a major issue, it was a reminder that even small tasks can add up in terms of time.
Moving forward, we want to be more flexible in choosing sensors early on rather than sticking with one for too long. Exploring multiple options from the start could save time and lead to more reliable results.
/*
Project Title: Rotational Movement to Distance to Heat
Authors: Aishwarya Shetty and Jaden Singh
Description:
The first transducer uses a potentiometer to control the speed of a fan. The fan moves an object, and an ultrasonic sensor (HC-SR04) measures the distance of the object from the machine. The measured distance is then used to control the brightness of an incandescent bulb. A button allows skipping the middle step, enabling direct control of the bulb's brightness through the potentiometer.
Arduino | Role | Details
--------------------------------
A0 input Potentiometer (speed control)
6 output Fan (DC motor)
7 input Button (middle step bypass)
8 output Ultrasonic Trigger (HC-SR04)
9 input Ultrasonic Echo (HC-SR04)
SDA, SCL input/output LCD I2C interface
10 output Incandescent bulb
Libraries Used:
- Wire.h: For I2C communication
- LiquidCrystal_I2C.h: For LCD display
*/
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// LCD Setup (I2C Address: 0x27, 16 columns, 2 rows)
LiquidCrystal_I2C screen(0x27, 16, 2);
// Pin Definitions
#define POT_PIN A0 // Potentiometer
#define FAN_PIN 6 // Fan (DC motor)
#define BUTTON_PIN 7 // Button
#define TRIG_PIN 12 // Ultrasonic Sensor Trigger
#define ECHO_PIN 11 // Ultrasonic Sensor Echo
#define BULB_PIN 3 // Incandescent bulb
// Variables
int potVal; // Potentiometer value
int fanSpeed; // Fan speed
int distance; // Distance value
int brightness; // Bulb brightness
bool buttonState = HIGH; // Button state
int normalizedFanSpeed, normalizedDistance, normalizedBrightness;
long duration;
int distancecm;
void setup() {
// Initialize Serial
Serial.begin(9600);
Wire.begin();
// Initialize Pins
pinMode(POT_PIN, INPUT);
pinMode(FAN_PIN, OUTPUT);
pinMode(BULB_PIN, OUTPUT);
pinMode(BUTTON_PIN, INPUT_PULLUP); // Internal pull-up resistor
pinMode(TRIG_PIN, OUTPUT);
pinMode(ECHO_PIN, INPUT);
// Initialize I2C LCD
screen.init();
screen.backlight();
screen.print("Initializing...");
delay(2000);
screen.clear();
}
void loop() {
// Step 1: Read inputs
readInputs();
// Step 2: make decisions about what to do
updateInternalState();
// Step 3: drive all the outputs
driveOutputs();
//Step 4: Report Data (via LCD Display)
display();
}
void readInputs() {
potVal = analogRead(POT_PIN);
buttonState = digitalRead(BUTTON_PIN);
distance = getUltrasonicDistance();
}
void display() {
if (millis() % 20 == 0) {
// LCD Display
screen.clear();
screen.setCursor(0, 0);
screen.print("i:");
screen.print(map(potVal, 0, 1023, 0, 99)); // 0-99 potentiometer value
screen.setCursor(5, 0);
screen.print("f:");
screen.print(normalizedFanSpeed); // 0-99 fan speed
screen.setCursor(6, 1);
screen.print("d:");
screen.print(normalizedDistance); // 0-99 distance
screen.setCursor(12, 1);
screen.print("o:");
screen.print(normalizedBrightness); // 0-99 bulb brightness
}
}
void updateInternalState() {
// Map potentiometer to fan speed
fanSpeed = map(potVal, 0, 1023, 0, 255);
normalizedFanSpeed = map(fanSpeed, 0, 255, 0, 99);
if (buttonState == HIGH) { // If button not pressed, use ultrasonic sensor
distance = getUltrasonicDistance();
// Cap distance between 5 and 20 cm
distance = constrain(distance, 5, 20);
brightness = map(distance, 5, 20, 255, 0);
} else { // If button pressed, bypass distance sensor
distance = 0;
brightness = map(potVal, 0, 1023, 0, 255); // Direct control via potentiometer
}
// Map brightness and distance to normalized values (0-99)
normalizedBrightness = map(brightness, 0, 255, 0, 99);
normalizedDistance = map(distance, 5, 20, 99, 0);
}
void driveOutputs() {
// Set bulb brightness
analogWrite(BULB_PIN, brightness);
// Set fan speed
analogWrite(FAN_PIN, fanSpeed);
}
// Function to get distance from Ultrasonic Sensor
int getUltrasonicDistance() {
digitalWrite(TRIG_PIN, LOW);
delayMicroseconds(2);
digitalWrite(TRIG_PIN, HIGH);
delayMicroseconds(10);
digitalWrite(TRIG_PIN, LOW);
duration = pulseIn(ECHO_PIN, HIGH);
distancecm = duration * 0.034 / 2; // Convert to cm
return distancecm;
}