Arduino PC

Although a microcontroller is a computer on a chip with an integrated processor, memory and I/O peripherals, still to a student, it feels hardly any different from other DIP integrated circuits. Therefore, we designed a project "Arduino PC" as an assignment for the high school students who attend the "Digital Electronics" course. It requires them to design and simulate an electronic circuit in Tinkercad to achieve the given project requirements (discussed below). The goal is to enable the students to see microcontrollers as a full-fledged computer (though restricted in capability) which can be used with a custom keyboard and an LCD (Liquid Crystal Display). It also allows us to check their prowess in using the concepts learnt in the class.

For this assignment project, we recommend Tinkercad so that the students need not stick around the digital electronics lab for the components, and can work at their own convenience. Also, it is easy for instructors to track the status of each student's project over Tinkercad once it is shared by them.

The project requires the students to:

  1. Design a custom keyboard with 15 input keys (10 keys for digit 0-9 and 5 for instructions +,-,x,/ and =) and maximum 4 connecting (data) pins (apart from the 2 pins used for providing power supply) for sending input to the Arduino Uno.
  2. Interface an LCD with the Arduino Uno.

  3. Write simple code for the Arduino Uno to interpret the key pressed and display it on the LCD.

  4. To perform the simple mathematical operations (over integer inputs) assuming all the inputs and results are always integers within the range -32,768 to 32,767.

This project helps the students in learning to

  1. Encode different inputs into binary codes.
  2. Design a binary encoder using digital circuit (this is the heart of keyboard circuit design).
  3. Identify (decode) the individual inputs from their binary encodings.
  4. Write Arduino codes.

Supplies:

The project requires:

  1. Access to a personal computer with a stable internet connection.
  2. A modern browser which can support Tinkercad.
  3. A Tinkercad account.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Designing the Keyboard Circuit

Designing the keyboard circuit is one of the major components of the project, which requires the students to encode each of the 15 key inputs into different 4-bit patterns. Although there are 16 distinct 4-bit patterns, however, one 4-bit pattern is exclusively required to represent the default state i.e., when no key is pressed. Therefore in our implementation, we assigned 0000 (i.e., 0b0000) to represent the default state. Then, we encoded the decimal digits 1-9 by their actual 4-bit binary representation (i.e., 0001, 0010, 0011, 0100, 0101, 0110, 0111, 1000 and 1001 respectively), and the decimal digit 0 by 1010 (i.e., 0b1010). The mathematical operations '+', '-', 'x', '/' and '=' were encoded as 1011, 1100, 1101, 1110 and 1111 respectively.

Having fixed the encodings, we designed the circuit as shown in the figure, where the keys have been represented by switches (push buttons).

Step 2: Interfacing the LCD

To view the output of the Arduino Uno, a 16x2 LCD is used. The circuitry for interfacing the LCD with the Arduino is quite standard. In fact, Tinkercad provides a pre-built Arduino Uno circuit interfaced with a 16x2 LCD. However, one may change some of the Arduino Uno pins interfaced with the LCD in order to better accommodate other peripherals like the custom keyboard which we developed. In our implementation, we used the circuit shown in the figure.

Step 3: Writing Code for the Arduino Uno

To interpret the input coming from the keyboard, and to display the result on LCD, we need to load the instructions into Arduino Uno. Writing code for the Arduino is quite up to one's own creativity. Remember that the Atmega328p in the Arduino Uno is an 8-bit microcontroller. So one needs to improvise to make it detect overflow and work for large numbers. However, we just want to verify that the Arduino Uno can decode the input and differentiate between numbers (0-9) and mathematical instructions. Therefore, we restrict our inputs to small integers (-32,768 to 32,767) while ensuring that the output also falls in the same range. Further, one can work around to check other issues like button debouncing.

A simple code which we used in our implementation of the project is attached. This can be copied and pasted in the code editor in Tinkercad.

Step 4: Putting Everything Together

In the end, we interfaced the power supply pins of the keyboard with that of the Arduino and connected the data pins (which carry the 4-bit data) to the digital pins 10, 11, 12 and 13 (in order as mentioned in the Arduino code). We also connected an LED (via a 330-ohm resistor) to each of the data pins to view the binary encoding of each key on the keyboard. Finally, we hit the "Start Simulation" button to test the system.

Teacher Contest

Participated in the
Teacher Contest

Be the First to Share

    Recommendations

    • Instrument Contest

      Instrument Contest
    • Make it Glow Contest

      Make it Glow Contest
    • STEM Contest

      STEM Contest

    2 Discussions