1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Motor Controller

Discussion in 'Robotics & Mechatronics' started by Omar.M, Mar 25, 2007.

  1. Omar.M

    Omar.M Member

    Joined:
    Dec 13, 2006
    Messages:
    293
    Likes:
    4
    Surprisingly, I seem to get some pretty good marks in the class. Over 90% too! I have a hutch he dislikes me.

    Anywho, thanks for the help. I'll get the supplies over the next week or so, and start building it. I'll show you some pictures too!
     
  2. Hank Fletcher

    Hank Fletcher New Member

    Joined:
    Mar 22, 2007
    Messages:
    932
    Likes:
    12
    Location:
    N.B., Canada
    Omar, I just sent you a PM, but since you're getting good grades and that you just have a "hunch," then maybe there's not much of a problem? I had a tech teacher with a kind of funny attitude like that, too, when I was in high school, but the truth is, he was one of my best teachers and is still a good friend to this day. If you're getting good grades and he hasn't said anything offensive beyond being mildly sarcastic (which seems to be the norm for tech teachers), chances are he really respects and appreciates having you as one of the better students in the class, but for a variety of reasons pertaining to the profession he's restrained in so far as the means availalble to him to express this.
     
  3. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,218
    Likes:
    641
    Location:
    Derbyshire, UK
    I don't know how it works over there?, but in the UK it's fairly common for Electronics (when it's taught in school at all) to be taught by a teacher with no electronics knowledge at all. They simply send any teacher they have on a one or two day course to learn how to teach it, and that's it! - so they usually know nothing at all about the subject.

    A similar thing is about to happen as well, the authorities have decided that primary school children need to be taught a foreign language (currently it starts in secondary school). So do they provides any more resources?, NO, do they provide qualified teachers, NO - they send the existing teachers on a one day course to learn how to teach a foreign language!!.
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. Omar.M

    Omar.M Member

    Joined:
    Dec 13, 2006
    Messages:
    293
    Likes:
    4

    I've wondered the same. He's from an engineering background, but most of the times he seems like he knows less than some of my class mates. Most of them secretly make fun of him but I tend to stop them for some reason.

    I know not how good he is at technology himself, but he has his moments.
     
  6. Hank Fletcher

    Hank Fletcher New Member

    Joined:
    Mar 22, 2007
    Messages:
    932
    Likes:
    12
    Location:
    N.B., Canada
    The strength of Ontario's public education system is due in part to the strength of the teachers' union there, which has worked well at both looking out for teachers' interests, but also for maintaining standards of the profession. With the Ontario College of Teachers and the Ontario Ministry of Education, the teachers' union forms a triumvirate, if you will, that just can't be beaten in its capacity to maintain a public education system.

    Tech teachers in Ontario are a little unusual in that they're the only class of teachers that don't necessarily have to have a university degree. They still need to go to teachers' college, though, and in lieu of a degree they must demonstrate at least five successful years as leaders in their desired field of teaching (carpentry, metal working, electronics, automotive). The perks of being a teacher in Ontario, thanks to the union, mean that the public schools can compete with private businesses in attracting the best in any field to teaching. This is the reason why the England education system (and other professions in England) is not working as well as it could: taking away the power of the unions did away with the advantages of the profession, and consequently the incentive for the best in England to stay there.
     
    Last edited: Apr 5, 2007
  7. Omar.M

    Omar.M Member

    Joined:
    Dec 13, 2006
    Messages:
    293
    Likes:
    4
    Like I promised, here are some pictures for the robot I am working on with a bit of information. The size of the images is as small as I could get them while making sure they were legible. The webpage is rather silly, merely a way I could put a bunch of pictures up without having to post links to each of them. Any feedback on the robot is appreciated!

    http://www.flooto.com/robotics/
     
  8. Hank Fletcher

    Hank Fletcher New Member

    Joined:
    Mar 22, 2007
    Messages:
    932
    Likes:
    12
    Location:
    N.B., Canada
    Good photos! Documenting your projects is almost as important as actually doing them. What's the IC on your breadboard?
     
  9. Omar.M

    Omar.M Member

    Joined:
    Dec 13, 2006
    Messages:
    293
    Likes:
    4
    Thank you very much :). I agree, the documenting is important. I am thinking of creating a tutorial like article about this robot if it works out at the end. These were just photos for you guys to see what I am up to!

    The IC in the breadboard is a PIC microcontroller. Specifically 16F684 (not 16F84 as people misread). I like it because it has an internal A/D converter. And it's a pretty good size for me (I don't think I need many more pins).
     
  10. Omar.M

    Omar.M Member

    Joined:
    Dec 13, 2006
    Messages:
    293
    Likes:
    4
    Alright, well I've been reading up on different things for a while now. We might have a problem.

    I've figured out the 555 timer stuff, got a bunch of desired values that I may want to use so everything is good to go there.

    The problem lies with the SN754410. I remember you telling me that the PWM pulse from the LM555 would be connected to the EN pin on the SN754410. After reading datasheets and some sites, apparently, the EN pin is either ON (5V) or off (0V). The 2.5V or 3.5V that we're going to be getting might do nothing....?

    Did I over look something or are we doomed?
    Thanks,
    Omar
     
  11. Hank Fletcher

    Hank Fletcher New Member

    Joined:
    Mar 22, 2007
    Messages:
    932
    Likes:
    12
    Location:
    N.B., Canada
    You did overlook something, or perhaps more appropriately I should say you've "underlooked" something, specifically the details of the SN754410 datasheet. Take another look at the range for the high-level input voltage.
     
  12. Omar.M

    Omar.M Member

    Joined:
    Dec 13, 2006
    Messages:
    293
    Likes:
    4
    Okay, okay. You win. No beating Mr. Fletcher ;).

    So just to wrap my head around this once more:
    The PIC will just be telling the IC when to turn on the motors (and possibly in which direction). The 555 timer will be connected to the 5V line and will be pulsing about 2.5V to the EN pin. When the EN pin is high, the driver will be on and when it is off, the driver will be off. So this on and off cycle very fast will potentially limit the voltage coming out of the driver-- correct?
     
  13. Hank Fletcher

    Hank Fletcher New Member

    Joined:
    Mar 22, 2007
    Messages:
    932
    Likes:
    12
    Location:
    N.B., Canada
    If you're checking the output levels directly from pin 3 of the 555 as a PWM signal you're not necessarily getting an accurate reading of the "on" voltage. That's why it's not such a bad idea to use a variable resistor to be able to slow the frequency down to 1Hz or even slower. My $20 multimeter takes about a second or even longer to read a voltage. At a very low frequency, you should be able to see the output signal change from a little over 4V for the high, and a little under 1V for the low. When you increase the frequency, your multimeter will start to read both the high and low as an average, but the voltage for each should still be the same values - too fast for your multimeter to read, plenty slow for the SN754410.

    Yep, that's the point of what we're doing. You definitely want to use your PIC to control both directions - that's the advantage in using the h-bridge over a relay or transistor. You'll just need two PIC output pins for the h-bridge control since the PWM signal for EN is coming from the 555. Eventually I think you'll really want to look into using the PIC's own PWM capabilities, but there's a learning curve to these things, I suppose.
     
    Last edited: Apr 8, 2007
  14. Omar.M

    Omar.M Member

    Joined:
    Dec 13, 2006
    Messages:
    293
    Likes:
    4
    Well, the values and such for the circuit, I'm using math to figure out the voltage. I think that's pretty accurate, if I follow the circuit and use my values correctly, that I won't need to check the output with the multimeter.

    I'm not using a variable resistor, I was just thinking of using static resistor values since I have so many and I wont be changing the speed anytime soon.
     
  15. Hank Fletcher

    Hank Fletcher New Member

    Joined:
    Mar 22, 2007
    Messages:
    932
    Likes:
    12
    Location:
    N.B., Canada
    Just been thinking...
    The intermediate step between your 555 PWM control and your robot having autonomous control over the PWM signal could be to have a pot on an ADC pin of the PIC and to have the PIC output a PWM duty cycle as a function of the voltage read from the ADC. You could also do something similar with a pot on a second ADC pin if you wanted to control the PWM frequency. That would give you all the functionality of the current method using the 555 (with the advantage of being able to easily control your robot speed with the turn of a pot knob) without requiring the extra hardware of the 555.

    Again, that will complicate your coding a bit, and I'll have to admit that not yet having the chance to tinker with a PIC (I'm planning on getting one in the next couple months) limits my ability to assist you in that area. The good news is that there's obviously plenty of other people on this forum and elsewhere who know exactly what to do.
     
  16. Hank Fletcher

    Hank Fletcher New Member

    Joined:
    Mar 22, 2007
    Messages:
    932
    Likes:
    12
    Location:
    N.B., Canada
    Didn't I warn you about that already? Check the output voltage, especially from the h-bridge, before you connect your motors. Otherwise, you're taking a gamble that what you think ought to be happening is indeed what is happening. Having control and checking each step as you go (e.g. checking the 555 output signal) is a good means to being able to troubleshoot things when they go wrong. Remember when I said electronics technology was 99% reading comprehension and 1% ingenuity? I was wrong. Take ingenuity out and replace it with troubleshooting.

    That's a pity. I thought it'd be a cheap, cool and practical feature for your robot.
     
    Last edited: Apr 8, 2007
  17. Omar.M

    Omar.M Member

    Joined:
    Dec 13, 2006
    Messages:
    293
    Likes:
    4
    Actually, that is a rather good idea. I think I can code that myself, without a problem. But right now, I think I'll just use static resistors. You've given me so many choices, I think I'll go with the one that'll be easiest first.

    Right now, I don't really need speed control. I'll work on that next after the robot works ;).

    Thanks again, I'll keep you posted!
    Omar
     
  18. blueroomelectronics

    blueroomelectronics Well-Known Member

    Joined:
    Jan 21, 2007
    Messages:
    12,536
    Likes:
    168
    Location:
    Toronto, Canada
    You wont hurt the motors, it's the little L293D that will pop.

    I'll be getting the metal work done first for the mongoose. I often send out some of the first samples parts off to people whom contributed to the design process, I'll try to keep a set for you Omar. They are designed for the Tamiya Double Gearbox (not the Twin)
    [​IMG]
     
  19. Omar.M

    Omar.M Member

    Joined:
    Dec 13, 2006
    Messages:
    293
    Likes:
    4
    Wow! That would be so cool. But I must admit I have not really contributed to your design process. After all, I can't come up with cool robots like that xP.

    Omar
    Edit for Mr. Hank Fletcher-- I've got the 555 circuit built and ready to go. It works, and as you suggested-- I multimetered each part and worked on the design. Most I have to do now is pop in the motor driver chip and program the PIC.

    I was looking at the SN754410 datasheet again- and the ground pins have got me a little confused. Since I am using two different power supplies for the motors and the ICs, I was wondering which ground pin would be connected to which supply?

    Thanks for all of your help. THE 555 WORKSS!
    Omar
     
    Last edited: Apr 9, 2007
  20. Hank Fletcher

    Hank Fletcher New Member

    Joined:
    Mar 22, 2007
    Messages:
    932
    Likes:
    12
    Location:
    N.B., Canada
    All ground pins should be connected to the common for both supplies. Make sure VCC1 is your logic voltage, and VCC2 is your motor supply voltage, although I would have thought you would use the same 5V regulated supply for both in your case. Don't if you want to keep batteries for your motors elsewhere from your batteries for your logic, or you think the motors will draw more current than the regulated supply can provide to both motors and logic simultaneously (which would cause your PIC to lose power). 1A, 2A, 3A, and 4A should each be connected to their own output pin from the PIC. This is presuming you want to run each gearmotor independently, which I'd recommend since it would allow you to spin the robot on the spot (more useful for following lines). The 1Y and 2Y will each be connected to a single terminal on one motor, and same again for the 3Y and 4Y for the other motor. You can tie 1,2 EN and 3,4 EN pins together to the output (pin 3) of the 555, which will mean the motors will run at the same speed no matter what the PWM duty cycle you use from the 555. Bear in mind that this means that the motors will only ever rotate at the same speed (although they'll be able to run independently), so options for driving the robot will be:
    - forward in a straight line
    - backward in a straight line
    - spin clockwise
    - spin counterclockwise
    - drive with left wheel only, either direction (turn right or left)
    - drive with right wheel only, either direction (turn left or right)

    There are two more drive options that you might consider with this setup, although it will require just a little bit more PIC coding. First, you can effectively "brake" your robot by changing the motor direction back and forth quckly. Using this method will allow you to stop your robot suddenly without requiring any additional hardware, as opposed to just allowing your robot to coast to a stop. Given Bill's comments on the Tamiya motors and their gearing, you might determine that this would be a redundant feature based on your predictions of what the maximum inertia (mass times top velocity) of your robot will be. Still, if you had to stop your robot on a slope, this method would give you the maximum holding torque with no extra hardware. The second drive option is to brake either motor in the method I've just mentioned in order to get the same results as the last two points in my list above, except with greater holding torque in the stationary wheel.

    While writing this, it's occured to me that the best way to PWM your motors (looking into the future) is to continue using the 555 to limit the max supply, and then PWM from the four PIC outputs also, using the PIC to control motor speed and direction. That keeps you from wasting PIC code on something that's a constant anyway: the max motor supply. Bear in mind that with PWM from two inputs you will want to be cautious of the frequencies for each you use, since two 150Hz signals 180 degrees out of phase will cancel each other out. With signals over 1000Hz and about 200Hz apart from each other, I can't see the phasing issue as being much of a problem.
     
  21. Hank Fletcher

    Hank Fletcher New Member

    Joined:
    Mar 22, 2007
    Messages:
    932
    Likes:
    12
    Location:
    N.B., Canada
    You might also consider connecting the grounds pins of the SN754410 to some heatsinks, but with just one chip and no stacking, it shouldn't get too hot. If it does, use some heatsink compound and glue a small piece of aluminum to the top of the chip (or get a proper chip heatsink). Again, for one chip running within normal specs, I don't see this as an issue. Just don't build anything from the rest of your robot around the chip (don't smother it), and make sure it gets proper ventilation (the air from the robot movement should be sufficient).
     

Share This Page