# data[].attributes.headline
MICROCONTROLADOR RASPBERRY PI PICO RP2040

# data[].attributes.subject
MICROCONTROLADOR RASPBERRY PI PICO RP2040

# data[].attributes.body
Los microcontroladores como Raspberry Pi Pico se utilizan normalmente como el cerebro de dispositivos inteligentes

# data[].attributes.body
Esto proporciona todas las herramientas necesarias para aprender a programar en lenguaje ensamblador.

# data[].attributes.body
Es una placa construida alrededor del chip de CPU ARM RP2040 de Raspberry.

Raspberry vende este chip a otros fabricantes, incluidos Adafruit, Arduino, Seeed Studio, SparkFun, Pimoroni y liberado a cualquier fabricante.

# data[].attributes.body
Es la forma nativa y de nivel más bajo de programar una computadora, donde cada chip de procesamiento tiene su propio lenguaje ensamblador que cubre la programación del procesador ARM Cortex-M0+ de 32 bits.

# data[].attributes.headline
10 razones para usar lenguaje ensamblador, en microcontroladores

# data[].attributes.subject
10 razones para usar lenguaje ensamblador, en microcontroladores

# data[].attributes.body
(1) Incluso si no escribe código en lenguaje ensamblador, saber cómo funciona internamente la computadora le permite escribir código más eficiente.
(2) Los coprocesadores PIO del RP2040 solo se pueden programar en lenguaje ensamblador. Hay una biblioteca de aplicaciones comunes en el Software Developer's Kit (SDK)
(3) Cuando está depurando cualquier programa en el RP2040 usando utileria gdb (debuger), gran parte de la vista que tiene está en el nivel del lenguaje ensamblador.
(4) Para que el programa RP2040 sea más rápido.
(5) La conexión de su Pico a un dispositivo de hardware a través de los puertos GPIO y la ve- locidad de transferencia de datos son extremadamente sensibles
(6) El RP2040 es lo suficientemente rápido como para utilizar el aprendizaje automático. Esto se basa en matemáticas de matriz rápida.
(7) La mayoría de los programas grandes tienen componentes escritos en diferentes idiomas.
(8) Quizás trabaje para una empresa de hardware que fabrica una placa competidora basada en RP2040 para la RPI Pico.
(9) Para buscar vulnerabilidades de seguridad en la red de Internet de las cosas (IoT)
(10)Al programar microcontroladores, tiene memoria y recursos limitados.

# data[].attributes.headline
Programación del RP2040 en lenguaje ensamblador

# data[].attributes.subject
Programación del RP2040 en lenguaje ensamblador

# data[].attributes.body
Podemos ver programas que realizan tareas útiles y conocer todas las funciones flexibles y potentes que tiene el RP2040 para conectarse a sensores, controladores y canales de comunicación externos.

# data[].attributes.body
Caja de música

# data[].attributes.attachment_link.readable_text
Wanted to do a project with the Pi Pico and thought a Music Box would be a good start. Made one in 2012 following the instructions on elm-chan and using an ATTINY45. Time for an update!

Effort/Level

Easy/Beginner Soldering required. About 2 hours assembly time.

3D print takes about 6 hours for the box. The "Aperture Labs" logo is a separate print in white material. You'll need to paint the top of the letters. I used black hobby acrylic paint. There are options for plain boxes (no logo), too.

Or, you can get a wooden "craft box" and drill holes in it for speaker and USB connector. For the craft box, look for one at least 100mm L x 60mm W x 60mm H (4 in x 2.25 in x 2.25in). You'll need a hole drill bit about the size of your speaker.

All costs USD.

About $30, not counting 3D print, or craft box. Also depends on what you have on hand.

The simplest and cheapest option shown below is no box, just the Pico, a speaker, a resistor and an Adafruit Amp, about $12 if you have some wire, a breadboard and a spare 5V power adapter on hand,

The "Full Portal" version, with Neopixels as a backlight, is around $30.

I reviewed what was available and found some source material from Markus Gritsch, from 2012. Markus supplied a midi file for the Portal game song "Still Alive". Did a little more searching around and found I could convert a midi file to a "music box" sound on the Music Box Maniacs site.

That meant that you could convert almost ANY midi file to a music box song, given size restrictions for memory on the Pico. You have to stay below 1MB for code and files. If you wanted longer songs, you could add an SD card reader and play from there. Limited by the size of your SD card. I leave that for the interested student to figure out....

If you don't like the mp3 version in the downloads, there are lots of different versions of Still Alive on Music Box Maniacs, available for download. Or, other songs you might like in a music box. The github download has plain and Portal-themed STL files.

Next question...There's no I2S output on the Pico - could the Pico play audio? I found a very helpful article by Michael Horne, Playing Sounds from the Raspberry Pi Pico using CircuitPython.. This was a "Maker's Journey" tale of Michael discovering how to play a wav file on the Pico.

TL;DR: Adafruit to the rescue! Michael's solution was based on Adafruit's CircuitPython. CircuitPython already has libraries for the Pico that use PIO, "programmable input-output" to help play audio. The PIO functions use the new hardware on the Pico and a software "state machine" for absent hardware functions. For an introduction on PIO, see this blog post.

More digging and I found a CircuitPython example for playing mp3 files. I mashed up Michael's code with the mp3 example and mp3 played out the speaker!

For extra effect, I added a backlit fade-in/fade-out with a Neopixel stick. Adafruit also had the code for that, in Logan's Run Hand Jewel LED. I used a NeoPixel stick, so only needed to change the numpix to 8, and the pixpin to board.GP0. Note that I did get a little flicker, which I could not resolve. I think I had poor solder joints. [SIGH].

See the images below for a wiring guide. See Gain section below for resistor value and where to wire it in.

Once assembled, it's pretty easy to load the code:

Install the UF2 per these instructions. Copy over the lib/neopixel.mpy to the Pico lib folder.

Download files from the project github repo. There are files for a plain box and for one with the backlit "Aperture Laboraties" logo.

Copy over the files code.py and still-alive.py to the Pico

Power up and enjoy!

The 3D printed box is based on this ( great!) youtube video from Product Design Online. The video guides you through how to create a print-in-place. parameterized box with hinges. The video notes have a link to download, in different formats, the base box design. I used that as a base for the music box, adding features for a speaker, USB connector, mounting standoffs, and a back-lit logo. Fusion 360 STL and design files are included in my downloads.

Print the box in the orientation shown below. I used Prusa Slicer to create the printer gcode. Prusa uses "Expert" mode to allow you to have specific support material. I used a box support on the USB connector. See this video for more information on how to use support enforcers.

Background & Issues

Michael pointed out that the music was glitchy when played from a computer USB port. This was the presumed result of the computer continually trying to read the Pico as a USB device, generating noise. Solution: play from a power adapter or USB battery bank.

Michael's article used an example of a wav file and was based on an Adafruit article for using the MAX98375A I2S breakout board and amp.

There were still distortions when playing the sound file. There was a comment in an Adafruit FAQ stating that could happen with the gain set too high - I had left it at the default 9dB, and I was using a tiny speaker. A quick addition of a 100 Ohm resistor between the gain pin and voltage lowered the gain to 3dB. That sounds fine.

Songs in mp3 format downloaded directly from Music Box Maniacs had distorted sound even when played on a wall wart or a battery bank. I used Audacity to mix the stereo tracks to mono only and down-sample to a 22khz rate. Problem solved!.

# data[].attributes.attachment_link.description
Wanted to do a project with the Pi Pico and thought a Music Box would be a good start. Made one in 2012 following the instructions on elm-chan and using an ATTINY45. Time for an update! Effort/Level Easy/Beginner Soldering required. About 2 hours assembly time. 3D print takes about 6 hours for the box.

# data[].attributes.body
Envia mensajes de texto

# data[].attributes.attachment_link.readable_text
We all could use a good joke after surviving an insane year with the pandemic. We built the Pico Phone using the Raspberry Pi Pico. Dial a phone number and the Pico texts you a joke!

How does it work?

The Pico Phone consists of the following basic components (check out the components section):

Whenever someone enters their phone number followed by '#', the Pico transmits the phone number to the notecard. The notecard triggers a webhook. Using Twilio, Losant, and the Dad Jokes API, a joke is texted to your phone number!

In case you are not familiar with the Notecard, we recommend checking out this article.

Building the Hardware

We designed a PCB that houses the Raspberry Pi Pico and the Notecard (as shown in the figure below).

The design files are available from here. We assembled the PCBs using a reflow oven. Then, we plugged in the Pico and the Notecard (as shown in the snapshot below).

We used CircuitPython to write our code for the PicoPhone and the code sample is available at the end of the article. Installing CircuitPython on to your Pico is quite easy. Check out this video.

We used the Notecard library and the Sparkfun Qwiic Keypad Library in our code.

Cloud Piece

We used Losant's workflow and webhook to set things up. Our Losant workflow looks like something shown below:

We got our jokes using the Jokes API. We also had to setup an account on Twilio to send text messages.

Now, we took it for a spin by entering the phone number followed by ' #'. We got a joke via text!

All the components needed for the project are listed below.

# data[].attributes.attachment_link.description
We all could use a good joke after surviving an insane year with the pandemic. We built the Pico Phone using the Raspberry Pi Pico. Dial a phone number and the Pico texts you a joke! How does it work?

# data[].attributes.headline
Requisitos para progreamar con Rasperry PI

# data[].attributes.subject
Requisitos para progreamar con Rasperry PI

# data[].attributes.body
• Un Raspberry Pi Pico
• Protoboard con pines para sujetarla
• Varios cables de conexión
• Un LED
• Opcionalmente un cautin para soldarla
• Y una PC o MAC, si esta limitado en algunas chromebook (habilitar Linux OS) por software muy especifico que requiere.

# data[].attributes.body
Simula el movimiento de planetas

# data[].attributes.attachment_link.readable_text
Dmytro Panin has taken one small device and a giant leap towards creating a near perfect digital orrery. David Crookes takes a closer look in the latest issue of the MagPi magazine.
For centuries, astronomers have used orreries to simulate the motion of the planets around the sun. These mechanical models of the Solar System originated around 150 BCE, but they gained their name when English nobleman Charles Boyle, the Fourth Earl of Orrery, commissioned his own planetarium in 1713 based on a design by clock makers George Graham and Thomas Tompion.

When it's set for the present time, the device can be used as a clock too. Pluto has the job of tracking seconds. "Let's call it a small consolation prize for being demoted to dwarf planet," Dmytro says

Dmytro Panin would love to have one. "They're a bit on the bulky side, but I may attempt to build an orrery one day," he says. In the meantime, he has produced a digital version that is equally captivating and useful, powered by a Raspberry Pi Pico microcontroller. "Astronomy has always fascinated me, and I wanted something that I could look at and see the planets in the Solar System progress over time," he continues. "So I built a visual reminder."

A star build

His project is out of this world. As well as Pico, it uses two other main components: a Waveshare Precision RTC expansion module with an on-board DS3231 chip and a Pimoroni Pico Display Pack. This allows the device to calculate the planets' positions based on the current time and date. It then presents the planets revolving around the sun, showing their relative circular orbits.

Dmytro considered using a Raspberry Pi Zero for his orrery, but eventually opted for a Pico

"The cool part is that no external data is needed," Dmytro says. "The positions of the planets are calculated on board and the only thing that the system knows is the current time, which comes from the RTC module." It makes the build a relatively straightforward one to replicate and Dmytro has been more than happy to make it open-source. He even shares his design for a 3D-printed case.

But why choose the Raspberry Pi Pico for this project? "Microcontrollers are amazing: you have a tiny object which can execute your commands and do virtually everything with extremely low power consumption. When I found out about the new RP2040 microcontroller and checked the specs, I knew it could became part of my next build," he says. "I was particularly interested in using MicroPython instead of C to program a microcontroller."

With just three main components and a 3D-printed case, the Solar System Display is a simple, yet very effective, project

Space to think

Dmytro has also added some neat flourishes to his creation. To start with, he wanted to figure a role for Pluto - the celestial body demoted to the status of dwarf planet by the International Astronomical Union in 2006. "I decided to represent the seconds by having Pluto bounce, starting from the full amplitude to just rolling at the bottom of the screen when a minute is about to end," he says.

He also made use of the Pico Display's tiny buttons so that past and future planetary positions can be viewed on the screen. Most of the time, however, it just sits on a shelf in his line of sight, allowing him to keep track of the current positions. "It means I can always see it," he says. "But the downside is that I can end up mindlessly staring at Pluto jumping around without realising how much time has passed."

Get The MagPi #110 NOW!

You can grab the brand-new issue right now from the Raspberry Pi Press store, or via our app on Android or iOS. You can also pick it up from supermarkets and newsagents. There's also a free PDF you can download.

# data[].attributes.attachment_link.title
Raspberry Pi Pico solar system display - Raspberry Pi

# data[].attributes.attachment_link.description
Dmytro Panin has taken one small device and a giant leap towards creating a near perfect digital orrery. David Crookes takes a closer look in the latest issue of the MagPi magazine. For centuries, astronomers have used orreries to simulate the motion of the planets around the sun.