2012-12-30

Arcade Stick


The arcade stick is done!!!!!
:D


Basic Operations
1. Controller reads the inputs from the joystick and the push buttons
2. Controller sends this information to the PC via serial communication
(well... using ftdi so virtual serial communication...)
3. The PC-side receiver translates this information into other useful instructions for the PC

I am using PIC 16F876a microcontroller as the controller
and a software written in MATLAB as the receiver.


For More Information

Check out the following posts:



Videos

Using the stick as a mouse:
Using the stick as an arcade stick:


By Joe Kwuen

2012-12-28

Arcade Stick: Receiver


This post contains extra details on the receiver of my arcade stick.
PC receives and translates serial data from the controller using MATLAB and JAVA robot class.
I have programmed to operate my stick normally as an arcade stick, and also as a mouse.
In this post I will provide enough hints for anyone to use MATLAB for such purpose.


MATLAB Serial Communication Problem

I noticed many people including me were having problem with MATLAB's serial communication module.

DO THIS BEFORE ANYTHING ELSE!

The following code most likely will fix whatever problem you are having.
priorPorts = instrfind
delete(priorPorts)

MATLAB's serial communication apparently does not work well when there are any... 
(even the closed ports) 
previously declared ports.
The above code just finds and deletes the memory previously allocated for them.

Some useful MATLAB functions are:
serial
fopen
serial.BytesAvailable 
fread


JAVA Robot

first import the class for simplifications later on
import java.awt.Robot;
import java.awt.event.*;
import java.awt.event.KeyEvent;

make a robot class
robot = Robot;

have fun :D

key simulation:
if (sw1 ~= sw10)
if(sw1 == 1)
robot.keyPress(java.awt.event.KeyEvent.VK_H);
robot.delay(20);
else
robot.keyRelease(java.awt.event.KeyEvent.VK_H);
robot.delay(20);
end
sw10 = sw1;
end

The delay of 20 ms simulates how actual keyboard works. 
A keypress function must be released else it will be like a stuck key.

mouse simulation:
pos = get(0, 'PointerLocation');
x_pos = pos(1)+speed;
y_pos = 768-pos(2)+speed;
mouse.mouseMove(x_pos, y_pos);

Read pointer location and move the mouse. 
You can set sensitivity by changing the speed variable.
The first line is included such that you may use your real mouse as well as the joystick to simultaneously move the mouse cursor.



By Joe Kwuen

Arcade Stick - Controller

This post contains extra details on the controller of my arcade stick.
The controller side of the Arcade Stick is fairly simple.
It is just a microcontroller - PIC 16F876a programmed using MPLAB with CCS C compiler.

During the main loop the controller
1. Reads the status of input ports
2. Organizes the info
3. Decides whether to send the info to the PC or not


Checking for Updates
pretty straight forward - just digital reads...


Organization
Just two bytes of information sending to the PC:
1 byte of joystick info
1 byte of push button info

The first byte consists of
0 - 0 - 0 - 0 - LEFT? - RIGHT? - DOWN? - UP?
there are four bits of zeroes as fillers because I am using 8N1 serial communication.
The other four bits are assigned to each direction.
For example, 0x08 = left and 0x0A = Left-Down

The second byte consists of
SW7 - SW6 - SW5 - ...
I guess it's self-explanatary that I am using each bit to indicate each switch.


Decision...
The following code is being used to decide whether to send the info or not:

if(old_dir != new_dir || old_sw != sw)
{
putchar(new_dir);
putchar(sw);
old_dir = new_dir;
old_sw = sw;
}

The controller sends info only when the inputs have changed.

This greatly simplifies the PC software and improves the operation of the arcade stick.



By Joe Kwuen

2012-11-20

Arcade Stick #1

This is the first posting on the arcade stick I am working on.
I play a lot of fighting games; yet I still don't have a descent fighting stick.
That is why I decided to make my own.

The components of this project are:
8 Push-Buttons
1 Joystick
Indicator Lights to Help Improve my Gaming Skills
Digital Controls to Provide Accurate and Fast Responses from the Inputs
USB Connection
C# User Interface

I finished the top side of my arcade stick.
It is made out of heavy cardboard, and plexiglass.
I used my school mechanic shop for drilling and etc.

I began testing just the direction controls on breadboard.
When I finish them
then I will start adding more circuitry and coding for the other inputs.

Anyways
I am posting a video of my arcade stick so far:



By Joe Kwuen

NOT AVAILABLE


INFO ON THIS PROJECT IS NOT AVAILABLE!

THIS MAY BE BECAUSE IT WAS
A SPONSORED PROJECT.

PLEASE CONTACT ME IF YOU NEED MORE INFO


By Joe Kwuen

2012-11-18

Main Page

In this section of my blog,

you can browse through my awards, education background, and list of all previous projects that I worked on.

I will post information about each project one by one.

I am hoping to use this section of my blog as a e-resume.

Thanks!!!












Lastly Updated on November 18th 2012

By Joe Kwuen

Awards



By Joe Kwuen

Education


University of British Columbia (UBC), Vancouver, BC
Electrical Engineering (General)
Expected to graduate in April 2013

British Columbia Institute of Technology (BCIT), Burnaby, BC
Electrical and Computer Engineering Technology Program
Graduated from the Computer Control Option – Jan 2011
Graduated from the Power Option – Jun 2011


By Joe Kwuen

Projects: Power

Ruskin Power Plant Exciter
  • Isolated Converter | Current
    • Designing isolated converter for UBC Solar Car
    • Required to efficiently charge batteries with solar panel inputs
  • DC-DC Converter | Dec 2012
    • Designing, building, and testing an open-loop controlled converter 
    • Designing and simulating a closed-loop controlled converter using Simulink
  • Power Distribution system for an Industrial Plant | May 2011
    • Developed a complete one-line diagram of the system using AutoCAD 
    • Sized protective devices, feeder conductors, and buses using CEC standards 
    • Designed a complete MCC
    • Adjusted settings of protection devices to achieve the best coordination
    • Provided coordination plot for the protective devices 
  • Various PLC/Control Relay Controlled Motor Starters and Synchronizers | May 2011
    • Developed ladder, schematic, and line diagrams for each controller using AutoCAD
    • Built and tested controllers for industrial-use motors and generators
    • Included all safety features: protective relays, fuses, circuit breakers, and overloads
  •  Lighting System for Commercial Buildings | Apr 2011
    • Designed lighting equipment quantity and layouts according to recognized standards
  • Three-output DC Power Supply | May 2009
    • Developed PCB using CircuitMaker and TraxMaker
    • Designed enclosure using AutoCAD
    • Outputs a regulated +5V output, variable 0~15V and 0~-20V simultaneously


By Joe Kwuen

Projects: Automation

GE Fanuc 90-30 Series



By Joe Kwuen

Projects: Control Systems


  • Digital Controller for a Servo System Jan 2011
    • Designed a suitable s-plane controller to stabilize a motor control system
    • Converted the s-plane controller into z-plane to implement the controller using a micro-controller
    • Tested the digital control system controlling a servo system
  • Analog Compensators for a Servo System | Dec 2010
    • Designed and tested various order lead-lag, and PID controllers
    • Applied Ziegler Nichols tuning method


    By Joe Kwuen

    Projects: Robotics

    Search-and-Rescue Autonomous/Remotely-Controlled Rover

    • Search-and-Rescue Autonomous/Remotely-Controlled Rover | Aug 2012
      • Developed all electrical components of the robot as the team leader
      • Contains four micro-controllers: a GUI controller, a communication controller, a sensor controller, and a motor controller
      • Designed PCB with Altium, and chassis with SolidWorks
      • Built completely without any complete modules: motor-driver, and etc.
    • Electromechanical Gimbal | Apr 2012
      • Designed to balance a platform at constant angles set using a PC user-interface
      • Utilized closed-loop controlled DC motors with self-made capacitors to detect angles


    By Joe Kwuen

    Projects: Signal Processing


    • Speaker Verification System | Aug 2012
      • Designed and tested a speaker verification system using Matlab
      • Implemented without using any available Matlab modules
      • Compares both voice and speech characteristics using correlation methods 


    By Joe Kwuen

    Projects: Electronics

    LCD Alarm Clock with Games

    • Microcomputer System | Mar 2012
      • Designed and tested a microcomputer system on FPGA using VHDL and logic block diagrams
      • Interfaced 68000 microprocessor with SRAM, FLASH, DRAM, and VGA port
      • Tested by programming 68000 with simple C code
    • Bed Bug Detector | Dec 2012
      • Developed the add-on user-friendly GUI maintenance unit
      • Developed the heater system that can heat up to 50*C manually and automatically
      • Developed the CO2 generation system that mimics human breathing
      • Finished 80~90% of the work done on this fully operational bed bug catcher
      • Designed the system enclosure using SolidWorks
      • Sponsored by Dr. Jason Sneath, and Dr. Shahriar Mirabbasi
    • Arcade Stick | Dec 2012
      • Designing with LED indicators, and fast-response push-button controls
      • MATLAB receiver using JAVA robot class
      • Able to operate as a mouse and an arcade stick
    • Sound-Activated LEDs | Sept 2012
      • Implemented a system of LEDs responding to stereo sound signals
    • WWV-Synchronized Clock | Mar 2012
      • Developed an alarm clock using 8051 micro-controller with assembly language
      • Integrated various functionality: WWV-synchronization, and auto-correction for time zones and summer time
    • LCD Alarm Clock with a game | Jan 2012
      • Developed an LCD alarm clock with a game
      • Reports two different time zones simultaneously
      • Displays graphical status according to preset timetable
    • Tamagochi | Apr 2011
      • Developed a Tamagochi using graphical LCD and PIC micro-controller
    • Breathalyzer | Feb 2011
      • Developed a breathalyzer with cheap alcohol sensor and PIC micro-controller
      • Failed to deliver accurate measures due to the quality of the sensor
    • Digital logic IC Binary Clock | Jan 2011
      • Developed a clock composed of only digital logic chips
      • Inspired by IEEE winner - all-transistor clock
    • CMOS-device Operation Tester | Jan 2011
      • Developed a CMOS-device operation tester for maximum 40 pin ICs
      • Sponsored by BCIT School of Energy
    • Pong | Dec 2010
      • Developed Pong using TS-7200 micro-processor and a graphical LCD
      • Integrated a perfect Pong AI system
    • Dynamic Webpage | Dec 2010
      • Developed a temperature reporting dynamic webpage using TS-7200
      • Implemented signal conditioning on temperature sensor to provide accurate and precise measurements


    By Joe Kwuen

    Projects: Programming

    Drawing Board Program
    • Elevator Simulator | Apr 2012
      • Designed and completed a concurrent elevator simulator using C++
      • Divided into well-synchronized multiple processes and threads
      • Modified easily to add more elevator units
    • Peer-to-Peer Ring CSMA/CD Network | Jan 2011
      • Programmed a CSMA/CD ring network that transmits and receives messages between five computers in C++
      •  Developed a customized protocol that resembles a standard CSMA/CD network
    • Drawing Board | Dec 2010
      • Programmed a "Windows Paint"-like drawing board using Allegro C
    • Pong | Dec 2010
      • Programmed a simple game using Allegro C


    By Joe Kwuen

    Projects: Others



    By Joe Kwuen

    My trip to Japan: Overall Thoughts


    I have just uploaded pictures from my trip to Japan.
    I stayed in Osaka at my girlfriend's place.
    Because she could not take a vacation from work, 
    most of my trip was just doing everyday chores:

    cleaning
    cooking
    shopping
    battling cockroaches...
    (yes... Osaka have a huge cockroach problem)


    LINKS

    Here are links to specific blog postings about the trip:


    MY THOUGHTS

    Excluding my short stay there when I was little,
    I have visited there about 4 times now.
    I love Japan because people are friendly , and food is excellent.

    But this time I had a bit of money problem while I was there - 
    The exchange rate was too much for me to handle even with free housing...


    WOULD I RECOMMEND TRIP TO JAPAN?

    Not now...
    Although it is a beautiful country with many interesting places to visit,
    Japan is just too expensive now - my total cost just for meals during my 3 week stay
    about $1000.
    I don't remember having expensive meals though...


    By Joe Kwuen

    Trip to Japan: Souvenir

    This page just has bunch of pictures while I was shopping for souvenirs

    NMB48 - nanba version of AKB48 store lol

    Kumamon - official mascot of Kumamoto region

    My girlfriend says we look alike...


    I love Anpan man... grew up watching him. I wanted to get this kaki gouri machine lol

    Bunch of takoyaki and taiyaki machines for sale.

    Shinobi Joe

    Kunoichi Nomi...

    My favorite snack in Japan - cheap and delicious!

    My favorite burger in the World... Teriyaki burger. I wanted to bring it here lol

    Hardoff Shopping
    Hardoff stores have some excellent deals. 
    They are usually located far away from major city districts,
    but if you can visit one, do so.

    I bought a PS1 with beat mania controller, and about 10 games for less than 30 dollars. 

    Nontan...

    My mom's favorite candies




    By Joe Kwuen

    Trip to Japan: Near Nomi's Home

    My everyday life when I was in Japan:
    Going to grocery stores
    Cleaning and Cooking
    Going out with Nozomi after her work
    Shopping at random places like Osaka's denden town and hardoff
    Battling with cockroaches...

    This page just has few pictures nearby where I stayed.





    Gift from Ai and Taka. I was moved...

    Cheap curry place... loved it.




    Nozomi treated me with pho because I was feeling homesick :D


    Homesick or maybe I was just annoyed by the wind (at rooftop of a business  building).



    By Joe Kwuen

    Trip to Japan: Land of the Deers - Nara

    I visited my favorite place in Japan - Nara.

    It is about an hour away from Osaka by train.

    Very excited. "Can't wait to be there" face lol

    My girlfriend is also equally excited - maybe not... 

    I am in NARA!

    Nara is famous for being old capital city of Japan, Todaiji, and alsooooooo

    Deers!

    Cuddling deers and people... how lovely lol

    Eating kaki gouri and having best time of my life lol


    Nozomi was scared of deers at first, but she found this sleeping one and decided to pose.

    Nozomi says we look alike. lol





    Thinking about my past and my future.
    For some reason everytime I visit Nara,

    I start coming up with the most random things to think about.

    Magic of Nara... (maybe also dropping of deers too)



    The last place we visited before heading home was an old inn.

    Many famous people visited this place in the past - including Einstein!!

    I got to sit on the exact chair he did about 100 years ago!

    I felt smarter.


    By Joe Kwuen