Digi XBee3 is the latest Digi development board with LTE-M radio. The board supports micopython. Here I am going to show you how to connect ultrasonic distance measuring sensor with Digi XBee3 and how to code in micropython.
DemoCodeClone from my GitHub repository
Step 1 : | ConnectingConnect all the component according to the attached schematics below.
Step 2 : | Setup IDEDownload and install XCTU from this link
Step 3 : | CodingRun the XCTU and add you radio module into the IDE. Go to Tool menu → File system manager. Click on Open to make a connection with the device. Create a folder called "lib". Upload “hcsr4.py” file into the "lib" directory.
Go to Tool menu → MicroPython Terminal. Click on Open to make a connection with the device. Press CTRL+B to get the python REPL. Press CTRL+E to get into the PASTE mode. Copy the below code into the terminal. Press CTRL+D to exit from the paste mode and run the pasted code snippet.
Place any obstacle in front of the sensor and you will be able the see the distance between obstacle and sensor in centimeters on your terminal. To stop the execution press CTRL+C.
Comments