Double Transducer: Light to Distance

Final images

An above view of a brown cardboard square with a double transducer circuit system attached. In the top left corner of the board is a motor driver and an Arduino Uno just below the driver. In the top center is a large protoboard with a photoresistor circuit propped up with a block decorated like a groundhog hiding hole. In the center of the board is an incandescent lightbulb with a green soldered thermistor circuit taped to it. In the bottom left is a LCD screen displaying numbers. In the bottom center is a linear actuator with a cartoon groundhog head attached to the moving part. Down the rightmost side of the board is 4 green post it notes with descriptors of the components.

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.

A large rectangular piece of cardboard holds an Arduino, wired to a small breadboard with a circuit board, a second larger breadboard, and to an LCD screen. The larger breadboard is also connected to a system consisting of an incandescent light bulb, which is mostly covered by a soldered breadboard also connected to the larger breadboard. The small breadboard connects to a metal cylinder on one end of the device, which has a paper picture stuck to the end. Green post-its say what each part of the device does.

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

A photoresistor circuit is in a medium sized solderless breadboard, propped at a 90 degree angle upright such that the photoresistor is facing at the camera about an inch above the table. The backside of the protoboard is decorated to be the hiding hole of the groundhog for the theme of groundhog day. The hiding hole has two flowers made of pipe cleaners for decoration.

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. 

A soldered thermistor with its circuit is taped with kapton to the glass part of the incandescent light bulb.

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. 

A small yellow solderless breadboard has a green driver board attached in the center. The driver has 16 potential connections for grounds, powers, inputs, outputs, and a few others. There are 6 wires total, connected to ground, power, A1 in/out, and A2 in/out.

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.

A silver metal linear actuator is propped up by two stacks of tongue depressors taped with grey duct tape. The moving end of the linear actuator has a cartoon image of a groundhog peaking its head above the dirt.

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.

A small blue LCD screen is displaying two rows of information. The top row is left aligned and states "i:97    m:96" and the bottom row is right aligned and states "88    o:69". These are aligned such that the 96 is directly above the 88 to indicate that the 96 is the middle input while the 88 is the middle output values.

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 Transduecr.mov

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.mov

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

An Arduino attached to a breadboard. Wires reach out from the breadboard to light an incandescent lightbulb, and more wires connect two small sensors on long legs to the board and Arduino.

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.

An Arduino attached to a breadboard. Wires reach out from the breadboard to connect two small sensors on long legs to the board and Arduino. There is also an LED on the board, unlit.

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.

An Arduino and breadboard are connected by a nest of wires, which also connect to a small breadboard with a thumb-sized circuit board on it. This connects to a metal box, which extends past the picture.

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.

An Arduino is wired to two breadboards, one lying on its side against a block of wood with a light sensor sticking out. The other has a small circuit board on it attached to a long metal box resting on two stacks of popsicle sticks. A screen is also wired to the Arduino, as is a soldered breadboard and an incandescent light bulb, which are touching at the point of a heat sensor.

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.

A soldering breadboard is suspended by wires just over a lightbulb, with several wires, resistors, and a thermistor attached. The LCD screen and parts of the rest of the project are in the background.
A small circuit board (not the same as previous) is on a small breadboard.
A cardboard base holds an Arduino wired to a breadboard lying on its side against a block of wood with a light sensor sticking out and a small breadboard that has a small circuit board on it attached to a long metal box resting on two stacks of popsicle sticks. A screen is also wired to the Arduino, as is a soldered breadboard and an incandescent light bulb, which are touching at the point of a heat sensor. The end of the metal box’s arm holds a paper cutout, and the wood block is decorated with pipe cleaner flowers. View is from above.
A cardboard base holds an Arduino wired to a breadboard lying on its side against a block of wood with a light sensor sticking out and a small breadboard that has a small circuit board on it attached to a long metal box resting on two stacks of popsicle sticks. A screen is also wired to the Arduino, as is a soldered breadboard and an incandescent light bulb, which are touching at the point of a heat sensor. The end of the metal box’s arm holds a paper cutout, and the wood block is decorated with pipe cleaner flowers. View is slightly from the side such that the lightbulb is visible, which was blocked in the above view.

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

}