1. Summary
  2. Files
  3. Support
  4. Report Spam
  5. Create account
  6. Log in

RS485 NXT-G Block

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.

RS485 NXT-G Block

Postby milluzaj » 28 Feb 2011, 15:21

I have created a NXT-G block to use the RS485. Xander posted to his blog. Here is the somewhat formal release notes:

This block only uses sensor port 4 of the NXT to connect to another NXT (via sensor port 4). This block takes a string (in send mode) and will send it over port 4, using RS485. It does not check to ensure the other NXT receives it. As long as the send block successfully communicates it will return an output string of 0. A non 0 output value means an error occurred. This means you can broadcast a message to several NXTs. You can send numbers via this block, but you must convert them to a string first. In read mode, the NXT will check its RS485 buffer until it gets a message. This means it will wait for a message and not move on until it gets one. If you plan to continually read a value, I suggest you do this in parallel in a loop as to not halt the overall program. The value read will be returned as a string.

This is just the first release, so I am looking for some feedback. I plan on releasing another block in the near future with support for addressing and sending booleans and numbers. Please post comments below.
Blog: 08milluz.wordpress.com
LMS Shuttle: facebook.com/lmsshuttle
milluzaj
 
Posts: 31
Joined: 28 Sep 2010, 22:15

Re: RS485 NXT-G Block

Postby haydenstudios » 01 Mar 2011, 02:33

Thank you for showing such support to us NXT-G users, and enabling RS485 communication with NXT-G! For quite a few weeks, I've been thinking,"if only I could do RS485, then this would be so much easier!", and here I stand with it a reality! Although, of coarse, you had probably been working on this block for more than a few weeks :) . I've attached a demo program with this post which scratches the surface of what can and will be done with this new block. I will give feedback in two forms, one in video, and another in text.
Click here for the one in video:


Click here for the version in text which has no stuttering, or "uh"s, and includes some important details that might have gotten left out in the video:
This is just the first release, so I am looking for some feedback. I plan on releasing another block in the near future with support for addressing and sending booleans and numbers. Please post comments below.
In general, this block is awesome but to follow up on your request, I will inform you of some things, here it goes:
I am glad that you will have support for booleans and numbers in the future, that would be very useful. I had some strange glitch when trying to plug the text output plug directly into a text switch block. When I tried to do so, the NXT would only execute the code found in the tab that I set as the default. I tried plugging that string (the string that is received) into a display block, and sure enough it was displaying the number it should be. I managed to work around this bug by converting the string into a number, and feeding that number into a tab viewed number switch block. But not everybody has the text to number block installed on their system, so I don't want to have to do this every time.
It does not check to ensure the other NXT receives it. As long as the send block successfully communicates it will return an output string of 0. A non 0 output value means an error occurred.
Hmmm... Well, I tried seeing what value was displayed by the NXT when my two NXTs were not connected to each other and the output plug was plugged into a display block, and I still got a "0" then. I still don't quite understand what you were trying to say, because it sounded to me like you were saying that it doesn't check to ensure the other NXT receives the message, but it does. On the other hand, I may just be interpereting your words that way just due to my inability to understand what you meant.
At another point, I had a strange situation when first writing this demo program where the string received by the NXT would always have a lowercase, "t" added onto the end of it. For example, a "0" would change to "0t". But I did not get to further investigate this because NXT-G crashed when I was finishing it, and I had to start over. When I started over, this phenomenon was no longer occuring. But perhaps it was somehow happening because of some mistake that I was unknowingly making.
All in all, this is a great block, and I take into account that the main reason that we have all these bugs is that this is a very early version, and I hope that my feedback is helpful to you, and that it is taken as friendly criticism, and not interpereted as trolling or flaming. Thank you for bringing the RS485 capabilities to us NXT-G users. Many thanks from me, and keep it up.
Attachments
RS485 Test.zip
Here is a little demo program I made with the new RS485 block, along with a MyBlock, and another costum NXT-G block.
(625.8 KiB) Downloaded 114 times
-Hayden
User avatar
haydenstudios
 
Posts: 251
Joined: 22 Oct 2010, 20:05
Location: The United States of America

Re: RS485 NXT-G Block

Postby milluzaj » 01 Mar 2011, 16:07

Thanks for the feedback. I have no idea what the "t" thing is. I will try to reproduce that.

As for the 0 return value. When do something on the NXT you write to a register in the firmware. This block does the same thing. I dont require a reply in this block (though I am making a block that implements a communication protocol that would handle that) so all it knows is that it was written to the firmware. So in theory if there is a disconnected cable or something, it would have no idea if it got the information.


Keep the feedback coming. Also if there are any artists out there that could make a nice graphic for this (36 pixels by 36 pixels), I would be very happy. My MS Paint skills only go so far.
Blog: 08milluz.wordpress.com
LMS Shuttle: facebook.com/lmsshuttle
milluzaj
 
Posts: 31
Joined: 28 Sep 2010, 22:15

Re: RS485 NXT-G Block

Postby mightor » 01 Mar 2011, 17:24

milluzaj wrote:My MS Paint skills only go so far.

Dude, they're bloody legendary!

- Xander
| My Blog: I'd Rather Be Building Robots (http://botbench.com)
| RobotC 3rd Party Driver Suite: (http://rdpartyrobotcdr.sourceforge.net)
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)
User avatar
mightor
Site Admin
 
Posts: 1060
Joined: 25 Sep 2010, 15:02
Location: Rotterdam, Netherlands

Re: RS485 NXT-G Block

Postby haydenstudios » 02 Mar 2011, 04:33

milluzaj wrote:Keep the feedback coming. Also if there are any artists out there that could make a nice graphic for this (36 pixels by 36 pixels), I would be very happy. My MS Paint skills only go so far.
Well, I might be able to help. I have made an icon, and apllied it to the image files in the NXT-G block. In this .zip file can be found screenshots from NXT-G of what the icon looks like when applied to this block. Heres a couple now: ImageImage
In my opinion, it doesn't look too bad, but that's probably just because I am proud of my day's work. Anyway, it's pretty much all there for you in the .zip if you decide to use it. The icon, and the dragged image are there. But you'll notice that I do not know how to edit the "Config RS485.vi" file, and that the original icon is still shown in the configuration panel, so you'd have to raplace it with the "RS485configpanel.png" image that I've also included which should be pretty straight forward (if you decide to use these image files). So, if you think that these images are pathetic, and completely unsuitable for your block, then do not hesitate to say no thanks to this offer, I will not be offended at all. If you decide to use them, then GREAT!! :D
Attachments
RS485icon.zip
Here are the image files that I used when applying the icon to this block, along with a few screenshots of this block in action, and the image that I normally would have put into the configuration panel if I knew how to edit the "Config RS485.vi" file.
(258.05 KiB) Downloaded 60 times
-Hayden
User avatar
haydenstudios
 
Posts: 251
Joined: 22 Oct 2010, 20:05
Location: The United States of America

Re: RS485 NXT-G Block

Postby timpattinson » 02 Mar 2011, 09:12

I've made some graphics...
485.zip
Zip file with PNG icon and GIMP file
(4.26 KiB) Downloaded 67 times

Hope you like them
-Tim
Commit to Lego Mindstorms StackExchange Q&A http://area51.stackexchange.com/proposals/4105
Minboards IRC Channel #mindboards on Freenode
My blog: http://timpattinson.wordpress.com/
User avatar
timpattinson
 
Posts: 224
Joined: 30 Oct 2010, 04:10
Location: 127.0.0.1

Re: RS485 NXT-G Block

Postby renchiou » 02 Mar 2011, 12:11

Thanks for the great block. I tested it, If I send "12345" then send "1234567", the slave NXT shows "123456". I think it's the problem of buffer. Would you please check it? Thanks!
Attachments
rs485test.zip
RS485M for Master NXT, RS485S for Slave NXT.
(355.8 KiB) Downloaded 50 times
renchiou
 
Posts: 7
Joined: 29 Sep 2010, 14:38

Re: RS485 NXT-G Block

Postby milluzaj » 04 Mar 2011, 04:21

Thanks for the images. If you dont mine, I would love to use some of them in future blocks (and revision 2 of this one). I have a block with a protocol coming soon (similar to Xander's protocol for the xbee in robot C).

I am going to play with the buffer issue. I cant seem to replicate it, but I will keep trying. What firmware was that with?
Blog: 08milluz.wordpress.com
LMS Shuttle: facebook.com/lmsshuttle
milluzaj
 
Posts: 31
Joined: 28 Sep 2010, 22:15

Re: RS485 NXT-G Block

Postby timpattinson » 04 Mar 2011, 07:22

Hi, If it was my images you were talking about then sure you can use them
-Tim
Commit to Lego Mindstorms StackExchange Q&A http://area51.stackexchange.com/proposals/4105
Minboards IRC Channel #mindboards on Freenode
My blog: http://timpattinson.wordpress.com/
User avatar
timpattinson
 
Posts: 224
Joined: 30 Oct 2010, 04:10
Location: 127.0.0.1

Re: RS485 NXT-G Block

Postby gloomyandy » 04 Mar 2011, 09:24

Hi,
If you looking at adding a higher level protocol you may want to consider bitbus...
http://www.bitbus.org/

When I added RS485 support to leJOS I spent a fair bit of time looking around at various protocols to use and finally decided on bitbus. It seems to strike the right balance between robustness and simplicity. The packets use CRC-16-CITT error checking and the protocol allows for multiple devices and handles retransmission etc. The leJOS firmware and class libraries contain code that allows you to construct a master slave network using the name or Bluetooth address of the NXT to establish reliable connections between up to 8 devices.

Andy
User avatar
gloomyandy
 
Posts: 320
Joined: 29 Sep 2010, 05:03

Next

Return to Mindstorms Software

Who is online

Users browsing this forum: No registered users and 1 guest

cron