LED Maze, The Schematic and Shift registers

LED maze schematic

This is the schematic of the LED maze. The implementation of the shift registers can be seen here. 3 inputs are passed to each shift register: clock, clear, and serial data in. Serial data in is used to decide which LED to activate, by using a binary representation of which LED to light. To light the 2nd and 5th led, for example, 01001000 will be passed to the serial in. Then, the clock is used to shift the serial data to it’s required position on each clock pulse. This is what results in the very dim LEDs showing up, as they are actually turning on for an extremely small amount of time compared to the LEDs that are meant to be on.  Then finally, clear is used to make LEDs turn off again. This cycle repeats fast enough so that the LEDs meant to be on appear constantly on, and the other LEDs appear off (or are actually off).

This combination of inputs allows the control of each individual LED within the maze.

LED maze, The Code

Code for ray tracing for the LED maze

One interesting aspect of the code is the implementation of ray tracing. Ray tracing is basically casting a “ray” from a point outwards, gathering data about when the ray encounters an object, and using that data to interact with the surroundings. In this project, Ray tracing is used to find out where the visible walls will be. A ray is cast from the user’s current position, and when it encounters a wall in the maze, it instructs the program to activate the led at that position. It repeats this all the way around the user, until the entire view of the maze that the user would have while within the maze is constructed. This is referred to as the “frame” and is how the program decides which LEDs to have on after each move made by the user. This does result in a small delay between each move until the next frame is displayed, but also gets the desired result of only showing the parts of the maze wold be visible in the maze to a user.

LED Maze, The Big Picture

the initial LED layout
LED layout in casing

 

The goal of this project is to create an 8×8 LED maze. The user should be able to use buttons to navigate up, down, left, and right through the maze. Instead of simply showing the entire maze at once, the only parts of the maze that should be visible would be the parts of the maze a person inside would be able to see, assuming the walls are taller than the person. I.E. the only maze walls visible would be the walls in the line of site of the user, and no walls behind another wall would be visible. A “Fog of War” type of effect. The goal is to accomplish this using transistors, shift registers, ray tracing, resistors, buttons, and of course LEDs. A jewelry holder is used as the physical “casing” for the Maze. Images above are the initial LED layout, and the casing used.