New Brain Design

The Idea…

So all of that AVR overview was to get us here, the design of a new robot brain. I compete in Mini Sumo at different robotic competitions. What I like is that it involves mechanical, electrical, and software engineering. The competition is autonomous, so none of this radio control stuff. The robot has to compete on its own. It comes down to whether I made a good design, or do I need to go back to the drawing board (or in this case computer programs).

Mini Sumo robot controller circuit board

This is the first robot controller I designed

So let’s get into the design process. My original brain board used an Atmel ATmega48 microcontroller. The mega48 had more than enough program memory to handle mini sumo. Since I used the DIP (dual inline package) version, I ran out of I/O pins for a couple extra features I wanted. The original plan was to have 4 IR LEDs, on individual I/O pins, and 4 IR detectors. I changed the plan to use 1 output each for 2 LEDs. After a few more changes, I came up with the circuit board you see on the right. The board is blue because I liked the color of the Arduino, so I made mine the same. Though the boards are the same color, I did not design my board to be compatible with the Arduino or its programming tools. This time I think I will make the board compatible with Arduino. Not physically as I need it to fit the size requirements on mini sumo, but in function. I will use a mega328, which the Arduino boot loader can be programmed into the chip. Then the Arduino programming tools can be used.

Now that I picked a microcontroller (the mega328), I can work out some other details. Originally I used the 16 bit Timer 1 for creating the 38kHz frequency use for the IR LEDs. This left me with Timer 0 for driving the servos. After looking over the internet for code to drive servos, it became clear that everyone was using Timer 1. Now I had to write my code for driving the servos as I could not use anything from the internet. Where is this leading? Well this time around I will use Timer 1 for the servos. So what about the IR LEDs? Here is where I have a few choices. I could use a 74xx04 logic chip to create an adjustable oscillator centered around 38kHz, a 555 Timer chip – again to create a 38kHz frequency signal, or maybe another microcontroller. I really like the idea of adding another micro. In this case I am looking at using a ATtiny24. It will have enough I/O and timers to deal with IR object detection.

Arduino Uno board

The Arduino Uno

What about USB? The Arduino only has a USB port for downloading the program into the micro. The board has a USB to serial port chip. Do I want to add this to my design? If I don’t, I would need an external USB to serial port converter to download programs using the boot loader. Should I put on a RS-232 transceiver chip (like a MAX3232E) to interface with a standard serial port?

Other Design Decisions

We have been dealing with some of the higher level design decisions. There are many smaller decisions to be made. Should I include a motor driver chip on the board? If so which one? The IR LEDs for the obstacle avoidance detectors need to be shielded from leaking IR light into the sensors. Is heat shrink ok, or should I use the plastic shrouds that Parallax (makers of the Basic Stamp) sells? How about having some prototyping area, or headers for plugging in a daughter board. These are just some of the decisions I have to make. The biggest decision I need to make now is to use surface mount components or go with through hole parts. This really depends on if I want to sell it as a kit. As a kit through hole components work better as more people could build it. If I go surface mount, then it might be left to me to install the parts and sell it as a partially completed product. Or what if I just designed both version, posted all the information here, and let you figure out which one you want to build, if any.

Well, that is all for now. Until next time here are a couple pictures of my Mini Sumo robots.

This is a modified Parallax Sumobot

My very modified Parallax Sumobot

Mini Sumo robot with Tony's brain board on top

My brain board on Parallax Mini Sumo chassis

AVR Overview – Programmers/Debuggers

Programmers and Debuggers

Today I am going to talk about some of the options you have for programmers and debuggers. When I talk about programmers, I am talking about the devices used to download code into your microcontroller while it is still in circuit. There are production programmers that pre-program the device before it is put in the circuit. Debuggers on the other hand are designed with the idea that the chip is already in the circuit. The debugger helps you find what is wrong when your circuit does not work. So let’s get going.

Atmel

Atmel again you say, well they did design the chip. Atmel has several choices of programmers and debuggers. On the low-end you have the AVRISP mkII. This is a simple USB programmer that plugs into a 6 pin header on your board. Current pricing for this is $34 from Digikey. All this unit does is program your device in circuit.

Next is the AVR Dragon. This is a programmer and debugger all in one. It sells for the low price of $49, from Digikey. The Dragon can perform low voltage programming, high voltage parallel programming, JTAG and OneWire debugging. There are a few limitations. First and foremost is you will have to solder on your own headers to connect it to your target board.  The second limitation is it will only program up to 32K of flash memory. I have heard of people hacking the unit to handle larger files, but I have not researched it more than that. In addition to all of that, there is a second AVR on the board you can program with your own code. All of its pins are brought out to headers.

How about the old STK500. This is more an evaluation board that supports programming and debugging. This board was designed more with the through hole (DIP) parts in mind. This board has many I/O pins, LEDs, and buttons for simulating your application. Best place to learn more about the STK500 is Atmel’s web site. There you can find vendors and pricing.

The AVR JTAGICE mkIII is a more expensive programmer, debugger, and an in circuit emulator. It does many things, but the cool feature is the in circuit emulator (ICE). This allows you to exercise external circuits with the JTAGICE unit. Again I will refer you to the Atmel website.

Atmel has a new kid on the block called the AVR One!. Currently it only supports the AVR32 and Xmega devices. Atmel has said it will include support for the other devices in the future.

More to come…

Since the Atmel part was so large, I have decided to break this up into 2 parts. Next time I will finish up with programmers and debuggers. After which I will conclude this whole overview with the software side of the AVR.

AVR Overview – Hardware

Hardware

This time I am going to discuss hardware platforms, mainly where you can get them. There are many vendors where you can get board with an AVR micro on it. I am just going to mention a few that I have dealt with before. I am going to move quick, so I hope you can keep up.

Atmel

I am going to start with Atmel. Through Digikey, Atmel sells the AVR Butterfly. The Butterfly has a mega169V micro, a LCD, joystick, and tons of I/O. The board runs about $20 from Digikey. If you read the magazine Nuts & Volts, you might have seen the articles “Smiley’s Workshop”. He uses the Butterfly to teach C programming for the AVR. I recommend you check out the articles.

Pololu

Pololu is another vendor, and a great place to get robotic parts. They carry a line of sensors, motor drivers, motor controllers, and AVR microcontroller boards. Their Orangutan series of boards range from small 24 pin DIP modules to large multi-micro/multi-board designs. So take a look around Pololu’s web site, you won’t be disappointed.

Sparkfun

All I can say about Sparkfun is WOW! They have more electronic offerings than I can mention. They have a long list of AVR development boards along with other microcontrollers. You will just have to check out there site to see everything.

Wright Hobbies

Wright Hobbies is a smaller supplier of electronics. They have 2 different boards for sale. The first is the M32 DevBoard. It uses the mega32 micro. All of the pins are brought out to headers. The second board is the Chibots Controller board. This board was developed by the owner Eddy Wright for Chibots – the Chicago Area Robotics Group. The Chibot Controller carries a mega48 and a motor driver. The board was designed for some of the simpler robotic games held by Chibots. We will hear more about Wright Hobbies in later articles.

Megabitty

The Megabitty is a very small 1″ square microcontroller board with dual 500mA motor drivers. The chip is a mega8, but could be replaced with a mega48/88/168/328 as they all use the same pin out. You will have to check the Megabitty web site to see where to buy the kit.

Arduino/Freeduino

Un Arduino Diecimila

Image via Wikipedia

I decided to lump these together because they are similar boards. In fact there are many copies of the Arduino platform that you could buy, one of them being the Freeduino. First place to look up information on Arduino is the web site. The Arduino is supported by a very large community committed to the platform. Arduino is a board and a programming environment. The resources are too numerous to list here, so I just suggest doing a search in your favorite search engine, for Arduino.

Next Time…

There are many more options out there, but since I plan to build my own. I will leave the rest of the searching up to you. Next time I am going to talk about programmers and debuggers.

Atmel AVR Overview

Overview

This will be a general overview of the Atmel AVR microcontroller. I plan to discuss the resources, hardware, programmers/debuggers, and software tools that are available. The reason I am providing this information is because my first project is going to involve designing a new robot brain based off the ATmega328. Now this is a large amount of information, so I am going to break it up into small, easily digested pieces. I will also leave out some material for you to explore on your own.

Main Resources

The main resource for anything dealing with the AVR is the Atmel web site. There you can download data sheets, app notes, and AVR Studio – the tool for designing the software you will download into your AVR project. Looking over the 8 bit devices you will notice 3 main families. The “Tiny”, “Mega”, and “Xmega” series. There are a few others, but we will be working with these families. The Tiny is your reduced pin count, very low-cost part. The Mega is your mid range part with more pins, more features, with a moderate price increase. The newest series is the Xmega. This part was designed to compete with Microchip‘s PIC24F (16 bit) series and Texas Instrument’s MSP430 (16 bit) series of devices. The Xmega includes DMA channels, higher clock speeds, and an Event System. I would suggest you check out Atmel’s web site for more information. As we continue along, I will be presenting this in greater detail, but for now I am just giving you the highlights.

The next place I would look for information would be the AVR Freaks forum. Checking out the forum, you will find more information than you can digest. Lucky for us the broke it down into sections. I follow a few of the sections (threads) like hardware, AVR Studio, and the avr-gcc compiler thread. You can also post questions to the forum, but I have a few suggestions. Don’t post any questions without doing some research first. Search to see if the question has already been answered. Your question should be as specific as possible – they will not do your work for you. Try to give as much detail as you can about your issue. Finally try to post the question in the most relevant thread. Following these simple suggestions will get you quicker responses. So check out the forum at AVR Freaks.

Moving on…

This is just the beginning. I will keep posting more information as we go along. Once I have completed this overview, we will be going right into designing the new brain. Though the design is for a robot, it can still be used as a general learning tool or even the brain for whatever you can dream up. Until next time, check out the sites I mentioned.