Musings of an aging computer nerd hitting 0x32
Small LED Matrix Numbers
Something I did a few (8) years ago on the Arduino to display two-digit numbers on a 8x8 LED matrix, this is an update to do the same in Micropthon.
Numbers have been defined to 3x5 pixels, so for a two-digit number it fits into 8x5 LED grid with spacing, saving some LED Matrix space.
The code for this can be found here numbers.py
DHT11 Sensor in Micropython
Just a short bit of code to test a DHT11 temperature and humidity sensor module.
This version has just three pins VCC, GND and data, so easy to connect and use with the DHT library.
Raspberry Pi Pico W LED Matrix
Found a LED Matrix with a Max7219 in my parts bin (box of random electronics in the garage) so looked into getting it working with the Pico and MicroPython.
This is an example why I love open source. The original library I found was functional but sparse, last committed to 4 years ago. There were a few forks, most not much activity. One had been active recently and had some major improvements in functionality so switched over to that fork. https://github.com/enchant97/micropython-max7219
Raspberry Pi Pico W Mandelbrot Set
Stumbled across a Python script to run a Mandelbrot set in ASCII in Python so I thought I would see how it ran on the RaspberryPi Pico.
After tweaking it slightly from the source it ended up like this mandelbrot.py
This results in the following;
...................................................................................................
.....................................................................................................
.......................................................................................................
.........................................................................................................
...................................,,,,,,,,,,,,,,,,,.......................................................
..........................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.............................................
.....................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,......................................
.................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,----------,,,,,,,,,,,,.................................
...............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---------:i;;::::-------,,,,,,,,,.............................
.............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,----------:::;ih$+;;::::-------,,,,,,,,,..........................
...........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,------------::::;;+# hiiii :---------,,,,,,,,,.......................
.........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-------------:::::;;i+hM MM #+;;:---------,,,,,,,,,,....................
.........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,--------------::::::;;ii+hH* $H+ii;:::---------,,,,,,,,,,..................
........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---------------::::::;i+HhH *h++;;::::---------,,,,,,,,,,................
.......,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---------------::::::;;;+ *@ +i;::::::-------,,,,,,,,,,,..............
.....,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---------------::::;;;;;ii+hM@ $hii;;:::::::------,,,,,,,,,,,............
.....,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,--------------:::;;;;;;iiii++h *h+ii;;;;:::::::----,,,,,,,,,,,...........
....,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-------------::::;ii++ ++++++hhHH$@ @MHhh++ii;;;;;ihi;:---,,,,,,,,,,,,.........
....,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,----------:::::::;;+H @MHhH$ # $@ h++ii++M$i;:---,,,,,,,,,,,,........
...,,,,,,,,,,,,,,,,,,,,,,,,,,,,--------::::::::::;;;ii@ #@ $HH* $# #;:---,,,,,,,,,,,,.......
..,,,,,,,,,,,,,,,,,,,,,,,,,,,------:::::::::::::;;;;ii+hM * i;::---,,,,,,,,,,,,,.....
..,,,,,,,,,,,,,,,,,,,,,,,,,-----:::::::::::::::;;;;;i++HHM# *+;;:::---,,,,,,,,,,,,,....
..,,,,,,,,,,,,,,,,,,,,,-----::::::::::::::::;;;;;;iiM #Mhii;;::---,,,,,,,,,,,,,....
..,,,,,,,,,,,,,,,,,------::;iH+;;;;;;;;;;;;;;;iiiii++H$ Mh++;::----,,,,,,,,,,,,,...
.,,,,,,,,,,,,---------::::;;iH#++iiii++H*++iiiiii+++H$ $ H;::----,,,,,,,,,,,,,..
,,,,,,,,------------:::::;;;+h **M HhhM $HHMhhhhhhHM@ H;::----,,,,,,,,,,,,,,.
.,,,,,------------::::::::;;ii+hM# @@ #$HHHHM H+i;::-----,,,,,,,,,,,,,.
,,,,------------:::::::::;iiiihh$ $$* @ i;::-----,,,,,,,,,,,,,,
,,-------------::::::::;;iii+H * @ M+;:::-----,,,,,,,,,,,,,,
,------------:::::;;;;i+#HhhhM$@ Mi;:::------,,,,,,,,,,,,,
----------::;;;;;;;iii+hH* * @ hi;::::------,,,,,,,,,,,,,
::::;;;iiMiiiiii+++++MHM $+i;;::::------,,,,,,,,,,,,,
*Hh+i;;::::------,,,,,,,,,,,,,
::::;;;iiMiiiiii+++++MHM $+i;;::::------,,,,,,,,,,,,,
----------::;;;;;;;iii+hH* * @ hi;::::------,,,,,,,,,,,,,
,------------:::::;;;;i+#HhhhM$@ Mi;:::------,,,,,,,,,,,,,
,,-------------::::::::;;iii+H * @ M+;:::-----,,,,,,,,,,,,,,
,,,,------------:::::::::;iiiihh$ $$* @ i;::-----,,,,,,,,,,,,,,
.,,,,,------------::::::::;;ii+hM# @@ #$HHHHM H+i;::-----,,,,,,,,,,,,,.
,,,,,,,,------------:::::;;;+h **M HhhM $HHMhhhhhhHM@ H;::----,,,,,,,,,,,,,,.
.,,,,,,,,,,,,---------::::;;iH#++iiii++H*++iiiiii+++H$ $ H;::----,,,,,,,,,,,,,..
..,,,,,,,,,,,,,,,,,------::;iH+;;;;;;;;;;;;;;;iiiii++H$ Mh++;::----,,,,,,,,,,,,,...
..,,,,,,,,,,,,,,,,,,,,,-----::::::::::::::::;;;;;;iiM #Mhii;;::---,,,,,,,,,,,,,....
..,,,,,,,,,,,,,,,,,,,,,,,,,-----:::::::::::::::;;;;;i++HHM# *+;;:::---,,,,,,,,,,,,,....
..,,,,,,,,,,,,,,,,,,,,,,,,,,,------:::::::::::::;;;;ii+hM * i;::---,,,,,,,,,,,,,.....
...,,,,,,,,,,,,,,,,,,,,,,,,,,,,--------::::::::::;;;ii@ #@ $HH* $# #;:---,,,,,,,,,,,,.......
....,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,----------:::::::;;+H @MHhH$ # $@ h++ii++M$i;:---,,,,,,,,,,,,........
....,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-------------::::;ii++ ++++++hhHH$@ @MHhh++ii;;;;;ihi;:---,,,,,,,,,,,,.........
.....,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,--------------:::;;;;;;iiii++h *h+ii;;;;:::::::----,,,,,,,,,,,...........
.....,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---------------::::;;;;;ii+hM@ $hii;;:::::::------,,,,,,,,,,,............
.......,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---------------::::::;;;+ *@ +i;::::::-------,,,,,,,,,,,..............
........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---------------::::::;i+HhH *h++;;::::---------,,,,,,,,,,................
.........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,--------------::::::;;ii+hH* $H+ii;:::---------,,,,,,,,,,..................
.........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-------------:::::;;i+hM MM #+;;:---------,,,,,,,,,,....................
...........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,------------::::;;+# hiiii :---------,,,,,,,,,.......................
.............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,----------:::;ih$+;;::::-------,,,,,,,,,..........................
...............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---------:i;;::::-------,,,,,,,,,.............................
.................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,----------,,,,,,,,,,,,.................................
.....................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,......................................
..........................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.............................................
...................................,,,,,,,,,,,,,,,,,.......................................................
.........................................................................................................
.......................................................................................................
.....................................................................................................
I amended the code to update the OLED I was using in the temperature sensor tests mand_oled.
Raspberry Pi Pico W Temperature
Have been tinkering with temperature measurement using the Raspberry Pi Pico.
First with the internal temperature sensor and then using a TMP36 temperature sensor externally.
I wrote two classes to access these and return the reading.
Here is an example using the two sensors together temps.py
You will need to upload the two classes to the Pico first in a library
sub-directory.
Here is how you would wire it up on a breadboard tmp36.fzz
Rasberry Pi Pico W OLED
Some components arrived from AliExpress recently so been able to play with an I2C OLED display with my Pico W.
Hello World Test
Code of this is here https://github.com/alastairhm/pico_w/blob/main/i2c_scan.py
And also used here to display the IP address after connected to the wifi https://github.com/alastairhm/pico_w/blob/main/wifi_oled.py
Next thing I’ve been playing with is internal and external temperature sensors, I will post about that soon.
Raspberry Pi Pico W
Just before Christmas I got a Raspberry Pi Pico W to have a play with.
Looking forward to using MicroPython to do some LED flashing and other things.
Started a repo on Github for it Pico W Repo