home.social

Search

255 results for “circuitpython”

  1. Here's a look at Week 11 of #CircuitPython #PhysicalComputing class. Students made rubber band launchers with a #RaspberryPi Pico, joystick, 3 servos, and a button. Big fun! youtube.com/shorts/envNY1mYCEQ

  2. Here's a look at Week 11 of #CircuitPython #PhysicalComputing class. Students made rubber band launchers with a #RaspberryPi Pico, joystick, 3 servos, and a button. Big fun! youtube.com/shorts/envNY1mYCEQ

  3. Here's a look at Week 11 of #CircuitPython #PhysicalComputing class. Students made rubber band launchers with a #RaspberryPi Pico, joystick, 3 servos, and a button. Big fun! youtube.com/shorts/envNY1mYCEQ

  4. Want easy capsense touchpad buttons? Just a PCB & 4 resistors. Coming soon to my Tindie store! If you want to make your own, files are here: github.com/todbot/touchpads
    This demo in CircuitPython but also works in Arduino w/ my TouchyTouch lib
    #circuitpython #capsense #captouch

  5. My latest blog post: Installing CircuitPython on a Freenove ESP32-S3-WROOM CAM Board

    mikecoats.com/circuitpython-on

    In celebration of CircuitPython Day 2025, here's how I installed CircuitPython on one of my favourite, but unsupported, boards, the Freenove ESP32-S3-WROOM CAM Board.

    #circuitPythonDay2025 #circuitPython #embedded #esp32 #espressif #freenove #python

  6. Consolidated a bunch of in-process projects I’m doing for our students in anticipation of speaking with @blitzcitydiy for #CircuitPythonDay on #csed and #makered.

  7. Consolidated a bunch of in-process projects I’m doing for our students in anticipation of speaking with @blitzcitydiy for #CircuitPythonDay on #csed and #makered.

  8. Consolidated a bunch of in-process projects I’m doing for our students in anticipation of speaking with @blitzcitydiy for #CircuitPythonDay on #csed and #makered.

  9. Consolidated a bunch of in-process projects I’m doing for our students in anticipation of speaking with @blitzcitydiy for #CircuitPythonDay on #csed and #makered.

  10. Pico Touch Board Audio

    I wanted to go back to my Pico Touch Board PCB Design and see if there was a way to make it more stand-alone. The original design was to make it a MIDI controller, but that isn’t the only option.

    https://makertube.net/w/tADSyrPrUdR1mx7yKRXZTC

    Warning! I strongly recommend using old or second hand equipment for your experiments.  I am not responsible for any damage to expensive instruments!

    These are the key Arduino tutorials for the main concepts used in this project:

    If you are new to microcontrollers, see the Getting Started pages.

    Parts list

    • Pico Touch Board PCB – built
    • Resistors: 1x 220Ω, 1x 1K
    • Capacitor: 1x 100nF ceramic, 1x 22uF electrolytic
    • Breadboard and jumper wires

    The Circuit

    Most of the GPIO are linked out to the touch pads, but the three analog inputs are still available. They are added on to the header on the right hand side of the board at the top, so we can use one of these as an audio output.

    Initially, I thought of connecting it to an 8Ω speaker. If I was using an Arduino then I’d use a 220Ω resistor in series to limit the current to less than 20mA. But as I’m using a Pico, the maximum current has to be a lot less. I seem to recall it is a little complicated, and there are some options, but I have a figure of around 4mA that I tend to work to. It is also running at 3.3V, which means that it would need an in series resistor of 3.3 / 0.004 = 825Ω. This would work, but the speaker will be really quiet!

    So I ditched that idea (there is a software reason too, but I’ll talk about that in a moment) and went straight to a PWM output with a low-pass filter to try to give me some vaguely useful as a line-out signal.

    I’ve not done the calculations, but instead went a bit “hand-wavy”, combing a 1K and 220Ω resistor to drop the voltage, along with a 100nF capacitor. I’ve also added a 22uF capacitor to remove the DC bias.

    That seems to give me something useful, but as you can see from the trace below of a square wave PWM output, there is a lot of room for improvement!

    Update

    Ok, so going back and doing this semi-properly as per my notes from Arduino PWM Output Filter Circuit, I can see that the 1K and 220Ω resistors can be treated as a 180Ω equivalent (take them as two in parallel) for the filter circuit, which means a cut-off of around 8kHz which ought to be pretty good….

    But reducing a 3V3 signal to around 20% leaves for quite a low level of audio – around 660mV peak to peak. It would probably be better to aim for a reduction of around a half.

    Using a 1K and 500Ω resistor would be an equivalent resistance of 333Ω, so putting that into a low pass filter calculator gives a cut-off frequency of around 5kHz for a 100nF capacitor.

    Weirdly the only thing that really seems to improve things is to raise that capacitor value to 1uF. My calculation would suggest a cut-off frequency of around 480Hz which is pretty small for an audio signal. But it seems to work.

    The PWM frequency I was seeing was coming in at around 120kHz so should be plenty high enough to get filtered out. In the Circuitpython code, it is apparently chosen to support the number of bits required at the base clock frequency whilst being inaudible. For the RP2040 running at 125MHz, and with the chosen 10 bit resolution (more here) this is:

    • 125,000,000 / 1024 = 122,070 Hz

    A 5kHz (or even 8kHz) cut-off I thought ought to be fine, but Davide Bucci on Mastodon explained for me:

    “120kHz is 25 times 4.7kHz, that is about 1.4 decades and with a first-order filter you have a tad less than 30dB of attenuation, that is not a lot. A signal at 3.3V peak to peak at 120kHz becomes about 100 mV on the output after the filter.”

    So switching to 1uF, as Davide explains: “if you put 1µF, you are indeed filtering a decade lower, therefore you gain 20dB in the attenuation and the 100mV become 10mV, much less noticeable.”

    The alternative is to repeat the 1K+100nF stage and add a second order filter which also seems to work pretty well.

    The final circuit that works fine for me at present, will be on of the following.

    The first is less components but assumes that the frequencies won’t go much about ~1KHz or so. That is ok for my current setup but would limit the audio range a fair bit.

    This is the output of the two-stage filter. It is so much better!

    The Code

    I wanted to stick with Circuitpython, so my initial thought was to use simpleio.tone() to generate a tone based on a frequency from an IO pin. However, this has the problem that the code is blocking whilst the tone is playing which isn’t very useful.

    Instead I went straight to synthio. It turns out that using synthio was actually a lot easier than the “simple” simpleio…

    Here is the basic code to generate an ASR-shaped square wave on a PWM audio output on GPIO 28 based on the touch pads as input.

    import board
    import touchio
    import synthio
    import audiopwmio
    from adafruit_debouncer import Debouncer, Button

    audio = audiopwmio.PWMAudioOut(board.GP28)
    synth = synthio.Synthesizer(sample_rate=22050)
    audio.play(synth)
    synth.envelope = synthio.Envelope(attack_time=0.1, release_time=0.6, sustain_level=1.0)

    touchpins = [
    board.GP2, board.GP3, board.GP4, board.GP5,
    board.GP6, board.GP7, board.GP8, board.GP9,
    board.GP10, board.GP11, board.GP12, board.GP13,
    board.GP14, board.GP15, board.GP16, board.GP17,
    board.GP18, board.GP19, board.GP20, board.GP21, board.GP22
    ]

    THRESHOLD = 1000
    touchpads = []
    for pin in touchpins:
    t = touchio.TouchIn(pin)
    t.threshold = t.raw_value + THRESHOLD
    touchpads.append(Button(t, value_when_pressed=True))

    while True:
    for i in range (len(touchpads)):
    t = touchpads[i]
    t.update()

    if t.rose:
    synth.press(60+i)

    if t.fell:
    synth.release(60+i)

    I did experiment with overclocking the Pico to give double the PWM frequency, using

    microcontroller.cpu.frequency = 250_000_000

    But although this did double the PWM frequency to around 244kHz, it didn’t seem to make much difference for the filtered signal.

    Battery Power

    One last thing I wanted to explore was if it was possible to power the touchboard with batteries. I left in a number of power options, so for this one I’m using the 5V/GND pin header. I’ve included a couple of capacitors for smoothing, and need to add the 1N5817 diode as shown below.

    This requires the following additional components:

    • 1x 1N5817 Schottky diode.
    • 1x 100nF ceramic capacitor.
    • 1x 47uF electrolytic capacitor.
    • Jumper wires.
    • 3 or 4 battery box.

    The 5V/GND header pins connect to the Raspberry Pi Pico’s VSYS pin via the Schottky diode. The 1N5817 has a typical voltage drop of 0.45V, so combined with the Raspberry Pi’s accepted input voltage of 1.8V to 5.5V this means that ideally two or three AA batteries (at 1.5V each) would work. Four 1.2V rechargeables might be an option too.

    It might be possible to get away with four 1.5V AAs, but that would give an input voltage of just over 5.5V, so I think that is probably pushing things too far. It might be a good use for some spent AAs though that are no longer reading a full 1.5V…

    One of the downsides of battery power is that the touch works best when your fingers are at the same GND potential as the board. It works best if the GND pin of the (unpopulated) barrel jack is touched when using the board.

    Closing Thoughts

    With hindsight it would have been useful to have included a simple PWM output stage on the original board, but it is relatively straight forward to add one.

    It might even be worth me making an add-on board that will connect to the header pins of the power and analog pins containing the simple passive filter components.

    What is pretty impressive though, is how easy it is to use synthio with Circuitpython.

    Kevin

    #circuitpython #pwm #raspberryPiPico #synthio #touch

  11. Finally calling this done! Say hello to the HellSplit a hand-wired, asymmetric 40% split #ortholinear keyboard with vertical column stagger and two rotary encoders. Powered by a pair of Raspberry Pi Pico's #RP2040 and #KMK firmware

    #mechanicalkeyboards #splitkeyboard #ergo #otho #mechkb #splitkb #pipico #raspberypipico #40percent #handwired #circuitpython @circuitpython @RaspberryPi @rpimag

  12. Someone asked how play multiple simultaneous CD-quality WAVs from an SD card to I2S DAC on ESP32 in CircuitPython. Turns out: possible! Can get a bit glitchy if doing USB stuff tho youtube.com/watch?v=97OA6L9PLCg
    code: github.com/todbot/circuitpytho
    #CircuitPython #i2s #esp32

  13. PyCharm is a fantastic editor for #CircuitPython. I use it in my #PhysicalComputing course. The IDE has changed recently so here is an updated install video focused on the @raspberrypi pico dealing with the quirks of editing & running code on a microcontroller youtu.be/5LoXTVGlNVU?si=9_XAXP

  14. PyCharm is a fantastic editor for #CircuitPython. I use it in my #PhysicalComputing course. The IDE has changed recently so here is an updated install video focused on the @raspberrypi pico dealing with the quirks of editing & running code on a microcontroller youtu.be/5LoXTVGlNVU?si=9_XAXP

  15. PyCharm is a fantastic editor for #CircuitPython. I use it in my #PhysicalComputing course. The IDE has changed recently so here is an updated install video focused on the @raspberrypi pico dealing with the quirks of editing & running code on a microcontroller youtu.be/5LoXTVGlNVU?si=9_XAXP

  16. PyCharm is a fantastic editor for #CircuitPython. I use it in my #PhysicalComputing course. The IDE has changed recently so here is an updated install video focused on the @raspberrypi pico dealing with the quirks of editing & running code on a microcontroller youtu.be/5LoXTVGlNVU?si=9_XAXP

  17. Working with a @raspberrypi pico & #CircuitPython? Here’s an updated tutorial on installing CircUp - a tool for installing & updating libraries. I have all my students use CircUp. It’s great! Hope you find the lesson helpful #csed & #stemed friends. Hack on! youtu.be/OD6CqkVaihM?si=3do_Sd

  18. My Raspberry Pi Pico 2-based Dub siren now has a simple synth engine in addition to a sample engine, so its sounds now range from classic siren sounds to air horns and vocal snippets.

    In this short video I show off the synth engine: 🎹🔈🎶

    v.basspistol.org/w/qmjJ3TY8Q8m

    thx again 2 @todbot

    And if you haven't seen it yet check out this video for yesterday's exploration of the sample engine: 📯🔈🎶

    v.basspistol.org/w/pS4PrN9Wjo5

    #CircuitPython #AudioElectronics #SynthDIY #RP2350 #synths #SynthIO #BonkWave

  19. I was inspired by @todbot's latest #CircuitPython audio effects experiments, so I had a go at incorporating what I learned into a DIY Dub siren. It consists of a Raspberry Pi Pico 2, an i2s module with stereo line out and some pots, an encoder and a button.

    Check out my unfinished (but already fun) prototype here:

    v.basspistol.org/w/pS4PrN9Wjo5

    NB: the case was a charity shop find.

    #electronics #AudioElectronics #SynthDIY #RP2350

  20. The new audio effects libraries in CircuitPython are super fun. Here's a quick "taster" showing off some of them, part of my impending "Synthio Tutorial". Thanks Mark & Cooper for making them!
    youtube.com/watch?v=nyv7XlQ1d00
    #CircuitPython #synthio #audioeffects #synthdiy

  21. Forbidden Planet “Krell” Display EuroRack Module

    This project uses my Forbidden Planet “Krell” Display and the Forbidden Planet “Krell” Display PCB Design but with some slight variations that means it could be EuroRack mounted with a control voltage (CV) input.

    This is a DIY module only for use in my own DIY system.

    Do NOT use this alongside expensive modules in an expensive rack. It is highly likely to cause problems with your power supply and could even damage your other modules.

    https://makertube.net/w/qJqgTxxsEznTuF2DRVZT9o

    Warning! I strongly recommend using old or second hand equipment for your experiments.  I am not responsible for any damage to expensive instruments!

    If you are new to microcontrollers, see the Getting Started pages.

    Parts list

    EuroRack 3D Print Design

    This is an evolution of my original Forbidden Planet “Krell” Display box, but fitting into EuroRack dimensions: 128.5 x 60, which essentially makes it a 12 HP module.

    It still takes the same inserts however, but now also includes options for holes for jack sockets or potentiometers:

    show_eurorack = 1;
    show_eurorack_support = 1;

    alg_pot1 = 1;
    alg_pot2 = 1;
    alg_cv = 0;

    I’ve also included a special “supports” option for use with the PCB and the EuroRack case.

    Krell Display PCB – EuroRack Build

    To build one of my Forbidden Planet “Krell” Display PCB Designs for use with a EuroRack, follow the previous Build Guide but note the following differences:

    • The MIDI circuits are not required when used as a CV input device.
    • The lower potentiometer should be replaced with a CV input circuit.
    • The upper potentiometer is optional, but I’m omitting it for my build.
    • Power will come via the 5V jumper headers from an additional EuroRack power PCB (details below).
    • Low-profile (e.g. 9mm high in total) headers should be used for the Waveshare Zero, but once again note the errata about the footprint on the PCB being too wide.

    Here are some build photos of a build for EuroRack use. For this build there are only two diodes (the two BAT43) and two resistors (22K and 33K). Also note that none of the 100nF ceramic capacitors are required either.

    Both electrolytic capacitors have been soldered into position on their sides as show below.

    The Thonkiconn style mono jack shares the footprint are of the lower potentiometer on the LED side of the board, but be sure to get use the correct mounting holes as shown by the orientation below.

    Nothing has been soldered to the power jumper yet. See the discussion below for how to link this to the power board.

    Krell Display Companion EuroRack Power PCB

    Bill of Materials:

    • Waveshare Zero “Krell” Display EuroRack power PCB (Github Link below).
    • L7805 TO-220 format regulator or equivalent (see discussion below).
    • 1x 16-way DIP EuroRack shrouded header.
    • 1x 1N5017 Zener diode.
    • 2x 47uF electrolytic capacitors.
    • 1x 100nF ceramic capacitor.
    • 2-way Jumper header socket and pins (probably need extended pins – see discussion).

    I’ve opted to use a DC-DC converter with a 7805 physical footprint as shown below.

    If a 7805 regulator is used then a heatsink will almost certainly be required. I’ve oriented the regular to allow for a “tab up” mounting which hopefully leaves plenty of room for some kind of heatsink to be used.

    Here are some build photos.

    There is an option on the PCB to install a 10R resistor as is sometimes recommended for EuroRack modules. From what I’ve read this seems to be to allow it to act as a “fuse” in the case of an incorrectly wired module. As I’ve discussed before (see here) I’m not sure this is so relevant for me, so I’m using the provided solder bypass bridge to leave it out.

    Note the orientation of the DC-DC converter.

    I’ve used extended pin headers for the power link between the two boards, but due to an error in positioning, they’ve had to be bent over slightly – more on that later.

    Physical Build

    A completed unit has the following parts:

    • 3D printed case, PCB supports, and two “krell” inserts.
    • Main PCB built for EuroRack use as described above.
    • Power PCB as described above.
    • M2.5 spacers and fixings as follows:
      • 4x 6mm M2.5 brass fixings.
      • 4x 15mm M2.5 nylon fixings.
      • 4x M2.5 nylon screws.

    The power link between the two PCBs has to be trimmed and slightly bent as shown below.

    Once the whole thing is put together, there isn’t room, at least on my build, for the nut to be put on the jack socket. Also, the 6mm and 15mm spacers might be slightly too short, depending on how far off the PCBs the LEDs ended up. Some experimentation and “encouragement” is probably required to get everything together.

    The Code

    The code is relatively straight forward, and is largely a mix of the analog and neopixel test code from the Forbidden Planet “Krell” Display PCB Build Guide.

    One quirk is scaling the analog read from 0..65535 to a useful 0-10 to allow for zero to 10 leds to light up. I’ve allowed for a range of values to be “basically zero” too to allow for some jitter or noise.

    As I only write out to the neopixels when something changes, this code seems to be quite responsive.

    This requires the following Adafruit Circuitpython Library Bundle libraries:

    • neopixel.mpy
    • adafruit_pioasm.mpy
    • adafruit_pixelbuf.mpy

    In fact, the entire Circuitpython code is given below.

    import time
    import board
    import neopixel
    from analogio import AnalogIn

    cv_in = AnalogIn(board.A3)

    pixel_pin1 = board.GP2
    pixel_pin2 = board.GP3
    num_pixels = 5

    pixels1 = neopixel.NeoPixel(pixel_pin1, num_pixels, brightness=0.3, auto_write=False, pixel_order=neopixel.RGB)
    pixels2 = neopixel.NeoPixel(pixel_pin2, num_pixels, brightness=0.3, auto_write=False, pixel_order=neopixel.RGB)

    col = (80, 35, 0)

    lastcv = -1
    while True:
    cv = cv_in.value / 256

    if (lastcv != cv):
    lastcv = cv
    led = cv / 25
    for pix in range(5):
    if (pix < led and cv > 5):
    pixels1[pix] = col
    else:
    pixels1[pix] = 0

    if (pix+5 < led and cv > 5):
    pixels2[pix] = col
    else:
    pixels2[pix] = 0

    pixels1.show()
    pixels2.show()

    GiHub Resources

    There is now an updated version of the OpenSCAD code for the case on GitHub and the PCB and code are also now available.

    Closing Thoughts

    This isn’t a perfect build in mechanical terms, but I’m not sure I ever do anything perfectly anyway, especially where mechanical things are concerned, but the final result is pretty pleasing.

    The video shows it running with a Pimoroni RP2040 in the driving seat. First a potentiometer provides a 0 to 5V input, then I’m using my Educational DIY Synth Thing‘s LFO to provide a 0 to 3V3 input.

    Kevin

    #circuitpython #EuroRack #Krell #NeoPixel #potentiometer

  22. #CircuitPython controlled pocket operator. KB2040 is setup as a midi in device. Reason is sending out four midi tracks on four different midi channels. Each button/synth voice on the pocket operator is assigned a midi channel. When a note on message comes in on the corresponding channel, the button is triggered via GPIO through a mosfet. The DAC is controlling the pot that is used for notes for some of the synth voices #pocketoperator

  23. I've hacked together a CircuitPython library to UART boot the RP2350. The two bin files it's uploading just cycle through the LEDs in different directions.

    I still have no RUN pin so I'm using one of my USB Power Switches to power cycle the board.

    #CircuitPython #RP2350 #RP2350A #PicoW #UARTboot #Electronics

  24. 🎄Reminder that @pyladiesdub end of the year event is on tomorrow evening& kindly hosted by DIGIT Games Studio. 🍕☕️

    🍪💻 I'll be bringing freshly baked cookies & some wip #CircuitPython projects.

    🧣Keep warm and see y'all there tomorrow evening!

    #mastodaoine #pyladies #IrishTechCommunity #diversityintech #python #PleaseShare mastodon.ie/@whykay/1134756084

  25. Tips on how to use CircuitPython in a bigger project with @prcutler and @todbot for #CircuitPythonDay happening now!

    youtube.com/live/uTl1KA2MPxI

  26. Hey @adafruit fam - too early to post #CircuitPythonDay content? If not, here's a build video on making Yoda talk phrases & answer Magic Eight Ball-style questions. Uses the @RaspberryPi Pico, a microSD card reader, the MPR121 capacitive touch board, and a speaker/stereo jack. #BuiltWithProfG Hack on! youtu.be/7ZfKEFuvWEY