Week 9: Input Devices¶
click here for my class notes Quentin Bolsee created the Qpad-xiao, linked here, to teach electronic production skills including soldering and programming. Thank you Quentin!
group assignment:¶
• probe an input device's analog levels and digital signals
click [here to see our group page](https://fabacademy.org/2026/labs/charlotte/assignments/week08-Adult/)
Click to go to our group page
We have had a total of 3 short afternoons in the fab lab over the past 2 weeks, because of the lab being closed for spring break. So our group is scrambling to get the homework done. Our main problem is that we have not had the time to mill our boards, and are therefore having to use alternatives like breadboards to test components.
We hooked up 2 pcb boards to measure step responce with the tx-rx input pins, and ran Adrian's code from his fabxiao website.
I noticed the alligator clips were touching both sides of the board, creating 4 charged plates instead of 2. So I added cardboard to insulate the back side of the boards from the alligator clip, and the test worked as expected. If we had connected a lead to one side of the board and the other lead to the other side of the board we probably could have done the test with just that one board. We may have been able to measure some change when putting pressure on the board since the FR1 boards we use are slightly flexible.
We were able to repeat the tests on a milled board!
individual assignment:¶
• measure something: add a sensor to a microcontroller board
that you have designed and read it
I spent the 2 afternoons in the lab trying to fix the size of my pcb board so that I can mill it. I am glad I listened to the advice from week 6's open time, because my board should be able to run various inputs and outputs once I get it milled, and soldered.
As I wrote in week08, I worked in Claude.ai to detail the attempt to fix the problem, and create a markdown document with screenshots referenced, and saved in a separate folder. Click here see that document.. The document ends when I realized Claude could not fix this, and I restarted from KiCad. Click here for the chat transcrip and screenshots
In the mean time, at home I have done some tests with my fabric pcb.
I used this code:
// Set which pin the Signal output from the light sensor is connected to
int sensorPin = A3;
int lightValue; // Variable to hold the reading
int pause = 50; // delay time
int led = A2;
void setup() {
pinMode(sensorPin, INPUT); // Set sensorPin as an INPUT
Serial.begin(9600);
}
void loop() {
// Read the light sensor's value (0-1023)
lightValue = analogRead(sensorPin);
// Print the value to Serial Monitor on the top right in Arduino window
Serial.print("Light value is: ");
Serial.println(lightValue);
if(lightValue > 0) {
digitalWrite(led, HIGH);
} else {
digitalWrite(led, LOW);
}
delay(pause); // delay to see the output
}
When I covered the sensor the serial port gave a non zero value. I read 1-4 mostly. When the light was on the sensor the value was zero. The sensor I am using is for turning on a nightlight, so those results fit.
I hooked the class pcb board into my fabric pcb with jumper cables, and sent power through the light when the sensor read more than zero. It worked! The light flashed on and off as I covered and uncovered the sensor.
code to run my idea-pcb: photo sensor to led
// Phototransistor Test
int sensorPin = A0;
int sensorValue;
int ledpin = A2;
void setup() {
pinMode(sensorPin, INPUT); // Set sensorPin as an INPUT
Serial.begin(9600); // Initialize Serial communication
}
void loop() {
sensorValue = analogRead(sensorPin);
sensorValue = map(sensorValue, 0, 1024, 1024, 0);
Serial.println(sensorValue);
if(sensorValue > 0) {
digitalWrite(ledpin, HIGH);
} else {
digitalWrite(ledpin, LOW);
}
delay(50);
}
I created a light sensor pcb on an acrylic oval scrap using copper tape so it looks like an eye. (although it could use eyelashes) First I drew out a schematic.

The left drawing is how Adrian's light sensor circuit is attached. I originally planed on doing mine the same way, but wanted all the connectors to be closer together. The right drawing is the one I used.
I soldered directly on a piece of copper tape that I had stuck to my soldering table by the ends of the tape.

I then cut between the pins to make sure they were separate, and soldered the components to the pins. I then removed the backing, and stuck the tape onto my acrylic oval. I later added a drop of B-7000 glue used for beading, behind the sensor to keep it attached to the acrylic. The glue dries clear. Below is an image of the final sensor propped on the glue to show both the connections and the type of glue used.

When I have my idea-pcb board vertical the ambient light gives a signal of over 500, and the idea light comes on with the message "I have an idea!"

When I tilt the pcb so that the sensor "eye" looks at my computer screen, the sensor's output is < 500, the light goes off, and the program prints the message, "I see more research is needed."

Here is my code for the Seeed XIAO RP2040 that I programed with Arduino IDE.
// Phototransistor Test
int sensorPin = A0;
int sensorValue;
int led = 4;
int too_dark = 500;
int stop = 500;
void setup() {
pinMode(sensorPin, INPUT); // Set sensorPin as an INPUT
pinMode(led, OUTPUT);
Serial.begin(9600); // Initialize Serial communication
}
void loop() {
sensorValue = analogRead(sensorPin);
sensorValue = map(sensorValue, 0, 1024, 1024, 0);
Serial.println(sensorValue);
if(sensorValue > too_dark) {
digitalWrite(led,HIGH);
Serial.println("I have an idea!");
delay(stop);
} else {
digitalWrite(led,LOW);
Serial.println("I see more research is needed.");
}
delay(stop);
}
Problems & solutions: - I could not get the light to turn on when the light was high or low - I had forgotten to declare pinMode(led,OUTPUT); in the void setup(). I figured this out by comparing previous programs, because no errors came up in the Arduino program.