Handheld Console With Wireless Controllers and Sensors (Arduino MEGA & UNO)





Introduction: Handheld Console With Wireless Controllers and Sensors (Arduino MEGA & UNO)

What I used:

- Arduino MEGA

- 2x Arduino UNO

- Adafruit 3.5" TFT 320x480 Touchscreen HXD8357D

- Buzzer

- 4Ohm 3W Speaker

- 5mm LED lights

- Ultimaker 2+ Printer w/ Black PLA Filament

- Lasercutter w/ MDF wood

- Black spray paint (for the wood)

- 3x nRF24L01+ Wireless Transceivers

- 2x 16mm Button

- 2x Pressure Sensors

- 3x 9V Battery Holders

- Breadboard

- 2x 0.96'' OLED I2C screens

- Male - female wires

- Solderstation

- Super Glue

- 2x one-channel touch module (RED/BLUE)

Step 1: Wire the (touch)screen

So we will be making this a handheld console, with two wireless controllers.

Therefore we will have a main unit (The biggest part, with the LCD screen)

The main unit will be ran with the Arduino MEGA.

The two seperate controllers will each run an Arduino UNO.

Later on we will make the Arduinos communicate with each other to send controller data.

Start with wiring the 320x480 screen correctly to your main screen unit (Arduino MEGA) like in this tutorial. (Adafruit has a great detailed tutorial for wiring & code).

For sound, I wired a buzzer and a 3W 4Ohm Speaker to seperate digital pins and GND.

with the tone(pin, frequency, duration); You can create some basic monophonic sounds.

Step 2: Get Familiar With the Libraries

The Adafruit 320x480 screen supports the corresponding Adafruit_GFX and Adafruit_TFTLCD libraries.

Read the documentation. I think it is explained kinda well there.

Make sure you put in the right settings in the Arduino IDE:

Tools -> Board -> Arduino/Genuino MEGA or MEGA 2560

Tools -> Port -> [The port with ''Arduino MEGA'' in it]

This particular screen library supports custom fonts, basic shapes and a variety of colors.

Something noteworthy might be that the refresh rate is too low for smooth animation. If you want to update the screen every tick, it will be too slow to handle redrawing each pixel, and it will flicker.

So I would suggest working creatively around this, like how some of the older handhelds handled animation: with keyframes. Less is more! And instead of redrawing everything every second, if you want to move a rectangle left or right, you can simply erase the trail it leaves behind, instead of erasing the entire object and redrawing it.

For example, I used the screen flicker as a blinking effect for the character at the intro sequence.

From the Adafruit_GFX library I mainly used the tft.fillRect(x, y, width, height, color); and tft.print(text); functions.

Experimenting is key.

Step 3: Design a Graphical User Interface / Main Menu

After gaining knowledge within the library and knowing its limitations/powers, you can start designing a Main Menu screen.

Again, think about rectangles. Atleast that's what I did.

Here's my code for the UI


You could create sliders for screen brightness, to control the ''Lite'' pin on your Adafruit Touchscreen, through an Analog pin.

Step 4: Wire the Two Controllers

For the controller part it is actually up to you what kind of sensors you want to use, depending on what game you are planning to make.

Okay, so for the controllers I decided to use:

- A pressure sensor

- An OLED screen

- One-channel touch module which turns on or off

- Gesture sensor (RobotDyn APDS9960)

- nRFL01+ Transceiver (for wireless communication)

- A push button

Note: The Gesture sensor and the OLED both use SCL / SDA connections. It took me a while to realize that Arduino only has two: A4 and A5. But you can simply wire these parallel together on the breadboard and it will work fine.

Step 5: Start Wiring the Wireless Connection

Wiring the nRF24L01+ modules took me some time, to make it work.

I had to resort to the TMRh20 RF24 library, after not being able to get the right sensor data transmitted to the screen.

In order for multiple Arduinos to communicate with each other, we have to make sure that at least one of the UNOs is powered, aswell as the MEGA.

Use the serial console of the MEGA to print out the results you get in from the UNO, and see if it works.

Here's the code

Here's the library

Step 6: Go Wild! Try Out Various Things

A crucial part of my development process was to just Try out a lot of things!

What kind of buttons do you want to use?

What do you put in your controllers?

Look around on websites, you will find a lot of components besides the usual ''A/B'' buttons or analog joysticks. Be inspired and motivated to give it a go!

Once you got a clear and working idea of what you want to put in the controllers, wire the components.

Depending on how they work, you will need to use digital inputs, or analog inputs.

NOTE: Some components may need SCL / SDA pins to work correctly. And if you have two or more sensors both needing the same, you will probably get a panic attack like me. But you don't have to worry!

You can put both the sensors' SDA and SCL pins in series with each other, going into A4 and A5 and it will work.

Step 7: Design

Once you got a cool idea for the sensors you want to use, sketch some ideas for a design you like.

After that, get into some modeling programs like Blender, Maya, Cinema 4D.

I used Blender to create a (rough) model.

To get clear measurements in Blender, you can change the unit of the grid size to millimeters.

After you've made a model, be sure you have no double vertices and you've recalculated your normals.

Export the file as an .stl, if you want to use a 3D printer like me.

NOTE: In Blender, you will have to set the export scale to 0.1, if you want the accurate size in Cura in the next step.

Step 8: 3D Printing the Enclosure

This model was printed with 2.85mm Black PLA filament on an Ultimaker 2+ printer.

Download CURA

Load up your .STL into Cura, and it will show you how long it will take.

For a handheld case it may take up to 10 hours to print, depending on size.

However, for low-detail models you can speed up the process, which is what I did.

Here are my settings:

Layer Height: 0.2

Wall Thickness: 0.8

Top/Bottom Thickness: 0.8

Nozzle: 0.4

Temperature: 60 degrees Celsius

Flow: 100%

Brim: Anywhere touching buildplate

Infill density: 20%

Gradual: 0

Nozzle Temperature: 220 C

Print Speed: 120%

Step 9: Soldering and Finalising

You've come a long way.

The final step is to acquire a perfboard / veroboard, and translate your breadboard connections to a part of a prototyping board.

Make sure the electronics fit inside the printed enclosures, and perhaps cut some wood MDF to make parts where buttons / controller inputs stick through.

I used a lasercutter for this.

The most important thing is to screw around, try out some stuff you've never done otherwise, and have fun!

Hope this tutorial was clear enough...It was a pretty difficult project, which yielded a great result! :)

Step 10: Preview



    • Science of Cooking

      Science of Cooking
    • Microcontroller Contest

      Microcontroller Contest
    • Spotless Contest

      Spotless Contest

    We have a be nice policy.
    Please be positive and constructive.