Re: Ev3 Lego Mindstorms

0 views
Skip to first unread message
Message has been deleted

Evagret Homestead

unread,
Jul 14, 2024, 5:41:12 PM7/14/24
to raigesrivis

Lego Mindstorms is a quite good set to get into robotics while being able to use legos to construct the robot. But this set is very expensive (more than 400$). So I decided to build my own version of it with way less money and using the Lego Power Functions Set I had lying around with many other components I used. Since I got bored of building Lego cars that can only move it's the perfect project to take it to the next level. The idea is writing a file in an SD card that arduino can load, read and act accordingly to what it reads. It's an Interpreter. An Interpreter is a program that reads a file and does something when it finds a text defined as a command inside the code. For example if it is programmed to print hello when it reads hello inside a file, it will print hello on the screen whenever it finds "hello" inside the file it opened. This will be done for controlling the DC and Servo motors and do other things too.

ev3 lego mindstorms


تنزيل https://picfs.com/2yZK3L



Let's begin by assembling the circuit. It will become really messy in the end so I suggest tying wires of each module like in the second picture . But first, take the two PF (short for Power Functions) Extension cables and cut them in the half. Then solder a male-to-male wire to each of the four wires of the plug. I recommend using red for 9V, black for GND, C1 and C2 can be yellow and green, both yellow or whatever you want because these two wires are these two that can change polarity to rotate the motors in both directions while 9V and GND are for power. Then secure all the wires with insulating (a.k.a. duct) tape. Make sure that you use a dark grey plug for power from the battery box and not a light grey. After assembling the circuit as shown in pictures 3-7, what's next is the program!

This function scans all the SD card for files with the extension .PRG (as shown in the screenshot).
There is no special formating in this file, it is just a simple text.
It's just a way for arduino to know that it's a program for it to read.
Each program must have a header so that arduino has a second way to recognize programs.
Each program also has a number which is the version.
It must be the same defined on the arduino code and the .PRG file.
If the program is written for a higher version, it will not run it.
It a kind of compatibility test between code and data in file.

Last thing before program execution is syntax.
Syntax is the rules that define the combinations of symbols that are considered to be correctly structured commands and their parameters in that language.
Please read this step till the end so that you understand what's going on in the next step

The first part is the command.
Then a colon character ":" is used to seperate the command from its parameters.
Afterwards, the parameters are written without any spaces.
Finally, a semicolon character ";" is used to say the interpreter that the command ends

I am planning to build an enclosure, add sensors like ultrasonic, more commands like "IF", "LOOP".
I have already started the version 2 of this robot that will be controlled via bluetooth module and an Android application.

In this code I have some extra functions (such as the bluetooth communication) that are not finished and are not supported by the current hardware, but will be supported in Lego Hybrid V2 that is under development.

The basic idea is that kids learn the most while playing. So I was thinking: can we make a ROS setup, with a mindstorms robot, that kids can install, run and tweak. I think these elements will be important:

As I researched the product I discovered that the EV3 brick, which is at the core of the Mindstorms robots, runs on Linux. Despite that, all of the coding software distributed with the project runs on Windows, OS X, iOS, and Android. I found an open source project that allowed the EV3 brick software to be modified, ev3dev. ev3dev is an open source project that allows the Mindstorm user to create a Debian-based operating system (OS) that boots from a microSD card. Once the EV3 brick boots the Debian image, the user can interact with the EV3 via SSH using the command line in a terminal window.

David Lechner is the lead developer for the project, and I had a chance to ask him a few questions. David's background is a bachelor's degree in electrical engineering from Oklahoma State, then he spent the next eight years doing industrial automation in the water and wastewater industry. Recently, for the last four years he's been doing freelance computer programming for primarily open source projects, such as ev3dev.

I asked him how the ev3dev project got started and he said his inspiration came from a blog post by Ralph Hempel, the founder of the EV3dev project. Being a tinkerer at heart, David couldn't resist. He said, "Even though I had no idea what I was doing, I jumped right in and started learning how to write kernel drivers (I had to start with "Hello World" in C because I didn't have any experience with the language) and how to maintain Debian packages and all sorts of other things that are needed to make an operating system." Fortunately for him he was in a position that allowed him to focus his efforts on that task. It wasn't long before Ralph realized that David had more time to devote and he made him a co-maintainer of the project.

I asked David how many people are involved with the project and he said, "It's hard to say exactly. Since LEGO robots are just a hobby for most people, we have quite a few people that show up for a weekend or two and then disappear. However, I would say that we have somewhere between 5 and 10 contributors that have been with us long term." I asked him if the project would consider allowing younger people to be involved since Mindstorm robots are used in so many schools. He said, "Of course. Unfortunately, at this point in time, we don't have much to offer that is very kid-friendly for younger students. Hopefully some day. On the other hand, it would be great to work with high school and/or college students that have just a little bit of programming experience already." He said that a potential developer in the project should not be frightened by lack of experience as he himself was very inexperienced when he got involved with ev3dev.

David said he enjoys working with students and has taught some after-school NXT robotics classes. He is currently serving as a coach of a First LEGO League team. I asked him what his most pressing needs are in the short term, and he said, "I would really like to see some other contributors that are willing to spend a significant amount of time making ev3dev better before the next generation LEGO Mindstorms robot comes along and everyone moves on to that. Perhaps some university students could make some aspect of ev3dev their senior design project, or companies that develop Mindstorms-compatible products could adopt ev3dev as a platform instead of developing their own."

When asked about his longterm goals, he said, "I would like to get our hardware drivers into the mainline Linux kernel. Jason Kridner (of BeagleBone) and Greg Kroah-Hartman (of The Linux Foundation) have been pushing me to do this in the short term. But, there is quite a bit to be done to even get the EV3 bootable from the mainline Linux kernel before we even get to the ev3dev-specific bits." David encourages users of ev3dev to try it and let the project know how they can improve, and let them know ideas that will yield iterations to the project.

To get started with your own ev3dev experience you need a LEGO Mindstorms Home or Education kit, the EV3 brick, and a 2GB or larger microSD card. Go to the ev3dev website and download the latest Debian Jessie image file. Download Etcher for your particular operating system to transfer the image to your microSD card, then after the image is on your card insert it into your EV3 and power on the unit. Follow the directions on the ev3dev website. Connect to the EV3 with the USB cable that comes with your kit and start having some fun.

My kids are in a first lego league. I wish they have a version of the mindstorm software that ran on Linux. It really frustrates me that Lego felt Linux was good enough to run their robots but they didn't feel the need to give back to the community by supplying a version of mindstorm for Linux.

Opensource.com aspires to publish all content under a Creative Commons license but may not be able to do so in all cases. You are responsible for ensuring that you have the necessary permission to reuse any work on this site. Red Hat and the Red Hat logo are trademarks of Red Hat, Inc., registered in the United States and other countries.

The biggest option the Lego community keeps asking for is face detection. If there was a Lego version of OpenMV with face detection, colour blob tracking and line following it would be the best Lego machine cam on the market.

I think that if OpenMV was to make a Lego Labview interface that it could sell a lot of cams to the Lego community at a slightly higher price to cover the cost of developemnt to the lego version.

Obviously the OpenMV software side of this is only writing a short script to make these features available as a slave to the Lego EV3 brick (Lego processor). The OpenMV hardware will be just make a case with lego attachment holes and also a lead to interface bewteen the OpenMV and the EV3 brick.

Some info on the Lego mindsorms EV3 platform. It is a Linux OS that runs a Lego virtual machine that auto boots a Lab view programming environment. see the EV3 developer tool kit at the bottom of this page -us/mindstorms/downloads

I do know 1 of the guys that maintain EV3DEV which is a alternative Linux OS for Lego EV3 that allows you to program the EV3 brick in Python, this guy loves machine vision and I have already showed him your cam and he was excited and though it would be great fro Lego.

Today I finally got some time to play with the new LEGO Mindstorms EV3. I upgraded my R2-D2 model so that it can now turn its head. This was possible due to the small new motor that comes with the set. EV3 has four inputs and four outputs. But the box unfortunately only contained three motors and three sensors. I also noticed that several very basic LEGO Technic parts, such as the 3/4 connector pin, are not included. On the plus side, there are several 36 Tooth Double Bevel Gears. The EV3 comes loaded with some programs, one of them being an Infrared controller software. I was able to use it directly to control two motors of R2-D2.

03c5feb9e7
Reply all
Reply to author
Forward
0 new messages