Atmel AVR Microcontroller projects

15,186

Circuit Image

A tiny speedometer/trip computer was constructed using an Atmel ATTiny2313 microcontroller and an HD44780-compatible character LCD display, along with a reed switch and magnets. This device measured the speed of a soapbox derby cart by attaching a permanent magnet to the rear wheel's rim and a stationary reed switch to the cart. Each time the wheel revolved, the magnet passed by the reed switch, momentarily opening it. The microcontroller calculated the cart's speed by dividing the circumference of the rear wheel by the period of the wheel's revolution. The project was inspired by a friend's need for a timer at his workplace, where employees were expected to build a burger within three minutes. A simple timer was designed with a single large red button to start a countdown from three minutes, resetting if pressed again. Upon completion, the device beeps for one second and enters a low-power mode using a 32.768 kHz crystal and a PIC16F84A microcontroller. Additionally, a project was undertaken to control a robotic arm/turret using a PC with a serial port. This involved designing a stepper motor controller IC with a GAL16V8 chip, enabling the ATTiny2313 MCU to control two stepper motors with minimal pin usage. The MCU acted as a hub, receiving commands from the PC via a MAX232 NIC, calculating turret position and velocity, and sending signals to the stepper motor controller. A Toshiba ULN2803A Darlington transistor array provided the necessary voltages and currents for the motors.

The design of the speedometer/trip computer involves a straightforward yet effective method of measuring speed using a combination of a reed switch and a permanent magnet. The reed switch, when placed in proximity to the rotating magnet on the wheel, generates a pulse each time the wheel completes a revolution. This pulse is detected by the ATTiny2313 microcontroller, which is programmed to keep track of the time interval between successive pulses. By knowing the circumference of the wheel, the microcontroller can compute the speed of the cart in real-time, providing immediate feedback to the user.

The timer project utilizes a simple user interface with a single button, enhancing usability in a fast-paced environment. The choice of the PIC16F84A microcontroller allows for efficient power management, leveraging its sleep mode to minimize energy consumption. This feature is particularly advantageous in applications where battery life is critical.

In the robotic turret project, the integration of stepper motors for precise control of movement demonstrates an effective application of microcontroller technology in robotics. The use of a GAL16V8 chip for the stepper motor controller allows for flexible programming and control of the motors while conserving the limited I/O resources of the ATTiny2313. The command interface via a MAX232 NIC enables seamless communication between the PC and the microcontroller, facilitating real-time adjustments to the turret's position based on user input.

Overall, these projects exemplify practical applications of microcontrollers in various electronic systems, showcasing the versatility and efficiency of modern electronic design in addressing specific user needs.Using an Atmel ATTiny2313 microcontroller and an HD44780-compatible character LCD display, along with a reed switch and some magnets, I was able to construct a tiny speedometer/trip computer for a soapbox derby cart. It measured the speed of the cart using a permanent magnet attached to the rear wheel`s rim, and a stationary reed switch attached t

o the soapbox derby cart. Every time the wheel revolved, the magnet would pass by the reed switch, thereby momentarily opening it. The microcontroller calculated the speed of the cart simply by dividing the circumference of the rear wheel by the period of the wheel`s revolution.

This project was motivated by a problem I heard about from a friend. At the Burger King where he works, employees should take no longer than three minutes to build a burger; however, at his Burger King, no way to measure your burger-building time was supplied. Initially, I suggested buying a watch or an egg-timer from the local dollar-store, but I was soon reminded of why that was not a great solution: it was too easy and rather boring.

The timer had to do one very simple thing: it had to count down from 3. 00 minutes to 0. 00 minutes and then beep. Consequently, I designed it to be very easy to operate. It had just one button - a very large, red one - that the user would press to turn on the device and start counting down from 3 minutes. Pressing the button while the count was already in progress would simply reset the count to 3 minutes.

When 3 minutes elapsed, the device beeps for 1 second, and then switches to a low-power mode. I used a 32. 768 kHz crystal and a PIC16F84A microcontroller as the heart of the device, taking advantage of the PIC`s low-power "sleep" mode so that one-button operation would be possible. There is no need for an "off" switch, because once it`s done timing, it just goes to "sleep", where it consumes very little energy until it is awakened by someone pressing its big red start button.

Essentially, I wanted to be able to control a little robotic arm / turret using a PC with a serial port. I thought this was a worthwhile project because I could later adapt it to aim a webcam, Nerf toy gun, or maybe even a felt pen so it could draw pictures.

One stepper motor rotated the base of the turret, while the other adjusted the turret`s pitch. I designed a stepper motor controller IC using CUPL (Univeral Compiler for Programmable Logic) and a GAL16V8 chip. This enabled an Atmel Attiny2313 MCU to control the two stepper motors using only three of its pins (one each for step, motor, and dir signals).

The Attiny2313 served as the "hub" that connected all the other components together by receiving commands from the PC via a MAX232NIC, performing basic calculations regarding the turret`s position and velocity, and then sending signals to the GAL16V8-based stepper-motor controller to drive the two stepper motors. In order to supply the voltages and currents necessary to drive each stepper motor, I used a Toshiba ULN2803A Darlington transistor array.

By clicking on the image to the right, you can view a video of the turret working. I wrote a program for my PC that would send the appropriate commands to the turret for it to follow a target on my computer screen. The result is quite entertaining. By clicking on the image below you can view a schematic I quickly put together of the circuit. It likely contains errors, but should at least provide a general idea of how the circuit is constructed.

This project was an ambitious project for my Engineering Science Capstone project (ENSC 440). The idea was to design an anti-lock braking system for a bicycle. In our small group of students, we divided up our work into various parts. One student focused mainly on the hydraulic actuators for the bicycle`s brakes; another student focussed mainly on the speed sensors for the bicycle`s wheels that would indicate a lock-up. I focussed on designing, buildin 🔗 External reference