Heya, question about controling motors... Can anyone please tell me how hard it would be to make a controler for 3 small DC motors, that would randomly run through certain states? I would need all three motors to randomly enter one of these states : > Forward Fast > Forward Slow > Stop > Backward Slow > Backward Fast. All 3 motors would be independant of the others, changing state randomly every couple of seconds. I am awear a PIC could probly do this for me fairly easily, but I have no experiance with PICs and have read up on them quite a bit and still have no real idea. This is for a little Laser Lightshow I am interested in trying to construct. Heres an example of what I am after http://www.laserfx.com/Science/Science8.html http://www.laserfx.com/Science/Science8.html (I am interested in the bottom version more then the top one.) Anyway I'm just after your opinions on how hard this would be to construct, I have a decent understanding of electronics, just not much practice. Any other help you could give would be much appreciated!! Thanks for reading >>Greg
Have you read this ? If you have and still have trouble, Im very interested in feedback as to what is unclear. After-all, its purpose is for those who dont grasp PICs.
Perhaps I'm just stupid? Yeah Hazer, thanks, I have read that guide. Its very good, but maybe I'm just stupid . I get it for the most part. I just need to know - is what I'm talking about practical? Like doable for an intermediant skilled guy? I've got an uncle that an electrician that'll let be borrow / use his gear so thats no prob. The question is can I use ONE PIC to control the three motors each at 5 different independant states. Would I maybe need a PIC for each? Anyway, thanks for the input. I'll keep looking around and try to learn some more stuff. >>Greg
Servo motors wouldn't really work for this, they are geared down a lot, they're meant for high torque low speed things, plus they only rotate a certain limited amount, not continuous rotation. To get forward and backward control you need an H-bridge, an example found here. For speed control you could use a power resistor in series with the motor to slow it down, then when you want full speed a transistor/mosfet is activated to bypass that resistor. Or if you're using a PIC, I'd go with PWM, especially as several PICs including the 16f628 have built in PWM modules. I'm not really sure how you could handle random switching between these states without a PIC or other microcontroller. It would be simple enough to get sort of random switching between these states using a counter chip with an oscillator, such as the 4017 with a 555, where each output will activate one of these states that you choose so it looks mostly random. If you're interested in learning about PICs, my favorite tutorial is here, and another good one is here.
Thanks mate, thats some... interesting stuff. I'll slowly chew through that and hopefully learn it. I get the basic principle and all, just when ever I try to do something it never works right That H - bridge idea looks promising. I've acctually seen a working 3 motor version of the laser lightshow at Uni, it seems to use only one PIC (about 16-18pin) and very few other components. (Bucketload of reisistors and caps.) I think it runs of about 9 - 12 volts, I've asked about it but noone seems to know - sure as hell not the lecturers. Hopefully I'll soon get the jist of this PIC stuff, gotta get me a programmer and start buggering around, if I do have any success I'll take up space and post some pictures round here somewhere. Thanks again, time to lern some edumacational thinz
Actually a servo would be ideal for this, they are geared down, but they are still pretty quick, (some as low as .09 seconds to move 60 degress on some small servos) they can be modified to rotate 360 degrees here is a list of hitec servos, if you click on one of them there is a property in the information called 360 degree modifiable. Typically what you do is take the servo apart remove the servo, and see what value the pot is, if it is say, 5k get some resistors about 2.5k. You then remove the pot, solder the resistors in to replace the pot (ie both legs in the spot where pin 2 was, one leg in each where pin 1 and 3 were. Now rather than moving to a known spot and stopping, it will turn slowly when you tell it to move a little bit from the center, and fast when you tell it to move towards the limit. If you know about servos, a pulse of 1100 µs would be fast, clockwise or counterclockwise (depending on the servo) 1400µs would be slow, 1500µs would be stop, 1600 would be slow and 1900 µs would be fast going the other way. I also have some code for a PIC to put a number in 2 registers and it outputs a pulse of that length in µs to a pin.