Chamal Ayesh Wickramanayaka
Published © MIT

DIGI XBEE3 with HC-SR-04

I am going to show you how to connect Ultrasonic distance measuring sensor (HC-SR-04) with Digi Xbee3 MicroPython radio module.

BeginnerFull instructions provided1 hour1,023
DIGI XBEE3 with HC-SR-04

Things used in this project

Hardware components

Digi Xbee3 Cellular Smart Modem LTE-M/NB-IoT Development Kit
×1
Ultrasonic Sensor - HC-SR04
SparkFun Ultrasonic Sensor - HC-SR04
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Digi XCTU

Story

Read more

Schematics

Digi Xbee 3 with HC-SR-04

This is how wire the both components

Code

Digi Xbee 3 with HC-RS-04

Python
import hcsr04
import time
from machine import Pin
p = hcsr04.HCSR04(Pin.board.D3,Pin.board.D2)
while True:
   p.distance_mm()
   time.sleep_ms(2000)

Credits

Chamal Ayesh Wickramanayaka

Chamal Ayesh Wickramanayaka

21 projects • 24 followers
Experienced software engineer with a passion for AI, IoT, and innovation, continuously seeking to learn and embrace new technologies.

Comments