UAT 204 Microcontrollers and Embedded Systems
Worksheet 1 Getting to know the Pico 2 and its ADC
Objective
Identify MCU pins and parts, write a first program, calibrate voltage measurement with the ADC and relate it to a real flight controller
Equipment and materials
- Raspberry Pi Pico 2 and USB cable
- Computer with MicroPython or the C/C++ SDK
- Breadboard, resistors and LEDs
- Adjustable supply
- Multimeter
- Example code at /downloads/uat-204/
Safety
- Never feed more than 3.3 V into an ADC pin; check the calculated value before powering
- Use a supply instead of a real battery, with the current limit set
- Unplug USB before rewiring
Steps
- Read the pinout and mark GPIO, ADC, 3.3 V and ground
- Install the tools as directed and write an LED blink program
- Build the divider and feed it from a supply no higher than the safe value
- Read the ADC at three voltages
- Compare with Example 1 and the multimeter; find a calibration factor
- Use the PX4 Pixhawk 6X page to map sensors and ports to processors
Record of results
| Board pin no. | Pin name | Function (GPIO, ADC, power, ground) | Connected to |
|---|---|---|---|
| Input voltage from supply (V) | ADC pin voltage by multimeter (V) | Code read | Input voltage computed from code (V) | Calibration factor |
|---|---|---|---|---|
| Device or port | Connected to which processor | Through which interface | Why the work is split |
|---|---|---|---|
Questions
From Table 2, by what percentage does the voltage computed from the code differ from the multimeter, and what is the most likely main cause (resistor tolerance, reference voltage or noise)?
With R1 = 100 kΩ and R2 = 10 kΩ, what is the highest input voltage that keeps the ADC pin at or below 3.3 V, and why should the supply still be set well below it?
How many mV of battery voltage does one step of the group's 12-bit ADC represent, and is that fine enough to warn of a low battery? Why?
Why does the Pixhawk 6X use two processors instead of letting the main processor do everything? Answer using Table 3.
Check before you hand in
What to hand in
- Annotated pin map
- Blink and ADC code
- ADC against multimeter table with calibration factor
- Pixhawk 6X device-to-processor table