Sixfab NB-IoT is another member of our Nb-IoT Shield family. This can be connected either with USB or you may also use any micro controller(Arduino, Raspberry Pi, Orange Pi etc. ). For this tutorial we are going to use Raspberry Pi. Here we will be sending data obtained by our Raspberry Pi from Ultrasonic Waterproof Range Finder(JSN-SR04T-2.0) and send this data over UDP.
Before you get started make sure you have done your router configuration as mentioned in previous tutorial step 1-10.
Components you will require for this tutorial are:
1. Sixfab NB-IoT EVB.
2. Raspberry Pi
3. Waterproof Ultrasonic Sensor JSN-SR04
4. Jumpers
5. Breadboard
Steps are as follows
1. Initially we need to do our connections, the circuit configuration is mentioned below.
EVB ↔ Raspberry Pi
5V ↔ 5V
GND ↔ GND
RX ↔ RX(GPIO15)
TX ↔ TX (GPIO14)
JSN-SR04 ↔ Raspberry Pi
5V ↔ 5V
GND ↔ GND
TRIG ↔ GPIO19
ECHO ↔ GPIO26
To know more about pinout of the Sixfab NB-IoT EVB
2. Clone sixfabNBiotTutorials repo to your Raspberry Pi
git clone https://github.com/sixfab/NB-IoT-EVB.git
3. Get into the cloned repo
cd NB-IoT-EVB/examples
Here you can observe ultrasonicEVB.py
Find the following line
ip = “XX.XX.XX.XX”
port = “XXXX”
and replace XX.XX.XX.XX with your router’s ip and XXXX with your port number and save it.
4. Run the script by typing
python advancedTutorialEVB.py
Here we are sending data obtained from the ultrasonic sensor over local server.
5. Type following command from another terminal to listen the data being sent over local server.
netcat -ul -p5500
where 5500 is our port number defined previously. Make sure you type it according to your information
Hence you are able to observe data from ultrasonic sensor sent over UDP. As mentioned in previous tutorials this tutorial can also be carried out in remote server.