Home Circuitpython Adafruit Feather M0 and US-026 ultrasonic sensor circuitpython example

Adafruit Feather M0 and US-026 ultrasonic sensor circuitpython example

by shedboy71

In this example we connect a US-026 ultrasonic sensor to an Adafruit Feather M0 running Circuitpython

US-026 is an upgraded version of the HC-SR04, with a kind of high performance, low cost ultrasonic module. The module uses the CS100 , a high performance-cost ratio ultrasonic ranging chip.


First lets look at some information about the sensor from the manufacturer


It has high measurement accuracy and the measuring distance is farther than 6 meters. Good consistency, well stability.
It can realize 2-6m non-contact ranging. The working voltage is 3V-5.5V, working current is 5.3 mA and supporting GPIO communication mode.
US-026 has 4 Pin power supply and communication interface. It is single-side printed board. 4 pin is welded on the back side (the chip side).
Input a 10uS above high level to Trig pin, the system will emit eight 40KHZ ultrasonic impulse. The system detects the echo signal and output through Echo pin. Calculating the distance according the lasting time of high electrical level which exported by the ECHO pin.

1.This module has stable performance and accurate measurement distance.
2.Module high-precision, blind (2cm) ultra-close, stable range is the success of this product to the market a strong basis.
3.Using IO trigger ranging,to at least 10us of high-level signal.
4.The module automatically sends eight 40khz square wave, automatically detect whether there is signal return.
5.There is a signal return, through the IO output of a high, high duration is the time from the launch to the return of ultrasound.



Working voltage: DC 3V-5.5V
Working current:5.3mA
Level output: High 5V
Level output: Bottom 0V
Sensing angle: not more than 15 degrees
Detection range: 2cm-600cm


Parts Required


Name Link
Adafruit Feather M0 Express Adafruit (PID 3403) Feather M0 Express – Designed for CircuitPython – ATSAMD21 Cortex M0
US-026  ultrasonic sensor 1pcs US-025 US-026 ultrasonic ranging sensor module
Connecting cables Free shipping Dupont line 120pcs 20cm male to male + male to female and female to female jumper wire



The Ultrasonic sensor has four terminals – +5V, Trigger, Echo, and GND connected as follows

  • Connect the +5V pin to +3.3v on your Adafruit Feather board.
  • Connect Trigger to digital pin 5 on your Adafruit Feather board.
  • Connect Echo to digital pin 6 on your Adafruit Feather board.
  • Connect GND with GND on Adafruit Feather.
feather and us-026

feather and us-026

Code Example

I used Mu for development, you can use the HCSR04 library

The following is based on a library , I copied the adafruit_hcsr04.mpy to the lib folder on my Feather M0 Express – https://circuitpython.org/libraries

import time
import board
import adafruit_hcsr04
sonar = adafruit_hcsr04.HCSR04(trigger_pin=board.D5, echo_pin=board.D6)
while True:
    except RuntimeError:


Here is what I saw in Mu REPL window





You may also like

Leave a Comment