close-circle
Close
0%
0%

PewPew FeatherWing

A shield for Adafruit Feather boards with buttons and a LED matrix display, for simple games.

Similar projects worth following
close

Game programming is hard. Sure, you can easily throw together something in RPGMaker, RenPy or Unity3D, and it's great -- but you don't actually know how it works inside. There is a certain skill required to go from scratch, write your own main loop, handle events, push the pixels, etc. Incidentally, the same exact skills are required when programming any other interactive system, such as a graphical user interface, an automatic appliance, a mobile art installation or... a robot! Those are going to be much more common in our lives soon. If we want to stay in control, we need to be able to program them ourselves, and for that we need those skills. They empower us and give us back the control over the technology.

One great tool for teaching it is PyGame -- which is a library, and not a game engine, so it forces you to attend to all those pesky details of game engine internals yourself. Which is a bit difficult, of course, but ultimately very useful. But even if you play with PyGame on the Raspberry Pi, it's still a very complicated and difficult to understand system. The learning curve is steep, and debugging is hell.

Enter MicroPython, and one of its flavors, CircuitPython. It's written by the people at Adafruit with the education in mind, but it runs on infinitely simpler devices than your average computer. Devices which you can't break easily, because reflashing the program will reset them to a known good state. Devices which run on batteries for hours, and which you can carry in your pocket. Devices, for which there is a plethora of add-ons and sensors that you could make use of in your game.

However, as of yet, there is no game library and/or add-on that would allow to easily create games in CircuitPython. This project is an attempt to fix this.

pewpewlite-4.0b_schem.pdf

Schematic for PewPew Lite 4.0

Adobe Portable Document Format - 1.75 MB - 10/15/2017 at 15:39

eye
Preview
download-circle
Download

pewpewlite-4.0b.zip

Gerber files for PewPew Lite 4.0

Zip Archive - 121.04 kB - 10/15/2017 at 09:01

download-circle
Download

  • 1 × PCB https://oshpark.com/projects/Bvfn9hBI
  • 1 × HT16K33 28SOP
  • 6 × Tact switch 6x6x4.5mm
  • 1 × 1.9mm Bi-Color 8x8 LED Matrix, with common cathode (788AHG)
  • 6 × SMD 0603 Resistor 39kΩ

View all 8 components

  • Sanity Check

    Radomir Dopieralski11/02/2017 at 10:41 1 comment

    It's important to periodically revise the project's goals, both to see if they are still relevant, and to adjust the course of the project to better fulfill them. It's time to do this for PewPew. I recently did that for PewPew.

    The last change in course of the project was almost two months ago, after the Mini Maker Faire Zürich, when I decided that while PewPew Lite seems functional enough, it costs up to $40 to get all the parts together — the feathers, the battery and the PewPew Lite itself. Then I identified the feather board as the most costly part of the whole, and one that I don't have any control over. So I decided to try and get rid of that part by designing a standalone version of PewPew.

    I have to note here, that nobody was complaining about the price, they were, however, complaining about the fact that they have to buy separate things in separate places. Making PewPew standalone would also solve that problem.

    I produced four different prototypes for that, with a design for the fifth already on my disk and prepared for ordering. I initially used a smaller PCB, but after struggling with fitting everything on it, I switched back to the Feather form factor, and after @davedarko recently pointed out that I can make it bigger and use the bigger LED matrices, I designed yet another version, shaped more like the GameBoy.

    But then, in the mean time, I also worked on #µGame — and I realized that the ST7735R 128x128 RGB display on it is cheaper than the IS31FL3733 chip I use for driving the LED matrix, not to mention the LED matrix itself. And it was trivial to make the PewPew games run on µGame too.

    Sure, the LED matrix has a lot of advantages compared to the TFT display. It has excellent brightness and viewing angles, while not using a lot of battery power. It's made of plastic, not glass, and therefore it's very hard to damage, even when carried in the pocket. Its low resolution and limited colors impose restrictions that stimulate creativity and make it actually much easier to finish the game. But the display also has advantages over the LED matrix. It's bigger, has more colors, lets me use cute graphics for the "pixels", doesn't require me to route dozens of tiny traces or solder TQFP48 packages with insane pitches, is very common and easy to source and looks more like a "real" game console. It also lets me display text in a readable form, which is great for things like error messages.

    I don't want to merge the µGame and PewPew into one project — PewPew has very well defined goals that are different from the "for fun" nature of µGame. But I think that it doesn't actually make much sense to have an "advanced" version of PewPew, when µGame exists. So I won't be ordering that last prototype. Instead, I made one last version of the PewPew Lite shield, with only one small change — replacing all the resistors on it with resistor arrays, reducing the number of parts from 17 to 11, and making it better suited for eventual fabrication. I will wait for it to sell out on Tindie, and order another batch, and in the mean time I will work on the workshops.

    Honestly speaking, PewPew Lite is really good for the goals of this project, and the standalone version doesn't really add much. And after looking into assembly services and the prices for them, I realized that I can't really make it much cheaper than the feathers — not so much that it will matter. Maybe I could get it down to $30 or $25, but I'm not sure it's worth it. And the extra features, like more colors and sound, are not really adding much to the project goals — they are more of a distraction.

    So I will stick to the PewPew Lite and work on the content from now on. And new features and developments are going to go into µGame, which is more of an experimental project, without clearly defined goals.

  • Version 4.2

    Radomir Dopieralski10/23/2017 at 23:48 2 comments

    After finding the reason for CircuitPython crashes in #µGame and getting the audio amplifier to work, version 4.1 has pretty much all the parts that I wanted to have. However, its physical layout is somewhat problematic, especially the rather large speaker smack in the middle of the board, which makes it hard to add a battery there.

    So I started working on version 4.2. So far I have the following changes:

    • Added guide holes for the USB socket.
    • Larger footprint for the flash chip, so that more chips can be used.
    • Smaller and cheaper reset switch.
    • Pads instead of holes for the battery connector.
    • Moved the audio amplifier circuit.
    • Moved the speaker to the front of the board, and used a footprint for really small SMD speakers.
    • Moved some components away from each other, so it's not as cramped.

    I'm still considering two more changes:

    • Add a voltage divider to an analog pin, for measuring battery voltage.
    • Move the charging circuit before the switch, so that charging is possible with the switch off.

    I think that 4.2 will be the last prototype, at least if everything works as expected.

  • PyWeek Failure

    Radomir Dopieralski10/22/2017 at 17:11 0 comments

    The week has ended and the contest is now closed. I didn't manage to finish my game, even though I was very careful to set the scope small. There were simply too many distractions during the week.

    I still plan to finish that game one day, it's a top-down shooter similar to the Alien Breed series or the classic "Into the Eagle's Nest". I feel it can be really fun to play on PewPew.

  • PyWeek, Here I Come

    Radomir Dopieralski10/15/2017 at 10:15 0 comments

    There is this challenge, where you have to write a game in Python in one week. I never really had the time for it (I preferred Ludum Dare, where you only have one weekend, so it's easier), but I decided to try and enter this time. Of course CircuitPython is Python too, so I'm going to develop a new game for PewPew. But since others wouldn't be able to play it without making their own PewPew, I will also write an emulator for it.

    Here's my entry: https://pyweek.org/e/pewpew/

    The topic is "They're behind everything". Wish me luck.

  • PewPew 4.1

    Radomir Dopieralski10/15/2017 at 00:33 7 comments

    I assembled one of the boards for the PewPew 4.1 and got it to work. It's really close to what I want ultimately, at least feature-wise.

    It has the IS31FL3733 chip for handling the LED matrix, an ATSAMD21E18A-AU microcontroller for running CircuitPython, and extra S25FL216K0PMFI011 flash memory for more disk space, a battery charging circuit, and a piezo speaker. I should have an amplifier for the speaker in there too, but I didn't get it to work yet — I have parts for it on order. Oh, and I'm using a rectifier diode in place of a shottky diode, because I'm waiting for those too.

    I have made a custom board definition for CircuitPython, and built custom firmware for it — so that I can make use of all the pins I need and the extra flash memory. Once I finalize the hardware, I will submit the board definition to the CircuitPython upstream.

    I'm still not happy with three things: the position of the speaker, the connectors for the battery and the fact that the board is pretty difficult to assemble manually. I would definitely not want to have to assemble 10 of them. So now it's time for optimization of the layout, possibly moving a few parts around. I also considered replacing the piezo speaker with a headphone jack — we will see about that.

  • Boards from Aisler

    Radomir Dopieralski10/14/2017 at 10:29 8 comments

    Recently I found a board maker similar to OSHPark, but based in Germany, Europe. Could it be that my wish came true? As soon as I had a new version of PewPew's PCBs designed, I decided to try them.

    The prices seem similar to what OSHPark offers: at OSHPark I paid $8.95 for three 2.00x0.90 inch PCBs, here it's €8.43. However, OSHPark has free shipping (which constitutes the bulk of the waiting time for me), while Aisler charged me additional €4.96 for shipping. But that's totally fine by my if the boards land in my mailbox faster this way.

    There is a bit of disappointment here, though. I made my order on 28th of September, and for nearly two weeks nothing happened. I finally went to check the order's status two days ago, and it said on the website that they will be fabricating it within 1 hour. I assumed that it's just a fancy message, but indeed one hour later the message changed to information that they are shipping it within minutes, and later that day that it shipped. The boards arrived two days later.

    So in theory, it could be much faster than OSHPark, which usually makes my boards within a few days, and then they take two weeks to get here. However, in practice waiting for fabrication made it about the same. Perhaps it will get better as they get more orders and the panels will fill up faster?

    Now about the boards themselves. Here's a photo:

    First of all, as you can see, the boards are green. As with OSHPark there are no color options, which is fine, but green is a bit boring. Their website is all orange, it would be super-awesome to get some orange boards! Oh well, green is fine.

    There is ENIG finish, just like with the OSHPark boards.

    Both the solder mask and the silkscreen are much lower resolution than what you get with OSHPark. If you look at the chip footprint on the left, you will see that every pin pad is different width — that's the effect of low-res solder mask. You can also see that the head of the sheep logo bled into the outline — that's the effect of low-res silkscreen. For comparison, boards from OSHPark and SeeedStudio:

    Finally, the board outline. I'm really shocked about that: it looks like it was cut out with a hatchet by a drunk worker. I guess I shouldn't have ordered during the Octoberfest.

    I still need to assemble the board and see if it works, but all the traces look fine visually. We will see how that goes.

  • Contest Video

    Radomir Dopieralski10/13/2017 at 00:53 0 comments

    I have the video, which is required for the prize finals, finally done, at least the first version of it. I don't really have any video editing tools, so this all has been done by gluing together bits and pieces with ffmpeg.

  • GamePad module and Trinket M0 Haxpress

    Radomir Dopieralski10/03/2017 at 21:16 0 comments

    My pull requests just got merged into CircuitPython. One is the for the Trinket M0 with a hacked on flash chip — it's now called Trinket M0 Haxpress, and the other one is adding a gamepad module with functions for scanning and de-bouncing button presses.

    I'm now waiting for the version 4.1 prototype PCB and parts, and once that works, I can make the custom firmware for it and start working on the sound support in the library.

  • Struggling with BOM

    Radomir Dopieralski10/03/2017 at 16:04 0 comments

    The PewPew Lite was simple enough to solder by hand. The self-contained PewPew is not going to be so easy. Of course, I can solder a prototype or two — I even explicitly shied away from QFN parts — but just thinking about making a 20 pieces for a workshop makes me shudder. So I need a PCB assembly service.

    I have been looking at the different services, and what they need as the input, and not very surprisingly, the main input they need is the bill of materials, also known ass the parts list. Unfortunately, it's not enough to just say "a 10kΩ resistor" — you have to specify the size, tolerance, and most importantly, the product number. Actually, forget everything else, they just want the product number, and if the part is exotic, a link for where to buy it.

    So I've spent the last couple of evenings trying to use the #FindChipsPro service, and it has been a bumpy ride. I started with the pick-and-place file that Fritzing generated for me — it's a CSV file that lists all the parts, together with their exact positions on the board. So I just removed the irrelevant position information, and got a list of parts in a format that could be imported into FindChips. Then FindChips started sugeesting parts. Oh boy.

    It couldn't find any tact switches at all. Apparently the best alternative to a USB micro socket is a HDMI socket. There is only one power switch with the pinout I need, and it's a super-expensive ALPS. 0402 20kΩ resistors simply don't exist. Forget about any LED matrices at all, not to mention bi-color ones. And so on and so forth.

    With much struggling and some cheating, I finally put together a BOM list that only has 3 parts missing. I have simply added the URLs for those in the comments. The list is at https://www.findchips.com/org/10-open-hardware/list/48895-pewpew-41-bomcsv

    The good news is that the total cost of all parts seems to be around $15 at quantity 1. That means that together with the PCBs and the assembly service, there is a chance that the whole thing won't be more expensive than a Feather board.

  • Replicating the Trinket M0 Express Hack

    Radomir Dopieralski10/02/2017 at 21:47 2 comments

    It would be great to have more memory on PewPew, so I decided to try and replicate the Trinket M0 Express hack, only with my bare chip. To do that, I need a flash chip. The original hack used a S25FL116K0XMFI043 chip, but of course I don't have that. But they should all be pretty much the same, no? So I tried with a W25Q32FVSSIG instead:


    The connections are pretty much what you would expect:


    And the board definition is in this branch: https://github.com/pewpew-game/circuitpython/tree/trinket-m0-express

    After compiling and flashing the firmware, it... doesn't work. I mean, the CircuitPython itself works and shows me the REPL console, but there is no USB disk. And it's easy to see why — there is a number of files in the boards directory that contain flash chip definitions, and that you include in your board definition files. And guess what, the chip I'm using is not there. So I have two options now: dive into the datasheets and prepare my own flash definition file, which would be the "correct" choice, or order a flash chip that is compatible with what is there already, then wait a few weeks for it to arrive and try again, which is the "lazy" choice. Guess which one I've chosen.

    Since I'm waiting for the PCBs and parts for the next version of PewPew anyways...

    Update: So I overcame by inherent laziness and created a flash file for the W25Q32BV family. And what do you know, it works!

View all 46 project logs

  • 1
    Solder paste for the buttons

    Heat the board a little bit with your hot-air station, and then apply the soldering paste on all the button pads.

  • 2
    Place buttons

    Place the buttons in they correct positions. Be careful to align them properly, as the surface tension of the solder will not be enough to move them.

  • 3
    Solder buttons

    Apply the hot air to solder the buttons. Be careful to not melt the plastic caps.

View all 23 instructions

Enjoy this project?

Share

Discussions

Orlando Hoilett wrote 08/06/2017 at 18:07 point

How comfortable does it feel when you're holding it? The Feathers are rather small.

  Are you sure? yes | no

Radomir Dopieralski wrote 08/06/2017 at 18:26 point

It's not the handheld heaven, but it's definitely better than some keychain games, such as the tamagotchi. The d-pad is pretty much the same size as on Nintendo DS Lite, the fire buttons are a bit closer (and I think they would feel better if they were farther apart, but there is simply no room).  The whole thing is wide enough to put the fingers of both of my hands on the back, which gives pretty comfortable and sure grasp. I suppose someone with hands bigger than mine could have problems, though.

What I am mostly struggling with is the thickness of the whole thing — when using standard headers it's almost 2cm together. This can be greatly improved by using the short pin headers, though, and there is still enough room between the boards to fit a battery.

  Are you sure? yes | no

oshpark wrote 05/10/2017 at 23:43 point

great project!

  Are you sure? yes | no

Radomir Dopieralski wrote 05/10/2017 at 23:46 point

Thank you, hopefully the new PCBs arrive before PyCon.US, so I can show them off there. They just got shipped, and if they arrive within 7 days, I'm good. Otherwise we will miss each other going opposite directions.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates