Cool Cap Engineer

Engineering by an anime nerd

Leave a comment

Projects: N64 Controller Now Pygames Controller


So yesterday, I started testing the Python script to generate the keyboard board events that the emulator could recognize. The way the script works is that whenever I pressed the tact switch connected to the PIC8F4553 microcontroller, it sends a simple c character to the python script. When the python script sees the c character, it will then generate a keyboard event which the x key (A button on the N64 emulator) is pressed.

When I tested the script, it works in Windows perfectly. Heck, I could create a virtual keyboard and mouse for windows based for a couple test scripts alone (future project?). However, whenever I run the script, then run the emulator, the emulator ignores the keyboard events generated. To be fair, it recognizes it sometimes when I click the Python IDE then switch to the emulator window. I sent an email the Project64 creator, posted on the Stackoverflow forums, but it seems like no one knows why the emulator is ignoring the keyboard events.  However, I realized that I will shift the project focus from a controller designed for emulators, to a controller that can be used for Pygames.

By changing the project focus to Pygames, I know for a fact I can finish the project before January 21st as well making this a RCOS project for next semester. Not to mention I still use the parts I ordered a couple days ago. What I’m going to do is get an idea of functions that will allow Pygame developers to expand their games and extra parts I will need. One of the extra parts I will need an accelerometer to add motion controls. I’ll reveal the list of controller functions later on this week.

1 Comment

Projects: N64 Emulator Controller Update #2


Yesterday, I just placed the order from Sparkfun for the prototype of the controller. The prototype will be implemented on a breadboard first before progressing any further. As you guys can tell from the shopping cart, I brought 12 tact switches with a nice round top on each one, left and right bumpers, and two analog sticks. One analog stick will be for the analog stick on the N64 and the other analog stick will be for the C buttons. The reason why I’m mapping the C buttons to an analog stick is because I figured I could create a controller similar to a PS3 or 360 controller, which feels natural to me. I have no idea how long it will take the order to get here in Philadelphia, but my guess is next week before Christmas.

Anyway, I started to mess around with the serial library for Python. Using the library was much more simpler than I thought as there are plenty of documentation on how to use the library. To understand how the library works, I wrote a simple little code in python that not only sends the letter c to the PIC microcontroller, but waits up to 1 seconds for the PIC microcontroller to send “hello” to it. Originally, I wanted to paste the code to this paste, however, the code editor for wordpress is really poor and will mess up the coding syntax of Python. The way the code works is that whenever I’m prompted to enter a character, it will either exit the program, or transmit the letter ‘c’ to the PIC18F4553 microcontroller. When the microcontroller pick up the c, it will transmit “hello” to the computer.


It seems like there are some timing issues since I get a weird character after the first transmission. I’m going to look into how to resolve this issue until the parts come in. I will also learn how the keyboard event generator will work in Python.


Projects: Open Source N64 Emulator Controller #1

So, here I am again. I am going to relax after having another brutal semester at RPI. However, next semester will be one of the toughest semesters I ever had. Although I’m only taking 12-15 credits next semester, I will be working at 5 different jobs. The first job is a part time job at TV Ferret redesigning their sewage inspection systems. The second job is working as a lab TA for the Mercer Lab at RPI. Another job will be working at RPI’s Advising Learning and Assistance Center as a tutor for introduction for Electronics and Electric Circuits. The final two jobs will be working at two research centers, but I doubt I will get both of them. Add in my senior design project, and you get a very stressful semester. So I figured going to have to work on a semi big project before going back to RPI. What’s the project I’m working on? A controller for an N64 Emulator.


Recently I started to get into video game emulators, more specifically the Project64. Lately, I’ve been playing The Legend of Zelda; Ocarina of  Time on the emulator. The biggest problem, which I’m sure a lot of people who played emulators have encountered, is the controls. Controlling your characters using a keyboard is not humanly possible. I want to make playing on the N64 emulator as easy as pie. I envision myself, picking the device, and playing a rousing game of Super Mario 64 without attempting to throw my laptop out of the window.

To make the project more interesting, I will set up a deadline for myself. I want to at least finish the prototype before January 21st, or before I go back to RPI. Whether the final prototype will be built on a breadboard or a pcb is up in the air. If I finished the project before January 21st, I will make it into a project for RPI RCOS, which focuses on open source projects,  next semester.  In other words, expect more posts to come from me December 17th until January 20th….as long as the world does not end by that time. So, the question you guys might be wondering how am I going to accomplish this?


So obviously I’m going to use a microcontroller for this project, but it will be a very different microcontroller than the microcontrollers I used in the past. Instead, I will be using Microchip’s PIC18 series microcontrollers. Why? Simple, my dear Watson. I spent one semester using nothing but PIC18 microcontrollers for my research at RPI’s Center for Automation Technologies and Systems.


So the picture above shows the overall system I will be working with for the project. Here’s how it will work. I will have the PIC18F4553 microcontroller to read in the state of the buttons on the controller. Afterwards, it will tell a python serial communication script which button is pressed. Once the serial communication script receives the data from the microcontroller, then it will tell another python script to generate the appropriate keyboard events, which will be automatically seen by the emulator.Depending on the progress of the project, I will create a gui interface for the device. The gui will have an on/off button, and an option to determine the COM port the driver should look at. Again, I will give more details as time progresses. It’s going to be a fun 35 days!