Arduino OLED Snake Game W/ 555 Timer Speed Control

by RJ - 763053 in Circuits > Arduino

18 Views, 0 Favorites, 0 Comments

Arduino OLED Snake Game W/ 555 Timer Speed Control

unnamed.jpg

This is a simple game of snake controlled by a joystick, on an OLED screen. The difference here is that the speed your snake moves at is directly proportional to the period that it takes the 555 timer to go from outputting a HIGH to another HIGH. The 555 timer is controlled by a potentiometer, so the speed can be controlled by the player to fir their needs.

Supplies

Screenshot 2026-06-18 215440.png

Arduino Uno

Breadboard

OLED Display Module

Joystick

555 Timer (The image above isn't a proper 555 timer due to software limitations with finding one that contains all my components)

Potentiometer

100uF Capacitor (Represented by the blue LED due to software limitations)

LED

Buzzer

1x 5kΩ Resistor & 2x 330Ω Resistors

Jumper Wires

Computer to Upload Complicated Code.

I'm not sponsored trust me

Building the Timer

Screenshot 2026-06-18 220621.png
Screenshot 2026-06-18 230345.png

This takes up most of the breadboard when it comes to raw wiring, so it's a good idea to get the clock system done first.

Wire the 555 timer in astable mode, with the following connections.


555 Timer pins:

Pin 1: GND

Pin 2: Through the positive leg of the capacitor, and pin 6 of the 555 timer

Pin 3: Through a 330 ohm resistor, and to pin 4 on the Arduino

Pin 4: Pin 8 on the 555 timer

Pin 5: UNUSED

Pin 6: Pin 2 on the 555 timer, and to either the closest leg of the potentiometer or the middle

Pin 7: Through a 5K resistor to the 5V power rail, and to either the closer or center leg of the potentiometer

(Between Pin 6 and 7, the connections to the potentiometer don't matter beyond one of them being connected to the middle pin, changing where the other goes will just change the direction you need to move the potentiometer to speed up or slow down the game)

Pin 8: The 5V power rail


LED: Positive leg connected to the resistor going to 555 timer leg 3, negative leg connected to ground rail


Capacitor: Positive leg connected to 555 timer leg 2, negative leg connected to ground rail

Wiring the OLED Screen

Screenshot 2026-06-18 232713.png

This is a lot simpler than the 555 timer as now we only have to deal with 4 pins

Follow these instructions in wiring the OLED screen, pin by pin


Pin 1 (GND): Straight to the ground rail

Pin 2 (VCC): Straight to the power rail

Pin 3 (SCL): Either to A5, or the dedicated SCL pin (which is just the same as A5)

Pin 4 (SDA): Either to A4, or the dedicated SDA pin (which is just the same as A4)


In the photo above I used the dedicated pins, but the project works just fine without needing to modify the code if you use A5 and A4

Wiring the Joystick

Screenshot 2026-06-18 233132.png

The Joystick is a little more complicated to wire compared to wire than the OLED screen, but it should still be manageable !

Follow these pin instructions.


GND: Straight to the ground rail

VCC: Straight to the power rail

Vertical/y pin: A1

Horizontal/x pin: A0

(Note: Since there are so many different joysticks out there with different intended x and y movement, the above two pins may have to be swapped depending on your joystick)

Select pin: Arduino pin 2

Wiring the Buzzer

Screenshot 2026-06-18 234255.png

Saving the easiest for last. The buzzer is by far the easiest to wire as all you have to do is:


GND leg: 330 ohm resistor to ground

VCC leg: Arduino pin 3


Most buzzer's aren't polarized so it won't matter which leg goes where, as long as they both reach one of the two needed destinations.

Code

The code will all be downloadable, as I intended to comment on it in such a way, and create my functions in such a way to where the code is naturally readable and easily learnable.


I would like to thank the YouTube channel TechsPassion, as a large amount of my code is a restructure of their code from the video "Snake Game Using Joystick, OLED With Arduino". Their code was used as a blueprint by me due to some time constraints. My version from the file below is intended to be more readable, while also integrating the 555 timer, as the original code is just for the snake game on an OLED.


Again, to know how my code works and what everything does, it's a lot more beneficial to just read the code and its comments rather than adding more steps to this instructible that would just be repeating everything anyways.


Enjoy your completed snake game :)