open the door of embedded systems to iot! mruby on lego mindstorms (r)
DESCRIPTION
mruby is lightweight implementation of the Ruby language, and it will encourage embedded system programmers to open the door to IoT (Internet of Things).TRANSCRIPT
![Page 1: Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)](https://reader033.vdocuments.us/reader033/viewer/2022052900/5561573ad8b42a857d8b53ff/html5/thumbnails/1.jpg)
Open the door of embedded systems to IoT (the Internet of things) !
mruby on LEGO Mindstorms EV3 ®
Takehiko YOSHIDA@chihayafuru
![Page 2: Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)](https://reader033.vdocuments.us/reader033/viewer/2022052900/5561573ad8b42a857d8b53ff/html5/thumbnails/2.jpg)
Agenda
Self-introduction What's LEGO Mindstorms◦ Standard Programming Environment
◦ Extended Programming Environment (ev3dev)
Can we use mruby in embedded systems?◦ Example of a light sensor for Mindstorms RCX
◦ APIs for EV3s color sensor implemented with mruby
Concluding Remarks Demonstration of the "RUBY JINJA"
![Page 3: Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)](https://reader033.vdocuments.us/reader033/viewer/2022052900/5561573ad8b42a857d8b53ff/html5/thumbnails/3.jpg)
Self-introduction
I'm from Matsumoto city, Nagano.
I work in a manufacturer of information-related equipment as a programmer.
Takehiko YOSHIDA@chihayafuru
![Page 4: Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)](https://reader033.vdocuments.us/reader033/viewer/2022052900/5561573ad8b42a857d8b53ff/html5/thumbnails/4.jpg)
A hierarchy ofa Japanese manufacturing industry
Samurai
Farmer
Artisan
Trader
Mechanical Engineer
Electrical Engineer
Software Engineer
![Page 5: Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)](https://reader033.vdocuments.us/reader033/viewer/2022052900/5561573ad8b42a857d8b53ff/html5/thumbnails/5.jpg)
What's LEGO Mindstorms
Educational Tool > Toy
STEM education◦ Science
◦ Technology
◦ Engineering
◦ Mathematics
![Page 6: Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)](https://reader033.vdocuments.us/reader033/viewer/2022052900/5561573ad8b42a857d8b53ff/html5/thumbnails/6.jpg)
History of LEGO Mindstorms
1st gen.Mindstorms RCX
2nd gen.Mindstorms NXT
3rd gen.Mindstorms EV3
Release DATE 1998 2006 2013
CPUH8
16MHzARM7
48 MHzARM9
300 MHz
RAM 32 KB 64 KB 16 MB
![Page 7: Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)](https://reader033.vdocuments.us/reader033/viewer/2022052900/5561573ad8b42a857d8b53ff/html5/thumbnails/7.jpg)
Standard Firmware Architecture
OS (Linux)
SystemProgram
Device driver (kernel module)
VM (Virtual Machine)
UserProgram
DirectCommand
![Page 8: Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)](https://reader033.vdocuments.us/reader033/viewer/2022052900/5561573ad8b42a857d8b53ff/html5/thumbnails/8.jpg)
Extended Firmware
ev3dev◦ full Debian 7 (wheezy)
Linux Distribution.
◦ customized for the LEGO MINDSTORM
EV3 controller.
◦ Bootable from microSD/SDHC card
Available Programming Language
C / C++
Python
JavaScript (Node.js)
Lua
Go
Ruby
![Page 9: Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)](https://reader033.vdocuments.us/reader033/viewer/2022052900/5561573ad8b42a857d8b53ff/html5/thumbnails/9.jpg)
What's mruby ?
mruby is the lightweight implementation of Ruby language complying to (part of) the ISO standard. Its syntax is Ruby 1.9 compatible.
mruby can be linked and embedded into your application.
https://github.com/mruby/mruby
![Page 10: Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)](https://reader033.vdocuments.us/reader033/viewer/2022052900/5561573ad8b42a857d8b53ff/html5/thumbnails/10.jpg)
Can we use "mruby"in embedded systems ?
Real-time constraint• Can mruby meet the deadline ?• A process of GC (Garbage Collection)
deactivate other interrupts.
![Page 11: Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)](https://reader033.vdocuments.us/reader033/viewer/2022052900/5561573ad8b42a857d8b53ff/html5/thumbnails/11.jpg)
An example of a light sensor for1st gen. Mindstorms RCX
LED Light
Photo Detector
![Page 12: Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)](https://reader033.vdocuments.us/reader033/viewer/2022052900/5561573ad8b42a857d8b53ff/html5/thumbnails/12.jpg)
Circuit diagram of general light sensor
Signal
Power
Common
Out
In
LED
Photodiode(Photo Detector)
![Page 13: Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)](https://reader033.vdocuments.us/reader033/viewer/2022052900/5561573ad8b42a857d8b53ff/html5/thumbnails/13.jpg)
Connector of Mindstorms RCX
![Page 14: Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)](https://reader033.vdocuments.us/reader033/viewer/2022052900/5561573ad8b42a857d8b53ff/html5/thumbnails/14.jpg)
Circuit diagram of the RCX’s light sensor
Signal
Power
Common
Out
In
![Page 15: Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)](https://reader033.vdocuments.us/reader033/viewer/2022052900/5561573ad8b42a857d8b53ff/html5/thumbnails/15.jpg)
Waveforms of a signal voltage from the Light Sensor for RCX
Oscilloscope
reflected light is strong reflected light is weak
![Page 16: Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)](https://reader033.vdocuments.us/reader033/viewer/2022052900/5561573ad8b42a857d8b53ff/html5/thumbnails/16.jpg)
delay of programmed cycle
![Page 17: Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)](https://reader033.vdocuments.us/reader033/viewer/2022052900/5561573ad8b42a857d8b53ff/html5/thumbnails/17.jpg)
Color Sensor API with mruby for Mindstorms EV3
![Page 18: Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)](https://reader033.vdocuments.us/reader033/viewer/2022052900/5561573ad8b42a857d8b53ff/html5/thumbnails/18.jpg)
Initializer of Color sensor
Ev3Color.new(port)
port : "in1", "in2", "in3" , "in4"
![Page 19: Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)](https://reader033.vdocuments.us/reader033/viewer/2022052900/5561573ad8b42a857d8b53ff/html5/thumbnails/19.jpg)
Connector of Mindstorms EV3
![Page 20: Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)](https://reader033.vdocuments.us/reader033/viewer/2022052900/5561573ad8b42a857d8b53ff/html5/thumbnails/20.jpg)
3 modes of Color Sensor
Ev3Color#mode=(mode)
EV3Color.Mode.COL-REFLECTEV3Color.Mode.COL-AMBIENTEV3Color.Mode.RGB-RAW
![Page 21: Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)](https://reader033.vdocuments.us/reader033/viewer/2022052900/5561573ad8b42a857d8b53ff/html5/thumbnails/21.jpg)
Evolution of Mindstorms
Intelligent
Brick
Light
Sensor
1st gen.
Mindstorms RCX
2nd gen.
Mindstorms NXT
3rd gen.
Mindstorms EV3
ANALOG
ANALOG
DIGITAL
![Page 22: Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)](https://reader033.vdocuments.us/reader033/viewer/2022052900/5561573ad8b42a857d8b53ff/html5/thumbnails/22.jpg)
Concluding Remarks
What is mruby suitable for ?
What is mruby NOT suitable for ?
![Page 23: Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)](https://reader033.vdocuments.us/reader033/viewer/2022052900/5561573ad8b42a857d8b53ff/html5/thumbnails/23.jpg)
What is mruby NOT suitable for ?
Reaching a hardware limit under software control.
Be willing to work in the background of mechanics and electronics, and struggle with C/C++, assembly language.
![Page 24: Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)](https://reader033.vdocuments.us/reader033/viewer/2022052900/5561573ad8b42a857d8b53ff/html5/thumbnails/24.jpg)
What is mruby suitable for ?
High-functional / Multi-functional electric devices
Newly-developed Cloud servicesCreating new value with mashup technology
![Page 25: Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)](https://reader033.vdocuments.us/reader033/viewer/2022052900/5561573ad8b42a857d8b53ff/html5/thumbnails/25.jpg)
References
LEGO Mindstorms®http://www.lego.com/en-us/mindstorms/
ev3devhttp://www.ev3dev.org/
mrubyhttps://github.com/mruby/mruby
mruby-ev3devhttps://github.com/chihayafuru/mruby-ev3dev