9. Outputs

This week was outputs week which builds on our efforts to make a dev board in week 8. With our dev boards from last week (allegedly working) we can now unlock the power of controlling devices from it and programming what they should do. A simple example of an output is turning an LED on/off. We also saw some really cool examples pertaining to motors and many of the use cases they have in all of the machines we've used thus far (3D printing, CNC, and the PCB mills). Many of these motors have microcontrollers (called drivers) to hide away some of the complexities of controlling them. Unfortunately this week I didn't play with them much as I was continuing my knock off GameBoy idea. Without further ado, onto the week's fun.

Game Console Part 2 Take 5

I left off last week with a non functional PCB because of designing with the wrong chip. The next board I printed had new issues but these were of my own doing. In inkscape while preparing my traces I must've accidentally stretched them in the X direction!

Original
Stretched

It may be unclear from the images but the slight stretch proved very problematic later. I didn't initially notice, but when I placed the esp32 on the pads it just didnt seem to fit! Unfortunately i didnt take a picture of that one but I promise you it was sad.

Onto the next...I printed once again, making 100% positively sure that I did not have any accidental slipups with the preparation in inkscape. Sadly though, this time around I found out I had switched around the data lines for the USB input to esp-32. My USB mini has 4 output pins

USB pinout
Flippity Floppity. D- and D+ swapped

VCC and ground I had correctly configured. But after finishing soldering the board and not being able to connect to the computer I reviewed the ESP-32 datasheet and realized I had carelessly swapped the data lines

The carnage

After removing all of the components I was sad. Really sad. How many more ways could I fail? After a few minutes I picked myself back up and decided I was prepared to find out. I went back to my schematic and did the traces over with the correct data lines. I carefully prepared the files for the mill once more. After about an hour I was ready to solder my new and improved, COMPLETELY CORRECT board. I got to soldering with one known flaw- The LCD screen I was going to use has 11 pins and I was only outputting on 8 pins. I had already decided to use a breadboard for that portion and if it worked I could do a reprint with the correct number of pins. I resoldered the components from my initial failed attempt.

Call me Frank...enstein

I had also confirmed it was programmable! It wasn't pretty but I finally had something working. I got started on programming my game engine. First thing to do was just get accustomed to the graphics. As I've never developed a game engine before I decided to do it concurrently while making my first game. This would give me ideas on what features would be good to have with it. I started with Pong. Relatively quickly I had the basic graphics created.

Pong graphics

Shortly after that I had some basic collision logic implemented and had the ball moving. Initially I had tried to repaint the screen on every step of the game but I quickly realized the refresh rate was too slow and there was a major flicker on the game. I hacked together some logic so that each game object would erase itself if it moved from its initial position. This is working well but will need to be refined as it leaves behind some residual traces in certain scenarios. It also may not be the best answer for more complex shapes.

Pong ball on the move

Now that I had something working and I had confirmed my design I decided to add the appropriate number of pins for the screen in a reprint. This time my board had a much cleaner look and my ability to solder it improve ever so slightly.

Second is the best

Now I'm well on my way! Things that will be added in coming versions will be multiplayer ability, cleaning up my game engine code and being more efficient (and precise) in the collisions and improving the repainting. My first multiplayer game will likely be some variant of space invaders. Still unsure if I will do this using wifi, serial or bluetooth.

Schematics, PCB design, and Arduino code.

All files fromt his week can be found here: