Coin Sorter/Counter – Big Picture

The project was done with an intent to build a simple coin sorting and counting machine based on Arduino. Infrared break-beam sensors are used to sense the motion of the coin that send an interrupt signal to Arduino, and the detected coin’s value is displayed on LCD 16×2. The initial step was to construct the machine with cardboard. A slightly slanted slider was attached to the board that let the coins fall smoothly into its designated place. Three different holes were cut depending on the ascending diameter of the coins. For the purpose of efficiency, three coins of varying sizes were considered. The next step was to position the pair of Infrared (IR) break-beam sensors, under each hole to detect the breakage of an IR beam. Receiver was set across from emitter, and both were interfaced to Arduino board with resistors, and soldered wires. Arduino program reads the interrupt caused by the coin and prints the value of each coin as they are inserted in to the slider. After numerous attempts, the goal of sorting and counting the coins with Arduino powered machine was accomplished.  

ECE412 Final – Automatic Toilet Paper Dispenser

Big Picture

In this project we used windows and Arduino and we started out with high hopes and big plans. We began brainstorming ideas for the project and originally planned to use a load sensor or another proximity sensor of some sort to be able to weigh, or ultimately tell when you were out of toilet paper. We decided that a load cell was too hard to incorporate mechanically and even if it was it wouldn’t be accurate enough to sense a few sheets of toilet paper. After we trashed that idea, we decided we would still have a sensor for when it was empty but we would use a interrupt sensor and a series of pullies tied in with the motor to show that the motor was turning but no more toilet paper was coming out. Well this plan also failed due to lack of time and mechanical availability. So we decided to try to perfect the simple action of automated toilet paper dispensing. 

Sample Demo


The hardware of this project was mostly recycled from other projects. The Styrofoam casing and motors came from a previous project that was about RC cars using DC motors. Our hardware was fed through the existing and new holes and the board and wiring was all implemented on the opposite side to what the user would see. The motor was wired through a transistor and diode to protect the DC motor in case of feedback. We originally had a 5V power source but the output was too low for the motor to turn with the toilet paper attached. The PWM ports on the Arduino were used to change the power used for the DC motor. The photo infrared sensor acts as a trigger to activate the toilet paper dispenser for 3 seconds.


The code for this project is a mixture of checking for interrupts in the PIR and if there are changes then the toilet paper dispensing is triggered and then resets after it is done. It is very similar code for paper towel dispensers that you would see in almost all public bathrooms. Our PIR was very sensitive so often the it would trigger multiple times in a row, but otherwise the code worked perfectly. There were plans to add a buzzer to the rig as shown in the code, but it never made it to the final product. Everything was coded in Arduino.

Timer and Stopwatch with LED’s – Schematic

The schematic used in this project was based off of the same general schematic used for the previous two labs. Some extraneous portions of these previous schematics were removed, but the basic circuit connecting the board to the LCD with a potentiometer for dimming was left untouched. The notable addition made by our group was the common cathode RGB LED connected to PC0, PC1, and PC2, along with three current limiting resistors connecting the three leads to the board. This LED, though admittedly not used to its full potential, was used to indicate pauses in the operations of functions as well as the completion of the timer function.

Timer and Stop Watch with LEDs – Big Picture

The goal of this project was to create a Timer and Stop Watch that uses the UART display, LCD and a push button to interact with the user. The main idea was to understand how to set interrupts to create a 1 second delay to maintain the proper time. Using the Atmega328PB board that was used throughout the semester, and LCD and the built in push button on the Atmega board, the user will be able to select the function for Stopwatch/Timer on the UART, press the push button to begin timer/stopwatch and watch the time count up/down on the LCD. This requires understanding on the registers to set the interrupts and configuring the code to display time in the proper format to the LCD. Later, a RGB led is used to flash from red to rreen to inform the user time is up. The idea was to create a elaborate light display to do so, but because of time constraints, a single RGB led was utilized.

Timer and Stop Watch with LEDs – Code

The code above is used to maintain and countdown time for the timer/stopwatch in this project. It is set in the interrupt and is calculated for every second. Due to the nature of the LCD, it is required to use and display the time using an array. Therefore, the ten’s place of the minute, one’s place of the minute, ten’s place of the seconds and one’s place of the seconds is used to calculate time along with the interrupts. For the purpose of this project, the maximum value of time is 59 minutes, therefore the if else statement above considers the value in the format of ##:## and counts up from the one’s place of the seconds and once that reaches 0, increments the ten’s place by one and then repeats this til stop watch is stopped.

Simon Says

The goal of this project was to create a functioning version of the electronic game, Simon Says. This was achieved as the game operated as expected, producing random patterns of illuminated LED’s and accepting user input. Each round produces a random sequence and awaits user input. If correct, the green LED flashes and the next pattern is displayed. If incorrect, the red LED flashes and the game restarts with a randomly generated sequence.

Digital Dimmer Circuit -Code

This section of the code is heart of the project. Being able to detect each zero crossings and to interrupt the program appropriately is important. The read on the interrupt pin will be HIGH and drop to LOW when the sine wave crosses zero and rise back up to HIGH. On that rising edge, the program will be interrupted and will jump to the interrupt handler. Within the interrupt handler, the potentiometer analog input will be use to calculate the appropriate delay time before sending a pulse to the driver to allow the current through.

Digital Dimmer Circuit – Schematic

The heart of this circuit is the area between the full bridge rectifier and the TRIAC driver. This section of the circuit allows the user to find the zero crossings of the AC signal. The full bridge rectifier creates a fully rectified wave that inputs to an EL817 (photocoupler). This photocoupler sends an input to the Arduino that will trigger an interrupt at the zero crossing. A pulse is generated from the Arduino which is sent to the TRIAC driver which then sends a pulse to the gate of the main TRIAC which allows current to flow through. The potentiometer serves as a means of varying the amount of power sent to the connected load, in this case a blender. Depending on the position of the potentiometer, a proportional delay is implemented before the pulse is sent to the driver which translates to a change in motor speed on the blender.

Digital Dimmer Circuit

The digital dimmer circuit created in this project is a more precise version of what most people have on the wall in their homes. Dimmer circuits utilize a device called a triac. A traic is a special thyristor that allows for current control over both halves of the AC waveform. The digital dimmer takes the analog input from the potentiometer and through the user’s code maps it to an output to a triac driver. Based on this input the driver’s output will open the gate of the triac which controls the dimming of the circuit. However, sending just any output to the driver can result is very inconsistent results. Using a full bridge rectifier coupled with a photocoupler, creates another input to the Arduino that maps all zero crossings. Using these inputs as well as delays, an output that times to the zero crossings of the AC wave allows for the user to create a typical dimming circuit that goes from zero to max. However, changing the timing of the outputs call allow for very precise and unique ways to control the output of the circuit.

Carnival Arm Code Post Group 6

This code was intended for an ATMega328p and was coded using Atmel Studio 7. The purpose of the code is to detect if the microcontroller gets a shock and if it does send a signal to the buzzer to let the user know the won. We accomplished this by creating a while-true loop that goes on continuously until it detects a signal from the shock sensor, that is set as an input in PIN 5 of Port B, if it detects a shock it will generate a random integer between 0 and 5. If the integer that was generated is the same as the one specified in the code, in this case a 3, it will activate and deactivate the buzzer, set as an output on PIN 5 of Port C, letting the user know if they have won or not.