Lots o' Lego Mindstorms...
- Posted: Jan 08, 2016 at 6:00AM
Did you get a Lego Mindstorms during the holidays? Today we've got two posts just for you. One to help you teach others about it and the other to hook it up to the cloud...
First Friend of the Blog, Ed Price has some great advice to those looking to teach with the Lego Mindstorms.
Teachers, School Staff, Curriculum Providers, Home School Staff, and Other Student Trainers,
Do you teach (or help train students on) Lego Mindstorms EV3? Do you want to chat with Microsoft engineers about it, as well as teachers who are also teaching Lego Mindstorms, all around the world? Do you want to learn from all of us, bounce ideas off of us, and collaborate on new ideas?
Do you want free software that helps you teach actual syntax/text-based coding for Lego Mindstorms robots? Do you want to help your students take it up a dozen notches toward a career and future in technology?
Microsoft wants to help you.
We want to give you free curriculum. We want to give you free support, tools, and software.
Heck, if you're teaching high school computer science, we even want to help put an actual engineer in your school to directly help you teach it! And if you have girls in your school, we want to connect them with Microsoft women engineers for mentoring and invite them to an on-site training opportunity!
We even want to get you and the teachers in your school trained up in how to use OneNote for Education, Office 365, Windows, Microsoft Surface, and/or anything else from Microsoft that you need training on.
And we want to do it with real relationships. Where you can ping us at any time and get what you need. We're always there. You know us by name. Where you know our passions, and we know yours. We are ready to help you.
The only thing missing... is you!
Please join us:
We're here to help you train the next generation of engineers and industry leaders! We want to support you as you teach computer science and robotics!
Microsoft is all in.
Have a good bye!
- Ninja Ed
The next post is also from a Friend of the Blog, Laurent Ellerbach, who shows us all how to connect to the Azure IoT Hub...
Recently, I’ve played with node.js and Azure IoT Hub. You can see my previous blog posts here, here and here. And as I’m a huge fan of Lego, I’ve decided to connected my Lego Mindstorms ev3 (the new version of NXT) to Azure IoT Hub. Well, at the end of the day, the ev3 is just a 32-bit ARM9 processor, Texas Instrument AM1808 cadenced at 300MHz. The main OS is Linux and it does have 1 USB port and 1 SD card reader. It does allow to boot on an SD card another OS so you don’t have to flash the main one. and on the USB port, you can plus a wifi dongle.
Setup the Mindstorms ev3
I already used the excellent monobrick to run C# code on the brick and it was working perfectly. Now my challenge was to run node.js and connect it to Azure IoT Hub. So I looked quickly at various available images and found quickly the ev3dev one.
So I’ flashed a 4Gb SD card and booted on it. Just follow the steps on the ev3dev site to flash the SD card. I’m using a very cheap wireless dongle, an Edimax. It does cost less than 10$/€ and it’s very small, so easy to add to the brick. It does connect at 150Mb max but you really don’t need to have more on the brick!
Time to boot the brick using ev3dev. I’m using an external power supply so I’m not consuming batteries and I do recommend to do it while running all those tests. It is very convenient during the development and test phase. Later you can of course run on batteries.
Setup the development environment
I’ve decided to go for Visual Studio. You can get a free version of Visual Studio Community here. I’ve installed as well the needed tools as explained in my blog post here. If you prefer you can go as well for Visual Studio Code which you’ll find here. It does work perfectly as well.
Deploy the solution on the brick
To deploy the solution, it’s just about creating a directory and copying the needed files on it. This time I used WinSCP for this. I’ve created a nodeNXT directory in /home and deployed the files there. Just copy the generated server.js and package.json file.
Some code to upload data
Now here is some code to play with. This is a very basic code but shows all what you need to get data from sensors and upload them in Azure IoT Hub:
And voilà we made it. The Lego Mindstorms ev3 is now connected to Azure IoT Hub using node.js and able to send data to Azure.
Bottom line: when you have sources of and SDK, don’t be afraid to adapt, change and modify what you need for your own platform. I did it with the Azure IoT SDK because my node.js version was too old to fully run it. And I did it with the ev3dev package as it was outdated and there were couple of bugs in it.