Espruino Pico Mario Clock
A simple project using the Espruino Pico to make a cool Mario clock
Every minute Mario will jump and hit the blocks to change the time. The speaker will make a coin noise when this happens, unless it is at the top or bottom of the hour, where it will play a part of the Mario tune.
It has two buttons, the first turns the display back light on and off, while the second turns the sound on and off
Note: This project is in a prototype state. The projects goal is to have the electronics permanently housed in a mini Gameboy like case. The STL plans for the case will be included with this repo when completed so you can print your own!
Before you start putting the parts together, you may wish to review the Pico layout diagram:
The complete wiring diagram for the project:
- Soldering: You must solder the pins into the pico and into the display first, so that they can be inserted in to the breadboard.
- Placement: Follow the wiring diagram, being very careful to check the wires are connected to the right pins in the Pico, and that the display is aligned to the right most pin in the Pico (A5)
Installing the code
You will need to install the code via the IDE, the instructions may be found here Once you have the IDE setup and also running, and the pico and its components wired up, we can now plug the Pico in to the computers USB port (any USB port).
Clone or download a zip this repo to your computer somewhere, if you download this project as a zip file you must also unzip it first.
In the IDE you can open the file
mario_clock.js, and now we connect the IDE to your Pico by clicking the connect button.
Once the Pico is connected, you click the
Send to Espruion button, it will take a few seconds to send over all the code. Once its completed the transfer, in interactive REPL window you write
save(). This will install the code on to the Pico and start it.
While prototyping instead of executing the command
save() to commit the work to the Pico, you can execute
onInit(), which will call the main function of the program, thus starting it on the Pico.
When the Pico looses power (by unplugging it from the USB port) it will forget the time as it has no other power supply to maintain the time. A battery may help solve this.
The Pico is not great at keeping the time, and over the days and months the time will drift from the true time. To keep the time correct, an option would be to connect a WiFi module to it, which can get the time from a time server on the internet and keep the time in sync.
To set an image to 1 bit in Gimp you must set the following image attributes:
- In the popup window click
Use black and white (1-bit) palette
EXPORTyour image as a
The online tool will then allow you to upload your 1-bit BMP and generate a JS snippet with the image converted for you.
Wrapping it all up
In the resources folder of this project are the STL files I have designed (using TinkerCAD). You can use and modify these files to suit your project.
I used a CELRobox to print mine, but these STL files should be printable on any 3D printer you may have or have access to.