Joe Z.'s Unique Hello World Project
Everyone knows the first program is called the "Hello World" project. The Hello
World program is intended for the newbie programmer get their feet wet and be as
simple as possible. This is why, in the embedded realm, the Hello World programs
is to simply turn on an LED. Joe didn't want to settle for the typical Light up,
or blink the LED. He wanted to literally make a single
LED communicate. How would a single LED communicate? Using morse code, obviously.
Making a Library for the Button
The button code with the accompanying software debouncing is a lot to put into a
main routine. It's best that these sorts of code become tucked away in a library
and re-used in all of the programs that you will be implementing puch buttons in
your circuits. The new library
that we put together include features of using multiple button switches
and varying the debouncing threshold.
Intro to Servos
The full explanation and narrative of the introduction to servos and understanding
of torque is being added.
Additions to the List of Future Tutorials
From an email request, I have added three new tutorials to the list: From Breadboard
to PCB Prototype, Using a CNC Machine to create the PCB and Using Transistors with
Microcontrollers: A Beginner's Guide (Video Series)
to the video series that I produced on how to build a CNC machine from the ground
up (published at BuildYourCNC.com), I will be producing a similar set of videos
on the use of the Atmel AVR Atmega32 Microcontroller.
The video serieswill start as an introduction, but will then switch rapidly
to example-based projects for the microcontroller.
I have been enthralled with microcontrollers and robotics, and have embarked on
a specific endeavor to create a bipedal robot balancing on point feet--that is,
balancing in all directions without falling. This has yet to be accomplished, but
has been tried many times over. There is
one exception (PETMAN from Boston Dynamics)that has been successful, using
a human scale robot with human scale feet. The really cool thing with the PETMAN
is that they have achieved great locomotion with a human-like walking gait.
So, as I wander towards my endeavor, I will be explaining the process from scratch
on the use, programming and construction of circuits fusing the AVR Atmega32 microcontroller;
hopefully overcoming many challenges along the way.
After programming years ago in Microsoft's PDE (Professional Development Environment,
or what I call "Enhanced Qbasic"), one of the greatest challenges for me was to
learn C# and WPF. Yes, this was way back in the DOS days! It was back in the late
90's that I decided to delay my learning of Windows programming, to study Architecture.
This decision was good and bad: Bad due to the loss of programming experience; but
very good in that I am learning at a time that the .NET Framework is very advanced,
and the WPF (Windows Presentation Foundation) has gained solid footing. In the C# Notes and Examplesarea you will find
some of the challenges that I was able to overcome, and the notes that I made during
the implementation of a large database-driven application.
The Cheap AVR Programmer
The makers of the Atmel chips, as well as other manufacturers, offer many products
that help in the development of the AVR line of microcontrollers. There's a development
board that provides numerous components for connecting to a computer: For example,
input components (buttons, sensors, etc.) and output components (LED, speaker, etc.).
And then there are components called programmers which interface the computer to
the development board. While purchasing this equipment is certainly an acceptable
route for some, I'm going to skip all of that and simply develop my own programming
and development equipment...for very little money. For example, the programmer that
I'm going to show you how to build has been on the internet for quite some time.
It's really not that difficult to build, and the microcontroller manual contains
the necessary information to build such a component.
AVR Software Toolchain
Various software applications are needed to make a microcontroller work. You will
need to select a language to use to program the microcontroller. My preference is
C++, which allows for versatility. I find assembly language to be overly complex
and in fact C++ is nearly as efficient, when well-written code is compiled with
the AVR-GCC compiler. Then there is the BASIC language. The acronym says it all:
Beginners All-purpose Symbolic Instruction Code. I remember that from the 70's.
From the most versatile (assembly language), to the highest level and easiest language
(BASIC), an analogy can be derived from the complexity. Assembly language is like
a manual transmission. The manual transmission requires you to perform most of the
gear-changing functions, which in-turn will allow you to take advantage of various
motor RPM, and the speed at which the gears switch. In contrast, C++ is like one
of those BMW Getrag transmissions that allow for greater ease in shifting, and pops
into place with smooth gear transfers. BASIC is like an automatic transmission,
but it is getting much more versatile these days; so much so that it's almost as
good as programming in C++.
You will also come to enjoy the fact that most of these applications in the AVR
development toolchain are free.
Introduction to Servos (video complete, official page soon to come)
I will do a run-down of the different types of servos out there and how they function.
I will also get into the details of closed-loop control.
Introduction to PWM (video complete, official page soon to come)
Pulse Width Modulation can be used by a microcontroller to control many devices
that generally accept an analog voltage. Although the microcontroller cannot output
a voltage like an analog device can, it can output voltage in a digital way. We
will investigate these methods and even show how to output a real analog voltage
through the use of capacitors.
Servo Control Using the Standard PWM Output (video complete, official page soon to
PWM is the method used to control non-digital hobby servomechanisms. I will show
how to simply control the servo using the 16-bit timer and the PWM channels.
Servo Control Using the Output Pins (video complete, official page coming soon)
PWM will still be the method to control the hobby servo, but we may want the microcontroller
to drive more servos than the number of standard PWM channels will allow. Therefore
we will investigate a method that uses standard pins as PWM output to control many
Servo Control For Servos That Use Encoders
We will investigate the programming necessary to create a closed-loop system that
reads an encoder and positions a motor to create an overall servomechanism.
Controlling High AC Voltage Devices Using Relays
Do you want to control a household device? Using a relay and a spare output pin
on your microcontroller can do the trick. In this tutorial, we will control the
stuff that would be plugged into the wall outlet.
Controlling Higher DC Voltage Devices Using Mosfets
Enough of this 5v limit. With Mosfets, you can send higher DC voltages to devices
that would function better above the 5v limit that comes out of the microcontroller.
LED Control Using PWM
This tutorial is a precursor to motor control using PWM. We will control the brightness
of an LED and make it fade in and out softly.
LCD 4-Bit Mode
Is your LCD taking up too many pins? In 4-bit mode, the LCD will only need 4 data
lines--so your microcontroller can free-up 4 of the pins for other uses.
Introduction to Serial Communication
The basic fundamentals of serial communication will be explained in this tutorial.
Configuring and Communicating with the USART
Universal Synchronous Asynchronous Receiver Transmitter is the serial communication
function in the microcontroller. We will communicate to and from the computer via
RS-232 (with the help of the Max232 chip to adjust voltage levels), and we will
also communicate with a digital servo with a single wire to serve as both TX (Transmit)
and RX (Receive).
Motor Control Using PWM
This tutorial will delve into motor control. Using PWM, we will be able to increase
and decrease the speed of a motor and even change motor direction.
From Breadboard to PCB Prototype
This tutorial will explain the process necessary to create a schematic in Cadsoft
Eagle, layout the PCB (Printed Circuit Board) and build the prototype.
Using a CNC Machine to create the PCB
If you have access to a CNC Machine, PCB routing is a great way to create chemical
Using Transistors with Microcontrollers
Learn how to use transistors in your microcontroller projects.
Control of a Small Low-Current Stepping Motor
In this tutorial, a small low-current stepping motor will be controlled by the pins
of the microcontroller.
Control of Higher Current and Higher Torque Stepping Motors
A larger stepping motor will be controlled using Mosfets and a separate higher voltage
source; however the microcontroller will still be providing the control logic to
Control of Stepping Motors Using A Driver
As an alternative to Mosfets, I will select various driver chips on the market today
and use those to provide the high-powered driving current, again under the direction
of the microcontroller.
Control of Stepping Motors Using the Translator/Driver Combination
This is where things get interesting with stepping motor control, since the microcontroller
now becomes a processor for much broader control--with only the need to send out
step pulses and a high/low signal for direction control.
Using Alternative Clocks
Alternative clocks such as crystals, RC circuits and others will be explained and
connected to the microcontroller. We will use these devices to adjust the frequency
of the microcontroller.
Interfacing a Shift Register to Expand the Number of Output Pins
Imagine what you could do with many output pins! Do I hear...LED array? We can also
investigate using this device to communicate to the LCD with only a few wires.
Read a PIR Sensor
PIR (Passive Infra-Red) sensors will be explained and we learn to control these
devices with the microcontroller.
Read an Ambient Light Sensor
We will connect an ambient light sensor to the microcontroller, and check its reading
on the LCD.
Introduction to Interfacing with I2C
Inter-Integrated Circuit is a type of communication that is common with many sensors
and devices. I will probably start with an accelerometer that communicates using
Read an IR Distance Sensor
An Infra-Red distance sensor will be connected to the microcontroller, and the information
will then be displayed to the LCD.
UltraSonic distance Sensor Reading
An ultrasonic distance sensor will be connected to the microcontroller, and the
distance displayed to the LCD.
I will do a survey of the wireless options that can be used with microcontroller
and explain each of them.
Radio Frequency Wireless Communication
We will communicate with another device using wireless radio frequency communication.
Communication using Xbee and Zigbee Devices
We will investigate the use of Xbee and Zigbee products for wireless network communications.
A GPS module will be interfaced to the microcontroller. The information will be
parsed and delivered to the LCD. We may do some other interesting things with GPS
Other Microcontrollers, such as the ARM and PIC will get tutorials of their own.
When I begin with these tutorials, I will start another list.