Week09
Input Devices¶
Group assignment:¶
- Probe an input device(s)’s analog levels and digital signals (As a minimum, you should demonstrate the use of a multimeter and an oscilloscope.)
- Document your work on the group work page and reflect on your individual page what you learned
Individual assignment:¶
- Measure something: add a sensor to a microcontroller board that you have designed and read it.
Group assignment¶
Our group assignment is on lab’s page.
I demonstrated, so I learned nothing specially.
Using input¶
I’m going to use linear potentiometer to capture manipulation of levers for final project product. So, I prototype this for this week 9 individual assignment.
PCB¶
The potentiometer I purchased was PTB0143-2010BPB103. So I refer the datasheet and made part library for it, and then draw a schematic and board design.


I used Grove connector to connect this linear potentiometer and microcontroller board.
I generated gerber file and converted it to toolbath by using pcb2gcode. This is through-hole mount board but I could generate three toolpath files, bottom copper, drill and outline with following command.
After that I just needed to run these three toolpath.
Design file: W9_POT-Board.sch, W9_POT-Board.brd millproject
3D printed parts¶
Next one I needed to make was 3D printed parts to fix the things. One is to fix PCB and outer sleeve of Cessna 172 lever, the other one is to fix lever of potentiometer and inner wire of Cessna 172 lever.


I drew these and exported STL files and then printed.
Design file: W9_Sleeve-PCB.f3d, W9_Bourns-PTB-knob.f3d
Hardware Assembly¶


I assembled PCB, 3D printed parts and components. The PCB I made this time was connected to the microcontroller board I made last week. The output of linear potentiometer was connected to XIAO RP2040’s A1 pin through the board I made at Week 8.
Test¶
At last, I wrote a very simple code to confirm my hardware design works as I designed.
int sensorValue = 0; // declaring variable
void setup() {
Serial.begin(9600);
}
void loop() {
sensorValue = analogRead(A1); // reading the sensor value
Serial.print("sensor = ");
Serial.println(sensorValue); // printing the read sensor value through serial over USB to host
delay(2);
}
This code simply read a voltage that A1 pin was connected to. It’s a variable end of linear potentiometer, and is output a voltage that related to the position of metal lever of the potentiometer.
And the lever of potentiometer are mechanically connected to the wire of Cessna 172 mixture lever. The position of mixture lever will be reflected to the position of linear potentiometer through the wire.
We can see read value moves by moving mixture lever.
Problems¶
I didn’t face any problem.
Checklist¶
- Linked to the group assignment page.
- Documented what you learned from interfacing an input device(s) to your microcontroller and optionally, how the physical property relates to the measured results.
- Documented your design and fabrication process or linked to the board you made in a previous assignment.
- Explaind how your code works.
- Explained any problems you encountered and how you fixed them.
- Included original design files and source code.
- Included a ‘hero shot’ of your board.