View unanswered posts | View active topics It is currently Wed Jul 30, 2014 8:55 pm






Reply to topic  [ 6 posts ] 
Using new NXT sensors from Lego? 
Author Message
Rookie

Joined: Tue Nov 20, 2007 4:26 am
Posts: 6
Post Using new NXT sensors from Lego?
I've just started using RobotC (only downloaded it yesterday!). Today I ordered the 3 new sensors for the NXT from the Lego online shop - Colour sensor, Compass sensor and Accelerometer. Do I need an update for RobotC to use these sensors in my programs, or do they use existing drivers (i.e. are they made for Lego by HiTechnic or Mindsensors, for example?)
Alternatively, can I just poll any generic sensor, including homebrew and just establish the input range of the sensor empirically?

_________________
Ruth


Tue Nov 20, 2007 4:36 am
Profile
Expert
User avatar

Joined: Fri Nov 09, 2007 4:51 am
Posts: 121
Location: Hungary, Europe
Post Hitechnic
Hi,

In my best knowledge Lego sells Hitechnic's sensors. You may want to check individual sensor pages on http://www.hitechnic.com for coding examples.

RobotC 1.10 distribution contains also more examples on on how to use hitechnic sensors. Loop up the samples in the installation directory which is by default:

C:\Program Files\Robotics Academy\ROBOTC for Mindstorms\Sample Programs\NXT

and check the following examples:

Nxt Hitechnic Accelerometer.c
HiTechnic Gyro.c
Compass Sensor Driver.c
Compass Sensor.c
I2C Coding Examples.c

You may also want to see (almost) on-line the results (on the PC screen): just include some lines from the NXT DebugStream Test.c program but use writeDebugStream function instead of debugPrintLine. The latter would simply add a CR/LF at the end of the string before printing but there seems to be a minor compiler bug here.

Good luck!


Tue Nov 20, 2007 6:39 am
Profile
Rookie

Joined: Tue Nov 20, 2007 4:26 am
Posts: 6
Post 
Thanks for that information. I should have worked my way through the examples before asking! Much appreciated.

_________________
Ruth


Tue Nov 20, 2007 6:44 am
Profile
Expert
User avatar

Joined: Fri Nov 09, 2007 4:51 am
Posts: 121
Location: Hungary, Europe
Post Re: accelerometer
Never mind. I'm also a newbie with RobotC, installed the trial a week ago and asking couple of questions.

I have bougth gyroscopic and accelerometer sensors directly from hitechnic and made some measurents with them. They seem to be working fine, I need just a few more days to get familiar with them.

If you do not know much about on accelerometers you can find loads of information on them on the internet (use "inertial sensor" as search key), e.g.

http://www.eecs.berkeley.edu/~boser/pub ... slides.pdf

There is a tiny (microgramm-size) mass within the sensor, "hanging" on (piezoelectric) springs. When sensor housing is moved the mass follows it with a little delay. The change in the masses position results in changed capacity and measured as acceleration.

Be careful: mechanical shocks -- like dropping sensor the onto a hard surface -- might break the micromechanical circuit within the sensor while a similar drop of a light sensor will not yet harm the electronics. I usually work with these sensors over a carpet, you know, just in case.


Tue Nov 20, 2007 7:32 am
Profile
Moderator
Moderator
User avatar

Joined: Wed Jan 31, 2007 3:39 am
Posts: 299
Location: San Diego, California. USA
Post 
Hi Ruthmachie

Elemes is dead on, the code examples that come with RobotC should work great for the sensors you bough. You can also use the sensors like a sonar sensor, in sonar centimeters mode.

The sample code uses the sensors in I2C mode, the only really important difference would be that I2C mode gives you more control over the sensor and allows multiple sensors on 1 port. Using the senor in sonar mode is much more convenient and easy to use however.

Good luck with your new sensors, I'm jealous! lol B-)

Scott

_________________
Mmmm Legos B-)

My Robot Projects:
http://www.freewebs.com/robotprojects/


Tue Nov 20, 2007 9:25 pm
Profile WWW
Rookie

Joined: Tue Nov 20, 2007 4:26 am
Posts: 6
Post 
Thanks, everyone, for the helpful replies. Now I just have to wait for the postman ;-)

_________________
Ruth


Mon Nov 26, 2007 5:16 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 6 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


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.