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.

Changes and Additions

Obsolete

Well isn’t that always the way, you use a perfectly good part and the company that makes it decides to obsolete the part. The Panasonic PNA4602M has been discontinued so I am searching for a suitable replacement. You can still get the part from different hobby electronic outlets. Parallax is still selling them along with Hobby Engineering and Adafruit Industries. Right now it is looking like the Vishay TSOP34838 is a possible replacement. It has the same pin out as the Panasonic part with lower current requirements. That is a good thing. I am just trying to understand the data sheet as how to work with the part. I wonder if it will have the same issue as the Sharp GP1UX series that I talked about in my last post.

Ring Sensor

I forgot to mention the sensors that detect the edge of the sumo ring. In mini sumo the edge of the ring has a white line around it, while the rest of the ring is black. Most mini sumo robots use IR reflector sensors to detect this white edge to know if they are about to drive out of the ring.  Pololu makes a nice series of sensors they call the QTR sensor. This is the sensor I plan to use as they are inexpensive and easy to get. If I made a circuit board and bought the components to populate the PCBs, it would cost way more than just purchasing the sensors. I forgot these because they are not mounted on the main board, but attach to the front under body of the robot. The board will have headers on it to connect to the QTR sensors.

Final Design Ideas

Microcontrollers

Atmel microcontroller atmega328

An Atmel ATmega328 microcontroller

Like I have said from the start I will use the Atmel mega328 as the main controller and a tiny24 as a slave micro. When I started looking into the tiny24 a little closer I noticed that 2 of the timer output pins are also 2 of the SPI port pins. I had originally planned to use the SPI port to talk between the mega328 and the tiny24. If I am using the timer outputs, then that will cost me the SPI port. There are some other tricks I can use, like using the timer to generate an interrupt to toggle I/O pins high and low or running a super loop and toggling the output bits based off the timer count. I will have to figure this out soon so that I can draw the microcontroller section of the schematic.

For those who do not understand what I am talking about, the SPI port is a serial port that uses 3 to 4 I/O pins. The formal name is Serial Peripheral Interface Bus. It is used on the circuit board for communications between a micro and support chips. My original plan was to use the timer to generate the 38kHz for the IR LEDs and use the SPI port for transferring the sensor results back to the mega328. That is why this becomes a problem.

Sensors

infrared sesnor

Panasonic PNA4602M

Since we are dealing with a robot that is going to compete in mini sumo, the I need some way of detecting the opponent. The standard sensor in use is a Panasonic PNA4602M. The sensor detects IR radiation modulated at 38kHz and outputs a high signal if it receives such a signal. So I will use the tiny24 to blink some IR LEDs at 38kHz and a few more pins to read the outputs of the PNA4602Ms. The only thing to watch out for is the PNA4602M is sensitive to noise on its power lines, so you need to add 0.1uf caps across the power and ground pins. This will help cut the amount of false positive detections. Also by only turning on 1 IR LED at a time you will reduce false detections.

Sharp also makes similar detectors to the Panasonic unit, except they expect the modulated signal to only last 600uSec. After which it expects to not detect any modulated IR for another 600uSec. This makes this detector a little more difficult to use, but it does have higher immunity to false detections. So I am going to use the PNA4602M, you can decide for yourself if you want to use the Sharp sensor. You will have to look up which Sharp GP1UX series sensor you would want to use..

Motor Driver

Texas Instruments dual motor driver chip

Texas Instrument SN754410 driver

I have selected the SN754410 as the motor driver chip. Along with the driver, I will need a 74AC14 hex inverter chip. This chip will allow me to use simple sign magnitude motor control instead of locked anti-phase control. I know the 754410 uses bipolar transistors which will drop some voltage across the transistor junction, but the easy of use is why I selected the chip. What I can do later, if I feel like it, is design my prototype daughter board with an upgraded motor driver circuit. The 754410 does not come in a surface mount package, but that really won’t cause problems with the PCB design. Again even if I decided to make this a kit, all the parts would be through hole. Since I like to build circuits, I will make a through hole and a surface mount version for myself.  I will leave the decision up to you of which version you want to build.

Power Supply

The power supply is going to be built using a few extra components. This is a robot brain that I am going to be experimenting on, so things can and will go wrong. I am going to add in a little extra protection. Before power gets applied anywhere a P-channel MOSFET is going to provide reverse battery protection. Once power has been regulated down to 5 volts a Zener diode rated for 5.6 volts is going to protect the circuit from accidentally receiving full battery voltage. What about a fuse you ask? Well I plan to put a fuse inline with the battery pack. Rating the fuse is going to take some work. I don’t want it to blow every time the motors start-up, but still need to protect the electronics. So I will just have to do some research.

Other Electronics

So what else am I going to put on the board? I am going to have 1 diagnostic LED for each microcontroller, and an LED for the power supply to let me know it is on. Then there is that audio circuit I was talking about. After looking over all the stuff getting mounted to the board, I have decided to simplify the circuit down to the LM386 audio amp chip and support components. It will still work, just the quality of the audio will be less than ideal. That is ok, the robot will still beep with the best of them.

Next Issue

Well this turned out to be longer than I thought it would be. Next time I will go through what software I will be using for schematic capture, a preliminary parts list, and I will show you the schematic of the power supply section.

Driver Modules

Modules

We finished the discussion on motor driver chip, So now I want to talk about motor driver modules. What I mean by module are the circuit boards with driver chips already installed. Again there are many vendors, but as you can see below I have a few favorites that I keep using.

Pololu

Pololu Motor Driver Module

Pololu Single Motor Driver

Pololu makes several modules. They categorize them as motor controllers and motor drivers. The difference being that motor controllers have some on board processing and take a serial command, analog voltage, or RC servo signal as an input. The motor drivers on the other hand are just carrier boards for the driver ICs with the required support components. You will still need to supply your own digital control signals. Pololu makes their modules with some of the chips I have already mentioned, like the MC33887 and VNH2SP30. They also have some real high current drivers made with MOSFETs. They can handle 10 amps or more. I am not using big motors so the higher current units are way more than I need.

Sparkfun

Sparkfun 2 motor driver module

Sparkfun Dual Motor Driver

Again, Sparkfun has many driver modules, so many it would be a waste of time to list them here. It is interesting to note that besides the units Sparkfun makes, they also sell modules from other companies like Pololu and Solarbotics. Sparkfun makes motor drivers with simple logic, serial, and analog voltage interfaces. Basically you get the same kind of interfaces that Pololu has, just a wider selection of modules. In addition they have a OpenServo module for replacing the electronics in your servos. It uses a different interface than the standard RC servo control signal. Anyway, take a look at their website as I am sure you’ll find something you like. Looking at Sparfun’s website I always come away with a new idea of something to build.

Solarbotics

Solarbotics L298 motor driver

Solarbotics Motor Driver

Solarbotics is a company that sells many BEAM style robot kits and accessories. They carry a line of motor drivers from Phidgets and Dimension Engineering in addition to their own units. Solarbotics makes a L298 driver module and a L293D servo electronics replacement module. The Phidget and Dimension Engineering modules are well designed and have a professional look about them. You’ll have to decide on your own if you want these type of modules since they are a little expensive. Cost is relative to the project, so for your creation it might be worth it.

Driving a Speaker

So I am doing all this talking about driving motors, but there is another inductive load I like to drive – a speaker! At Mini Sumo competitions it is not required to have any indication of the 5 second countdown before your robot is allowed to move. You do get a better crowd reaction if you do. Most robots blink an LED to indicate the 5 seconds. Other produce a beep for the same reason. I am thinking of having a series of tones to indicate the count down. I just think it would be one of those “cool” factors I talked about in another post.

I plan to over design the audio circuit for driving a speaker. From the output from the microcontroller I will use a resistor/capacitor filter to change the squarewave into a sinewave. Then the signal will pass through a LM358 op-amp so I can provide a little “coloring” to the audio signal. Finally I will send the signal to a LM386 power amplifier to drive the speaker. This circuit is really just for fun as it serves no other function.

So what is coming next… I will talk about some of the final design decisions and start creating the schematic. I will go over some of your schematic capture options. After that I will give you a bit more information about mini sumo and how it affects my design decisions. Until then, see you.

Motor Driver Update

I just wanted to fix an error I wrote. I said I would need 4 TC4427A chips to drive 2 motors. I was wrong, I would only need 1 chip per motor. The real problem is the 4427 can only supply less than 100mA of current. Some better choices would be the TC4424 or even the IXDN404PI. The IXDN404PI would need external Schottky diodes like the L298, but it can handle up to an amp of current. Just wanted to put that out there.

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.