LionsBlog

Pocket Pet Rogue - Part 2 - The Hardware

by Bastet on June 05, 2022

In this post i want to talk about the hardware for our little game, what would be the bare minimum, what is broadly available from different vendors for the foreseeable future and what is affordable. I will be trying to stay below 35€ per unit for a small batch production, including PCB, display, MCU, case and the miscellaneous small parts. There will also be the option to ghetto together your own from parts you might even have in the drawers, much like the Arduboy. When designing this i will take notes from the design philosophy of the legendary Gunpei Yokoi. Withered technology, stuff that is proven and does the job.

From a hardware perspective this little game needs a platform that can run unattended for a long time, there is no fun in having to charge the game every four hours or change batteries every day. So we need an MCU that can be send to sleep and then consume virtually no energy. Also the display needs to be still legible with backlight turned off, as that is also one part that consumes power like nothing else. As we might want to reuse the device for other games and want some more comfort than the original had we will be going with more than the classic three buttons, the hardware will come with at least a navigation cross and at least one fire button. Bonus points for the MCU if we can somehow easily update or even change the game. For sound a simple amplified PWM channel should be enough, maybe with a little buffer.

The Screen

I want classic graphics for PPR, much like its model, the Tamagotchi. The first original had somewhere around a very low res 32*16 b&w pixels and that worked like a charme for the day. Maybe we could use a bit more but not much, with something available in the foreseeable future. Also it should be low on energy consumption. With low resolution there should be no problem with the MCU to display bandwidth so even if the display we select needs to be accessed trough SPI or I²C we should be fine if we want to display smooth animations. I don't see where we would need that for Pocket Pet Rogue but its good to have.

With that we have three options:

  1. Make a LCD ourselves. David of EEVBlog fame did that for his very own Voltmeter, the first test batch is expensive but every subsequent one is cheap as glass. Lets assume Davids numbers here then we have ~140€ for some initial five displays, the final displays should be around 1 to 2€. Sadly can't find any real prices on that as it depends on the size. And we would need either a dedicated LCD controller or a MCU with a built-in one.
  2. An OLED display with 128x64 or thereabout, single modules go for around 3€.
  3. The old PCD8544 display that was, among others, used in the classic Nokia line of phones and has 84x48 black and white pixels.

Lets put that into a table.

Display Technology Resolution Average energy usage Price per Unit(average)
Custom LCD TN Whatever we like Depends on the used MCU or LCD Controller 2€
OLED Display OLED 128x64 10 mA 3€
PCD8544 LCD TN 84x48 0,24 mA + backlight LEDs 3€

A custom LCD would be nice but has the problem that our prefered controller needs to be able to handle them. You can't simply put some standard IO to high for these, LCDs need special treatment so that they don't get destroyed.

The two realistic options here would be the OLED and the "Nokia" display and when i look at that we want to draw as less power as possible i would like to try my luck with the PCD8544. Yes, you would need to take the backlight LEDs into account but these are only needed in bad lightning conditions. You can buy these on module or as a naked LCD with a metal case, the controller is already in the glass and can do SPI.

The Brains, also called the Microcontroller

As said the microcontroller needs to be nice to the battery, cheap and readily available. Let me go over my three favorites, each of these has their pros and cons.

My first go-to would have been the good old ATMega line of MCUs by Microchip. They are easy to code for, they can be easily programmed and they are not too harsh on the battery. If i check the grassland variant used in countless Arduinos around the world, the ATMega 324, then the average price is around 3€ and the availability is shaky. Power usage would have been superb with only 0.2 mA when running but there is a big problem, only 32k of flash and one can't use any external (program-)memory on its own. For the game we plan this will be a problem.

Then one could go with the ESP32 as an relative easy to program for target, price is also around 3€ for the ESP32-S2-WROVER and the module is in good availability. Eats around 20 mA, down to 14 mA on 80 MHz, when running without Wifi, up to 310 mA with, and 0,025 mA when only the RTC is running. Needs some serial to USB chip to make it easily programmable and the last time i used one i ran into problems with memory allocation as its internal memory is fragmented. Getting 128 kByte malloc'd is a chore.

And my final possible choice is the RP2040 which is available directly from the Raspberry Pi Foundation in large quantities and is around 1,10€ per MCU. It needs and additional serial flash for around 80 Eurocent but this could be used to our benefit if we want, think replaceable modules. Power consumption is in the middle with 20 mA average during normal use and down to 5 mA when used at 10 MHz. Sleep, called dormant here, is 0.18 mA.

I am on the fence for the RP2040. Yes, the power consumption is a bit higher than the ESP32-S2, but i can pull a neat trick with it, make the hardware multi-game without any big effort. Just make the serial flash exchangeable on a module. And nothing can beat its price, obscure Chinese MCUs aside.

Controls

Here we have several possible solutions, all have a cross and at least a firebutton, 8-Bit computer style. But with that alone controlling the game would be tedious, you want at least some form of cancel button. Several ideas:

  1. The classic simple Cross, A, B configuration like the Arduboy.
  2. What Big N did, Cross, A, B, Start, Select.
  3. Somewhat inspired by cellphones, Cross, Fire, Left Option, Right Option. The latter two being positioned under the display with the possibility to show in text or icon what they do in the current context.

With what i have in mind i would much prefer the third option, the first has been done to death and i find it lacks a bit, it simply is a reduced GameBoy control set. The second one would be simply copying. Could work but i would love to try out for the alpha hardware if the third one can give a smooth and easy to understand experience. That's the other thing, giving an easy experience. Almost everyone can pick up a device that has four directions and a fire button easily enough. The option buttons would explain themselves with whats on the screen.

Conclusion for now

Let's try our luck with a RP2040 driving a PCD8544 LCD. Accounting for everything else we might create a little nerdy gaming device for under 30€. In smallish quantities one should add.


The time on the server is 2024-04-26 21:49:35 - Login