UAT 204 Microcontrollers and Embedded Systems

Worksheet 1 Getting to know the Pico 2 and its ADC

Lab 6 hAssesses CLO1

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

  1. Read the pinout and mark GPIO, ADC, 3.3 V and ground
  2. Install the tools as directed and write an LED blink program
  3. Build the divider and feed it from a supply no higher than the safe value
  4. Read the ADC at three voltages
  5. Compare with Example 1 and the multimeter; find a calibration factor
  6. Use the PX4 Pixhawk 6X page to map sensors and ports to processors

Record of results

Table 1 Pico 2 pins used in this worksheet
Board pin no.Pin nameFunction (GPIO, ADC, power, ground)Connected to
Table 2 ADC readings against the multimeter
Input voltage from supply (V)ADC pin voltage by multimeter (V)Code readInput voltage computed from code (V)Calibration factor
Table 3 Pixhawk 6X devices and processors
Device or portConnected to which processorThrough which interfaceWhy the work is split

Questions

  1. 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)?

  2. 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?

  3. 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?

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

CLO1 Explain microcontroller and embedded architecture. (CLOs are a web-team draft; the course owner sets the final ones.)

Instructors: answers and teaching notes for this worksheet are in the teaching pack