Motor interface electronics

In my sub-$500 robot project, I am currently using the output of two D/A converters to drive direction and power.
0V = stop.
0 -> +5V forward 0 -> -5V reverse
The voltage goes into two comparitors. One for direction, the other for PWM. The PWM is basically a comparison against an integrating ramp generator.
While electrically very cheap to make (A quad comparitor, op amp, resisters, capacitors, and a few transistors.) It puts a burden on the computer system to *have* two D/A outputs.
The question is, is there an easier, more cheaper way?
I thought about parallel port, but the parallel port is such a powerful resource, I'd hate to use it up.
USB, but that increases the cost of the system even more.
I thought about an I2C bus, with two I2C D/A converters, and while that is cheap, if forces an I2C bus.
Should I just assume that there are two D/A outputs for use?
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
mlw wrote:

Don't be silly! Of course! Just assume there are D/A outputs. Sure! That's been exactly what you've been telling us all along, isn't it? Just use the OS and make the system call. It doesn't matter if there's no hardware there. That's what the OS is for, making up stuff that doesn't exist. That's the advantage of using a PC. The OS makes up for all that stuff you need to do robotics, but don't really have, doesn't it?
Of course, all us using microcontrollers are using a single PWM pin output. The PWM pin goes directly into commercially available H-bridges. And there's hardware inside the micro which takes all the software burden off the CPU, so the micro makes one write into a hardware register and everything else is automatic. So we take the PWM pin, hook it to the Hbridge input, then hook the motor to the Hbridge output, and we're done.
But you should be able to search around and find a PWM or D/A driver for Linux and just call it and get the same thing, right? Great! Let us know what you find.
Randy www.newmicros.com
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
RMDumse wrote:

I've done nothing of the sort.

Oh, please. On your micro-controller, just run apache and PHP for a web interface, just use MPI and networking for distributed processing, use SQLite for a small self contained SQL database for information processing and logging, use the V4L infrastructure to develop your vision systems, use the PC sound system for speech synthesis, use the video out for a display, use a PC joystick for manual control, etc. etc. Micro-controllers don't even count.

You need at least two signals to run H-Bridge electronics, direction and PWM. A single pin is not a solution, do you have two pins? How many motors can you drive? One? Two? Three?

For the cost of a $1.29 chip per D/A channel, I can create an I2C bus off the parallel or serial port. I am looking for a more comprehensive solution.
The question I was asking is which interface is easier and more cost effective to use.

The D/A and A/D converters as well as a number of I/O devices are well supported on Linux. Linux has, as a native kernel driver, an I2C bus. It has full parallel port access as well. I don't have to "find" anything, I was curious about what people think about the best methodology was and maybe someone may have had a constructive opinion to share.
An I/O solution for a PC is no more than about $49 and a little more if the user wants more sophisticated hardware.
My robot's target price is less than $500, and it would be REALLY cool if I can make it for less than $400.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
hi,
are there I/O cards available for PCMCIA slots at reasonable price?
Rich
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
On 8 Apr 2005 12:43:08 -0700, snipped-for-privacy@gmail.com wrote:

The sn74lv8153 chip below may be what you are talking about. I got some free samples a while back, but have never figured out how to get them to work with a PC serial port. If anybody has ever used these with a PC, please post up the how-to info. The bottom board from futurlec seems to have a good bit of serial port I/O for $49.
http://focus.ti.com/docs/prod/folders/print/sn74lv8153.html http://www-s.ti.com/sc/ds/sn74lv8153.pdf
http://www.futurlec.com/RS232DevBoard.shtml
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
http://focus.ti.com/docs/prod/folders/print/dac5571.html
D/A converter with I2c input
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
mlw wrote:

Actually they do, especially for larger robots. I wouldn't even THINK about trying to control a larger robot with a single PC, unless the board is using a *real* real time operating system. A tried-and-true approach is to use a microcontroller to control the motors; the controller includes a dead man's feature that will stop the robot if A) the motors stall, B) last-ditch mechanical switches make contact, or C) some other condition that indicates the robot needs to stop *immediately*. These sensors are routed to the controller, separately from the PC, so you have a fail-safe system. You can parallel them to the PC if you want to.
On robots that weigh less than 20-35 pounds fail safe's are not as critical, but as the machine gets heavier, it's important to build in safety features. Cost should not be the overriding factor.
A $5 programmable PIC or AVR will run two motors, or you can splurge and use one chip per motor. Connect the fail safes to hardware interrupt pins. Reaction time is in the hundreds of nanoseconds. Several of these controllers have D/A, though I don't think you need to go the D/A route. They all have internal timers as part of their core, and PWM through timer interrupts is very stable and glitchfree, especially if the chip is crystal controlled.
This approach is not unlike how a a modern PC uses co-processors for graphics, network connections, and other services. Microcontrollers, including the more robust ones that Randy's company sells, go a long way to offloading mundane processing, allowing for faster speech, vision, and other processes where a PC really shines.
-- Gordon
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Gordon McComb wrote:

-- Gordon
Wouldn't a fuse (or resetable electronic fuse) be required for protection. Why would a PIC be any more reliable than a PC when it comes to reading sensors for a current overload? I learnt the importance of this with my first robot that ran amuck, hit a wall, and the motors promptly went up in smoke!
I have always seen the PC as a rather oversized programmable IC chip with built developmental software.
How fast are these PICS? A quick web search seemed to return a clock speed of 4MHz with the ability to overclock up to 20MHz?
With say a 800MHz PC couldn't you emulate a few PICs and pump the data in/out the parallel or serial ports to some hardware and still have enough grunt to do "higher" level processing?
I have always thought about playing with these PICs but haven't seemed to find the time. I will have to search the net for some good tutorials on using PICs in circuits. I have done a lot of assembler programming on the 6502, Z80, 68000 and x86 so it shouldn't be that hard to learn yet another instruction set and cpu architecture.
I had thought to use an old 8085A and some 8155s, that have been collecting dust for some years now, for a simple robot brain but found the PC easier to play with and now see it as having more potential.
-- John
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

No matter what other protection there is, adding a fuse is a good idea, assuming that you can get at the machine to fix it. Take the fuse out and nobody's going to switch it on when they're not meant to. Possibly not a good solution for Mars landers, etc...
I've also got 100A DC circuit breakers (eBay, surplus) for those "whoops, I just dropped my screwdriver across the motor power rails" moments.

If you're looking at Microcontrollers, don't forget to have a look at Atmel's AVR range. (Have a look at <http://www.avrfreaks.net )
I'm also looking at some of the Dallas 8051-compatible microcontrollers; the DS80C400 has CAN, 1-Wire, 3 x serial AND an Ethernet MAC all on chip. I would be a happy man if I could get hold of some suitable PHYs for these in sensible quantities (like 1 - 4). Dallas also has a range of higher-speed 8051-compatibles, up to 33MHz. Samples available - what nice people they are. <http://www.maxim-ic.com/Microcontrollers.cfm
All the uCs I've mentioned have in-circuit Flash programming facilites. I rather like the idea of being able to re-programme without pulling everything apart.
Cheers
Matthew Smith South Australia
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

depends how it was designed and programmed but usually a fuse(or cb or polyswitch) , polarity protection , and fail safes are a essential part

But what about power use ? Can you run a pc from a couple of flashlite cells or a single 9V battery(just the controller part of the bot))

from 2MHz up to 48MHz

But what about IO and power use ? Only a limited number of serial and parallel ports

16f pics have 35 instructions , 18F have around 88 instructions the 18f's are faster
www.winpicprog.co.uk has some good tutorials for the 16f series

fastest pic is 48MHz 18F4550 http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId 35&dDocName=en010300
dspic (16bit with some dsp instructions) at 30MHz http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeIdu
16F pics http://www.microchip.com/ParamChartSearch/chart.aspx?branchID 02&mid&lang=en&pageIdt
18F pics http://www.microchip.com/ParamChartSearch/chart.aspx?branchID 04&mid&lang=en&pageIdt
atmel avr's run at 16MHz with fastest also at 48MHz (and with usb) http://www.atmel.com/products/avr / www.avrfreaks.com
arm7 chips (16/32bit) like Philips lpc2xxx run at 60MHz with 8KB to 64KB of ram and up to 512KB of flash http://www.semiconductors.philips.com/markets/mms/products/microcontrollers/product_catalog/16_32bit/index.html http://www.hitex.co.uk/arm/lpc2000book/index.html
http://www.sparkfun.com/shop/index.php?shop=1&cats for some dev boards
other arm7 chips range from 30 - 80MHz
8051's can run at up to 75MHz the new Atmel ones are single cycle AT89C513x has usb as well http://www.atmel.com/products/8051 /
silabs have 8051's witth up to 1Mbps ADC's running at 100Mips http://www.silabs.com/tgwWebApp/appmanager/tgw/tgwHome?_nfpb=true&_pageLabel=GenericContentPage&contentObjectId=/public/web_content/products/Microcontrollers/en/index.htm
Philips 8051's http://www.semiconductors.philips.com/markets/mms/products/microcontrollers/product_catalog/8bit_80c51/index.html
Dallas Maxim 8051's http://www.maxim-ic.com/Microcontrollers.cfm
www.futurlec.com have a range of cheap pic , avr , 8051 and Z8 dev and controller boards
the freescale(mot) 16 bit dsp chips run at around 60MHz the newer ones single cycle and a lot of pwm channels and builtin pid etc 56f80x , dsp56300 ,5dsp http://www.freescale.com/webapp/sps/site/taxonomy.jsp?nodeId 27956292
56f8323 http://www.freescale.com/webapp/sps/site/prod_summary.jsp?codeVF8323&nodeId 27956292 can get a starters kit for around US$79 from digikey http://www.digikey.com/scripts/dksearch/dksus.dll?keywordsearch?vendor75&mpart=MC56F8300DSK&site=us
or go with a board designed for motor controll etc http://www.newmicros.com/ isopod and servo pod usb
They also sell Philips lpc21xx arm7 based boards how to set up eclipse ide with arm gcc http://www.newmicros.com/download/appnotes/ARM/TiniARM_Dev_Eclipse.pdf
The thing is a lot of micros have hardware support for a lot of things like pwm , usart, capture and compare , can , spi , i2c etc
The speed or MHz isn't the main factor, comes down to the features you need in hardware.
A 18 wheeler semi has more potential than a family car but we don't all drive big rigs , why?
Its not just efficent. The key is use the tool for the job.
Lots of micros out from from 4 bit to 64 bit from less than 1 MHz up to 1Ghz Also lot of dsp chips also , 16 , 32 bit up to 2GHz
Can also do everything a micro can do in an fpga.
Alex
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Alex Gibson wrote: John Casey wrote:

Actually I plug it into the 240v (110v in your part of the world) socket. My little robots have been connected via wires to the power and brains. They were only experimental bases to test the software for the day I build a real robot :)
As for my big robot it uses large batteries that make up 90% of its weight. The base is solid steel and the wheels have strong wheel bearings. It uses 24volt truck window wiper motors. It is powerful enough to carry a full sized human or push a large couch around the room! How else is it to rescue its master from danger :) Or push the mower over the lawn? It is a prototype and one day I hope to replace it with the guts of a small electric wheel chair, only a PC will work the controls. I don't see mwl's $500 as a realistic figure for a real robot. That might be enough to cover its brains hardware but that's about it.
If a robot is to do some hard work it will need lots of power. This is the Achilles heel of the robots today.. no cheap lightweight portable power source. The other limitation is the cost of actuators.
[...]

You can add as much i/o as you need. How many pins does a PIC have? More than say 3 parallel ports or a group of USB ports. I fail to see that as a problem.
There is nothing to say the i/o modules cannot use micro controllers rather than use umpteen ICs from your IC junk box.
Every three years or so you have to replace your PC with a new one to keep up. So I have spare PC's. The one I am using at the moment is my old 800MHz laptop which has been replaced with my latest and greatest.
How much cheaper can you get than that?
The i/o circuits can be inherited by each new PC.
This is I understand essentially a hardware newsgroup.
For me I want to use what little time I have actually experimenting with software and use the hardware I can afford to buy.
You can have the neatest piece of engineering under the sun, bristling with microprocessors and PID controllers, and yet not being able to compete with a scrappy remote control car driven by a human brain.
You can get a dumb machine to do some very neat movements using stepper motors or fast acting servo control, but they are still dumb machines.
The motor control on my large robot is so bad I am thinking of calling it Jerky. But, if it is smart enough, it can work around its handicap until I get around to installing a better system.
It comes down to cost, availability, area of interest, time available and ultimate goals.
The PC based robot vs uController based robot is not an XOR situation. They are both worthwhile activities.
IMHO :)
- John Casey
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Wouldn't say its all hardware. More of a focus on smaller more easily buildable stuff.

Or doesn't even work (seen more than enough PHD type projects) that should have stayed on the drawing board.
Also know quite a few academics who think that building practically working circuits and building hardware is only for technicans not something that engineers should dirty their hands with.
Want to get a CMU type line following contest going at the uni I'm at (I'm secretary of the Engineering society 700+ members) but hit a brickwall in the mechantronics faculty guys. Still working towards it but going to take a good bit longer.

I agree with you but personally prefer a distributed controller approach. Basically having smart sensors etc so have a micro at the sensor that processes the raw data then sends it to main controller in the format you want.
Doesn't just have to be a micro at the sensor or motor can also stick in analog circuits to smooth out rough edges due to the digital or other problems.
If I had the time, I'd like to have a good look at the psoc from cypress gives you a mixture of programmable analog and digital blocks with a micro in there as well.
Also helps with timing issues and simplifying the main controller. On power use I prefer not working with 240V, to easy to screw up. With small battery stuff it doesn't matter if I'm half asleep or freshly awake, if I screw up the worst that can happen is having to replace a blown chip or similar.
Got all the bits for a larger bot using electric bike / scooter motors and medium gell cells (Oatley electronics) but need the time to get it built.
About another seven weeks until the end of semester and having enough of a struggle with electromagnetics and optics (wave packets and so on). Also doing a High Performance Computing subject parallel programming in fortran 90 / 95 using openmp and mpi.
Alex
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
JGCASEY wrote:

Fusing is also important, but for different reasons. I'll leave that to a different discussion for now.
The "problem" with using a PC with Windows or standard Linux is that neither OS is real time, and there can be delays in not only firing sensors, but especially polling sensors, and then controlling motors. On many PC-based robots I've seen, there are delays of a quarter second, and in worst case scenarios (the OS is busy is doing something with the hard drive, for instance), the delay could be longer. Delays aren't so bad with robots that use non-threaded and non-multitasking OS, like DOS, but the trend these days is to use off-the-shelf Windows and Linux as the OS.
By putting something as simple as a bumper switch on a PIC's interrupt pin you get immediate feedback to a potential runaway robot. The PC doesn't have to poll this switch, and because it's connected directly to the PICs hardware, the delay is limited to the interrupt latency -- about a microsecond even on a slow PIC -- and the mechanical momentum of the robot. (Here, dynamic braking could be used.)
Offloading motor control to microcontrollers then gives you additional freedoms, if you want to take advantage of them. You can drive the motors with PWM, connect quadrature encoder inputs to it, design a PID algorithm into it, and atomitize overall motor control functions. If you're a fan of subsumption you could program behaviors into the chip and abstract those functions from the PC.
In short, it gives you flexibility, and in robot design that's never a bad thing.
-- Gordon
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Gordon McComb wrote:

Even the best realtime system has variations is response times. The best a realtime system can do for you is mitigate the delays and guarentee a maximum delay.

On Windows this is certainly true, especially if you are using DOS emulation for various tasks. That's why Windows just plain sucks.
As for Linux, you can bump your task priority. It isn't a guranteed response time, but on your robot, and Linux, you have control over what the OS is doing.

Windows is bad for so many reasons, and if you want that discussion I am qualified to have it. Linux does not suffer the problems that Windows has and while it is not "real time" it is manageable.

Same thing with a PC's interrupt.

And how is this any different than using an interrupt on a PC?

No doubt, but if you don't have to, why bother?

You can do this with a PC as well.

Like I've always said, microcontrollers have a place. If you have a well defined task, sure. They are just a bad choice for general purpose applications.

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
mlw wrote:

VERY. You're writing assembly code for the BIOS? Or do you plan on revising system kernels to immediately branch off your OS tasking to respond to a hardware interrupt? Why do either when a piece of $5 hardware does it, is machine portable, is OS-agnostic, and allows nearly unlimited expansion?
You seem to be confused as to what many of us are suggesting with microcontrollers. True, there are some robots that only use microcontrollers, but there are many others that are based on a PC -- running an OS of some type -- but also use microcontrollers for subsystems. The latter is what we're talking about. Use whatever PC and OS you want, but don't think you'll get the same performance and flexibility using a single board over offloading tasks to one or more microcontrollers.
In any case, many of us have specifically mentioned using microcontrollers WITH a PC, so it's hard to imagine how you have missed these discussions. Several of the people who've responded to have designed PC-based robots that use microcontrollers for specific tasks (me, Kap'n Salty, others), so WE GET IT. However, I am having doubts that you're reading what we're saying.
-- Gordon
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Gordon McComb wrote:

Gordon:
It is to MLW's credit that he came over to comp.robotics.misc and asked his questions, unfortunately, he does not seem to be listening to the answers. MLW's loss. However, it is a free world and he/she is free to spend his time and money any way he sees fit. I just hope that other people are listening the answers.
So far my favorite MLW quote from this thread is the following:

The last sentence was a belly buster for me. A PIC16F630 costs $2.05 for quantiy 1 from Digikey and tube of 25 costs $1.32 each ($33.01 for the tube.) I guess he has not figured out that we use microcontrollers like he seems to want use op-amps and comparators.
Anyhow, back to building robots that actually work...
Later,
-Wayne
P.S. To E-mail me directly, send to Wayne .at. Gramlich @dot@ Net.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Wayne C. Gramlich wrote: [...]

It has certainly made me look into the use of PICs. Unfortunately they are not something I can buy from the local electronic shops along with how to manuals. So it is going to be some culling of web sites until I get up to speed on how to use these little chips.
[...]
-John
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
JGCASEY wrote:

I think Dick Smith carries PICs and PIC programmers, though I don't know how far away you are to one of the stores. (It is my understanding that Australia is a very small country, and you can travel its entire distance coast-to-coast in about an hour. Correct me if I'm wrong...)
Seriously, there's also Dontronics.com, a very active mail order outfit in Victoria, and Don sells both PICs and AVRs. You might want to look at both, and decide which has the functionality you like best.
-- Gordon
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Gordon McComb wrote:

:)
You are surely not confusing us with Austria?
A lot of Americans do!
http://www.ga.gov.au/education/facts/dimensions/compare.htm

Oh, you *were* joking,

We have a shiny new Dick Smith store. The staff know nothing about electronics. It has become a retailer of mostly electronic products like all the other shops that sell tvs, computers, etc.
There was a kit programmer available for $99.95 with an obsolete PIC16F84 included.
Don is the the best choice but he is internet based. I like to talk to people and handle the merchandise. I would hate to end up with a stack of boards that really weren't what I thought they were or lack the documentation that a hobbyist would need to use them.
Also I don't trust internet transactions.
Still I will use the internet to learn about them.
-- John
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

You can buy them from quite a few places around but not always that cheaply.
a good resource for where to buy things is oz over clockers www.overclockers.com.au forums.overclockers.com.au

wheres the smiley ??
http://www.lonelyplanet.com/mapshells/australasia/australia/australia.htm the scale looks a bit off http://www.lonelyplanet.com/destinations/australasia/australia/get.htm#around
About 5 hours wrong there. Sydney to Melbourne is a relativly short trip of 45min - 1 hour by plane about 12- 14 hours by car. Sydney to Perth is around 5 hours flight.around a 3- 5 day drive

Dons very good.
No don't buy any Dick Smith pic programmers. Total waste of money.
One of the kitsrus.com kits from dontronics for pic programmer and get one with a zif socket.
Or build a cheap avr programmer or if you can afford it an atmel stk500.
www.futurlec.com.au or www.futurlec.com have some cheap pic , avr , 8051 and z8 boards starting from around $35 Australian dollars.
Alex
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.