Help: First Robot Project - Motor Driver Breadboard Circuit

Hi

OK here's a challenge for you blokes!

This is my first robot/uC project. I am studying electrotechnology as a student, but only at an early stage, so I don't have the skills to solve this problem ( yet ? ).

Problem: fault finding electrical motor driver circuit connection/s on a breadboard.

[ Now this problem probably needs me to take a photo of the circuitry, or draw a diagram, but I thought ( vainly ) that it may be a grounding problem or similar with my unused/floating pins/ports on the uC, so I haven't done so until necessary. ]

Anyway, the first stage of my first robot project is trivial ( for experienced 'bot heads ), but not for me - drive two small motors that drive a Tamiya twin-motor gearbox using a Texas Instruments L293DNE Half H-bridge driver using PWM modulation via two PWM modules on a PIC16F876A.

OK, here's the thing. When the PIC is on a demo board ( Mikroelektronika EasyPIC 2 ), and I use the set of IO pins for Port C and run jumper wires ( including an Earth from breadboard to demo board Earth Port C IO ) from the demo board onto my breadboard circuit, the motors run according to my test software OK no probs. NOTE: if I remove the Earth off the demo board the motors stop, so I guess it's a grounding/connection issue, because we KNOW the demo board is configured OK.

HOWEVER, when I place the PIC ( and crystal ) onto the breadboard circuit ( minus jumpers from demo board, of course ), guess what happens? - no movement in the motors. All unused pins are floating, except MCLR, which is tied LO to Earth via 470 R resistor.

I have tried trouble shooting myself, thoroughly, and at one stage I got the motors running by changing their power connections, but I think there was too much noise ( everything on one power bus ), because the motors were not following their program, so I changed to two power buses, added some more caps, and now the motors work fine - but only when the PIC is on it's ( wired properly ) demo board. I have done many Google searches for photos of similar breadboard circuit also to attempt to resolve the issue by myself.

I have tried tying all unused pins LO ( or was it HI ? or both ? - confusing, isn't it with so many variables for a newbie ) using resistors.

*** Does Port A need special settings because it has AD/DA modules? ***

If anyone is game ( crazy ) enough to respond, your help is much appreciated.

I plan to document my project on my website eventually to help other beginner 'bot heads with similar problems.

|-]

Cheers

Dale

Reply to
Dale Stewart
Loading thread data ...

Go to oap.sourceforge.net click on the project link and scroll down to the motor driver board. Click on the PDF link and compare your schematic to it. Sounds like you are using almost the exact same hardware.

Eljin

Reply to
Eljin

Hi Eljin

Thanks for your reply. Yeah those blokes are using a PIC16F876, but their model and circuit are much more complex than mine. As my project is my first, it uses only a basic motor control model.

The schematics part is easy, it's the 'real world engineering' trouble shooting of actual wiring onto a bread board that is the most challenging aspect. This is especially evident in that the circuit works fine when the PIC + crystal are on the demo board connected to the breadboard, but when the PIC + crystal are transfered to the breadboard only, separate from the demo board, there is no motoer movement.

When I get some time I will draw up a wiring diagram and post it ( I don't have a digital cam, but maybe I will buy one later ( if not expensive ) to photograph the breadboard circuit.

|-]

Cheers

Dale

Reply to
Dale Stewart

Sounds like your breadboard is having troubles with power or ground. These problems can be difficult to track, but if you spend an hour and trace wires, compare to the demo board, you should be able to figure it out.

Rich

Reply to
aiiadict

Bugger it, I'll just buy a motor controller - I can't get help from/through a computer............

|-[

Cheers

Dale

Reply to
Dale Stewart

Ummmm ... try tying Mclr high to 5v. Also, not the best idea to have all the pins floating in noisy environmental situations - ie, inductive switching.

Also, the first step is getting your PIC to run on the breadboard. If by breadboard you mean whiteboard, the PIC may not even run very well there. The oscillator may not go. There is a lot of stray capacitance between adjacent rows on whiteboards.

Also, the tamiya motors are extremely noisy, electrically. You might try snubbers directly at the motor power terminals - eg, .1uF in series with 10-100 ohms across the motor pins.

- dan michaels

formatting link
======================

Reply to
dan

MCLR needs to be held high, not low. Normally, MCLR is brought low to reset the PIC. Connect it to Vcc (I assume 5 volts) through a 1K resistor or higher (up to 10K is probably fine). That should do the trick.

Also, don't allow inputs on any CMOS device to float. At the very least, set your unused PIC I/O pins to be outputs at startup.

Hope that helps -- and sorry for the late reply.

Reply to
the Artist Formerly Known as K

Thanks heaps Mike

I'll give that a go...

My apologies for losing my patience - I have been trying to solve this issue on and off for some weeks, and I guess the frustration is getting to me. I even took it to one of my electronics teachers, but it's not really his field.

|-]

Cheers Dale

Reply to
Dale Stewart

Reply to
Dale Stewart

I'm pretty sure you need the caps with the crystal -- are you sure your teacher isn't using a crystal oscilator, rather than just a crystal? Personally, I use 3-pin ceramic resonators -- they're cheap, don't require external caps, and generally provide a clock suffciently precise for most uses. For more precise timing, use crystals (with caps) or a crystal oscillator.

You should be OK with the breadboard -- I run 16F876/77's all the time at 20MHZ on these with no problems, although I can't vouch for what the motors might do when added intot the mix.

As Dan suggested, get the PIC up and running first. Just write a simple program to blink a LED so you can make sure your hardware is OK. Once that works, then worry about the motor control.

Hope that helps -- m

Reply to
the Artist Formerly Known as K

In general, not the best idea to have floating pins. Easy sol'n is to set unused pins to outputs using TRIS, or pull them low or high via external resistors - 4.7-10K or so. ============

I'm a little surprised that cap.salty runs the PIC at 20-mhz on a whiteboard, as the oscillators are a little bit finicky at those frequencies. In general, you do need 18-27 pF caps on both OSC pins. With xtals, you always need external caps, but some resonators have the caps mounted internally. Also, I personally have never had much luck running PICs at 16-20 mhz using resonators, but it seems to work for some people. ==============

The SBOT40 pcb should work good for your application. You can easily mount a 16-pin chip like the L293DNE [or better TI SN754410] in the prototyping area, and build up a [semi-]permanent setup pretty quickly. You get serial port, ICSP, and pulldowns on all the unused pins built-in.

formatting link

- dan michaels

formatting link
======================

Reply to
dan

dan wrote: [snip]

I do this pretty routinely and I have yet to see a problem -- I'm using the three-pin (caps built in) variety, at 20mhz. The timing seems sufficently accurate that I2C works at 800khz-1.2 mhz with 3-4 units on a mobile robot.

On a breadboard or not (I also have a standard pcbpexpress-fabbed miniboard that I usually use these days), I keep the leads as short as possible to the PIC from the resonator. Obviously, if he uses a two-pin resonater, the caps will be mandatory -- but I don't think I'd bother with the capless variety.

Of course, I get away with a lot of other dodgy crap, like using a hex inverter and a couple of resistors in lieu of a proper rs-232 level converter, so go figure. Luck 'o the half-Irish.

Cheers -- m

Reply to
the Artist Formerly Known as K

.......

The ole 0-5v cheater-RS232 ckt. Some people say they're ok, but in fact, they're machine-dependent. I've tried such, and found ... 0-5v works ok with my notebook, but won't work with my desktop machine. Moral ... to prevent fits of hair-pulling, don't bother with'em.

Reply to
dan

Not something I'd do in a commercial product -- but it works with everything I have around here, so in context, it works perfectly.

Good for breadboarding -- assuming you know in advance that you can get away with it with your host equipment.

Reply to
the Artist Formerly Known as K

If I were you I would be doin gsomething a lot less complicated for your first prodject, it depends on how old you are, if you are still in elementartary or middle school you shoudl be doing something using servos and a basic stamp, oopic or brainstem.

Reply to
MR Robot

Uhh.. I am a little older - 39!!! Maybe I have to dummy down my project ( hehehehe ).

Yep, I worked out easily how to vary the speeds ( like 10 - 100 % in forward, reverse, turn-right etc, brake ), etc with Parallax continuous motion servos - using BASIC Stamp. But I have to design & make up an aluminium chassis, as I can't easily mount the servos on the Tamiya plastic chassis plate.

So later I will build something like the Parallax BOE-Bot chassis, but basically for free, because I am doing an Advanced Diploma in Electrotechnology ( a new student - can't you tell??!!! ) and can get the materials free from the storeman - ( my best mate! ). One of my current classes teaches metal sheet fabrication, so thats OK too.

The Tamiya parts I have are very easy to make into a complete robot. My robot is made up of 3 Tamiya kits:

  1. Chassis plate kit
  2. Twin motrs & gearbox kit ( two speed ratio options )
  3. Caterpillar track kit

(

formatting link
)

The C programming is OK, as I am doing a Control Programming Style class based on the 8255 IO PC card interfacing a PC to external devices - and am finding that easy. One of the projects was to drive a tethered LEGO buggy around a track - easy.

My regular teacher for the C programming class who also teaches PICs is away in Europe for a few more weeks. He is very helpful, as he has built heaps of robots, circuits and sensors using PICs. So I can get help from him later.

Today I got a parcel with a swag full of stuff from the Mark III site, including a mark III controller board, so I can put my breadboard circuit on the back burner.

So I will just be patient and make a tactical retreat for now.

As a well-known cyborg once said: " I'LL BE BACK... "

Eventually I will build my own PCBs for my 'bots.

I will EVENTUALLY have ( 3-4 yars plan )

*PIC - based ( C ) 'bot *LEGO Mindstorms ( Java ) 'bot *BASIC Stamp 'bot *AVR ( C ) 'bot *Ubicom ( C & BASIC ) 'bot

cHEERS

|-]

dALE

Reply to
Dale Stewart

I am not sure what he uses exactly, whatever is sold by Dick Smith and Jaycar: " crystal, with parallel resonance with HC49/U case "

OK I have some 3-pin resonators I imported from USA: 4, 10, and 20 MHz ( can't find them in Oz ) . I also have 4 & 8 MHz 2-pin crystals . I am using the 8 MHz that came with my demo board - the board uses 15 pF caps.

OK chief - roger, roger

Thanks heaps chaps

|-]

Cheers

Dale

Reply to
Dale Stewart

I have been using an 8MHz 2-pin crystal/resonator with no caps. I also have 4 MHz ( parallel resonance, HC49/U case ), and the 3-pin ceramic resonators 4, 10 & 20 MHz with caps built in. I will buy some 18-27 pF caps and give those a go with a simple LEd circuit first.

Thanks heaps Dan, expect an order soon.

|-]

Cheers

Dale

Reply to
Dale Stewart

My guess is he's using a complete oscillator unit, although I'm not sure based on the description. If so, then no caps are required -- these units contain the crystal and ancillary components in a single case to form a complete oscillator. They are generally 4-pins, with one unused. The remaining pins are Vcc, Gnd, and OSC signal out.

He could be could be using something else, but in any case I'm pretty sure that the caps are not optional if you're just using a crystal by itself.

Finally, be sure you have the fuses set correctly when you program the PIC. If any of these are wrong, the device will refuse to start up.

Cheers -- m

Reply to
The Artist Formerly Known as K

With the 1st two options, you always need external caps. OTOH, there is so much stray capacitance between adjacent rows on the whiteboards -

15-20 pF range - this may have substituted. You should also read the oscillator section in the 16F8776 datasheet.
Reply to
dan

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.