RS 232 and Dashboard

Well, with our season over, it’s time to start thinking about next year. One thing we want to start working on within the next couple weeks is a test RC system; basically a fully functional robot with only the electronics. With it w can test motors and other such things, but mainly we want it to be able to develop code for the camera, gyro, and other sensors, both in and out of the season. In addition to this, we think it would be really cool if we could build a physical, rather than digital, dashboard, utilizing the RS 232 dashboard port, a set of LEDs and numerical displays that works just like the dashboard program and built into our test system.

Obviously, the biggest obstacle to overcome is building a circuit to receive and process the RS 232 data, which the other students and I don’t know much about at all. Our mentors would likely know a lot, but we’d like to find out as much as we can on our own first If anyone here can point us to some good RS 232 documentation, has any other comments or suggestions, or has done something like this themselves, we’d really appreciate it if you could tell us about it. If it hasn’t been done before, or at least not to such an extent, we’ll document it as much as possible once we build it.

Thanks in advance.

You probably don’t really want documentation on the RS-232 standard. It’s just a definition of what voltages represent which logic state, and how quickly those voltages change. You also probably don’t want to design a circuit to process it; the voltage level circuitry is available in chip form (MAX232, for example) and the timing circuitry is built in to just about every microcontroller sold (it’s called a UAR/T).

What you probably really want is documentation on the Dashboard data format. That can be found here: http://www.ifirobotics.com/dashboard_viewer.shtml

Oh, I have the Dashboard documentation. What I don’t know is how I would take the RS 232 signals and translate them back into numeric values, so I could then trigger LEDs and display PWM values and the like.

To turn RS-232 serial data into numbers, I suppose you could design some sort of state machine out of discrete logic…but you really ought to be using a programmable computer with a serial port. Although building your own UAR/T might be a fun challenge, it’s much easier and much less expensive to use what’s already built in to most microcontrollers.

Bottom line: don’t try to turn serial data into numbers yourself. Let the available hardware do it for you. Connect the receive pin to the incoming data, program the UAR/T for the proper bit rate, and read the incoming bytes as they arrive. Your first task should probably be to decide what kind of processor you have the ability to program, and then either to design a computer around it, or use an existing design like a BASIC Stamp or Gumstix system.

If you install the Labview you got this year, there is a Dashboard utility that comes with it. You will, with some effort learning Labview and staring at the Block Diagram, be able to figure out how to convert the data stream.

At the http://www.ifirobotics.com/dashboard_viewer.shtml Alan gave you, is a link to the “Dashboard Viewer 2005” - which is a ZIP file containing both the Dashboard program and PDF documents describing the byte-level protocol.

Or maybe you are looking for hints on how to get started coding?

First, capture some actual data into a file to see what it looks like. To do this:

  • connect the OI Dashboard port to your computer, and set up the serial port to 115200 baud/etc as instructed in the Dashboard Specification.
  • run the Dashboard Viewer program and make sure you are getting data from the robot. Stop the Dashboard Viewer.
  • capture or copy whatever is coming into the computer serial port to a file. This will be “binary data” not human-readable (yet).
  • fiddle around with your robot controls, to make sure PWM changes/etc are transmitted to the OI in Dashboard data packets
  • stop the capture after a 30 seconds or so - you should have lots of data to look at

Find a utility containing a hex viewer such as Winhex or FileZilla. This will show you the binary data, expressed as “hexadecimal” equivalent characters. Using these, compare the data in the file with the Dashboard Specification.

Armed with this information, you can start writing some C or Visual Basic code on your computer. The code will open the serial port and read the live incoming Dashboard data stream from it. I suggest you start by opening an output disk file and copying the data to it. This will prove you have valid data (you can look at the file with the hex viewer).

Now you can start adding recognizer code to your program, looking for the start-of-packet bytes (FF, FF), then copying the remaining 24 bytes of the data packet frame into a data structure in memory. Once you have it there, it should be fairly easy to pick out the fields you are interested in (the PWM values, for example) and use them for the kind of output you would like from your program.

Well, for the most part, this whole project is intended to be a challenge and a learning experience, but I’ll agree that we don’t want to go that far, if there’s equipment already available that can do most of the work, especially considering that just using a microprocessor other than the FRC goes beyond the scope of anything our team has done before.

But I would imagine it follows the same basic idea as the PIC, excpt in a much more simplified version. I can also forsee us using a lot of assembly code.

And I’m no stranger to working with raw binary data. I spent a lot of time last summer learning assembly by doing a little ROM hacking for the GBA. A very educational experience.