Raspberry Pi Pico W LED Blink

by Ramatronics Laboratory in Circuits > Microcontrollers

8929 Views, 4 Favorites, 0 Comments

Raspberry Pi Pico W LED Blink

WhatsApp Image 2023-05-16 at 12.32.58 PM.jpeg
WhatsApp Image 2023-05-16 at 12.06.57 PM.jpeg

INTRODUCTION:

In my previous instructables, I showed you step by step how you can download the micro python firmware for raspberry pi pico w and upload it on the raspberry pi pico w. Now In this instructables, I am going to show you how we can blink the on board LED of the raspberry pi pico w board. I will also connect an external LED to the raspberry pi pico w and and blink it. This instructables is suitable for beginners who want to start programming with raspberry pi pico w. So let's get started.

Supplies

raspberry-pi-micro-usb-cable-en-raspberry-pi-power-adapters-raspberry-pi-4528-15-B.png
picow.png

Hardware Requirements:


https://quartzcomponents.com?sca_ref=3671286.DzEptz4I3w

Raspberry Pi Pico W

https://quartzcomponents.com/products/raspberry-pi-pico-w?_pos=1&_sid=726851df3&_ss=r

Bread board

https://quartzcomponents.com/products/colored-breadboard-mb-102-830-point?_pos=1&_sid=179cfbb2b&_ss=r

LED(color = red, size = 5mm)

https://quartzcomponents.com/products/red-5mm-led?_pos=1&_sid=d50f3cd19&_ss=r

Jumper wires(male-to-male)

https://quartzcomponents.com/products/65pcs-breadboard-jumper-cable?_pos=7&_sid=6ed0cd1a2&_ss=r

Resistor(330 Ohm, 1/4W)

https://quartzcomponents.com/products/330-ohm-1-4-watt-resistor-with-1-tolerance-pack-of-10?_pos=2&_sid=810656157&_ss=r



https://www.amazon.in/

Raspberry Pi Pico W

https://www.amazon.in/Raspberry-Pi-Official-Dual-core-Processor/dp/B0BKTK2P41/?_encoding=UTF8&pd_rd_w=h6QOg&content-id=amzn1.sym.22a42d01-0089-4fec-a28b-ec7a361d085f&pf_rd_p=22a42d01-0089-4fec-a28b-ec7a361d085f&pf_rd_r=RV1P5GHW82HA7E36TTY5&pd_rd_wg=0zylc&pd_rd_r=212c9554-b847-430f-86c5-a100a25f54f7&ref_=pd_gw_ci_mcx_mr_hp_d

Bread board

https://www.amazon.in/Robotbanao-Solderless-MB102-Breadboard-Points/dp/B08GG6ZC41/ref=pd_ci_mcx_mh_mcx_views_0?pd_rd_w=s3BWL&content-id=amzn1.sym.7c947cdc-0249-4ded-881f-f826efe2df4c&pf_rd_p=7c947cdc-0249-4ded-881f-f826efe2df4c&pf_rd_r=8QWNEJNFE04KNQSNV7K7&pd_rd_wg=GyGs2&pd_rd_r=75b0c2fe-36fc-41c6-a893-b9abc7052e6f&pd_rd_i=B08GG6ZC41&th=1

LED(color = red, size = 5mm)

https://www.amazon.in/Red-LED-5mm-Diffused-Pieces-Pack/dp/B08P1DLM7G/ref=sr_1_6?crid=2JXEKPMPMX474&keywords=red+led+5mm&qid=1683997272&sprefix=red+led+5m%2Caps%2C545&sr=8-6

Jumper wires(male-to-male)

https://www.amazon.in/Robotbanao-Breadboard-Wires-Jumper-Dupont/dp/B08WWYP1HJ/ref=sr_1_31?crid=1Y8MEU6ZD297L&keywords=jumper+wires&qid=1683997319&sprefix=jumper+wire%2Caps%2C547&sr=8-31

Resistor(330 Ohm, 1/4W)

https://www.amazon.in/100pcs-330E-RESISTOR-0-25W-METAL/dp/B08DC71KLW/ref=sr_1_10?crid=30ZU89C04G7XN&keywords=330+ohm+resistor+1%2F4w&qid=1683997365&sprefix=330+ohm%2Caps%2C813&sr=8-10



https://robu.in/

Raspberry pi pico W

https://robu.in/product/raspberry-pi-pico-w/

Bread board

https://robu.in/product/mb102-830-points-solderless-prototype-pcb-breadboard-high-quality/

Micro USB Cable

https://robu.in/product/50-cm-micro-usb-cable/

Male headers

https://robu.in/product/2-54mm-1x40-pin-male-single-row-straight-short-header-strip-pack-of-3/


Software Requirements:

Thonny(Micro Python IDE for Beginners).

https://thonny.org/

Downloading the Firmware and Installing It on Pico W

bootsel.png
pico-top-plug.png
plug-in-pico.png

If you have purchased a new raspberry pi pico w board, first of all you need to download the latest version of micro python firmware for your raspberry pi pico w board and install it on your pico w. I have already published an another instructables on raspberry pi pico w in which I have explained in detail how to do this. I highly recommend to read that instructables. The link of the instructables is as following:

https://www.instructables.com/Raspberry-Pi-Pico-W/

Writing a Micro Python Program to Blink the on Board LED

Screenshot 2023-05-16 163534.png
WhatsApp Image 2023-05-16 at 12.06.58 PM (1).jpeg
WhatsApp Image 2023-05-16 at 12.06.58 PM.jpeg

Open a new script in thonny IDE and write the following lines of the micro python program and save the script on your pico w board with file name as main.py.

import machine
import time

led = machine.Pin('LED', machine.Pin.OUT) #configure LED Pin as an output pin and create and led object for Pin class

while True:
  led.value(True)  #turn on the LED
  time.sleep(1)   #wait for one second
  led.value(False)  #turn off the LED
  time.sleep(1)   #wait for one second

After saving the main.py, click on run option.

Making a Prototype Circuit on the Bread Board

pico w_page-0001.jpg
pinout.png
WhatsApp Image 2023-05-16 at 12.32.58 PM (1).jpeg
WhatsApp Image 2023-05-16 at 12.32.57 PM (1).jpeg
WhatsApp Image 2023-05-16 at 12.32.57 PM.jpeg

Write a Micro Python Program to Blink External LED

Screenshot 2023-05-16 163602.png

Open a new script in thonny IDE and write the following lines of the micro python program and save the script on your pico w board with file name as main.py.

or

You can just replace the number 15 by string 'LED' in main.py script that you have written in step 2.

import machine
import time

led = machine.Pin(15, machine.Pin.OUT) #configure GPIO-15 Pin as an output pin and create and led object for Pin class

while True:
  led.value(True)  #turn on the LED
  time.sleep(1)   #wait for one second
  led.value(False)  #turn off the LED
  time.sleep(1)   #wait for one second


After saving the main.py, click on run option.