I built a small project to test the Raspberry Pi Pico with the Pico LCD 1.3 module. This turns out to be a very nice gift for any person who sits in the office all day. The device will remind every 30 minutes to drink water. You can connect it to a computer and put it on a desk. Additionally, I added a small game mode to it, so one can also play a round of PONG.

drink water reminder
Drink Water Reminder

Hardware components

This drink water reminder consists only of these three off-shelf components. No soldering is required:

  • Raspberry Pi Pico with pre-soldered headers (amazon.de*)
  • Waveshare Pico LCD 1.3 (amazon.de*)
  • micro-USB cable

* The links are affiliate links. The offers do not come from me, however, I receive a commission through the reference, if then a purchase takes place, but without you incurring additional costs.

raspberry pi pico
source: raspberrypi.com
pico lcd 1.3
source: waveshare.com

Drink reminder

The device reminds every 30 minutes with a short flashing of the LCD with a special image.

Showing image to remind drinking water

PONG game

With one click on the joystick the device starts a game of traditional pong. The user can control his paddle with the joystick. The game goes until a score of 25 points.

Playing PONG

Software

As always I published the source code on GitHub. The source code is based on the LCD sample code from waveshare and my PONG code from Wordclock 2.0. I stick with plain C-code so I had to rewrite the PONG code from object-oriented to a variant using a global struct for holding the PONG game state.

techniccontroller / pico_drink_reminder

source code for the Drink Water Reminder on GitHub

The software architecture is very simple. A state machine with 5 states controls the whole functionality. Inputs to the device are the five positions of the joystick: ‘up’, ‘down’, ‘left’, ‘right’, ‘ctrl’.

state chart of state machine
State chart of implemented state machine

To display the images (I have included two different images, which are shown alternating) I used the converter from this website to convert a 240x240px large JPG image to an Arduino-like uint16_t array. In this array one pixel is represented by 2 bytes. I saved then the arrays in a normal .c-file in the sourcecode.

image as array
Image represented as uint16_t array in the source code


3D printed case

I constructed the case for the drink water reminder with Fusion360 and printed it on my 3D-printer Monoprice Select Mini V2. The case consists of a top, a bottom part and a cover for the joystick. The cover is clued onto the joystick with some hotclue. For mounting the bottom and the top part I decided to include a small clamping structure in the design.

CAD cut through the case
CAD cut through the case to show the clamping structure

The STL files can be downloaded here:


References
Share this post

0 Comments

Add a Comment

Your email address will not be published. Required fields are marked *