Read Sensor Value

This guide will show you how to read the analog and digital sensor value from Grove Port or GPIO breakout.

 

Analog Read

The figure below shows the GPIO that can read analog sensor value.

Note: You may look for the pins labelled "ADC" at the back of the board.

1. While your Robo Pico is connected to your computer, open your editor software (for example Thonny). Select the code.py file in your drive.


2. Connect your sensor module to the Robo Pico, to Grove Port 6 using Grove to 4 female pins / grove cable.
OR connect to the GPIO breakout using male-to-female jumper wires togetther with grove cables (if applicable).

Example module used: Maker Soil Moisture Sensor

 

3. Copy and paste the following code to your editor.

 

4. Flash the codes to your Raspberry Pi Pico / Pico W. And your CIRCUITPY drive should look like this (no lib file is used):

 

Digital Read

We will show all 3 types of connections for this application, including Grove Ports, Maker Port and GPIO Breakout.

In this example, we will use the generic module of HC-SR04 Ultrasonic Sensor as illustration.

 

Grove Port and GPIO Breakout

1. While your Robo Pico is connected to your computer, open your editor software (for example Thonny). Select the code.py file in your drive.


2. Connect your sensor module to the Robo Pico, to Grove Port 4 using Grove to 4 female pins / grove cable.
OR connect to the GPIO breakout using male-to-female jumper wires.

3. Copy and paste the following code to your editor.

 

4. Flash the codes to your Raspberry Pi Pico / Pico W. And your CIRCUITPY drive should look like this:

Library file(s) required:
    adafruit_hcsr04.mpy

If you don't have this file in your computer, download the lib bundle here and search for this file inside the "lib" folder.

 

Maker Port

1. While your Robo Pico is connected to your computer, open your editor software (for example Thonny). Select the code.py file in your drive.


2. Connect your sensor module to the Robo Pico, to Maker Port using JST SH to 4 female pins / grove cable.

3. Copy and paste the following code to your editor.

 

 

4. Flash the codes to your Raspberry Pi Pico / Pico W. And your CIRCUITPY drive should look like this:

Library file(s) required:
    adafruit_hcsr04.mpy

If you don't have this file in your computer, download the lib bundle here and search for this file inside the "lib" folder.

 

Hardware Components

Robo Pico

S$21.29 S$21.29

x 1 unit(s)