I decided to make a forum post series about the development process of a Maker project from scratch. I wanted to show the steps I take for an idea and cover the development issues experienced throughout different stages. The first stage, in my opinion, is idea generation and circuit design development. The hardest part is often coming up with an idea that will work on a particular development board. Once you come up with an idea that sounds reasonable, I’d recommend you check out this forum post I made on limitations: Development Kit Limitations - How to Determine Compatibility. Knowing the limitations of the development platform will improve your ability to assess if your idea is possible.
Maker Project Idea: Tic-Tac-Toe Using Bi-Directional LEDs
The idea that I came up with was making a Tic-Tac-Toe game for two players using bi-directional LEDs for indicating which player is making the move. Here are the pre-requisites I set for my idea:
- Need different light colors for players (preferred using bi-directional LEDs, but would compromise if I couldn't find suitable ones with two different LEDs)
- Need a way to switch between players; either using programming logic or electronics design
- Need enough current for every component (Arduino is generally limited to 40mA per pin)
Initial Circuit Idea
My initial idea for the electronic design included a way to switch between players using transistors. This would reduce the number of input/output (IO is shorthand), at least theoretically. This idea did not work, but it was still important to the design process. Here is the circuit diagram for what I came up with (only two out of nine lights shown for simplicity):
The circles labeled would be IO ports on the Uno or Mega (I didn’t realize how few ports there were on the Uno). The idea was to provide a logic control output to PlayerSW1 output and PlayerSW2 in an alternating pattern. Each output to the specific light (red or blue) would only happen if one of the transistors was on. In theory, this would greatly reduce IO, nine Outputs for LEDs, two outputs for player control, and nine more inputs for checking what buttons were pushed. This would have lead to twenty IO in total. The other option I could think of was just having a one to one setup: nine inputs for checking buttons and eighteen outputs for controlling LEDs which is twenty-seven IO total. I did not show the input circuit on the diagram since this idea didn’t work.
Problems With the Transistor Idea
The transistor idea sounded good until I started wiring things together and thinking through potential code. Here are the glaring issues after some thought:
- I'd need two transistors per bi-directional LED, eighteen parts in total and eighteen more resistors for the transistors
- Realized a logic error in control: having the transistors for one player all connected in parallel (or bussed together) would just switch color for the next player regardless, it would not allow individual color per turn.
Final Circuit Design
It turns out that having a one to one design was the easiest for me to understand and wire on a breadboard. Here is a basic port wiring diagram (will have a picture of actual wiring and a better diagram for the whole setup later; only three lights shown out of nine for simplicity):
Overall, this design is easier to implement and is cheaper because fewer parts are required. It does mean that the design is not possible on an Uno, there are too many inputs and outputs required. Using the Arduino Mega 2560 was my other choice which has plenty of ports available.
You may be wondering why I provided small snapshots of parts of the circuit rather than showing the entire setup above.
The entire design of this project is extremely overwhelming even with organized colors. I personally find that circuits are far more “digestible” if simplified down to a few repeated elements by using shorthand design. Shorthand design implies that there is more to the final circuit and does not quite represent the actual look or feel of the design. Many beginner circuit designers end up confused by these types of designs because there is no sense of “scale” or sense of how it translates to real wiring. To make sense of the smaller diagrams, just treat the small circles as any available digital port on the Arduino and the small hollow triangle connected to the bidirectional LEDs and 10k resistors as the Arduino’s ground reference (any pin that is labeled GND). In reality, there are physical wires connecting from the ports to the components and back to the ground completing the circuit or circuits. In shorthand, it is a lot easier to leave the grounds unconnected by a wire in the diagram to save space. Ground symbols of the same type (some designers use different symbols for different types of ground points) in a diagram are always connected even when it isn’t explicitly drawn. It is redundant to draw wires to these points for shorthand. It is up to you to decide whether or not to try drawing your starting diagrams in shorthand, do what makes the most amount of sense to you personally. The next post will discuss what components I selected and provide a wiring diagram that better represents the physical world using Fritzing.
Here is the PDF of the whole circuit design for convenience (did not use exact same parts, but the wiring diagram is generally the same as what I have on my breadboard): TTTFRZ_schemPDF.pdf (1.8 MB)