LED Snake


This project was to create a game of snake using a cheap Chinese clone of a Wemos D1 ESP8266 micro controller, along with a 5 X 8 Adafruit Neo Pixel shield. The micro controller hosts a website which acts as a remote control, communicating with the game code via the “WebSocket” protocol.


This project started out as something for me to mess about with while on my travels. Using the “Adafruit Neo Pixel Shield” on top of the D1 clone (which uses the “Arduino Uno” form factor) was a great idea due to the ESP8266 platform’s versatility meaning the simple setup of web based projects and the possibility of using the LED shield as an output display. I found a snake tutorial online which was written in python and decided to convert it to C++ and build it in to my platform. The platform doesn’t have any inputs at the moment so I decided to use the Wi-Fi capabilities of the ESP8266 and make a webpage based controller that would be hosted on the platform. This controller would communicate with the game code via the “WebSocket” protocol which creates persistent connection which allows wither the server or the client to send data to the other party at any time.



The Controller

The Chinese “Wemos D1” Clone I bought from SEG in china was a perfect choice for this project due to its deep integration in to the Arduino ecosystem i.e. its layout being the same as the “Arduino Uno” which allows compatibility with the wide range of available "Shields".

The LED Screen

The LED screen is an “Adafruit NeoPixel Shield” which was designed around the “Arduino Uno” form factor which the “Wemos D1” clone used in this project shares. The screen consists of 40 WS2812B (NeoPixel) LEDs. These are RGB LEDs which are addressable over a 3 wire interface meaning we can control each led independently of the others.


The Game Code

The game code was adapted from a python tutorial found here and is split up in to several different files. One file for the main functions such as the setup and loop functions, one file for

The Controller Code

The controller is a web page containing arrow buttons which is hosted on the ESP8266 micro controller. The web page uses the “Fabric” framework and presents the user with arrow elements arranged on a canvas object. Each of the arrows has an event listener which sends a string of information to the game code via the “WebSocket” protocol.

How To Play


Press Play Lol