Mini Arduino Nano gamecomputer
Sometimes certain parts invite you to make a nice application and in this case it was a few analog joysticks in combination with an
Arduino Nano and a small OLED screen. All the ingredients to make a small game console. Since the display only needs two connecting wires
(I2C) and the analog joysticks need two analog inputs each an Arduino Nano had more than enough pins. The whole can then be powered with
four AAA batteries. I have the Arduino Nano and the display in header pins so that they can possibly be replaced or reused themn. This also
better than solder directly onthe pins of these components. The Arduino Nano I have is situated in the middle of a bit of experimentation
board with both joysticks on either side. To save space I placed the display above the Arduino Nano and then I connected everything to the
Arduino and added the power supply line with short wires. For the batteries I bought a ready-made holder with switch, this is handy because
then we don't need to place an on and off switch somewhere. This was the whole (simple) hardware design, now it was important to write some
software. I had already written a library for the display, so it could be nicely reused and the choice fell on three games that I had already
made in the past, snake, pong and breakout. I wrote these games so that they can be played with either one or two people, who can sit opposite
each other. Then I wrote an easy choice menu and the game console was ready. The source code of both the library and the games is at the bottom
of this page as download. The design and software are not copyrighted (it's GPL) and I hope I can help people with this inspire them to make
their own version and, for example, design a nice housing, write new games or improve or supplement the old games. I wish everyone good luck
and a lot of fun with this design and at my home the kids had a lot of fun with it. Kind regards,Hein Pragt.
Arduino Nano
The Arduino Nano is also a very small Arduino board that is especially suitable for use on a breadboard because the connector pins
can be put on the bottom side. This makes it easy to plug the board into a breadboard. The board is based on the well-known ATmega328
(Version 3.x) or ATmega168 (Version 2.x). There is no power plug on the board, but there are power input pins. The board can be powered
through the Mini-B USB connection, 6 to 12V voltage on the raw input or 5V stabilized power on pin 27. The voltage source will be automatically
selected from the best of the three. The Arduino Nano can be programmed via the built-in USB port. The board can be programmed with the
standard Arduino programming IDE, you can board and simply select the port from the drop-down menu. The possibilities of the small board
are very wide but the design is specially made for use on an experiment board (breadboard).
Chip | ATmega328 / ATmega168 16 Mhz |
Voltage | 5 V uitvoering |
Voltage raw | 7 - 12 Volt |
Digitale pins | 14 (waarvan 6 PWM) |
Analoge inputs | 8 |
Size | 45 mm x 18 mm |
SRAM | 1 KB (ATmega168) of 2 KB (ATmega328) |
EEPROM | 512 bytes (ATmega168) of 1 KB (ATmega328) |
Flash | 16 KB (ATmega168) or 32 KB (ATmega328) |
Oled Display Module for Arduino 0.96 128x64 I2C
The display I used is a fairly standard OLED cheap display with white pixels, a resolution of 128 x 64 pixels and a control by means of I2C by the
the SSD1306 driver IC. This shield also only needs two data lines and it consumes minimal current so that it can also be used in projects that
need to be powered by a battery or battery. The size of this screen is slightly larger than the previous one and measures 26.0 x 15.0 mm. The
module runs on 3v3 and can be connected to the outputs of the 3v3 output of the Arduino, where the I2C lines can simply be connected to the
5V Arduino pins. The I2C address of this OLED shield is 0x3C by default. The screen is very clearly readable due to a very high contrast.
Because it uses 128 x 64 pixels you do not lose more than 1 Kb of valuable sram for this display with the Arduino.
The SSD1306 display controller
The SSD1306 is a single-chip CMOS OLED/PLED driver with controller for displays with a maximom resolution of 128 x 64. The IC contains
a display controller with display RAM and a built-in oscillator so that it can be used with minimal external components. It has a built-in
256 steps brightness control. It has a 6800/8000 series compatible Parallel Interface and a I2C interface.
Pins of the 128x64 display
Display | Arduino |
Vcc | 3v3 |
Gnd | Gnd |
Scl | A5 (SCL) |
Sda | A4 (SDA) |
Link: Datasheet of the SSD1306 controller.
Analoge joysticks voor de Arduino.
An analog joystick is like two potentiometers connected together, one for vertical movement (Y-axis) and another for the horizontal movement
(X-axis). So these yield an analog resistance value that can be easily converted into a voltage readable by the analog input pins of the Arduino,
The position of the joystick then corresponds to the voltage and will be between 0 and 1023, with 512 being the center point. In addition, there
is a pressure switch underneath that can be connected to a a digital pin of the Arduino. In this design I eventually use the analog inputs as
digital by converting the voltage into three values, center, left and right, as this is more convenient for programming.
The connections of the two joysticks are on the following pins of the Arduino Nano:
#define BUTTON_PIN1 7
#define BUTTON_PIN2 6
#define XPIN1 A7
#define YPIN1 A6
#define XPIN2 A2
#define YPIN2 A1
Link: Website with example about the analog joysticks.
Arduino Nano game console links, files downloads
Last update: 14-05-2022
Disclaimer: All pages on this Web site are copyrighted by Hein Pragt, unless otherwise noted. I strive for accuracy but cannot be held
responsible for any errors in the content. For questions about the content of this site or persmission to copy you can contact me at:
( email: heinpragt@outlook.com). Heinpragt.com is registered under KvK number: 73839426.
|