Interrupt Debouncing

When we first used the interrupts in conjunction with the optical encoders they worked just fine when we turned the wheels by hand, but when we ran the motors via a power source the interrupts were being called sporadically. This was a serious issue that, if not dealt with, meant that we could not rely on the interrupts. So, we began investigating what could be the cause. We disconnected everything on the Arduino board except all necessary circuitry related to the encoders and interrupts. Still, they were malfunctioning. The next, and more drastic step was to disconnect everything and test the interrupt pins themselves by setting the code to incur an interrupt at every rising edge. That way, we could just connect a wire from Ground (GND) and 5V (Vcc) to the interrupt pin one at a time to simulate rising edges (GND->Vcc) and falling edges (Vcc->GND).

This worked perfectly and we could comfortably conclude that the interrupt pins on the Arduino board were functioning properly. But our problem was still unsolved. Suddenly, when we just left a wire connected to the pin leading straight up in the air, we got an interrupt. Weird, huh? We had a hunch that the wire was acting as an antennae, picking up any electrical noise. The research then began. We found a website that seemed to describe all the problems that we were having. We tried their solutions by twisting the cables, wrapping the wires in aluminum foil, and we even built the inductor capacitor filter for the motor.

All this, but to no avail. Then I remembered a similar situation with a circuit using a push button and how the signal could not decide where to go so it floated until it settled on a value. This deals with debouncing.

The solution to our problem, with interrupts that is, can be found in the following tutorial below:


Assignment 2 – Atmel’s AVR, Processing, and Java with Eclipse

The Atmel AVR is a microcontroller IC (Integrated Chip) that features non-volatile computer memory, or in other words: flash memory. Being developed from EEPROM (Electrically Erasable Programmable Read-Only Memory) its flash memory has the ability to be erased and rewritten. Atmel’s AVR was designed and based off of Modified Harvard Computer Architecture, which features concepts from the combination of the Original Harvard Architecture and the Von Neumann Architecture. The basic computer has a CPU (Central Processing Unit) and memory from which the CPU accesses data. This data could be machine code instructions that tell the computer how to handle information or the data could simply be documents, pictures, music files, etc. Von Neumann Architecture employs a single memory system to store instructions and data. The CPU will need to access instructions or data one at a time, or in turn with one another. Original Harvard Architecture employs entirely separate memory systems to store instructions and data. This allows instructions and data to be loaded and/or saved simultaneously. Since Original Harvard Architecture allows for instruction and data memory to occupy different address spaces they have the advantage of speed but at the disadvantage of needing separate memory spaces, which in actuality costs more to make. Von Neumann Architecture has the advantage of using a single memory space that saves on the cost of manufacturing, but has the disadvantage of access speed. So in essence, when engineers took the best of both worlds Modified Harvard Architecture was born. The most beneficial modification uses a single memory space with a memory hierarchy to separate data and instructions in a technique that allows for fast access. Another feature of the Atmel’s AVR is the use of RISC (Reduced Instruction Set Computing). RISC is a CPU design strategy that uses simplified instruction code to allow for faster instruction execution. It’s like taking a short cut to accomplish a task. Another method of faster memory access from within the CPU is the implementation of processor registers. These are small amounts of storage available for the CPU to use as a space for calculation, manipulation, or other forms of operation. Now, instead of having just one processor register we can implement an array of them to form what’s called a register file. The array is designed with fast static RAMs (Random Access Memory) that dedicate multiple input/output pin ports so that data may be accessed more quickly. To top it all off, the language that is used to write the code for all this memory access and processing is C. C is one of the fundamental languages that acts as medium for the ease of writing code over Machine Code and the compactness of code space. Machine Code though, is more efficient in the amount of code space that it takes up. Yet the hassle of remembering all the memory addresses is solved through C’s libraries.

Through the use of Processing, robotic art can be drawn. One thing to consider though, is the amount of detail the robot can create. This “detail” is referred to as resolution, or the amount of pixels per area. A pixel is the single instance of one of the many instances that make up a picture. Consider this, try drawing a circle with 4 dots.

It looks more like a square doesn’t it? Now use 8 dots to draw the circle. Continue to double the amount of dots you use while pausing in between to acknowledge the circle’s improving shape.

The circle formed better with more dots as opposed to less at the same viewing distance. Try the same exercise again but this time look at the circle from twice the viewing distance as you did before. The circle should appear to look like a circle in half the amount of dots or less as it did before. This is the concept of pixels and resolution. If the robot is to draw a picture on the floor at a constant viewing distance, then the amount of resolution needs to be known in order to make the picture look as it was to be intended. After playing with some code in Processing, here is an example of robotic artwork:

The overall square is composed of 25 spares in a 5X5 matrix. These squares in turn, are made up of 9 smaller squares in a 3X3 matrix. If we continued to divide the smallest square into further smaller squares, then we would essentially be increasing the resolution. The current number of pixels is (9 smaller squares * 25 bigger squares) = 225 squares in overall square.

We can calculate the number of pixels the same way in some java examples. I took an example from one of Dr. Becker’s Robotic Jar files found at his website:

This example should “Pick up three thing objects from consecutive locations immediately in front of the robot. Move to the next location, put all three things down again, and then move one more time.”

Again, we can count the resolution from this example. From the current picture, it looks to be composed of a 10X7 matrix, consisting of 70 pixels of resolution.

Let’s Play some Music!

One of the Arduino’s many capabilities includes sending digital tones through a Piezo speaker. A simple example can be found on the Arduino website: A speaker is connected to a 100 Ohm resistor to control the output current. The negative lead goes to ground and the positive lead connects to the resistor which goes to pin 8 on the Arduino board. A schematic, using Fritzing, is shown below:

The code defines the various pitches that the Arduino can reproduce and plays a simple melody that we all know so well: “Shave and a Haircut Two Bits” Play.

Robotic Build Progress

Here are some progress photos on building the robots. Some will be mo-bots and others will be beacons (w/o wheels).

Assignment 1 – Robotics: An Android Controlled Chess Game

At Florida Atlantic University, Professor Shankar along with many others have a goal. That goal is to create a life-size robotic chess game that can be controlled via any android cell phone. The design must be very cost efficient and portable because he wants to make working with robots available to high school students (who work on a tight budget).

The process starts from the phone. The chess application will communicate with four beacons strategically placed at each corner of the chess board area. The beacons will then send commands to the robots that control the individual chess pieces. Depending on the move, the robot will have to communicate with the surrounding robots to issue new commands. If the knight moves in an L-shaped manner and there is a pawn in the way, the pawn will have to move out of its way. More detail can be read on the FAU website:

Now, here is a problem that will most likely occur in the process of construction and coding. When a robot moves across the ground, there is a problem with slippage. Slipping of the wheels causes inaccurate movement from square to square. One way of fixing this is to have the robot send coordinates to the beacons through the technique of Lightning and Thunder Triangulation. This technique uses the time delay from light and sound to determine distance. But, to determine location, this technique must be used twice with two beacons. Once location is determined, the code can decide if the robot is centered on the square correctly. If it isn’t then the technique can be used again to provide adjustments.