This is my make-through for the week's assignment. Grab a cup of coffee!
I am making a joystick controller that is composed of 6 buttons that can be used to play arcade games such as Super Mario and Pac Man.
The joystick controller I am making supports PCs only. It has 2 modes: Button Mode and Tilt Mode.
Button Mode: This mode allows the user to control the game by pressing buttons.
Tilt Mode: This mode allows the user to control the game by tilting the controller. [Deprecated for Second Iteration]
First of all the Push Button that will be used will be the B165L Push Button. This button is reliable because of its low cost, dimensions, and ease of use.
The button will fill fit inside and joint inside of holes larger than 12mm and less than 19.5mm in diameter. It also has a screw that comes with it that is used to create a joint at any hole.
This is what makes the button perfect in our case: It is very cheap, it comes with its own joint, and is reliable for a joystick shape and dimension-wise.
The second component is the Arduino Leanardo. It is the most reliable microcontroller currently in this iteration in terms of cost, availability. and features.
The main reason Arduino Leanardo is used over other available microcontrollers is its Hardware User Interface feature, which allows the computer to recognize the microcontroller directly as a recognizable USB Device and can control both the computer's Keyboard and Mouse.
This is due to that the Arduino Leanardo is designed to communicate directly with the computer, unlike the Arduino Uno. It features a library "Keyboard.h" that allows us to bind Keyboard Presses in the code.
This will be useful in binding the pushbutton presses to Keyboard actions.
UPDATE: The Tilt Sensor is deprecated in this iteration and will be fully featured in the next iteration.
The KYO-20 contains a single digital output pin and features moving mercury such that its movement triggers internal switches that can be read through a digital pin.
The position of the mercury decides the output of the signal pin, and from the signal pin we can read it and know the tilt position.
This sensor will be placed inside the microcontroller for the Tilt Mode.
Before starting any project, a proof of concept phase is necessary.
The first phase of any prototyping process is Cardboard Prototyping.
I started by creating a very simple prototype using Cardboard and made my joints using a glue gun.
It was necessary to imagine how the product would feel given its size in fitting the Arduino Leanardo, the pushbuttons, and the tilt sensors.
I simply created a simple cardboard prototype in order to be able to imagine how I will start my design on CAD, and if my idea is valid.
On the right is a freehand sketch of the prototype because I do not have pictures of the cardboard prototype.
Step 1: Draw a Free-Hand Sketch
Step 2: Decide Dimensions and Fillets
Step 3: Draw Sketch on Fusion 360
Step 4: Extrude all Sketches and Assemble
Step 5: Export DXF File and Fabricate
Step 1: Import FIle to LaserWorks
Step 2: Select Cut Parts
Step 3: Set Cutting Speed and Power
Step 4: Upload File To Laser Cutting Machine
Step 5: Place 3mm Plywood
Step 6: Set Origin and Track Frame
Step 7: Start Cutting
Problem: Dimensions weren't enough, No Living Hinges, No T-Slots
Potential Solution: Use the sheet metal module to create living hinges. Create T-Slots for assembling the parts.
Step 1: Edit Free Hand Sketch and Dimensions
Step 2: Edit Sketch on Fusion and add T-Slots
Step 3: Create holes for mounting the electronic components
Step 4: Use models of electronic components from GrabCad to test how everything fits
Step 5:Export DXF and fabricate the model
The joystick is fabricated on plywood. It is fabricated through Laster Cutting using the software Laserworks
Step 1: Import DXF files on Laserworks
Step 2: Position the parts close to each other to save space
Step 3: Set the cutting speed and power
Step 4: Upload to the machine
Step 5: Set Machine Focus
Step 6: Test the focus through the pulse button
Step 7: Set Origin and Start Fabrication
Problem: It had missing sides. Editing the design was very hard due to poor design constraints. Each side was made individually in a 2D sketch.
Potential Solution: Create a single sketch, extrude, and use the sheet metal module to export a fully integrated design
Step 1: Edit Free Hand Sketch and Dimensions
Step 2: Extrude and unfold using Sheet Metal Module.
Step 3: Draw Living Hinges on Curved Sides
Step 4: Edit Sketch on Fusion and add T-Slots
Step 5: Create holes for mounting the electronic components
Step 6: Use models of electronic components from GrabCad to test how everything fits
Step 7:Export DXF and fabricate the model
The joystick is fabricated on plywood. It is fabricated through Laster Cutting using the software Laserworks
Step 1: Import DXF files on Laserworks
Step 2: Position the parts close to each other to save space
Step 3: Set the cutting speed to 15 and power 75.
Step 4: Upload to the machine
Step 5: Set Machine Focus
Step 6: Test the focus through the pulse button
Step 7: Set Origin and Start Fabrication
Arduino Leonardo (It is necessary to use an Arduino Leonardo because it is read as a hardware input to the computer. This is because the Arduino Leonardo communicates directly with the computer, unlike Arduino Uno).
Round Pushbuttons (This is a normal pushbutton, but it was chosen based on its shape and reliability to be mounted on the design).
KYO-20 Tilt Sensors (These are the tilt sensors used for the gesture mode, however I did not have enough time to integrate it this iteration. I will finish it in the next iteration).
All buttons are connected to internal input pullup resistors.
All wires with the same color are connected to the same node
Each button has a terminal to ground, and the other terminal to an Arduino pin that is in input pullup resistor mode.
Step 1: Define all GPIO Pins and configure internal pullup resistors.
Step 2: Bind Keyboard to Pushbuttons
Step 3: Use Delays to bounce off buttons
Step 4: Map Tilt Sensors to Keyboard Controls
Step 5: Switch between modes
The mechanism of the code is rather simple.
First of all, I bind each digitalRead function to a variable to simplify the code. (lines 44 to 52)
Secondly, I execute the action in each loop according to the mode we are in (Line 54)
Lines to 79 to 55 are for the button mode. It binds each button press to a keyboard press.
Lines 81 to 96 are for the tilt mode, however it is deprecated in the current iteration.
Lines 97 to 100 are for switching between button mode and tilt mode.
The delay at line 101 is for debouncing the button presses.
All pushbuttons were soldered to jumper wires.
Each pushbutton had one of its terminals soldered to a single node that is connected to ground.
The other jumper wires were connected to the Arduino Leanardo's pins respectively like in the schematic.
The pushbuttons were mounted and tied to the holes in the plywood through the nuts that are provided with the pushbuttons.
4 holes were planned in the design that match the position of the 4 holes of the Arduino Leanardo's board, where the board is mounted and tied to the plywood through M3 screws and nuts.
There are 8 T-slots on each top and bottom face.
There are 4 T-slots on each side and front face.
Each face is positioned on the other through the taps that were designed for guidance.
After they are correctly positioned, the nut is inserted, and the bolt is tied through the hole.
Unfortunately the small living hinges were burnt, and some parts are not unjointed.
It was a huge design mistake for me to rely on living hinges as joints. I fixed this problem later using a super glue. I will talk about It more below
The living hinges were not strong enough to hold the small sides in place, as I said it was a mistake in problem.
I solved these two problems by jointing to the top and bottom faces with a super glue and also a glue gun.
I forgot to create a hole for the USB to enter through.
I tried to solve this problem by drilling, however I broke the whole part.
Fortunately, I edited the part on Fusion 360, and reprinted the part at a nearby Lab.
Finally!
The joystick is finally ready.
It has 6 pushbuttons, just as planned.
The gesture mode was not implemented, I will implement in the next iteration.
I have tested it on PacMan, and it works like charm.
The video is in the conclusion section.
To the right you can find me playing PacMan with the joystick I made with the second trial.
The project had a lot of progress and development. Let's take a look at all 3 stages side to side.
We can all see how the learning progress is reflected on these three stages.
Let's take a look at each stage after fabrication
This was where Stage 1 stopped because assembling was not possible because there was no screw joints.
Here in the third stage: I finally did it. It is now usable! It has all sides with living hinges. It is fully usable!
This was stage 2. It had no living hinges, and had wires flowing out. However it was still usable and had screw joints.
What I learned this iteration is...
Fusion 360 Designing for Laser Cutting
Operating the Laser Cutting Machine, and using the software LaserWorks.
Mounting electronic components on my designs.
Assembling parts through T-Slots.
The next iteration I will hopefully create a smaller version, a more professional one. This time using 3D Printing, and using a PCB instead of Arduino Leanardo.