Analog Signal Measurement by Pico

 

 Analog Voltage Measurement Using Raspberry Pi Pico 

Objective

  • To read analog signals using the Raspberry Pi Pico's ADC (Analog to Digital Converter).

  • To convert and display analog sensor values as digital voltage levels.Components Required



S.N.ComponentQuantity
1Raspberry Pi Pico1
2Analog sensor/potentiometer1
3Breadboard + Jumper wiresAs needed
4Micro USB Cable1
5Computer with Thonny IDE1

Circuit Description

  • The analog output of the sensor (or middle pin of a potentiometer) is connected to GPIO 26, which corresponds to ADC0 on the Raspberry Pi Pico.

  • The other two ends of the sensor/potentiometer go to 3.3V and GND respectively.

  • Ensure the Pico is connected to your PC via a Micro USB cable

ckt diagram:


video link:






ADC Pin Mapping on Raspberry Pi Pico:

ADC ChannelGPIO Pin
ADC0GPIO 26
ADC1GPIO 27
ADC2GPIO 28

Working Principle

This MicroPython script reads analog values using the ADC and converts them into voltage.

Key Functions:

  • ADC(26): Initializes GPIO 26 as an ADC input.

  • read_u16(): Reads a 16-bit ADC value from 0 to 65535.

  • The raw ADC value is then converted to a voltage using:

    Voltage=ADC Value×3.365535\text{Voltage} = \frac{\text{ADC Value} \times 3.3}{65535}
  • The script runs continuously, updating the analog value and corresponding voltage every 0.5 seconds.


Code: MicroPython

python

from machine import ADC from time import sleep analog = ADC(26) # Initialize ADC on GPIO 26 (ADC0) print("Reading value from GPIO 26 and ADC0") while True: value = analog.read_u16() # 16-bit ADC value (0-65535) voltage = value * 3.3 / 65535 # Convert to voltage (assuming 3.3V reference) print("ADC Value:", value, "| Voltage:", round(voltage, 2)) sleep(0.5)

Applications

  • Sensor data reading (e.g., temperature, light, gas sensors).

  • Real-time voltage monitoring.

  • Basis for data logging or plotting.


Advantages

  • Uses MicroPython, ideal for education.

  • High Resolution than arduino uno.

  • Can be extended to read from multiple ADC channels.


Limitations

  • No filtering (analog readings may fluctuate).

  • Resolution is limited to 16-bit with read_u16().

  • Not suitable for high-speed sampling without optimizations.


References


Conclusion

This project introduces analog data acquisition using Raspberry Pi Pico, which is fundamental for interfacing with the real world. From potentiometers to environmental sensors, this ADC setup provides the building blocks for more advanced IoT and electronics projects.

 Next Step: Try connecting a temperature sensor (e.g., LM35) or LDR and observe how the voltage output changes with temperature or light!

Comments

Popular posts from this blog

Astable circuit using 555 timer ic

LDR base solar light tracking system using Transistor DIY project

Monostable circuit using 555 timer ic