CircuitPython with ...
 
Notifications
Clear all

CircuitPython with Raspberry Pi Pico - Getting Started  


DroneBot Workshop
(@dronebot-workshop)
Workshop Guru Admin
Joined: 2 years ago
Posts: 939
Topic starter  

Build a Keyboard and Mouse Emulator, make a rainbow with RGB LEDs, and work with a microSD card - all with CircuitPython on a Raspberry Pi Pico!

Article with diagrams and code: https://dbot.ws/picocp

Once again we are working with the Raspberry Pi Pico, the 4-dollar microcontroller that uses the new RP2040 MCU. And today we’ll be programming it using CircuitPython.

After installing CircuitPython and the MU Editor we will build a Keyboard Emulator for the popular audio program Audacity. You can use the same technique to make a custom keypad for any application, with as many keys as you need.

Next, we emulate a mouse using a Joystick and two pushbuttons. Just because we can.

Then we hook up a microSD card module through the SPI port and learn how to create a file, write to it and read it back. All the basic operations you need to start using microSD cards in your Pico projects.

And finally, we will hook up soon addressed;e REGB LEDs, otherwise known as Neopixels, to our Pico and control them using a few Adaruit libraries and sample code. It's a rainbow inside the workshop!

CircuitPython is a fork of MicroPython, the language we used in the previous Raspberry Pi Pico video. It was created by Adafruit and has a lot of advantages, especially for beginners.

Using CircuitPython gives us access to over 300 libraries and drivers, allowing us to work with the many features of the Raspberry Pi Pico right now.

We’ll install CircuitPython on a Pico and then work with it using the MU Editor, a Python editor designed for beginners with CircuitPython integration built-in. Of course, you can use any editor that you wish, that's one of the strengths of CircuitPython - no special software required.

Here is what we will cover today:

00:00 - Introduction
04:13 - CircuitPython
06:47 - Installing CircuitPython on Pico
09:40 - Installing MU Editor
12:44 - Testing (Blink)
14:43 - Build a Keyboard Emulator
22:49 - Build a Mouse Emulator
28:28 - Write & Read a microSD card
34:32 - Addressable RGB Strip (Neopixels)
39:24 - Conclusion

Hope you enjoy the video and that it helps you get the most out of your Raspberry Pi Pico!

"Never trust a computer you can’t throw out a window." — Steve Wozniak


Quote
jfabernathy
(@jfabernathy)
Estimable Member
Joined: 4 months ago
Posts: 144
 

Enjoyed the video.  I need to try your USB HID examples.  I think they have a lot of potential for my use. On the neopixel example, do you know if the library uses the PIO feature yet??

 

If your code won't compile, have another glass of bourbon. Eventual the problem will be solved.


ReplyQuote
robotBuilder
(@robotbuilder)
Honorable Member
Joined: 2 years ago
Posts: 741
 

@dronebot-workshop

Another brilliant presentation! The pièce de résistance to your videos is the detailed articles with code downloads that come with them unlike many other online video tutorials many of which are painful to watch.

 


ReplyQuote
tannewt
(@tannewt)
New Member
Joined: 1 month ago
Posts: 4
 
Posted by: @jfabernathy

Enjoyed the video.  I need to try your USB HID examples.  I think they have a lot of potential for my use. On the neopixel example, do you know if the library uses the PIO feature yet??

 

Yup, `neopixel_write` uses PIO internally.

 


ReplyQuote
jfabernathy
(@jfabernathy)
Estimable Member
Joined: 4 months ago
Posts: 144
 

@tannewt welcome Scott. You are everywhere these days.

😀

If your code won't compile, have another glass of bourbon. Eventual the problem will be solved.


ReplyQuote
Martin Richard
(@martin-richard)
Active Member
Joined: 2 months ago
Posts: 8
 

Hi Everyone

I followed this video and did the examples except fot the button and mouse examples after finishing i closed down my pc  and the next time i tried to use it it would not boot up after playing around i disconnected the Pico from the usb port and the pc booted up as normal 

i tried to boot up a few more times and came to the conclusion if the Pico was connected at power on the PC would not boot until i disconnected the Pico 

anyone else had this happen

Regards

 

Martin


ReplyQuote
jfabernathy
(@jfabernathy)
Estimable Member
Joined: 4 months ago
Posts: 144
 

@martin-richard I have seen this before.  I have gotten into the habit of ejecting the CircuitPython drive regardless of whether or not it was a Pico. I've had this happen with the Metro ESP32-S2 as well.  It's good practice to eject or unmount any USB drive before removing, or suspending or shutting down a PC. IMHO.

 

If your code won't compile, have another glass of bourbon. Eventual the problem will be solved.


ReplyQuote
gekopmac
(@gekopmac)
Active Member
Joined: 1 year ago
Posts: 5
 

Hello all,

What I would like to see is, how do you get the syntax of the commands and what libraries are there and where are they.

Kind regards,
Henk de Sain

 

 


ReplyQuote
OldCodger
(@oldcodger)
Eminent Member
Joined: 7 months ago
Posts: 20
 

Hi,

Will any SSD1306 display work on the Pico.  I’ve been looking around and I haven’t found one that says it works with a Pico.

Who made the one you used in the video Bill ?

 

Regards 

Dave


ReplyQuote
DroneBot Workshop
(@dronebot-workshop)
Workshop Guru Admin
Joined: 2 years ago
Posts: 939
Topic starter  
Posted by: @oldcodger

Who made the one you used in the video Bill ?

I looked at it Dave, but unfortunately, it has no markings. I bought a bunch from Amazon, and the packages all just say "0.91" White IIC OLED SSD1306", along with some Chinese writing that I can't interpret.

The issue with the Pico is that it is a 3.3V logic device, and some OLEDs require 5-volts.  As the OLED is the slave device in this circuit and as it never sends data back to the Pico you could try powering the OLED with 5-volts.  That is acceptable, as it can read the 3.3V I2C logic signals, and the screen would be powered by the full 5-volts.

😎

Bill

"Never trust a computer you can’t throw out a window." — Steve Wozniak


ReplyQuote
OldCodger
(@oldcodger)
Eminent Member
Joined: 7 months ago
Posts: 20
 

Thanks for the info Bill,

I‘m surprised you can’t read Chinese though 😂😂😂

 

Regards

 

Dave


ReplyQuote
OldCodger
(@oldcodger)
Eminent Member
Joined: 7 months ago
Posts: 20
 

@dronebot-workshop

Hi Bill,

I saw 2 ssd1306’s advertised on Amazon so I bought them. I was surprised how small they were when I opened the box !!

i looked at your video again and I think they are about the same size as yours, 0.5 of an inch x 1.5 inches.

Next time I’ll do more accurate research 😂😂😂.

The good news is they both work perfectly 


ReplyQuote