View unanswered posts | View active topics It is currently Tue Oct 21, 2014 9:43 am






Reply to topic  [ 7 posts ] 
Blue tooth communication 
Author Message
Rookie

Joined: Tue Jan 07, 2014 1:27 pm
Posts: 1
Post Blue tooth communication
Is it possible to communicate between two NXT bricks using an NXT cable to send and receive information? Does anyone have a sample of this? it looks like the xBee will be a great long term solution, but I need to get something hacked to together that I can later convert over to a wireless xBee communication methodology. Any pointers would be appreciated.


Tue Jan 07, 2014 1:35 pm
Profile
Online
Site Admin
Site Admin

Joined: Thu May 24, 2012 12:15 pm
Posts: 591
Post Re: Blue tooth communication
Have you considered using the built-in bluetooth adapters to connect the two NXT bricks together wireless? We have a full setup guide on our wiki (http://www.robotc.net/wiki/Setting_up_B ... NXT_Bricks) that can help walk you through the process, as well as a listing of ROBOTC Bluetooth functions to get you started with the programming (http://www.robotc.net/wiki/NXT_Functions_Bluetooth).

_________________
Check out our Blog! And our Facebook page!
Need help? Take a look at our Wiki and our Forums.

I just met you,
And this is crazy,
But here's my code now,
So fix it, maybe?
~ Carly Rae Jepsen parody


Thu Jan 09, 2014 12:16 pm
Profile
Guru
User avatar

Joined: Sat Mar 01, 2008 12:52 pm
Posts: 1030
Post Re: Blue tooth communication
John,
it would be really great if you could provide us with a sample program for a quick-as-possible-polling of all the slave's sensors (perpetually or on demand, including slave encoder readings) and commanding all the slave's motors (intermediately, on demand) by the master NXT... (via rs485 or via BT)

It should make all slave I/Os accessable just as if they were local on the master, sort of mimic "daisy chaining" which is currently provided by the EV3 Lego software for up to 4 EV3s

8-)

_________________
regards,
HaWe aka Ford
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;task main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PutPixel(x,y);}}}while(1)}


Thu Jan 09, 2014 1:12 pm
Profile
Guru
User avatar

Joined: Sat Mar 01, 2008 12:52 pm
Posts: 1030
Post Re: Blue tooth communication
... Earth Control to Robomatter ...?

_________________
regards,
HaWe aka Ford
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;task main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PutPixel(x,y);}}}while(1)}


Wed Jan 15, 2014 8:32 am
Profile
Site Admin
Site Admin

Joined: Wed Jan 24, 2007 10:42 am
Posts: 613
Post Re: Blue tooth communication
Robomatter here... It's a little fuzzy as of late... maybe slowly moving to new web servers will help.

ROBOTC supports the RS-485 method of communicating. This is what we use for our XBee Projects (http://www.robotc.net/firewiki). That method uses two wireless Xbee Radio's using Dexter Industries's "NXTBee Adapter" (cool sidebar: John at Dexter Industries actually designed the NXTBee for us originally for a project we were doing!)

One of the cool thing you can do though is replace your Xbee radios and just throw a normal NXT sensor cable between Sensor Port 4 on a pair of NXTs and do the same serial communication between those. Using that and your own custom serial protocol, you can easily make a program that will read/control sensors and motors on another brick. We have some examples on how to get started and an easy to use Xbee/RS485 library included with ROBOTC (just add #include "XbeeTools.h" to your program) to access the commands covered in the "firewiki".

It's no fun if we give you guys all of the code needed for your projects - plus we have other important things to do... like finish working on EV3 :)

_________________
Timothy Friez
ROBOTC Developer - SW Engineer
tfriez@robotc.net


Wed Jan 15, 2014 4:57 pm
Profile
Guru
User avatar

Joined: Sat Mar 01, 2008 12:52 pm
Posts: 1030
Post Re: Blue tooth communication
thank you, but I don't have xbees.
I just wanted to do it just via rs485 (S4-S4) or preferably via BT as one won't waste another precious NXT sensor port - or both all at once, connecting 1 master to 1 BT slave and to 1 other rs485 slave.

I actually thought that after 7 years of NXT life there should be easy and powerful communication APIs providing message control protocols like. e.g.,
Code:
    RemoteSetSensor(char conntype, long netID, char port, char SensorPortType); // SensorPortType: ADC_TYPE or I2C_TYPE
    RemoteGetSensor(char conntype, long netID, char port, long SensorType, long * values[] );   // pointer to the sensor value / array
    RemoteGetEncoderCounter(char conntype, long netID, char port, long * value );
// usage:
    RemoteSetSensor(rs485, 1, S1, ADC_TYPE );  // via rs485: config at slave #1: ADC sensor at S1
    RemoteSetSensor(rs485, 1, S2, I2C_TYPE );  // via rs485: config at slave #1: I2C sensor at S2
   
    RemoteGetSensor(rs485, 1, S1, SENSOR_LEGO_TOUCH, touch_reading);      // via rs485: read at slave #1: Touch Sensor value at S1
    RemoteGetSensor(rs485, 1, S2, SENSOR_LEGO_USNXT, USS_reading);        // via rs485: read at slave #1: US Sensor value at S2

    RemoteGetEncoderCounter(rs485, 1, motor_C, counter);    // via rs485: at slave #1: read motor rotation counter of motor_C (e.g., OUT_BC optional)

An underlying (already implemented and integrated) RobotC network protocoll should make it MT-safe and should protect from data collision, data loss, and data corruption.
It could be something like the bitbus protocoll which is implemented by Java/LeJos, but this of course requires RobotC firmware changes.

for using BT instead of rs485, just the data transmission mode and the slaveID will have to be exchanged in the function call:
Code:
    RemoteGetSensor(BT, 2, S1, SENSOR_LEGO_TOUCH, touch_reading);      // via BT: read at slave #2: Touch Sensor value at S1


analoguously there should be advanced remote motor command already available by the firmware, e.g.

Code:
    RemoteOnMotor(BT, 2, port , pwr);  // via BT:  at slave #2: motor ON at port (A,B,C,D) with pwr(-100...0...+100)
    RemoteBrake(BT, 2, port );  // via BT:  at slave #2: motor off and brake at port (A,B,C,D)
    RemoteCoast(BT, 2, port );  // via BT:  at slave #2: motor off and coast at port (A,B,C,D)

    RemoteRotateMotorDegrees(BT, slaveID, port, degrees, pwr)  // via BT:  at slave #2: motor ON at port (A,B,C,D) for (degrees) with pwr(-100...0...+100)
// e.g.,
    RemoteRotateMotorDegrees(BT, 2, motor_A, 3600,   80)   // via BT:  at slave #2: motor ON at motor(A) for 3600 degrees with pwr=80



I was looking for code using NXT-networking like this and expected to be published and available meanwhile.

BTW, for the EV3 via USB the user API could look quite similar!
Code:
RemoteGetSensor(USB, 3, S1, SENSOR_LEGO_TOUCH, touch_reading);      // via USB: read at slave #3: Touch Sensor value at S1


But first of all the BT and rs485 comm protocol APIs would be needed for my last 3 NXTs I've got!

_________________
regards,
HaWe aka Ford
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;task main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PutPixel(x,y);}}}while(1)}


Wed Jan 15, 2014 5:43 pm
Profile
Rookie

Joined: Fri Jan 10, 2014 5:36 am
Posts: 1
Post Re: Blue tooth communication
I don,t know about this but thanks for the post

play free online pokies


Wed Feb 05, 2014 7:46 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 7 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.