Home About Me Assignments Final Project

Final Project: Remote Game Controller


Quicklinks:
presentation SLIDE
presentation VIDEO


Table of Contents:
Initial Idea: Flying Tray
Alternate idea: Light Switch
Remote Game Controller: Initial thoughts
Designing the board
Milling
Soldering
Designing the Case
Printing the case
Assembly
Decorations
Embedded Programming
Making the Interface
Bill of Materials
License
Slide
Video
Files

Initial Idea: Flying Tray

At first week, we had to plan our final project and I came up with an idea of a flying tray. I've never had any flying things and looking up from the internet, drones look really nice and fun.

So basicly its a drone, and drones carry stuff, usually below them or integrated on their structure, like cameras. This one should carry stuff ABOVE, and with light, flat frame it should work indoors.

Here is the sketch image from week 1:
Sketch of the flying tray

So who's it for and what can be done with it?

It could be;
Medical tray for elderly - pills fly to you by timer or when called.
Food tray - some light food, like salad flown to table in a restaurant.
Snack tray - potato chips are light, why not float those around in a party.
UFO - put some leds on it and make it spin. WEE!

Design

At week 3, we went through computer-aided design, I drew the deck of flying tray with Inkscape. Further on, I made a 3D model and render from that image with blender.

Inkscape design
Blender render from top and bottom

So far, it is an artistic image, but gives an idea where I'm going with this.


Alternate idea: Light Switch

Light sensor with synchronous detection x 10. Each result control LED luminosity. So if you move finger over the strip,light is brightest where finger is going, i.e. light follows the finger. When finger is removed, depending on the position in strip, that sets the level of room lighting.


Remote Game Controller: Initial thoughts

So this is it. Design board with:
- accelerations sensor
- few buttons(game controls, calibration)
- RGB/led for mode, calibrations, info...
- regulator for battery power
- pins for bluetooth
- Atmega328P for space and pins

Casing can be made with 3D printing.

Small parts for transferring different position buttons pressing can be 3D printed or laser cutted.

Wireless communication with bluetooth master/slave pairing

Idea is to to make wireless, battery powered, hand held controller for self made games with unity 3D. It will take user input in form of a motion and button presses and wirelessly transfer that input to a computer, where it will be translated to commands.

It is meant for game programmers and designers, as an example and basis, that it is relativily easy to make a custom made controllers.

It will contain a PCB board, 3D printed casing and buttons, and a commercial bluetooth module

Processes used covered the following lessons:
- Electronic design and production.
- Embedded programming.
- 2D design (vinyl cutting for decorations, laser cutting for slide switch)
- 3D design and printing(case, buttons, mechanism)
- Input devices ( accelerometer, buttons)
- Output device (RGB and normal LEDs, Bluetooth)
- Interfacing (To make it work within Unity 3D)

For additional information, week 19, week 20 and week 21 covers alot in a form of short pages and simple questions.



Designing the board

Used Autodesk Eagle in designing the board, as I had done previously, starting from week 7 . I decided to go with ATmega328P microcontroller, as it had sufficient amount of memory and leg pins. Also needed to take a look how to connect the accelerometer from ADXL343 datasheet.

Acceleration sensor schematics

Atmega328 connections

RGB LED and buttons

Regulator for battery

One liners

I had planned to make an elongated design, so I placed the components accordingly. On the milling layer added extra holes for screws.

Complete board design

Milling

Used fabmodules.org to generate files for milling. Proceeded as done in week 5, with only notable setting difference that the cut depth was 0.09 mm and tool diameter 0.22 mm.

Ready for soldering

Soldering

Started to do soldering, as I had done previously, starting from week 5, and picked up the necessary components so I could test if accelerometer was responding correctly. Soldering accelerometer was not a regular soldering job, as it had only bottom pads, not side ones. I tinned up pathways below it, and applied bits of soldering paste used in reflow oven. Attached the accelerometer and then heated those pathways with soldering iron. After brief testing, it was giving out flat zeroes. So applied heat from heat gun, hoping it would help. The heat gun resulted some discoloration on the board but did the trick; the accelerometer was alive.

I then proceeded to solder the remaining parts, but after a visit at our storage, I realized we didnt have 330 ohm or 11 ohm resistors, as I had planned to use with 5V regulator. So I changed my plan, and went for simplified version of the regulator circuit, which had only two capasitors. I had to add a zero ohm jumper to make it work with the board I had. After soldering I quickly tested it with multimeter that there were no shorts.

Soldered board

Designing the Case

Made my design with Fusion 360, as I had practised it many times before(weeks 4, 6, 8, 10 and 18). Whole design consisted of seven parts; top and bottom part of the case, two buttons and mechanics pieces for power switch. I used trace image from eagle as a canvas to ease out the designing.

Fusion Design

Printing the case

Made my 3D print with our Stratasys printer. Process was the same as week 6, though I changed visible surface style to enhanced, hoping for a cleaner result. As it came out, the finishing wasnt that much different from normal surface style. I think I need to make walls somewhat thicker, and then sand it manually if I want smoother results.

Printed casing

Assembly

I attached my board to the bottom part of the case with 4 screws and attached the battery case with glue.

Assembly without battery or bluetooth module.

Assembly with removables in place.

Put some springs on buttons, so it wouldnt sound like a maracass when moved. Used some scrap pieces of clear acrylic to make light pipes for the leds and used glue to attach them in place. Power button slide mechanism was too small, and broke when trying to assemble it. I made replacement parts from 3mm acrylic with laser cutter.

Top piece with buttons with spring, and acrylic light pipes.

Decorations

For it not to look so plain, I cutted some vinyl for the decoration. Quickly drew some lines and circles with Inkscape, proceeded with vinyl cutting as was done in week 4. Applied the result.

Vinyl decoration

Embedded Programming

After browsing around, I decided to go with Arduino IDE's Wire library, which allows I2C communications. Then I followed this guide, for setting up ADXL 345 acceleration sensor with arduino IDE.

In addition of acceleration data, I wanted to send status of two buttons, or rather, two modes(making modes widens options). The final "frame" contained 5 values in a form of a string; x, y, z, modeA and ModeB. This was done as previously, starting from week 9.

Making the Interface

Making the interface with unity didnt differ that much from week 14. I made a scene for port selection, though this time its not FTDI but Bluetooth COM port.

Unity menu scene

Then created another scene to visualize the values coming from serial line and from the game controller itself. Added free skybox to the scene from unity asset store to visualize a bit more. I started another thread which could handle reading the serial line and updating variables, so it wouldnt tax too much Unity UI's Update method. I had to average accelerometer data, since it was too spiky. Then it was smoothness versus lag and I had to find balance, which was average of 5.

On this scene, buttons cycled through modes. Upper button mode had 4 possibilites, and this was reflected with RGB led(1 for each color and all off) on the controller and corresponding text on the scene. Lower button just changed the displayed object. Acceleration values give straight position coordinates to the gameobject. I made some treshold values for reading swipes to left, right, up and down and added icons to reflect that. Those icons deactivate after 1 second, and during that second none of the others can be active.

All active

Bill of Materials

PartValueDevicePackageDescriptionPrice
1megaATMEGA328P-AU2.87
BUTTON16MM_SWITCH6MM_SWITCH6MM_SWITCHOMRON SWITCH0.74
BUTTON26MM_SWITCH6MM_SWITCH6MM_SWITCHOMRON SWITCH0.74
C11uFCAP-US1206FABC1206FAB0.07
C20.1uFCAP-US1206FABC1206FAB0.12
C310uFCAP-US1206FABC1206FAB0.04
C410uFCAP-US1206FABC1206FAB0.04
C510nFCAP-US1206FABC1206FAB0.04
C610nFCAP-US1206FABC1206FAB0.04
D1LEDRGBNEWLEDRGBNEWP-LCC-40.60
IC1REGULATORSOT23SOT230.32
ISPAVRISPSMDAVRISPSMD2X03SMD0.6
JUMPER0RES-US1206FABR1206FABResistor (US Symbol)0
JUMPER10RES-US1206FABR1206FABResistor (US Symbol)0
LEDREDLEDFAB1206LED1206FABLED0.13
LED2GREENLEDFAB1206LED1206FABLED0.15
R110kRES-US1206FABR1206FABResistor (US Symbol)0.01
R21kRES-US1206FABR1206FABResistor (US Symbol)0.01
R3499RES-US1206FABR1206FABResistor (US Symbol)0.01
R41kRES-US1206FABR1206FABResistor (US Symbol)0.01
R51kRES-US1206FABR1206FABResistor (US Symbol)0.01
R710kRES-US1206FABR1206FABResistor (US Symbol)0.01
R810kRES-US1206FABR1206FABResistor (US Symbol)0.01
R91kRES-US1206FABR1206FABResistor (US Symbol)0.01
R1249.9kRES-US1206FABR1206FABResistor (US Symbol)0.01
R1349.9kRES-US1206FABR1206FABResistor (US Symbol)0.01
R1449.9kRES-US1206FABR1206FABResistor (US Symbol)0.01
R1549.9kRES-US1206FABR1206FABResistor (US Symbol)0.01
RESONATOR16MHzRESONATOREFOBM0.63
S1SLIDE-SWITCHSLIDE-SWITCHAYZ0102AGRLCSMD slide-switch AYZ0102AGRLC as found in the fablab inventory. Includes the mounting holes.0.84
U$2ADXL343ADXL343LGA143-Axis, ±2 g/±4 g/±8 g/±16 g Digital Accelerometer2.71
U$5SupplyPINHD-2X2-SMD2X02SMD0.66
U$6Rx/TxPINHD-2X2-SMD2X02SMD0.66
U1REGULATOR_SOT223REGULATOR_SOT223SOT2230.34
-
HC-06Bluetooth module5.95
ABSFilament15.6
PCSupport5.12
PCBFR-11.4
-
Total40.63

Total cost is approximately 41 euros, where half came from 3D printing material, which was a surprise.


License

This work is licenced under Creative Commons Attribution 4.0 International (CC BY 4.0) licence.

Software is licenced under MIT licence.

Slide

Presentation Slide

Video


Files

Electronics
Eagle Files: .sch .brd
Trace image and toolpath: .png .rml
Outline image and toolpath: .png .rml

Casing
Fusion 360 Case design: .f3d
Case design as stl: bottom top button button 2 switch part 1 switch part 2 switch part 3
Inkscape slide piece: .svg .pdf
Inkscape decorations: .svg

Code
Arduino IDE code file: .ino
Unity scenes: Menu Game
Unity scripts: MenuController.cs GameController.cs