Close

A Little Bigger Please?

A project log for PewPew M4

A PewPew with a display.

de∫hipude∫hipu 07/18/2019 at 19:239 Comments

I have just spent a week at the Europython conference, with all participants being given PewPews to play with. We also ran two days of workshops for programming them, and I got to help a lot of people trying to program them in between the talks. So I have some thoughts.

First of all, the serial console is a weak point. People don't know about it, don't know how to access it, and as a result don't get to see the exception messages. So then they just try to change things randomly or stare at their code looking for errors. We can't count on serial support being built-in into the editor, as not everyone can install Mu or a plugin for their editor, and sometimes they simply are not in the dialup group and don't have the admin rights to add themselves. The modemmanager thing on Ubuntu is also extremely annoying, as are the extra drivers needed for Windows 7 and 8. I really need a better way of displaying errors, so the screen is an important addition.

Second, colors. People love colors, and are very disappointed that they can't change the color of the LED matrix from the code (one can't help but wonder about their mental model of the underlying hardware, but let's not get into that too much for now). Also, while kids don't mind tiny screens, adults often do, even when there is nothing wrong with their eyesight. Not to mention the buttons, which were too small for some hands even in the large version of PewPew.

So I'm thinking that I really should use that 160x128 1.88" color TFT screen. It has colors, it can display the console or menu, and it's still relatively cheap. It will never be as bright or visible from distance as the large 8x8 LED matrix, but that's not the main use case. Of course, the problem is that pushing so many bits to the display each frame is not fast enough for smooth animation. So let's also upgrade the microcontroller, and use the SAMD51 — sure, it's more expensive, but it's only $2. I think we can still fit in the magic barrier of $10 with that. And PCBs are getting cheap too recently, so let's use a bigger PCB that is easier to hold.

So all in all, a more capable hardware with fewer hacks, for a little higher price, but much improved convenience. Of course I started mocking it as soon as I came back from the conference:

And since I couldn't sleep a few nights afterwards, I designed a PCB as well:

As you can see, I'm using:

Once it arrives, I will need to experiment with bootloaders, linker scripts and so on to get CircuitPython to run on it, and then I will write a version of the Pew library that simply displays 8x8 huge color blocks on that screen. If it proves fast enough, maybe I will be even able to replace those blocks with custom GIF images later on? Who knows?

Discussions

poop man wrote 07/22/2019 at 03:02 point

poop man

  Are you sure? yes | no

davedarko wrote 07/19/2019 at 08:18 point

As much as I enjoy your small creations, I do think that's a sensible step, to go bigger! 

  Are you sure? yes | no

Frank Buss wrote 07/19/2019 at 01:15 point

Another cool idea would be to use Ethernet-over-USB. The Beagle Board uses this:
https://beagleboard.org/static/beaglebone/latest/README.htm
It works on all modern operating systems without installing drivers. You just connect the Beagle Board over USB, and then you can open a webpage on the board. Then you wouldn't even need a text editor, could be all in the webpage, including a nice terminal for error messages. I guess the SAMD51 would be powerful enough to implement this. Could be something simple, or as fancy as Cloud9:
https://aws.amazon.com/cloud9/

  Are you sure? yes | no

de∫hipu wrote 07/19/2019 at 07:40 point

That is an interesting solution, however, I can see two problems with it: just like with the espXX devices, most computers only let you easily connect to one network at a time, so you would lose your Internet connection and thus access to documentation and any online help, and second, implementing a network stack and HTTP server and all that would be a lot of work and would take most of the SAMD51 resources, leaving very little for the user.

  Are you sure? yes | no

Daren Schwenke wrote 07/21/2019 at 05:32 point

The network for the Beaglebone at least comes up as 192.168.7.1, and so it's a local network subnet by definition.  Never had an issue connecting to it and the internet at the same time.  Add a route and enable forwarding, and you can then also bridge that connection back to your internet connection on the PC.  

  Are you sure? yes | no

de∫hipu wrote 07/21/2019 at 13:40 point

I think I'd rather debug their serial permissions than try to add a route and enable forwarding on Windows or MacOS. It's supposed to just work out of the box.

  Are you sure? yes | no

de∫hipu wrote 07/19/2019 at 07:45 point

To be honest, at that point I would just log errors to a file.

  Are you sure? yes | no

Frank Buss wrote 07/18/2019 at 20:39 point

How does Arduino do this? It uses a serial port as well, but I think there are less problems on the different operating systems. Could you use just the Arduino IDE (it has an integrated serial port monitor) and then upload the Circuit Python code?

  Are you sure? yes | no

de∫hipu wrote 07/18/2019 at 20:52 point

Arduino requires you to have a dedicated software installed to flash boards, and that comes with all the drivers, permission settings and udev rules, otherwise it doesn't work at all. And since it's C++, you don't get any runtime errors at all, it just crashes. With CircuitPython you don't need any software to upload code — you just copy the file to the USB disk and you are done. The serial is an additional thing that is not strictly necessary, but it helps with debugging.

  Are you sure? yes | no