How to make a LED ring with Raspberry Pi Pico board

How to make a LED ring with Raspberry Pi Pico board

Hello and welcome back. In this project, we will learn how to make a LED ring with a Raspberry Pi Pico board. For that, I used 20 LED bulbs and 6 light patterns. You can assemble this project on the dot board. But, I designed a PCB for this project. For that, I have selected the JLCPCB Company. Through this company we can get quality PCBs for 2$ and below we will learn how to order this PCB step by step.

  • You can put any other light patterns into this project. But I used six light patterns.
  • If you want to buy this product, you can get it from our store.

Ok, let’s do this project step by step. The required components are given below.

Disclosure: These Amazon links are Affiliate links. As an Amazon Associate, I earn from qualifying purchases.

Step 1

Firstly, identify these components.

Step 2

Secondly, let’s learn how to order PCB with JLCPCB company. Follow the below steps for that.

  • First, go to the JLCPCB website and create a new account.

  • Next, sign in to your account and click the “Order now” button.

  • And then, upload the PCB Gerber file and change the specifications as you like. I changed the color to red.
  • PCB Gerber file — Download

  • Now, click the save to cart button. After, click the secure checkout button.

  • Next, enter your address and select the shipping method. Finally, pay for this order using your debit card, credit card, or PayPal account.

  • OK, now you can get it within 4-9 days. Because I used FedEx delivery method. It depends on your delivery method.

Step 3

Thirdly, let’s solder the components one by one.

Step 4

Now, connect the Raspberry Pi Pico board to the PCB and connect it to the computer.

Step 5

Next, upload the python script to the Raspberry Pi Pico board. It’s as follows.

  • Full details of this project — Download
#Import the library files
from  machine import Pin
import time

#Pattern one
def patternOne(times):
    for a in range (0,times):
        for i in range(2,22):
            Pin(i,Pin.OUT).value(1)
            time.sleep(0.07)
            Pin(i,Pin.OUT).value(0)          

#Pattern two
def patternTwo(times):
    for a in range(0,times):
        for i in range(2,22):
            Pin(i,Pin.OUT).value(1)
            time.sleep(0.05)
            Pin(i,Pin.OUT).value(0)
            
        for x in range(21,2,-1):
            Pin(x,Pin.OUT).value(1)
            time.sleep(0.05)
            Pin(x,Pin.OUT).value(0)

#Pattern three
def patternThree(times):
    for a in range(0,times):
        for i in range(2,22):
            Pin(i,Pin.OUT).value(0)
            time.sleep(0.05)
            Pin(i,Pin.OUT).value(1)
            
        for x in range(21,2,-1):
            Pin(x,Pin.OUT).value(0)
            time.sleep(0.05)
            Pin(x,Pin.OUT).value(1)

#Pattern four
def patternFour(times):
    for a in range(0,times):
        for i in range(2,22):
            Pin(i,Pin.OUT).value(1)
            time.sleep(0.05)       
            
        for x in range(21,0,-1):
            Pin(x,Pin.OUT).value(0)
            time.sleep(0.05)       

#Pattern five
def patternFive(times):
    for a in range(0,times):
        for i in range(2,22):
            Pin(i,Pin.OUT).value(0)
            time.sleep(0.05)       
            
        for x in range(22,1,-1):
            Pin(x,Pin.OUT).value(1)
            time.sleep(0.05)

#Pattern six
def patternSix(times):
    for a in range(0,times):
        for i in range(2,22):
            Pin(i,Pin.OUT).value(1)
            Pin(i+1,Pin.OUT).value(1)
            time.sleep(0.05)
            Pin(i,Pin.OUT).value(0)
            Pin(i+1,Pin.OUT).value(0)
            
        for x in range(21,2,-1):
            Pin(x,Pin.OUT).value(1)
            Pin(x-1,Pin.OUT).value(1)
            time.sleep(0.05)
            Pin(x,Pin.OUT).value(0)
            Pin(x-1,Pin.OUT).value(0)

#Call the functions
while True:           
    patternOne(3)
    patternTwo(3)
    patternThree(3)
    patternFour(3)
    patternFive(3)
    patternSix(3)
  • Now, copy and paste this script on the Thonny IDE and save it as “main.py” on the Raspberry Pi Pico board. Finally, click the Run button.

Ok, now you can enjoy this project. The full video guide is below. So, see you in the next project or tutorial.

How to make a LED ring with Raspberry Pi Pico board

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *