Mysterious User

Life's a garden. Dig it.

Before starting, make sure that you have the following materials:

  • Raspberry Pi Pico W
  • NB-IoT Module
  • Micro USB cable
  • Jumper wires

Step 1: Connect the Hardware

  1. Power off your Raspberry Pi Pico W before connecting any hardware.
  2. Connect one end of the micro USB cable to the Raspberry Pi Pico's Micro USB port and the other end to your computer's USB port.
  3. Connect the UART port on the NB-IoT module to the TX and RX pins on the Raspberry Pi Pico using jumper wires. Make sure to connect the TX pin on the module to the RX pin on the Raspberry Pi Pico and vice versa.
  4. Connect the power supply to the NB-IoT module.

Step 2: Install Thonny IDE

  1. Download and install the Thonny IDE on your computer:
  2. Connect your Raspberry Pi Pico to your computer via USB if you haven't done so already.

Step 3: Configure Thonny IDE

  1. Open Thonny IDE on your computer.
  2. Navigate to Tools > Options > Interpreter.
  3. Under "Default Interpreter," select "Pico MicroPython (USB)."
  4. Click the "Detect" button to make sure that the correct port is selected.
  5. Click "OK" to save the changes.

Step 4: Code for NB-IoT Module

  1. Open a new file in Thonny IDE.
  2. Copy and paste the following code into the file:
import machine
from machine import UART
import time
# configure UART communication
uart = UART(0, baudrate=9600)
uart.init(9600, bits=8, parity=None, stop=1, tx=0, rx=1) # set TX and RX pins accordingly
# enable echo mode
# set network operator
uart.write('AT+COPS=1,2,"NETWORK OPERATOR"\r\n') # replace "NETWORK OPERATOR" with your desired network operator
# set APN
uart.write('AT+CGDCONT=1,"IP","APN"\r\n') # replace "APN" with the APN of your network operator
# check signal quality
# connect to network
# activate PDP context
# get IP address
  1. Replace "NETWORK OPERATOR" with the name of your network operator and "APN" with the APN of your network operator.
  2. Save the file with a name, such as "".

Step 5: Run the Code

  1. Click the "Run" button in Thonny IDE or press F5 on your keyboard.
  2. The code will begin running and you should see the output in the Shell window.
  3. If everything is successful, you should see an IP address in the output.

Congratulations! You have successfully connected and configured the NB-IoT module with the Raspberry Pi Pico W. You can now use this code as a starting point for your NB-IoT projects.