Part 14 had us building a simple circuit to test for flame/heat/fire using a phototransistor. Before building the final phototransistor I put together a test using the breadboard. In addition to the breadboard test, I built a little IR emitter circuit that I would be able to use to test since I knew I was going to use this with my hack-a-toy. Here is my phototransistor test circuit. As well as the circuit reading working displaying values using the Arduino.
Test with the IR emitter.
The code that I used to monitor the photo resistor…
/* Program: lab14test
* creation: 1/30/2017
* author: Leslie Scott Kerfoot
*/
#define myPhototrpin A0 // Pin for the photo resistor.
int myInput = 0; // Main loop variable to read the input.
void setup() {
// put your setup code here, to run once:
pinMode(myPhototrpin,INPUT); // Setup the pin for input from the photoresistor.
Serial.begin(9600); // Setup our serial/debug output.
}
void loop() {
// Read the value
myInput = analogRead(myPhototrpin); // Read the analog input
// Print the value returned
Serial.print(“Value “);
Serial.println(myInput);
delay(100);
}
Once I finished testing the values of the bread boarded photoresistor, I then created a finished sensor for use with my robot later. Here is the finished product nicely soldered and shrink tube wrapped.