+ All Categories
Home > Software > Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)

Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)

Date post: 24-May-2015
Category:
Upload: takehiko-yoshida
View: 4,006 times
Download: 0 times
Share this document with a friend
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).
Popular Tags:
25
Open the door of embedded systems to IoT (the Internet of things) ! mruby on LEGO Mindstorms EV3 ® Takehiko YOSHIDA @chihayafuru
Transcript
Page 1: Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

Connector of Mindstorms RCX

Page 14: Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)

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)

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)

delay of programmed cycle

Page 17: Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)

Color Sensor API with mruby for Mindstorms EV3

Page 18: Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)

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)

Connector of Mindstorms EV3

Page 20: Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)

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)

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)

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)

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)

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)

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


Recommended