Video Tutorial (Optional)
Watch first if you want to follow along and see the Raspberry Pi Pico W sending an SMS using the Twilio API.
Project Overview
Send SMS Messages - Raspberry Pi Pico W: In this tutorial, you use a Raspberry Pi Pico W and the Twilio SMS API to send text messages from MicroPython over WiFi without installing the Twilio package on the Pico.
The Twilio Python package is popular, but it cannot fit on the Pico W due to limited storage. Instead, you use the Pico W s built-in WiFi and make lightweight API requests to Twilio.
- Time: 20 to 40 minutes
- Skill level: Beginner
- What you will build: A MicroPython script on Pico W that connects to WiFi and sends an SMS by calling the Twilio REST API
Parts List
From ShillehTek
- Raspberry Pi Pico 2W - the WiFi microcontroller board used in this build
External
- Computer with MicroPython IDE (Thonny recommended): https://thonny.org/
- WiFi network name (SSID) and password
- Twilio account: https://www.twilio.com/
- Project script on GitHub: https://github.com/shillehbean/youtube-channel/blob/main/sms-micro-python.py
- Twilio API documentation: https://www.twilio.com/docs/usage/api
Note: This approach avoids installing the Twilio MicroPython package on the Pico W by sending HTTP requests to the Twilio API instead.
Step-by-Step Guide
Step 1 - Install Thonny on your Raspberry Pi Pico W setup
Goal: Get an IDE ready for writing and running MicroPython code on the Pico W.
What to do: Install Thonny from https://thonny.org/. If you already have an IDE that can connect to the Pico W and run MicroPython, you can skip this step.
Expected result: You can open your IDE and you are ready to connect to the Pico W.
Step 2 - Create your Twilio account
Goal: Get the Twilio credentials needed to authenticate API requests that send SMS messages.
What to do: Create an account at https://www.twilio.com/. During setup, Twilio provides a Twilio phone number, an account ID, and a token that you will need in your code.
Expected result: You have a Twilio phone number, account ID, and token available for the script.
Step 3 - Connect to the Pico W and run the script function
Goal: Run the MicroPython script that connects to WiFi and sends an SMS using the Twilio API.
What to do: Connect to your Raspberry Pi Pico W in Thonny (or your preferred IDE). Then open the script from the GitHub link and run it:
The function logic is split into two parts.
1-) Making the internet connection: The script uses your WiFi network name and password and waits up to 10 seconds for a connection. If it cannot connect, it throws an error.
2-) Hit the Twilio API with the SMS you want to send: The script uses the MicroPython requests library to make a POST request to Twilio. You must pass the correct headers so the API can parse the payload, and you must include your Twilio authentication details to avoid auth errors.
Twilio API details are available here: https://www.twilio.com/docs/usage/api.
Expected result: When you run the function, you should see an HTTP status code in the 200s. If so, your recipient likely received the SMS message.
Conclusion
You set up a Raspberry Pi Pico W to send SMS messages by connecting to WiFi and calling the Twilio API from MicroPython. The key idea is using lightweight API requests instead of installing the full Twilio package on the Pico W s limited storage.
Want parts for your next Pico W IoT build? Grab what you need from ShillehTek.com. If you want help adapting this SMS approach to your own product or IoT workflow, check out our IoT consulting services.


