BS2 Motor Control via 74HC595 and ULN2803
![Bill Chennault](https://forums.parallax.com/uploads/userpics/820/n25YAQT2TKN7D.jpg)
All--
This is my first attempt at a digital circuit that will control motors. Remember, that I am a rank electronics novice. In my research, both here and other places, I have noticed that many circuit diagrams include only those IC pins necessary for the project. Therefore, that is all I included in my diagram, which I drew with Visio.
The four relays shown are on an eight-relay board from Elexol via Hobby Engineering . . .
http://info.hobbyengineering.com/specs/ELEXOL-IO24Relay.pdf
The four motors shown are 6 volt or 7.2 volt (I have not decided which, yet) devices from Banebots . . .
(http://banebots.com/osc/support/gearmotor_comp.htm)
I have an obvious question: Will this circuit even come close to working? [noparse]:)[/noparse]
All told, there will probably be at least 40 motors, as this will be an 8-legged walker. (Therefore, the circuit below will form a very small part of the overall electronics.) The Stamp(s) will serve as I/O device machines. All navigation and problem solving will be done by a network of PCs talking to a tablet PC on-board which communicates with the Stamp(s).
There is also an OBVIOUS problem: I have no provision to reverse the motors. Can you suggest how this may be done? Additionally, I have not included encoder-based position control because I have not quite figured out what I am going to do, exactly. (Since this will be a walker, encoder-based position control may wind up being a simple count from, say, 0 to 60 on·each joint. Each "bone" will be activated via screw drive.)
Please point out all of my mistakes, unless there are simply too many. In that case, I would appreciate a hint concerning the right direction to do additional research. (I have the WAM kit, Stampworks kit, Process Control kit, two PDBs, BOE and BS2p24 and BS2p40, plus this forum and the Internet for research and learning purposes.)
My diagram MAY appear below! Please give me your feedback.
--Bill
![Relay%20Control%20Circuit.jpg](http://www.billnkc.com/images/Robotics/Relay%20Control%20Circuit.jpg)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.
This is my first attempt at a digital circuit that will control motors. Remember, that I am a rank electronics novice. In my research, both here and other places, I have noticed that many circuit diagrams include only those IC pins necessary for the project. Therefore, that is all I included in my diagram, which I drew with Visio.
The four relays shown are on an eight-relay board from Elexol via Hobby Engineering . . .
http://info.hobbyengineering.com/specs/ELEXOL-IO24Relay.pdf
The four motors shown are 6 volt or 7.2 volt (I have not decided which, yet) devices from Banebots . . .
(http://banebots.com/osc/support/gearmotor_comp.htm)
I have an obvious question: Will this circuit even come close to working? [noparse]:)[/noparse]
All told, there will probably be at least 40 motors, as this will be an 8-legged walker. (Therefore, the circuit below will form a very small part of the overall electronics.) The Stamp(s) will serve as I/O device machines. All navigation and problem solving will be done by a network of PCs talking to a tablet PC on-board which communicates with the Stamp(s).
There is also an OBVIOUS problem: I have no provision to reverse the motors. Can you suggest how this may be done? Additionally, I have not included encoder-based position control because I have not quite figured out what I am going to do, exactly. (Since this will be a walker, encoder-based position control may wind up being a simple count from, say, 0 to 60 on·each joint. Each "bone" will be activated via screw drive.)
Please point out all of my mistakes, unless there are simply too many. In that case, I would appreciate a hint concerning the right direction to do additional research. (I have the WAM kit, Stampworks kit, Process Control kit, two PDBs, BOE and BS2p24 and BS2p40, plus this forum and the Internet for research and learning purposes.)
My diagram MAY appear below! Please give me your feedback.
--Bill
![Relay%20Control%20Circuit.jpg](http://www.billnkc.com/images/Robotics/Relay%20Control%20Circuit.jpg)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.
Comments
2) If you are going to want to reverse the motors, you could do it with additional relays, but you might want to look at what's called an H-bridge. That would avoid the need for the ULN2803 and the relays. Look on the internet for this subject (and search the forum for other threads). It's commonly used to control DC motors that have to be reversed.
Re: "1) The ULN2803 outputs switch to ground when activated (they're open collector outputs) so the relays need to be connected between some positive supply and the ULN2803. Be sure to connect the common diode connection to the same positive supply (these protect the ULN2803 from the negative voltage spike when the relays are turned off)."
If I understand correctly, then the four places where I show the relay coils connecting to ground, I should show them connecting to my +5vdc supply? Does this address both issues in your first point or am I totally missing your point?
I suppose by the time I finished this circuit and included everything I needed, I wouuld have designed an H-bridge in the first place! But, in my ignorance, I am thinking that I would go broke buying enough H-bridges and Stamps to control 40 motors. I suppose there is always the very faint possiblity that this project is too ambitious . . . but NASA did it. There are two of them on Mars right now, each has 40 Maxon motors. (It is remarkable that only one of these motors has been lost.) Wonder if NASA would send me the rover plans? [noparse]:)[/noparse]
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.
same voltage used to drive the relays.· Connecting 5V to Com and 12V to your relay can cause a differential voltage that will negate the protection·offered by·the diode.
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?
Newzed@aol.com
·
Mike, I have some UNL2803s coming this way. Perhaps, I will get data sheets with them. If not, they are all over the Internet. When they get here AND I get time to even open the stuff I bought from Parallax (been there, done that?), I will be very careful and attempt to interpret your advice correctly. Stand by for dumb questions!
Sid, I understand.
I will try to re-work and re-post my diagram tomorrow. I am learning a lot. Thank you.
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.
Keeping in mind that this circuit will not REALLY be incorporated into my machine and that I am taking advantage of your expertise to learn, have I interpreted what you said yesterday correctly?
1) I have connected the relays to the Common pin (pin 10) of the ULN2803 via a positive supply (+5vdc).
2) In my mind, doing the above also achieves connecting one side of the relays to the positive supply, as well.
3) Sid, looking at the new diagram, have I connected the Common terminal of the ULN2803 to the relay coils as you envisioned?
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.
I hope you are both well. I hope your families are fine and fairly fed. I hope the endeavors of your youth have brought you dividends that I can only imagine. I hope that you are busy and truly enjoying the well-deserved fruits of your labors.
I hope you look at my second circuit diagram, too. [noparse]:)[/noparse]
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.
The second diagram looks correct. Say the appropriate incantations as you're wiring it. You never know what gremlins are lurking about.
Mike
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?
Newzed@aol.com
·
Thanks.
What I would REALLY like to hear about is your old Datapoint days. My experience with Datapoint began prior to their licensing of ARCnet to SMC. I can remember trying to figure out a way to use the "Attached Resource Computer" system (I think that is right) in my environment. It was not a happening thing.
But, along came the S-100 bus, TurboDOS and the licensing of ARCnet and the world of networking never looked back. I had useable networks up and running with ARCnet as early as 1983. We wrote drivers in assembler and patched object code using Debug.
Man! Those were the days! (I am glad I lived through them: My goal in life was to become a production assembly coder. I am very glad I did not get what I wished for.)
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.
Thank you, Sir!
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.
The FIRST diagram looks EXACTLY like the second because I copied the second file over the top of the first without renaming it. The FIRST one would'a smoked, fer sure!
Thanks to Mike and Sid, the second one MIGHT not, depending on how many dumb mistakes I do not make.
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.
The frist time using any chip even when i put the BS2 OEM boards together
I·have data sheets·for the pin out of the chips that you are working with·with me while i put the together
I have alot BS2 board that i have put·together
Check·your work·many time before putting power to your project
The frist time i used the ULN2803 i fried one pin on it because·i hook it·up wrong
Sid and Mike are right that there a lot of gremlins are lurking about
Sam················
Thank you very much for the advice. I am very experienced in some things of a technical nature and VERY aware of the gremlins! Still, your advice is well taken and I will follow it.
I have data sheets on everything I will use and will get data sheets on everything I do not know at this time that I will use. (Does that even make sense? [noparse]:)[/noparse]
I would like to experiment with this concept: A super I/O machine. I want HUNDREDS of inputs and a LOT of outputs, perhaps as many as 100. This may require multiple Stamps in order to approach real-time processing. Using multiple Stamps implies communication among Stamps or communication from the Stamps (using USB?) to something a lot smarter than a Stamp, such as·an on-board tablet PC which, in turn, will communicate wirelessly with a network of desktops.
How many 74HC595s can I support with a single Stamp on a real-time basis? How many 74HC165s can I support with a single Stamp on a real-time basis? (The input will be supported by one Stamp and the output by another.) I do not know the answers to these questions. I have not been able to get the answers to these questions. So, maybe--with the help of the kind and generous members of this forum--I can discover the answers to these questions.
By the way, today I received 8 ULN2803s and Jameco's largest breadboard. I can fry "a pin or two" and still have enough left over to learn something.
The gremlins truly exist. However, they should beware for my strength is as of ten, because my heart is pure.
--Bill; Pureheart
ps I appreciate any advice or lessons you have time and the willingness to provide. I am an electronics novice . . . or less.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.
Peter is one of those wizards that wander through these fora.
Daniel
The Stamp Manual describes a Stamp network (and there's a series of Nuts and Volts articles on the subject) using the SERIN/SEROUT commands in open mode. You could very easily set up a fairly large Stamp network, maybe use a Propeller or even a PC as the master controller. In the "old days" at Datapoint, prior to the existance of ArcNet, there was a simpler office network using a twisted pair phone cable around the periphery of the office and an open collector driver not very different from the Stamp's open mode. There was printer software for a print server and file transfer software. The computers attached to this network had about the same memory capacity as the Propeller and were much slower. They did have diskette drives which might be equivalent to a large EEPROM in capacity (256K bytes).
The network protocol was simple. The master was given the name (or number) of the other device to talk to. The master listened for a quiet time in the network traffic, then sent out a "hey! are you there!" message with it's name and that of the destination. It would retry some number of times if it didn't hear a response within a timeout, then report an error to the user. If it did get a response, it would send out numbered packets of information with its name, that of the destination, the packet serial number, length, data, and a checksum. For each packet, it would then wait for an acknowledgement "sure, I received it correctly". The packets were small, could be sent at 9600 Baud quickly. In your case, there isn't much information to send each time.
The question of how many 74HC595's depends entirely on how quickly you have to be able to change them and where the data for them is coming from. Remember that the Stamp only has 26 bytes of variables although it does have additional RAM (GET/PUT) and EEPROM (READ/WRITE). That kind-of limits the data that can be usefully held waiting to transfer out to the 74HC595. You could receive the data over the "network" a byte at a time to shift into the 74HC595s.
Mike
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?
Newzed@aol.com
·
BEWARE...for you do summon another demon by name. So blithely do you call upon the fiend "real time". He appears to each in his own guise, and thus doth madness follow...
Shift registers, by their very nature, generally remove one from the realm of real time because their data is governed by a clock that separates the "now" from the "when I get it" and/or "when I give it". For relatively slow events, this isn't usually a problem...only your requirements can say for sure...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Truly Understand the Fundamentals and the Path will be so much easier...
In my application, "real time" means, oh, sometime in the next second or so. I have a LOT of experimenting to do, obviously.
Sid, I will check out the·TPIC6595. Thanks!
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.
If you've read this thread you know I am a rank newbie.
Is it your thought that the TPIC6595 will allow me to eliminate the ULN2803(s) to drive the relay loads directly?
If so, do you have time to draw a simple Stamp/TPIC6595 circuit diagram which will point me in the right direction?
The TI data sheet makes it look very simple. But, I am unfamiliar with some of the abbreviations and too ignorant to understand the explanations of them in the data sheet.
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.
Pin 1 - Vss
Pin 2 - Vdd
Pin 3 - data
Pin 4 - out0
Pin 5 - out1
Pin 6 - out2
Pin 7 - out3
Pin 8 - Clear - tie to Vdd
Pin 9 - No connection
Pin 10 - Gnd
Pin 11 - Gnd - tie to Pin 10
Pin 12 - clock
Pin 13 - latch
Pin 14 - out4
Pin 15 - out5
Pin 16 - out6
Pin 17 - out7
Pin 18 - serial out - if you daisy-chain, tie to Pin 3 of next chip.
Pin 19 - Vss
Pin 20 - Vss
OK?
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?
Newzed@aol.com
·
Gee. TI needs to learn how to label stuff like you do!
Thanks!
I will get some and play with them.
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.
As I studied the data sheets for (Sid's suggestion of) the TPIC6595, I began thinking, "Gee. This is eerily like the 74HC595." (Ok. Maybe I didn't say "eerily"; maybe I said something like "real strange", or something.) Reading further in a couple of data sheets, I finally discovered that "The logic functions of the TPIC6595 consist of the logic functions existing in the high-speed CMOS (HCMOS) SN74HC595 catalog parts except the outputs are inverted relative to the HCMOS version."
So, if I am interpreting this correctly--if so, it is pure luck--it means that the outputs of the TPIC6595 are opposite those of the 74HC595. Additionally, the TPIC6595 has been "beefed up" to handle more current, thus Sid's suggestion to use it in place of the 74HC595/ULN2803 combination with which I had planned to drive relay coils.
Am I interpreting this correctly and does anyone care to comment further on it?
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.
Yes, the TPIC6595 appears to have been designed specifically to replace the 74HC595 and ULN2803 with a single chip although with FET outputs instead of bipolar transistor outputs with little functional difference.
Mike
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?
Newzed@aol.com
·
Thanks. Since I have eight ULN2803s and know absolutely nothing, I will experiment with them in parallel while going through the StampWorks kit. When I eventually build something of my own, the TPIC6595 are obviously worth considering to reduce chip count and all that entails.
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.