Throughput, Latency, and Bus Speed

I have gotten several emails over the past few months asking about my RS485 blocks and how to increase the speed or why they cannot get enough information out of the brick in time. Through that email chain I developed some good examples and content which I will share here.

For this example lets assume you are using a Dexter Industries’ NXTBee and a USB xBee receiver. Let’s step through the timing for this at 9600 baud. 9600 baud means we can transfer 9.6 bits per millisecond or just over 1 byte.

Time 0 ms: Write data to RS458 Send in NXT.
Time 1 ms: NXT processes data and prepares to send.
Time 2 ms: NXT sending 1 byte of data. (9600 baud)
Time 3 ms: USB xBee receives data and send to computer.
Time 4 ms: Data arrives on computer.

It took 4 ms to send 1 byte of data. That is slow by any account, but the real issue not not in bus speed. In fact, the NXT RS485 bus was only in use for 1 ms of that entire transfer. We also assume 0 send time for the xBee radios (which is a bit of a stretch). This means receiving a reply from the computer will take 4 ms as well. This issue is called latency. We have a minimum of 4 ms latency per RS485 send. Our throughput for this example is 1 byte and our bus speed is 9600 baud.
Now if we send 4 bytes at 57600 or 5.76 bytes per millisecond we get the following:

Time 0 ms: Write data to RS458 Send in NXT.
Time 1 ms: NXT processes data and prepares to send.
Time 2 ms: NXT sending 4 bytes of data. (57600 baud)
Time 3 ms: USB xBee receives data and send to computer.
Time 4 ms: Data arrives on computer.

Note that the time to get the data is still the same, but we were able to move 4 times a much in the same time chunk. This is why speeding up will improve your throughput. Our latency for this example is still 4 ms per transfer, but our throughput is now 4 bytes on a bus speed of 57600 baud. (And yes, we could have done 5 bytes in there, but I am keeping things in powers of 2.)

Now if we look at this in NXT to NXT communication:

Time 0 ms: Write data to RS458 Send in NXT.
Time 1 ms: NXT processes data and prepares to send.
Time 2 ms: NXT sending 4 bytes of data. (57600 baud)
Time 3 ms: NXT receives 4 bytes of data. (57600 baud)
Time 4 ms: NXT application reads data from RS485 Read.

Now we have a much higher throughput to the NXT via the xBee radios. Mind you if we used a wired connection we have a latency of 3 ms as we do not have that extra receive step. This is why a wired connection has lower latency.

I hope this helps you understand some of the magic of communication protocols. All three factors are important in determining network performance and will vary based on application.

GFLUG at Festival of the Masters

It has been a while sinced I posted, but I have now moved to Gainesville, Florida to begin work on my Ph.D. This weekend I am spending time showing off the shuttle at Downtown Disney at Walt Disney World in Orlando, Florida. I have joined GFLUG and getting back in the swing of my LEGO hobby. We are super busy now, but I will share more when I catch a break!

image

RS485 LabVIEW Block Speeds

I have gotten a few questions regrading the “Set Speed” numbers in the RS485 LabVIEW VIs. To make life easy for everyone, I thought I would post them in one spot. Below are the numbers and the speeds they represent. Note: these are the same numbers used in the Enhanced Firmware for RS485 speed. These values do not work on the standard firmware as it is locked to 921600.

 

#define     HS_BAUD_1200   0
#define     HS_BAUD_2400   1
#define     HS_BAUD_3600   2
#define     HS_BAUD_4800   3
#define     HS_BAUD_7200   4
#define     HS_BAUD_9600   5
#define     HS_BAUD_14400   6
#define     HS_BAUD_19200   7
#define     HS_BAUD_28800   8
#define     HS_BAUD_38400   9
#define     HS_BAUD_57600   10
#define     HS_BAUD_76800   11
#define     HS_BAUD_115200   12
#define     HS_BAUD_230400   13
#define     HS_BAUD_460800   14
#define     HS_BAUD_921600   15
#define     HS_BAUD_DEFAULT   15

 

Windows Phone Development

First off, let me say that working at Microsoft is nothing what you would expect! Most people think of Microsoft as boring, dated and lame. That could not be more wrong. It is one of the most dynamic, fast paced placed I have ever worked. Working at Microsoft is fun and challenging.

Windows Phone was a late comer to the whole mobile OS arena. With iOS and Android taking up most of the market share, is there room for a 3rd OS? While the answer to that question is up in the air, I have to say developing for Windows Phone is a dream! I have done some Android work in the past and the SDK seems a little hacked together. Clearly Google was trying to make it usable with Java, but the overall experience was just okay. Windows Phone on the other hand integrates well in Visual Studio. Microsoft focus on the experience and encourages developers to do the same. Raw specs only go so far. The quality of the OS under the hood is really what matters.Nokia has some very solid handsets and while they are single core, the out preform my dual core Android phone. (Java is slow, what can I say?) I must admit I have never developed for iOS (although I just ordered my first Mac) so I cannot really make a comparison there.

This summer I have been developing some apps for WP7.5. The metro design is smooth and makes it easy for a person like me (who is not a UI designer) easy to design a decent user experience.To make things even better, Microsoft is encouraging interns to develop apps. It’s called Xapfest and it is sponsored by Windows Phone and Microsoft Research.  Microsoft gave us loaner phones (Nokia Lumia 710!), the new MSR Hawaii SDK and hosted several hackathons! What is a hackathon? Well it is free food, WP7 experts and 6 hours hanging out with other interns. I have been working on an app called Find It. It will be in the Windows Phone Marketplace in mid to late July. The app uses speech to text and optical character recognition of the Hawaii SDK to enable user to find a word or phrase in text. Think of this as Ctrl-F for the real world. The screenshot you see here is rather early. I will be working on making it look better come July.

The Windows Phone SDK is a free download from Microsoft and if you are a student, the costs to share your app is free (thanks to DreamSpark!). So why not give it a try?

Dear Old Rose

image

My 4 years at Rose-Hulman have come to an end. While saying good bye is always hard, it is also an exciting time. This fall my brother, Anthony, will begin at Rose and I will begin work on my Ph.D. at the University of Florida.

As you may know, this spring the Rose-Hulman family suffered a great loss. Matt Branam, the President of Rose-Hulman, passed suddenly on April 20th. As you might see from the picture above, the degrees were issued with Matt’s name. This is a great memorial to his life. In addition to all the degrees, all the seniors wore pins that said “Make it happen. Make it fun.”

In just under a week I head out to Microsoft in Redmond, Washington to work on Xbox this summer.  I will never forget my time at Rose-Hulman Institute of Technology and I look forward to coming back on homecoming!

Senior Project Almost Done!

So it has been a long time since I last posted. I have been busy traveling and working on projects for school. I am happy to share that one projedt is about done. My senior design project has evolved a bit. DaNI is now sporting a wireless access point and a distance sensor on the arm and a gripper open/close sensor.

image

Check out the image. I will have a video on Wednesday night! Oh and you can see it in person at NIWeek!

GEARBOTS District Meet

Life has been crazy these past few weeks. From Brickworld, to FIRST, to school, there has been little free time. However this weekend brought me to the great state of Maine. Just a few hours east of FIRST HQ in New Hampshire, southern Maine is just beginning to get into robotics. Leading the charge is the Southern Maine Gearbots. Combining FIRST (FLL and FRC), VEX and some custom challenges, this group is working hard to prepare the engineers of tomorrow. Naturally any robotics event is not complete without a visit from some famous robots. Making an appearance was the LEGO MINDSTORMS Space Shuttle and Boston Engineering’s Robotuna. For many this was their first experience with real engineers and robotics.  I was honored to be invited to the event and it really seems to be a great program! Enjoy a few pictures capturing this really great event! Next year will be event better. Hats off to all involved!

Follow

Get every new post delivered to your Inbox.

Join 934 other followers