NVM : Non Volatile Memory

Not much to show this week from Phil, he’s been getting deep into learning more about OOP in Python, and running into several problems that led him to more exploration, experimentation & fails (so, as we said, not much to show). He also sadly lost his 22 year old cat “Link” this week…

He did however, last week get into “NVM” (Non Volatile Memory) – A very elegant way of writing data to the Pico, so you can save info & recall it when the Pico Starts up again… We had tried using it for the Dinky OSC, but the older versions of CircuitPython didn’t support it, or at least were buggy with the ability to save without hanging the Pico (and forcing “Nuke ReFlashes!”).

Martin had read on the fantastic CircuitPython discord channel that the NVM issues had been addressed in the latest version. And so Phil re-opened his exploration of the use of NVM on a Pico… Phil did a quick search on discord & found :

Neradoc22/05/2022

“you might want to look into foamyguy’s NVM helper in the community bundle https://github.com/FoamyGuy/Foamyguy_CircuitPython_nvm_helper

Phil followed the link, downloaded the library from FoamyGuy and within minutes, had a fully working, easily updateable way of reading & writing info to NVM ! Like a dream you can save a dictionary via NVM_helper & all the byte conversions are sorted in that amazing script… So! Phil is back on track to keep track of the digital Tree , so we can implement the Real Time Clock & apply the effect of time to the tree depending on how often the tree is watered & fed & given sunlight! We will then hopefully see the fully working Tamagochi-esque digital tree…

Dinky OSC “Paw Game”

Phil is experimenting & learning how to control text / images on the #SSD1306 (128×64 px OLED display) attached to the #RaspberryPi #Pico – he’s ended up making a little game that involved moving a “Cat Paw” around with a slider & potentiometer and a button press “grabs” at what’s underneath the paw.

Phil is experimenting & learning how to control text / images on the #SSD1306 (128×64 px OLED display) attached to the #RaspberryPi #Pico – he’s ended up making a little game that involved moving a “Cat Paw” around with a slider & potentiometer and a button press “grabs” at what’s underneath the paw.

the code for the game is here

There are 8 “targets” to grab (you can change that by changing the line:
dots = 8 ) & the targets fly around with a random vector, each connecting to the next target with a line. The paw has a “hot spot” (the middle of the paw) and a “circle object” draws around it using the distance from it to the 1st target in the list (calculated by some simple trig in the utilities.py module, after an angle & radius has been calculated from the two objects’ positions)

Phil’s commented the main.py script as best he can, but, if you need any explanation, just holler!

Dinky OSC “image objects” drawn on SSD1306 128×64 px OLED screen controlled by GPIO pot, slider, buttons.

OOP Orbits

Phil has been learning OOP (Object Orientated Programming) in Python & applying it to his #dinkyOSC development on the raspberry pi pico. We’re aiming for two styles of GUI, a “simple” numbers / settings interface (like digital representation of a “normal” midi device, and a “visually creative” interface (what ever that develops into!)

Phil has developed an OOP system to create & manage “orbiting objects”

This “Orbit OOP” script creates an object that keeps track of a centre point, and equally spaces points around it using some simple trigonometry based on the slider & rotary Potentiometer’s values. (Slider = Length of radius to orbit, pot = angle (0-259° (converted to Radians (Degree * (Pi / 180.0)))

Button 1 & 2 “add & subtract” points (with a minimum of 1 & maximum of 9 points). When a point is added, the “orbit object” calculates the angular segments (4 objects = 90° segments, 5 object = 72° etc) and re-draws the objects accordingly. Phil also created different “image objects” that can follow the orbit points, but stuck with a simple BOX object (text box with padding) that follows the orbit point from its own centre (x,y for an object is usually top, left, so he subtracted 1/2 the width & height from the x,y orbit).

These scripts are still considered “experiments” but Phil had been asked by a few people online (when posting videos) if the code was available… so, here it is in a zip for you to play with. Remember, Phil’s still learning, so if it doesn’t “look like professional python code” do let him know where he can improve!

Dinky OSC – Raspberry Pi Pico

Eye Script test for the Dinky OSC with #Micropython on the #RaspberryPi #Pico

With the release of the #RaspberryPi #Pico in the last week of January 2021, we jumped at the chance to use it & the power of the newly developed RP2040 chip at the heart of the #DinkyOSC .

Using #micropython – we started exploring some of the initial components we think we’ll need for the DinkyOSC, buttons, potentiometers (“pots”), sliders and, the tiny 128×64 px SSD1306 OLED Display unit. Phil made an “eye Object” that takes values from the slider & pot & converts it to an X,Y position for the pupil of the Dinky Eye (graphic).

You can download the script (in a Zip) from here

Phil, as part of this project, will be writing guides & creating “step by step” procedures – so, he will work on this example as a first port of call. He himself is on a learning curve of how to write better python / micropython scripts & focussing on #objectOrientateProgramming to create shareable “modules” for the Dinky OSC, so if you see any glaring errors, do let him know as helpfully as you can. 😉

For an excellent start to using your own #pico – check out https://datasheets.raspberrypi.org/pico/raspberry-pi-pico-python-sdk.pdf

Dinky OSC – First Post!

We’ve been funded by Creative Scotland to explore the creation of a prototype “Dinky OSC” device to use with Sonic Pi

Hello! We’re so happy to be writing this post!

We had a tough 2020, with all of our (much loved) STEAM workshops cancelled due to #Covid19 – Everyone’s offering free online “how to” videos so we (Digital Maker CIC) needed to develop something to support our business while we wait for the ability to “run workshops physically” gets back to some sense of normality.

One of our most successful workshops so far (for WOW factor, creativity, ‘lightbulb’ moments) has been using Sam Aaron’s Sonic Pi – so we thought about making something that not only supports learners using Sonic Pi – but even advanced users, (musicians!) with an external OSC (“open sound control”) device. A small interface that can be programmed (or used “out the box”) to manipulate parameters in Sonic Pi “Real Time”.

We applied to Creative Scotland’s Open Fund: Sustaining Creative Development & have been successful in securing funding to develop our idea…

Our mission is to create a small, affordable OSC unit that is easy to use and helpful when creating music with Sonic Pi.

We will keep you posted through this blog on our journey.

Phil.