Lego Mindstorms NXT working on solar energy

Discussion specific to projects ideas and support.
wildman09
Posts: 9
Joined: 21 Dec 2010, 13:19

Lego Mindstorms NXT working on solar energy

Post by wildman09 »

Hello,

I'm a student from The Netherlands. I'm in Gymnasium 6 (VWO 6) and have a assignment. I'm making a Lego Mindstorms NXT which is working on solar energy.

The robot needs to detect the highest light source and drive to it so the robot can "recharge" himself. We have equipped 3 solar panels on the robot and are using 4 Lego Mindstorms Light sensors.

But I have a problem. I don't know exactly how to program this. How can the robot detect the highest light source and drive to it?

I think the program needs to compare the 4 Lego light sensors and go to the direction where the robot measures the highest light intensity. But how?

I hope somebody can help me.

Thanks,
Wildman
([email protected])
dad-and-adam
Posts: 26
Joined: 12 Oct 2010, 08:19

Re: Lego Mindstorms NXT working on solar energy

Post by dad-and-adam »

Hi wildman09,
A good technique is to do programming in small steps.
Step 1 might be: Display the sensor values on the NXT screen.
Step 2 might be: Point the robot (by hand) in various directions and observe the sensor values.
Step 3 might be: Have the robot rotate in place (using the motors) while displaying the sensor values.
Step 4 might be: Have the robot stop rotating when pointing at the highest sensor value.
Step 5 might be: Drive forward (toward the light).
Step 6 might be: Stop occasionally and rotate in place to verify the direction is still toward the highest sensor value.
Step 7 might be: Stop before it runs into the light.

What programming language are you using?

Dave
wildman09
Posts: 9
Joined: 21 Dec 2010, 13:19

Re: Lego Mindstorms NXT working on solar energy

Post by wildman09 »

Hi Dave,

Thanks for your comment. That is very useful.

One comment, I don't want the robot to rotate. It needs to measure (continual) during driving and adjust the driving direction. It needs to measure and compare the values and choose the direction with the highest light intensity (using 4 light sensors, Lego).

I'm using the programming language provide with the Lego Mindstorms: Lego mindstorms NXT 2.0 (programming software).

Thanks,
Wildman
dad-and-adam
Posts: 26
Joined: 12 Oct 2010, 08:19

Re: Lego Mindstorms NXT working on solar energy

Post by dad-and-adam »

Now I am starting to understand.
Is it correct that the four sensors are fixed to the vehicle and point in different directions?
If so, what is the angle between the four light sensors?
Is it 90 degrees (so the sensors "look" in all directions)?

Have you been able to determine what small steps are needed to lead to the final solution?

The Lego language is also known as NXT-G. I believe the "G" stands for "graphical".

Dave
wildman09
Posts: 9
Joined: 21 Dec 2010, 13:19

Re: Lego Mindstorms NXT working on solar energy

Post by wildman09 »

Yes, that is correct. The angle between the four sensors are 90 degrees (the sensors "look" in all directions).

"Have you been able to determine what small steps are needed to lead to the final solution?"
You mean, how to program it or?

"The Lego language is also known as NXT-G. I believe the "G" stands for "graphical"."
I didn't know that. Thanks.

Thanks,
Wildman
dad-and-adam
Posts: 26
Joined: 12 Oct 2010, 08:19

Re: Lego Mindstorms NXT working on solar energy

Post by dad-and-adam »

"Have you been able to determine what small steps are needed to lead to the final solution?"
You mean, how to program it or?
Before programming, it must be known what is desired. So a list of small steps generally comes first, and then programming is done to accomplish each step. Each step should be tested and refined before moving on to the next step.

So have you been able to determine a list of small steps? Have you been able to program any of them? If you have made some progress, could you share your list and where you get stuck?

Dave
wildman09
Posts: 9
Joined: 21 Dec 2010, 13:19

Re: Lego Mindstorms NXT working on solar energy

Post by wildman09 »

Step 1: Start the program, by pressing a button on the Lego Mindstorms (done)
Step 2: The robot needs to measure the light intensity (from the four Lego light sensors, which are in 90 degrees of each other) (trying, but stuck)
Step 3: The robot needs to compare the measured values. (trying, but stuck how to compare all the four sensors. I can't find where you can compare four values.)
Step 4: The robot needs to find the highest sensor value. (trying, but stuck how to find the highest value)
Step 5: Drive toward the light source.
Step 6: Keep measuring and compare the measured sensor values.
Step 7: If the new sensor values are higher then the old (highest) sensor value adjust the direction.
If the new sensor values are lower then the old (highest) sensor value keep driving the same direction.
Step 8: Stop the program, by pressing a button on the Lego Mindstorms (done)

These steps should the robot do.

Wildman
dad-and-adam
Posts: 26
Joined: 12 Oct 2010, 08:19

Re: Lego Mindstorms NXT working on solar energy

Post by dad-and-adam »

Hi,
There is an excellent NXT-G tutorial at http://www.ortop.org/NXT_Tutorial/
It covers a lot a basics like reading sensor values and how to have the program make decisions. That tutorial may help you get further along. Let us know if you are still stuck.

Dave
wildman09
Posts: 9
Joined: 21 Dec 2010, 13:19

Re: Lego Mindstorms NXT working on solar energy

Post by wildman09 »

I have had some help and made this program (see print screens).

http://img220.imageshack.us/img220/1993 ... 1from3.jpg
http://img841.imageshack.us/img841/639/ ... 2from3.jpg
http://img211.imageshack.us/img211/2108 ... 3from3.jpg

Tips/Suggestions/Idea's/Comments are welcome :D

Thanks,
Wildman
dad-and-adam
Posts: 26
Joined: 12 Oct 2010, 08:19

Re: Lego Mindstorms NXT working on solar energy

Post by dad-and-adam »

Wow. You have made a lot of progress in one day.
Have you been able to test the program? Does it accomplish the desired task?

Dave
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests