RS232 to TTL Converters worthwhile?
Hello Again Guys,
Despite what Mike Green mentioned, I still want to build a robot based on a tablet PC without any other microcontroller.· He made a good point, which was that a PC will want to use RS232 and all these cool devices use TTL serial interfaces which are inheirently incompatible.
The point of this message is that I'm still stubborn, but your expertise could keep me out of trouble.
Per his advice, it might just be easier to plop a BS2 between the PC and the other goodies.
But what about a simple translator like this?:
http://www.bb-elec.com/bb-elec/literature/232LPTTL-3406ds.pdf
Allegedly, I can just tie the receive and transmit lines together and I have a TTL serial I/O line.· I don't expect this to be magic.· For example, I have no idea how the bits/bytes/words will get translated.·· Will I run into a problem with communication phrases of really akward lengths?· What about something like Ping))) which actually has to measure the time of a pulse?
If anybody has any experience with attempting something like this your advice is sure appreciated.
Sincerely,
-Todd
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Despite what Mike Green mentioned, I still want to build a robot based on a tablet PC without any other microcontroller.· He made a good point, which was that a PC will want to use RS232 and all these cool devices use TTL serial interfaces which are inheirently incompatible.
The point of this message is that I'm still stubborn, but your expertise could keep me out of trouble.
Per his advice, it might just be easier to plop a BS2 between the PC and the other goodies.
But what about a simple translator like this?:
http://www.bb-elec.com/bb-elec/literature/232LPTTL-3406ds.pdf
Allegedly, I can just tie the receive and transmit lines together and I have a TTL serial I/O line.· I don't expect this to be magic.· For example, I have no idea how the bits/bytes/words will get translated.·· Will I run into a problem with communication phrases of really akward lengths?· What about something like Ping))) which actually has to measure the time of a pulse?
If anybody has any experience with attempting something like this your advice is sure appreciated.
Sincerely,
-Todd
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Comments
Jax
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
If a robot has a screw then it must be romoved and hacked into..
Thanks for the reply.· I hope none of the engineers here think I'm too weak here to dig into microcontrollers.· It's just that, hey, if I can only code for one animal, I'd rather keep it to one animal.· Fortunately it's a cheap experiment to perform with the·rs232/TTL converter.· But perhaps someone can save me a few bucks.
Oh... and just in case you guys haven't gotten enough of it (and completely off topic) I'm posting the link to the cute little 'bot with the tracking head (set to music... hehe) again.·
Sorry.
-T·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Okay... yeah... the using a microcontroller isn't sounding bad.· If nothing else, I would have to do a lot of multiplexing on the serial ports to get·enough TTL I/O lines.
One thing that seems so magical about the Stamp is that·the I/O pins seem to be so multifunctional in a way that·makes·no sense to me.··In addition to normal asynchronous·digital I/O, it appars that they do magical A/D conversion,·as in·the light meter·example in the BOE documentation:
http://www.parallax.com/Portals/0/Downloads/docs/prod/boards/BOE-RevC-v1.3.pdf
But if it is indeed magical, why did Steve Norris·(http://norrislabs.com/) use a 16F684 microcontroller (http://ww1.microchip.com/downloads/en/DeviceDoc/41202F-print.pdf) to do the A/D conversion for his two GP2D12 optical·proximity detectors (http://document.sharpsma.com/files/GP2D12-DATA-SHEET.PDF) on his RoboStool project?· Isn't that overkill?
Not only that, the way that the·Ping))) sensor functions makes·no sense to me.· I mean,·I don't get how these two commands (as in the datasheet) can·capture the time of a zillionth of a second pulse into the 'time' variable:
PULSOUT 15, 5
PULSIN 15, 1, time
Oh well...·I can·gamble on it·since I need to·save up enough money for a BOE... it just makes me feel uncomfortable.
Any comforting comments, suggestions or advice are appreciated.· I'm sure I'll come up with more questions as time goes on here [noparse]:)[/noparse]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Stamp I/O pins, like most microcontroller I/O pins, are very much multifunctional. They can be used for asynchronous serial I/O. They can be used for timing pulses (like from the PING). They can be used for producing pulses of a particular width. They can be used to produce analog voltages (with a couple of passive components attached to filter the output). They can even be set up (with a few passive external components) to measure analog voltages. A Stamp is a poor analog to digital converter ... it's not really designed for this ... it's slow and doesn't have great accuracy. On the other hand, if you want to measure battery voltage, it's a cheap and effective technique.
The PING))) sensor uses a brief pulse on the I/O line to initiate a measurement cycle. Some time later, the PING))) outputs a pulse whose width corresponds to the distance from the PING))) to the nearest object in the path of the beam. You measure the width of the pulse (with a PULSIN statement) and you can compute the distance (since the pulse width is a function of time to first echo).
Ahh... you are de-mystifying a lot of this for me.· I am more confident now.· You also mention a few things that are still questions for me, like better A/D solutions and power supply issues.· Of course, those questions are not exactly on topic for this thread.· In the meantime, like you said, I have some homework to do.
However, I don't want anybody to simply drop this thread.· It appears that RS232/TTL issues are still going to be with me.· For example, I think I'm going to want to multiplex a serial port for this project anyway, and I saw a product like this here:· http://www.usbserial.com/USBG-4X232.html
Allegedly it should be fine with Linux·and plain old signal propegation.· Though I don't anticipate any problems using it with some sensors or BS2 interface, someone around here may have encountered some issues.
Keep the ideas rolling in guys!
Thanks again,
-T
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I agree with you that a Tablet PC is a far more powerful and capable controller for the robot than a microcontroller, but it does not have the I/O necessary to control the motors, servos, and read the sensors that are required. Nor is windows really a RTOS (Real Time Operating System). Yes, you can design an interface using CMOS/TTL logic chips that allows the RS232 or USB port of the Tablet PC to control the robot, but it would require many many chips and consume a lot of power.
It is far better and simpler to have a microcontroller to run the motors and servos, read the sensors, and communicate with the Tablet PC over one RS232 line. Then the Tablet PC can be left to process the data and send commands to the microcontroller. This way each performs the function they were designed for.
Think of the Tablet PC as your conscious mind and the microcontroller as the autonomous functions of your nervous system. You do not have to think about controlling your heart beat or balancing when you are standing, that is automatic. You decide when you want to get up and go somewhere and your nervous system controls your muscles to accomplish that.
So what I am saying here is there is ALWAYS a solution to ANY problem no matter how big or small it is, anything can be done as long as you put your mind to it and today with the WEB there's all the information you need but you just have to find it and put it together.
Jax
ps. I won 1st place in both my local and State Science Fair in GA with a devise now called the clapper.. And yes I built it before they were selling them but I did not patent it due to the lack of my teachers and myself's thinking [noparse]:([/noparse] so I guess I cannot really call myself the inventor of it.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
If a robot has a screw then it must be romoved and hacked into..
Yeah, I'm pretty much sold on using a microcontroller, now that you guys mention all the risks I'd be taking by trying to fudge microcontroller functionality out of a PC. And yes, it would be a better idea anyway to have another processor doing the dirty work of monitoring all the robot 'stuff' while the PC does the thinking.
And Ugha, you also mentioned the same thing these guys were saying, although I think you were also thinking I was cautious about learning a new programming language. Naw... I can program anything. I was just thinking I could get rid of one variable (the microcontroller) but as it turns out, I'd actually be adding more by omitting it.
Speaking of programming, these pbasic commands serin and serout are the 'dedicated' I/O commands to the serial port (usually) hooked to the PC right? I mean, these aren't detracting from the 16 TTL I/O lines are they? Is that 'debug' command just a synonymn for the serout command, then?
Ah, and thanks for the vote of confidence on the makeshift NAND gate. That's pretty funny [noparse]:)[/noparse]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The programming connector on a BOE/BS2 is connected through a level shifter that translates the +12/-12 to TTL levels (+5v/0v) internally.
You can address this communication port and thus speak directly to the computer to the programming port by using pin 16 on either SERIN or SEROUT.
If you want to communicate with anything except a computer, pins 0-15 on a BS2 can be used for TTL level serial communication as well.
Think of DEBUG as a wrapper function that does the SEROUT communication on pin 16 and formatting for you. DEBUGIN is its counterpart.
DEBUG and DEBUGIN allow you to interact with the stamp from the BS2 editor, but to get anything like a GUI or custom interface, your going to have to write a
computer program yourself or find one for download that does what you want already.
I hope this clears some of this up for you.
As always, the support here is great. With this assistance, it appears I can seamlessly communicate with the BS2 over a serial interface programatically.
Anyway, this does not mean I'm done with the questions... I just should post the next question under a new thread since it will be a new topic.
Just give me a few days so I can formulate that question right.
Cheers,
-Todd
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔