Chamal Ayesh
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 hour110
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

Chamal Ayesh

4 projects • 1 follower
I am a software engineer with 15+ years experience. I have been working on IoT projects for 5+ years. Eager to learn new things.

Comments