ifeanyi Raspberry Pi Pico ADC and Muscle Sensor Setup Guide
Hardware Wiring and Pin Mapping for the Raspberry Pi Pico
Pin Identification and Configuration: * The Raspberry Pi Pico features three ADC (Analog-to-Digital Converter) pins and one ADC reference pin. * The pins are categorized as follows: * ADC Channel 0 * ADC Channel 1 * ADC Channel 2 * ADC Reference * The pin count is performed relative to Pin 40. Pin 31 is identified as being nine positions down from Pin 40. * ADC Channel 0 (GPIO 26): Located at Pin 31. This is the specific pin utilized for the signal wire. * VCC and Ground: It is noted as best practice to lay the VCC line first, though in this demonstration, three separate channels were considered.
Breadboard Setup Adjustments: * Due to the limited length of the jumping wires, the entire assembly on the breadboard (including horizontal wires) was shifted up by one space to reach the necessary pins on the Pico. * The "baseline" is established as the ground line. * A blue wire is used as the primary signal wire, connecting Pin 31 to the sensor.
Sensor Interfacing (Myoware Core Sensor / Quark Sensor): * The sensor used is identified variously as the Myoware Core Sensor or Quark Sensor. * Sensor Pinout: * : Voltage supply. * Ground: Reference ground. * sig: Signal output. * The
sig(signal) pin outputs an analog signal derived from patches applied to the body. This signal is sent to the ADC on the Pico to be converted into binary code (ones and zeros) for plotting and analysis. * The sensor connects via the blue signal line to ADC Channel 0 (GPIO 26). * The Raspberry Pi Pico supports up to three such sensors simultaneously because it has three dedicated ADC channels.
Firmware Installation and Bootloader Mode
Entering Bootloader Mode: 1. The device must be unplugged from the power source/laptop. 2. The "Boot Select" button on the Pico must be held down. 3. While holding the button, the device is plugged back into the laptop. 4. This sequence forces the device into bootloader mode, allowing the flashing of new firmware.
Installing MicroPython: * Target Hardware: RP2350 (Raspberry Pi Pico 2W / Pico W). * Software/Firmware Version: MicroPython version . * The installation is performed by selecting the correct variant (Raspberry Pi Pico W / 2W) and clicking install. Once the installation is complete, the Pico restarts, and the "Boot Select" button can be released.
Software Configuration and Environment Setup
Configuring the Interpreter: * The programming environment (interpreted through Thonny or a similar IDE) must be pointed to the hardware. * The user navigates to Run > Configure interpreter. * The setting is changed from "Local Python 3" to "MicroPython (Raspberry Pi Pico)". * Successful connection is verified by running a standard
print("Hello World")command, which returns the string from the board.Visualization Tools: * A "Plotter" (graphing tool) is used to visualize the real-time data stream coming from the analog sensor.
MicroPython Programming for ADC Data Acquisition
Importing Libraries: * The
machinelibrary is essential for hardware interaction. * The commandfrom machine import ADCis used to access the analog-to-digital converter functionality.Code Structure for Sensor Reading: * Object Definition: The sensor is defined as
muscle_sensor = ADC(26), referencing GPIO 26 (Pin 31). * Main Loop: An infinite loop (while True) is used to continuously poll the sensor. * Sampling Rate and Sleep: * Atime.sleep(0.1)command is included in the loop to prevent the device from reading millions of times per second. * This results in a maximum sample rate of approximately times per second. * Output: The code prints the raw values, which are converted from the analog signal into a range of numbers.Data Values: * The maximum 16-bit unsigned integer value received from the ADC is observed as .
Testing, Troubleshooting, and Observations
Initial Baseline Testing: * To test the ADC's functionality, the signal was briefly connected to the signal ground to check if the board was running and responsive. * A potentiometer was also mentioned as a method for testing the ADC range.
Signal Issues and Calibration: * During initial tests, the output remained at a constant high value () regardless of movement. * Mentions of specific angles for calibration/testing included degrees and degrees. * A ground reference of was mentioned in relation to a reading of , equating to a difference of .
Power and Hardware Considerations: * Battery Power: If the signal does not change as expected during muscle flexion, the system may need to be switched from USB power to external battery power. * Soldering: Currently, the setup uses a breadboard and headers, but for a permanent wearable solution, the components will eventually be soldered to a board. * Patch Placement: For testing, the location of the ground patch (e.g., on a bone) is deemed less critical than simply establishing a valid circuit to detect signal changes.
Questions & Discussion
Question from Participant: "Is this one breadboard enough when normally we need more?" * Response: The speaker indicates that while it may be "bad practice" (suggesting the VCC should have been laid differently originally), one breadboard is being made to work for the current prototype phase.
Question from Participant: "Where did you click something here? Or it popped up?" * Response: The speaker clarifies that they manually navigated to the "Run" menu and selected "Configure interpreter" to switch from Local Python to MicroPython.
Question from Participant: "Do you think we'll be able to get the prototype done today?" * Response: The speaker expresses optimism that the functional prototype (reading data) can be finished today, though it will not yet be in a "wearable" format.