Power Supply Schematic

Software

So finally I’ve been working on the schematic for the power supply. In an earlier post I mentioned that I will be using Eagle PCB design software from Cadsoft USA. They offer a free version that is board size limited to 4 inches by 3.2 inches and limited to 2 layers. You are also limited to 1 schematic sheet. Other than that you can make complex designs. I have the full professional version, so I can make bigger boards. Since this is designed for a Mini Sumo robot and is meant to attach to the Parallax SumoBot chassis, the board dimensions are going to be 3 inches wide by 3.3 inches long. This will fit within the limits of the free version of Eagle. The one issue will be that the schematic is spread out over 3 pages. Making the schematic compatible with the free version of Eagle will take some work, but when the files are available from my download page they will work. Now on to the power supply.

Part 1: Design

Starting at the beginning, after applying power to the board, we will need some reverse power protection. Several designs will show a 1N5817 or 1N5819 Schottky diode  in series with the input terminal of the voltage regulator. The anode side of the diode faces power coming in, and the cathode faces towards the unregulated input of the regulator. This works well, but for battery applications we run into an issue. The diode will drop about 0.35 volts across it, this is on top of the regulator’s minimum input voltage requirements. So the total minimum input voltage could be as high as 7.5 volts. A 6 cell NIMH battery pack might have enough initial voltage to power the circuit, but don’t rely on it. To use Alkaline batteries you would need 5 cells or more. How about Li Po? You might get away with a 2 cell Li Po pack. You could always use larger battery packs to meet the minimum voltage requirements of the diode-regulator circuit. I want to save space and weight, not to mention that if I am using hobby servos they don’t like more than 7.2 volts. What we want is the power supply circuit to handle any input from 6 volts to 12 volts.

What I am getting at is we can lower the minimum voltage required to run our circuits. It requires a change to the standard voltage regulator circuit and a change in components. We are going to replace the reverse protection diode with a P channel MOSFET. Then the good old LM7805 voltage regulator is getting replaced with a low drop out type regulator. So let us get to the schematic…

Schematic

Power input and mosfet

Battery connection and reverse protection MOSFET

Here is the battery input, power switch, and the reverse protection MOSFET. The battery connection is the standard screw type terminal block with 2 inputs. This allows you wire up any type or configuration of batteries and does not rely on a difficult to find (read purchase) battery plug. The power switch shown is a single pole, dual throw slide switch. The real switch will be a double pole, dual throw. I am looking at using the second pole of the switch to discharge the capacitors when the circuit is turned off. Now the P channel MOSFET is being used in the reverse battery protection mode. How this works is the gate of the MOSFET must be a lower voltage than the drain otherwise the device will not turn on. So if you wire up the battery backwards, the rest of the circuit will not see any power. Your electronics are saved.

What’s Next

This has been a long enough post so I am going to split up the power supply into a few posts. So come back soon for part 2.

Motor Drivers Continued…

So in this article I want to finish talking about motor drivers. I want to try to keep this short, so next time I will talk about driver modules you can buy from some of the vendors I have mentioned in previous articles.

Driver Chips

Some of you might be wondering why I am not building my own h-bridge for driving motors. I could build my circuit from transistors or MOSFETs, but I like the ease of use and the extra features that you find with a driver chip. Anyway I started looking at the chips I know about.

I could go with the TC4427A. It is really a MOSFET driver IC, but because I am using small motors I can get away with using this chip. For each motor I will need 2 of these chips to drive it. The TC4427A is only a half bridge chip, and you need a full bridge to control motor direction along with speed. So this solution would need 4 chips and a few resistors – not bad.

How about a Freescale MC33887 or the similar MC33926. These chips have many features including overvoltage and overcurrent protection, fault status output, and chip disable inputs. They sound great with the only issue being they only come in surface mount packages. This is not a problem for me, but for others following along who want to build this same board it could be an issue. Still I like these drivers and might make an adapter board later.

So for the same reason above the ST Microelectronics VNH2SP30 and 3SP30 just don’t factor into the picture. They can handle higher currents than the MC33887, but the surface mount package is even more difficult to deal with. In a later article I will talk about some options you have.

I decided to look at Allegro Micro Systems. They have a few drivers that would work well for the small DC motors I plan to use. Some of their chips I would look at are the A3950, A3959, and the A3968. Again we run into the problem of surface mount technology. The only chip, from my list, that comes in a DIP form is the A3959. It is a good chip with more than enough drive current for small motors. Since the IC is only a single full bridge I would need 2 of them. They come in a DIP 24 pin package, so that would take up a little extra room, but still this looks like a good option.

One of the old standby chips still in use is the L293D and the alternate part SN754410. They provide 2 complete full h-bridges for controlling 2 small DC motors. They cannot handle as much current as the other chips I have mentioned so far. You need to be careful and check your motors data sheet for its maximum stall and continuous current ratings. Verify that the L293D can handle that amount of current. Other than that, you need a hex inverter chip to properly drive the inputs to the L293D. So it is still a 2 chip solution, but they are small chips – 16 pins and 14 pins.

The last driver I am going to talk about is the L298. The L298 is functionally similar to the L293. The main differences are the L298 can handle higher currents, a larger 15 pin Multiwatt package, and you need to add the external diodes. The L293D has the protection diodes built-in. Like the L293D, we need a hex inverter logic chip to drive the inputs. You could forget the logic chip, but then instead of 4 pins you need 6 pins from your micro to control the chip.

Next time

Well this one got away from me. I had planned this to be a short post, but as write these articles I find there is so much information needed to explain what I am talking about. Next time I plan to discuss motor driver modules you can buy, and maybe talk about which way to go – chip or module? Until then check out some of the web sites from here.

Brain Design

Microcontroller

Atmel microcontroller atmega328

An Atmel ATmega328 microcontroller

Last time I said I was going to use 2 microcontrollers – a mega328 and a tiny24. If I feel like I am going to run out of code space on the tiny24, I can quickly swap it out for tiny44 or 84. The surface mount vs. through hole debate has morphed into “why not both”. The schematic will be the same for both, just the PCB layout will be different.

Serial Port

Having a USB port would be nice, but it is not a main requirement. Neither is having an RS-232 level serial port. I can get by with a TTL level serial port. I have USB to serial port adapters that provide RS-232 and TTL voltage levels. I will think about these some more.

Driving Motors

motor driver circuit board for an Arduino

Sparkfun Motor Shield

One of the big decisions to make is about a motor driver. The design of my first robot brain had headers to plug-in a motor driver daughter board. Sparkfun makes a motor shield for the Arduino that plugs in as a daughter board. The issue that comes up is how much prototyping space do I want. If I leave off the motor driver circuit, then I leave myself a larger area for prototyping. Then again I could include the motor driver and make a prototype expansion board. Pololu makes the 3pi robot and they offer an expansion board that mounts on top to give you a good-sized prototyping area. The 3pi has a cool look to it when the expansion board is mounted. It is a good idea to give yourself some area to experiment with. I like to add a few LEDs for debugging purposes or other circuitry for more functions.

Pololu 3pi robot with expansion board mounted on top

A Pololu 3pi with expansion board mounted

So if I put the driver circuit on the main board, which motor driver should I use? I can use the old standby chips like the L293D/SN754410, the L298, a pair of LMD18200Ts, or a FAN8200 if I could find them. These are bipolar transistor parts that have a voltage drop and a bit of current draw while conducting. Looking into MOSFET drivers appeals to me for the lower voltage drop and less current wasted while driving motors. I could use something like a TC4427 or more exotic parts from Allegro and Freescale. They make motor driver chips with extra features. I just have to decide which components I want to use. Either way I have decided that like the Pololu 3pi robot, I will have a separate expansion board for prototyping. This way I can plug it in only when I need to and the robot’s main circuit board does not have to change.

So I still have a few more things to think about. Next time I will go through the pros and cons of having the motor driver circuit on the main controller board. I will also post a few more pictures and details on my current mini sumo robots. At some point talking about the software tools will come up. Schematics, PCB layout, and parts lists are going to be required at some point. Check back for the next exciting article, or at the very least better than average.

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