Gyroscopic sensor and others

I was wondering if you might have some libraries for some other sensors for the NXT. In particular the Gyroscopic sensor, Accelerometer sensor, and the Angle sensor.

I’m trying to make an inverted pendulum with the arduino,

Thanks

Hello, we don’t have any of those sensors, but they shouldn’t be too bad to create libraries for. Are those official LEGO sensors or from a third-party company? If you post links to those, we can probably work together to figure it out.

Update:

Is this the angle sensor you mentioned? http://www.mindsensors.com/ev3-and-nxt/17-glidewheel-as-angle-sensor-for-nxt-or-ev3 If so, their user guide mentions the details of the interface on the last page: http://www.mindsensors.com/pdfs/AngleSensor-User-Guide.pdf It wouldn’t be too difficult to make a new library to handle that.

Sorry, I should have included the link.

https://www.hitechnic.com/cgi-bin/commerce.cgi?preadd=action&key=NGY1044

Thanks

Cool, it looks like the NXT Gyro Sensor from Hitechnic behaves like a light sensor. You should be able to use the https://github.com/wayneandlayne/BricktronicsLight library to at least query the raw data values from the gyro sensor.

Great, thank you very much

Let us know how it goes, and we’re more than happy to help out if you get stuck. If you get it working really well, we’d love to hear the details and even make an official Bricktronics library out of it.

Will do, Still working on learning to make things work the way I want them to. But I need to have this done within a month. I’m using your product for a class I’m helping with at UW Tacoma, Wa. It’s a Controls class for Computer Engineers. I’m hoping they like it as much as I think they should :slight_smile:

Can you put out an updated guide for the Jumper configuration for the Megashield, please? Running the Light example, I’m not getting any reaction from the sensor. First thought is jumper config, Your thoughts?

Sure thing. The light sensor example sketch mentions that pins 2-3 and 4-5 should be jumpered for the light sensor:

// 2. With a Bricktronics Megashield - Include these lines but do not
// call BricktronicsShield::begin() in the setup() function below.
// Select the sensor port for the light sensor (SENSOR_1 through SENSOR_4) below.
// Use the jumpers to connect pins 2-3 and 4-5 for the light sensor.

I really should update the website now that we support more than three sensors…

I completely missed that, I’m sorry. Thank you for getting back so quick

No worries, the example sketches have an awful-lot of text on them :-p since they are supporting three different configurations in one file.

So the BricktronicsLight library works like you though. THanks

Excellent, let us know how the other sensors go and we’ll help out if we can.

I may have been a little hasty in my reply. Yes, I can get some number from the sensor, but they do not seem like very usable numbers. I t will show the starting value and when it gets tilted in one of the two directions, sometimes it will register values like you would thing, sometimes not. But no mater the angle it’s held at it quickly reverts to the “home” value. Any thoughts or suggestions?

I think that might be how gyroscope sensors work. If I remember correctly I think they measure the “instantaneous rotation” experienced each unit of time. From the sensor’s website it looks like 40 is the center “home” value, and as you rotate the device it will report a number larger or smaller than 40 to represent the current rate of rotation. Does that match what you’re observing?

For your segway balancing robot, I think this sensor would be most useful for measuring the current rate of rotation (how quickly you are rotating one way or the other), but not very useful for measuring the current angle (how far the robot is tilted away from straight-vertical). Does that seem like a reasonable interpretation of what you’re doing? If not please let me know.

Yes it is correct, I have the angle sensor also but did not plan to use it just yet. The values I’m seeing are not the 40 but the actual value is not important, just have the usable values. I think I will have to do a little more homework on this and some more testing to see what I can do. If it is instantaneous from unit to unit, then that seems to match what I have seen today. I’ll work with it more and get back to you next week. Thanks for the help

Hey, I am trying to build a self balancing robot by using NXt gyroscope and its motors on Arduino mega 2560. Could you please help with some materials

Hi Shoriya14, thanks for the post, and welcome to the W&L discussion board!

What sort of sensors are you planning to use? The Bricktronics hardware and software don’t support any gyroscope sensors, at least not yet, but we can maybe help you figure it out if you can provide some more details.