As Jim mentioned on the last Enginursday, visually programming is a great way to get started with Arduino and other platforms, especially if you are relatively new to coding.
We have been working with the awesome folks over at MathWorks on implementing visual programming for the RedBot, to compliment the libraries they have already created for programming Arduino boards, Raspberry Pi boards, and others. They’ve created a library for running the RedBot in Simulink, a graphical block diagram environment built on top of MATLAB. For those of you unfamiliar with MATLAB, it is a numerical computing environment that is commonly used for processing large arrays of information. It's commonly used in industry and academic settings.
Now you may be wondering why we are so excited about this. The really great thing about MATLAB is its ability to process large arrays of data quickly and efficiently. Simulink also is a great tool as it allows you to test out code and run simulations of your system to check for errors before uploading it to your hardware. What does that mean in terms of project applications? You can quickly write up a demo sketch for your system without spending your time fighting syntax errors (raise your hand if you constantly forget the final '}' or those ever elusive line-ending ';' in your sketches like I do). This MATLAB/Simulink combo will also allow you to process large volumes of sensor data coming in from your robot army, automated kegerator, or self-driving blowtorch and manipulate the data and graph it easily. For example, if you needed to do some sound processing on your board, running Fast Fourier Transforms on an Arduino can eat up onboard memory and slow down your processor (not to mention it's yet another library to include in your code). Offloading this data processing to MATLAB gives you more options for playing with the data and allows you to immediately output some awesome graphs. Check out the cool Fourier transform of our flame, using the basic code of
You could even make a 3D graph showing the path your robot took based off of the encoder and accelerometer data. Check out the demo video for a quick overview of how quick and easy the interface is for programming your RedBot. You can also access a tutorial on Simulink and Arduino here, and the download for the library is available here.
ReplaceMeOpen
ReplaceMeClose
Hopefully this will become yet another useful tool for working with the RedBot. We're hoping that the library can continue to be expanded and will become a great resource for any one working on building their own robot army.
Oh just what we need. People using this goofy MATLAB language and these Duplo-esque building-block Simulink simulators to program for an embedded robot platform -- and paying for the benefit. MATLAB is not cheap, even the academic version, and for something like this locks you into a dumbed down suite. Mathworks will no doubt charge like $300 for the benefit of using this toolkit too, and for what? To get locked into a platform that doesn't apply to any other embedded system the user may encounter, generating mediocre output that nobody else will use.
"Oh hey guys, I've got my Matlab-output for the project, let's use that, but we need to compile it on my computer, and it doesn't work with anything but this specific platform. You're fired. MATLAB is an analysis tool that Mathworks tries shoehorning into making compilable/synthesizable code and doing a bad job of it. It's just outright lazy to depend on it for your product, which includes what you load on your bot.
At the very least this project should be free and on open versions of Matlab interpreters so at least they can used (and eventually dumped) without much loss.
I would imagine that the benefit of this is for the existing Matlab owners to ease the point of entry for them to play with this kind of robots, boards etc. I don't think the primary point of this is to sell more matlab licenses, or at least that's my take on it.
That's nice, but more than half the DIY/hacking/inventing revolution is the fact that tools and products are accessible to most people -- not just pre-packaged toolkits made for esoteric market segments.
This product is entirely off the mark for deserving free advertisement on Sparkfun.
This wasn't designed to be an advertisement at all. It is simply an attempt to show students (many who are required to purchase MATLAB for school work already- including most of the engineers here at SFE) yet another tool set available to them. As posted in these comments, everyone has their own preferred method of programming, doing data processing, etc. We simply wanted to show yet another tool that is available for folks. Also, as Paul mentions in his comment, this will hopefully encourage the folks over at MATLAB to become more accepting and willing to work with the hobbyist market, and hopefully we can get to the point of having access to it similar to the LabVIEW package we carry.
I quite agree. I'm familiar with Matlab - I've taught it, in fact. However, my personal choice is Python for all of my non-teaching work. It's very versatile. I've automated a lot of laboratory equipment using Python, which includes control, data collection, and analysis, and have never felt limited by the language. And the price is right.
The drag-and-drop languages look easy to start with, but they don't scale well. (Again, my opinion - YMMV.)
You are right on the mark. The other upside to a post like this is that we are now aware of a few more open source platforms (SciLab and Octave) that we can look into as well for our customers. Feedback on stuff like this helps to open our eyes to other tools available as well.
Toni and I had a lot of fun working together on the RedBot/Simulink project. I’m Paul, Toni’s counterpart over at MathWorks. I’ve been teaching classes to introduce automating robots at maker spaces lately, and the RedBot helps make things a lot easier on students new to the field on the hardware side, while Simulink helps students new to the software side. The majority of the students at the maker spaces are not students in college, but I wanted them to keep on playing at home after the course ended. After listening to my students and others like them (including the commenters here), MathWorks is now expanding access to our tools for people outside of college who just want to play around with ideas for fun instead of profit. We’re still experimenting with our offering, so we’ve set up a survey to hear what you’d like to get out of our tools. At the moment, we’re offering the same tools that are bundled in our Student Version, at the same price: $99. You can find the application/survey here. Of course as always, students can access the Student Version on our web store.
This $99 home use thing deserves a bump! Thanks Paul and Toni.
Don't hold your breath on a low-cost version of Matlab, they've been promising that since 1998...
For a cool experiment you guys should hide the Sparkfun logo in a big picture (or outdoor photo) and use that transform as a mask. See if you can make it really pop. It should only take a couple more lines like the one that produced the Discrete FFT (not a Fourier Transform).
Hmm, that is a good idea.
Hey, if it works, do a "crop circle" and try it on a sat image :-) You could have a filter that makes them show up on Google Earth that would normally be hard to spot. OK. I need a name for this kind of promotional scheme. Plunking?
Typical FPGA comment. Simulink works with Xilinx System Generator. So, you don't need to know RTL to be able to build a system/design to run on a Xilinx FPGA. As long as you have the proper ISE/Vivado version installed that includes SysGen, you're set. There's a few Youtube videos by Xilinx that shows this.
very good point; check out mathworks.com/Xilinx to see how it works for FPGAs
Was very interesting, thanks for share mywebsite help http://www.matlabi.ir
I'm a hobby guy doing a robotics course at coursera and I hit this page while looking for code to get my arduino robot talking to Matlab. Now the Matlab license I have doesn't include Simulink but based on this video and other simulink stuff I have seen recently it does look interesting.
So to me the appeal of a tool like simulink is being able to try out a lot of ideas without being bogged down in implementation too early. Of course for producing final hardware and software you can't rely on purely visual tools(yet?) but on the way to a final design it would be 'more' fun to simulate different designs.
Being able to simulate something before I actually build it, is in fact a killer app that is worth actual money BUT If I have to build a mathematical model for each electronic component and each bit of mechanical hardware that I am ACTUALLY interested in then that is not practical in the way that say software like Eagle CAD is. Eagle CAD is not the greatest software but the internets is full of Eagle footprints and schematics and even I've made some now. It has the utility of being pervasive.
So yeah maybe Cadsoft proved that if you want to be a default standard you need to give something valuable away to get the ball rolling. Mathworks, Wolframalpha for devices and probably Autodesk will all be trying get people to make models for their software and they still might end up losing out to a good enough opensource solution that comes out of nowhere. Fun times ahead.
Adding Model based development tools is very good, but MATLAB (Aprox .4500,-USD) is not affordable, if you are student you can get a student version, (Approx. 100,USD) , it would be better with open source like Scicos, Scilab. So we can keep tinkering a reasonable affordable prices. That is why this community was able to do things. !Affordability!
Open source tools are awesome, and I wish I would have known about these options when I was a student and using MATLAB myself, even though I was still required to purchase it for class work (which leads into a whole other discussion of the affordability of the current higher education system, but that is neither here nor there). The upside to this is that the folks at MathWorks are taking a look at all of this feedback and taking into consideration everything you (the OS community) are bringing up, and are working towards being more hacker/tinkerer friendly!
I've been using MATLAB on and off for nearly 10 years. It is my absolute favorite data analysis tool. That being said...
I've never used it in conjunction with external hardware (for embedded programming or DAQ), but don't see interfacing with an arduino to be terribly intelligent. For something with such limited processing power, I see little value in using such a mathematically robust package. The arduino can't handle even 1/4 of the tasks that MATLAB would commonly be used for, and if you're going to use such a limited subset of it, why shell out the money?
Also, I don't find simulink to be that much more user friendly than textual programming. No, you don't have to worry about semicolons and brackets, but because of it's complexity I see few benefits beyond that. Personally, I avoid simulink at all costs; the few times I've had to use it for a class have been very painful compared to just programming in the standard matlab environment. If I want a graphical language (which for DAQ I usually do), I go with LabVIEW (see my previous comment on the last installment of this series). I just wish I could actually program the Arduino with it rather than using it tethered. (I haven't checked on this in a while, so if they've changed that please correct me.)
That is the great thing about the SimuLink library for the RedBot. You can program the Arduino and then disconnect from your computer. Ideally, you could then have some kind of bluetooth or wireless connection piping data back into MATLAB from your remote sensors (or, in this case, robot), and have the data processing be done simultaneously as it is being collected. There is still development that needs to be done to smooth that out, but it's on its way there!
I actually had the opportunity to do some embedded code development with Simulink at one point. In some ways it was pretty neat - the program's logic was obviously much easier to visualize, and certain pre-existing blocks simplified some tasks and made the code cleaner (i.e.: unit delay).
In other ways, however, it was incredibly frustrating: Fairly common programming constructs such as loops or decision statements were kind of weird to implement in pure Simulink, often causing me to resort to embedded blocks of MATLAB code. It also just wouldn't generate code for certain Simulink blocks from various toolboxes, which was frustrating to say the least.
So basically, the head-scratching that I saved from not having to worry about missing '}'s was now replaced by deciphering cryptic MATLAB compile-time errors and figuring out how to represent my program as a continuous block diagram. Maybe it's due to my lack of experience, but I'd be very reluctant to use Simulnk for embedded development ever again. A text editor and compiler is just so much simpler, and works just as well.
Toni, totally diggin the hair! You rock! Thanks for the demo.
Thanks! Hopefully it was informative for you :)
I always get suspicious when a company doesn't publish it's price list unless you create an account.... for the others who don't want to go through that trouble, basic price for MatLAB is $500, then an extra $200 for each of the tool boxes you are interested in. Oh, and don't forget an additional $500 for Simulink....
There is also Octave which is another MatLab clone. How complete a clone it is I don't know. There is also R, the language created for statistical work, which includes fast array processing if fast array processing is the first thing you are looking for. It also has numerous packages. MatLab offers limited licenses for the package to people taking certain courses at coursera.com. I haven't yet found out what happens at course end.
That's really cool. I didn't know about the coursera licensing. Thanks for sharing!
I have used Scilab as a replacement for Matlab in my hobby work. It is a Matlab clone. It also has something similar to Simulink. Not sure if it would be applicable for the RedBot stuff. But, surely anyone looking to do similar number crunching/analysis on a hobbysit budget, look at Scilab...totally free and open source!
Free and open-source...sounds awesome to me!
It is a rather steep price tag for a hobbyist. As I mention in the video, they are working towards a release for home use that will be similar to the student version, which will hopefully be a much more affordable option.
I wonder if their Home version would work with all Simulink capable programs (Xilinx ISE/Vivado, etc).
Hopefully!