Double Transducer: Light to Distance
Final images
Carmyn's final double transducer design. The board consists of a photoresistor which takes in light brightness, sends a signal through the arduino to adjust the heat output of the incandescent lightbulb, which is read by the thermistor, which sends a signal through the arduino again to adjust the position of the linear actuator. We decided to add a theme of Groundhog Day to our double transducer because it was early February when we completed this project.
Gus's final double transducer design. This board also consists of a photoresistor which takes in light brightness, sends a signal through the arduino to adjust the heat output of the incandescent lightbulb, which is read by the thermistor, which sends a signal through the arduino again to adjust the position of the linear actuator. We decided to add a theme of Groundhog Day to our double transducer because it was early February when we completed this project.
Detail photos
The first step in the double transducer is to have a photoresistor taking in light brightness. The photoresistor is in a solderless breadboard propped upright so the photoresistor can be ~1 inch above the table.
The next step is to have the thermistor physically touching the incandescent lightbulb such that it can read the heat output of the bulb quickly and effectively.
Before the linear actuator can move, it needs to be connected to a "driver". This allows for precise controlling and connections to be made between the linear actuator and the Arduino.
The last step was to have the linear actuator physically move in and out, with an image of a groundhog attached to the end for an added story effect.
We had an LCD screen displaying the values of each step of the double transducer mapped to a scale of 0 - 99. The input step is labeled with "i", the middle step with "m", and the output with "o".
Final project movies
Carmyn's double transducer board turned on and running its code. The photoresistor value is changed to its extremes by either covering it with a hand or holding a flashlight over it. In response, the incandescent lightbulb, which is blocked by the soldered breadboard in the first part of the video, changes its heat output. The heat output is read by the thermistor attached to the said soldered breadboard. The thermistor value is then mapped to a position for the linear actuator to go to. The LCD screen in the bottom right displays the input and output values of each of the steps.
In this board the linear actuator moves in and out quickly while overall slowly making its way to its desired position. There are three potential solutions to this. The first is that there could be an issue with the mapping of the thermistor values to the input values of the actuator. The second is that we could have added an epsilon value to the thermistor reading such that there is a slightly wider range of input values corresponding to the movement to make it waver less. The third is that we could have taken an average value of the last however many (for example 5) readings of the thermistor to send to the actuator so once again it has less jagged movements.
Gus's double transducer board turned on and running its code. The circuit works the exact same way as the previous caption. The difference with this board is for some reason the linear actuator moves much smoother, but it does not seem to respond to the changing values of the previous steps in the circuit. This is particularly strange because we should have the exact same code, but I believe the differences may be due to a change in the pin mapping that one of us did and the other did not.
Narrative description
A light detector finds out how much light is shined on it and tells the computer. The computer then puts power into a lightbulb; more power if more light was on the light detector. The lightbulb heats up, and a heat detector tells the computer how hot it has gotten. The computer then tells a machine to move outwards, moving further the hotter the lightbulb is. A cheerful groundhog picture is attached to the machine.
Progress images
Day 1 progress: (above)
At this point, the project consisted of an Arduino that would take in data from a thermistor and a photoresistor. We hadn’t yet worked out how to translate that data into light intensity.
Day 2 progress: (above)
On our second day, we mostly learned new coding techniques that would help us throughout our project. However, we also learned how to set the brightness to a lightbulb, shown here.
Day 3 progress: (above)
On day 3, we got a linear actuator (a machine that extends and retracts an arm) and attempted to set it up, after soldering some circuit boards to work with it. It did not work.
Day 4 progress: (above)
On this day, the final product was mocked up; we got and installed LCD screens and attached the pieces of our project to the chipboard where necessary. Unfortunately, we still weren’t able to get the linear actuators to work.
Day 5 progress: (right two images)
Day 5 saw us soldering the middle step of our transducers together, attaching the lightbulb and thermistor to a soldering board.
We also learned that the circuit board we had been using was incompatible with the actuators, and swapped in a new one.
Day 6 progress: (above two images)
For our last work day, we built both projects and affixed them onto the cardboard. We also added some fun highlights, letting our project tell the story of how Punxsutawney Phil can see the future (with some lag.)
Discussion
From a process perspective, our biggest strength was effective and often communication between the two of us. We were able to meet fairly often, worked together well, split work evenly and with considerations toward our personal strengths, and kept a rough documentation of our progress which turned out to be incredibly helpful in many ways. One particular challenge we faced was getting the linear actuator to act the way we wanted in our system. It was difficult to find useful sources online to help us code the exact actions we needed, as well as finding a good driver that made the circuit easy. Ultimately, with more time, we could have gotten the linear actuator to work effectively and smoothly, but at the time the project was due, its movement was a bit choppy. After discussion with an experienced friend, Raewyn Duvall, a possible solution is to add an epsilon value to the thermistor reading that is being fed to drive the linear actuator.
Looking back, there are two points in the project where we think big changes could have been made. If we had had a different middle step, that would have changed a lot of our strategies when it comes to how we set up our final project and how we connected our beginning and end steps. Furthermore, we had two ideas about how to change our linear distance output- we went with a linear actuator, but our other idea was to craft some sort of pulley system with a servo motor. If we had gone with the servo motor, we could have had more resources to use online as this is a much more commonly used component, although we would also likely have had difficulties instead with crafting the pulley system. Both of these options would have also significantly changed the final look and design of our boards.
We both learned a lot through this project: diversifying our programming skills, developing a product from a more abstract concept, and project management. We also became more capable in many of the skills necessary in Physical Computing in general, like soldering, wiring together parts, learning how to use unfamiliar hardware, and constructing a final product.
Functional block diagram and electrical schematic
Code
/*
Project 1 - Double Transducer: Light to Distance
Carmyn Talento and Gus Gamble
The double transducer project gives us an assigned domain for a starting input and ending output,
and our goal is to choose a third domain as a middle step. Our given starting input is light brightness,
and our final output is linear position, and we chose our middle domain to be heat. All of our steps must
be continuously changing the next step. To accomplish this, we have a photoresistor reading the light input,
followed by an incandescent light bulb producing heat, followed by a thermistor reading the temperature,
followed by a linear actuator extending and retracting. Once completed, we will attach our project into a
larger line of projects where our final output is the starting input to the next group's project.
Sources:
https://www.firgelliauto.com/blogs/tutorials/how-do-you-control-a-linear-actuator-with-an-arduino
https://arduinogetstarted.com/tutorials/arduino-actuator
Pin mapping:
Arduino pin | role | details
------------------------------
A0 input photoresistor
A3 input thermistor
9 output linear actuator motor 1
10 output linear actuator motor 2
11 output incandescent light bulb
*/
//insert library and set up values for screen display
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C screen(0x27, 16, 2);
int x = 123;
//set pins for the significant components
const int PHOTOPIN = A0; //photoresistor
const int THERMOPIN = A3; //thermistor
const int MOTORPIN1 = 9; //actuator motor 1
const int MOTORPIN2 = 10; //actuator motor 2
const int INCANPIN = 11; //incandescent bulb
int currPos = 50; //keeps track of the actuator's current position
//set up process
void setup() {
//pin set up
pinMode(PHOTOPIN, INPUT); //photoresistor
pinMode(THERMOPIN, INPUT); //thermistor
pinMode(MOTORPIN1, OUTPUT); //motor 1 in linear actuator
pinMode(MOTORPIN2, OUTPUT); //motor 2 in linear actuator
pinMode(INCANPIN, OUTPUT); //incandescent bulb
//screen set up
screen.init();
screen.backlight();
screen.home();
//retract linear actuator before starting
digitalWrite(MOTORPIN1, LOW);
digitalWrite(MOTORPIN2, HIGH);
//turn on serial library
Serial.begin(9600);
}
//control loop
void loop() {
//saving information to variables for the values of each step
int photoVal = map(analogRead(PHOTOPIN), 50, 950, 0, 99); //step 1: photoresistor value
int incanVal = map(photoVal, 0, 99, 0, 1023); //step 2: incendescent bulb value
int thermoVal = map(analogRead(THERMOPIN), 50, 950, 0, 99); //step 3: thermistor value
int actVal = map(thermoVal, 0, 99, 100, 1000); //step 4: linear actuator value
//display values on LCD screen on scale of 0 to 99 for all 4 steps
//write to LCD- photoVal, incanVal, thermoVal, actVal
screen.print("i:");
screen.print(photoVal);
screen.setCursor(6,0);
screen.print("m:");
screen.print(map(incanVal, 0, 1023, 0, 99));
screen.setCursor(8, 1);
screen.print(thermoVal);
screen.setCursor(12, 1);
screen.print("o:");
screen.print(map(actVal, 0, 128, 0, 99));
//final output, step 4
analogWrite(INCANPIN, map(photoVal, 0, 99, 0, 1023));
//extend linear actuator
if (currPos > thermoVal){ //add an epsilon value to the thermoVal to smooth out the movement
digitalWrite(MOTORPIN1, HIGH);
digitalWrite(MOTORPIN2, LOW);
delay(actVal);
digitalWrite(MOTORPIN1, LOW);
digitalWrite(MOTORPIN2, LOW);
currPos = currPos + actVal;
}
//retract linear actuator
else if (currPos < thermoVal){ //add an epsilon value to the thermoVal to smooth out the movement
digitalWrite(MOTORPIN1, LOW);
digitalWrite(MOTORPIN2, HIGH);
delay(actVal);
digitalWrite(MOTORPIN1, LOW);
digitalWrite(MOTORPIN2, LOW);
currPos = currPos - actVal;
}
//don't move linear actuator
else if (currPos == thermoVal){ //add an epsilon value to the thermoVal to smooth out the movement
digitalWrite(MOTORPIN1, LOW);
digitalWrite(MOTORPIN2, LOW);
delay(actVal);
}
//check values and reset screen
//check values in serial monitor
Serial.print("thermoVal: ");
Serial.print(thermoVal);
Serial.print(", photoVal: ");
Serial.print(photoVal);
Serial.print(", incanVal: ");
Serial.print(incanVal);
Serial.print(", actVal: ");
Serial.println(actVal);
Serial.print(", currPos: ");
Serial.print(currPos);
// delay and clear screen to reset and not overwhelm screen
delay(100);
screen.clear();
}