Workshop
Kyushu Institute of Technology
Kazuaki Tanaka
2023/9/11-2023/9/15
About Me
• Kazuaki TANAKA(たなか かずあき)
• Kyushu Institute of Technology, JAPAN
Associate Professor
• Ph. D in Information Science
• Research topics: embedded systems, IoT,
mruby, wireless communication
Research topic:
mruby and mruby/c
• Ruby language for small devices
• OO Programming Language
• Target: one-chip microcontroller
PIC, ESP32, STM32, etc.
• Small memory footprint
minimum 20KB
• Open-Source Software
https://github.com/mruby/mruby
https://github.com/mrubyc/mrubyc
What is Ruby language?
• Object Oriented Programming Language
– Scripting language
– Web application, Ruby on Rails
• Matsumoto has said that Ruby is designed
for programmer productivity and fun.
led1 = GPIO.new(0)
while true do
led1.write 1
sleep 0.5
led1.write 0
sleep 0.5
end
Ruby code example:
Research topic:
wireless communication
• LPWA(Low Power Wide Area) communication
network
LPWA
• Long range wireless communication
– ~10km by small wireless module
– Using 920MHz band
24mm
17mm
Low power
Tx: 43mA
Rx: 20mA
Sleep: 1.7μA
Speed:
1kbps
Introduction
This workshop
• Experience in embedded software
development.
• mruby programming
• Controlling electronic circuits
• Brightness sensor
Simple Circuit
Electrical circuit
• Micro controller board
• Electrical parts and circuit
– LED, sensors
– Breadboard
(prototyping board)
Run the first program
• Coding
• Compile and Download
Download= transfer compiled program into
microcontroller board
• Execute
Programming environment
• Open following URL
or
https://mrubyc-ide.ddns.net/editor/rboard
https://bit.ly/45InC1H
Blinking LED
• program1
• First, run this program
led1 = GPIO.new(0)
while true do
led1.write 1
sleep 0.5
led1.write 0
sleep 0.5
end
Microcontroller board
• RBoard
• Features
– Execute program
– Store data
– I/O of Pins
– Input= Measure voltage
– Output= Set voltage
HIGH(1) or LOW(0)
Pin
Onboard LEDs
• 4 LEDs, each LED is connected to Pin
– LED 1: Pin 0
– LED 2: Pin 1
– LED 3: Pin 5
– LED 4: Pin 6
• Set pin voltage to HIGH, then turn on LED
Set to LOW, then turn off LED
Program
• GPIO: General Purpose Input and Output
led1 = GPIO.new(0)
while true do
led1.write 1
sleep 0.5
led1.write 0
sleep 0.5
end
Pin0 is assigned to variable led1
Iteration
write: set voltage
sleep: stop execution
Exercises
• Blink two LEDs alternately
• Blink four LEDs
LED 1: Pin 0
LED 2: Pin 1
LED 3: Pin 5
LED 4: Pin 6
LED
• Light Emitting Diode
Current flows from Anode to Cathode
Longer: Anode
Anode Cathode
LED Circuit
• Make LED on
– Current flowing through the LED
• Rboard feature
– Set voltage of Pin
– Set HIGH or LOW
Wrong circuit
Board
Pin (HIGH)
Pin (LOW)
LED
The resistance of LED is almost 0.
Many current flows,
cause damages to LED
LED circuit
Board
Pin (HIGH)
Pin (LOW)
LED
Resistor
1K ohm
Resistor limits current flowing.
LED circuit
Board
Pin (HIGH/LOW)
GND
LED
Resistor
1K ohm
GND is always LOW
LED on if Pin is HIGH
LED off if Pin is LOW
Breadboard
(Prototyping board)
• Red holes are connected
Using breadboard
• Connecting a LED and a resistor
LED
Resistor
Longer leg Shorter leg
workshop slide.pdf
Connecting
• Use jumper wires
Pin 15
GND
LED
Resistor
Pin 15
GND
Implement your code
led1 = GPIO.new(15)
led1.setmode(0)
while true do
led1.write 1
sleep 0.5
led1.write 0
sleep 0.5
end
Set pin mode
0: Output voltage
1: Input voltage
Pin 15
Exercises
• Blink several LEDs on breadboard
You can use Pin15, Pin16, Pin17, Pin18, Pin19, Pin20
PWM
PWM
Analog output
• Output of microcontrollers: Digital
– HIGH or LOW voltage
– In LED, ON or OFF
• We want: Analog
– Change voltage
– In LED, ON…bright…dark…OFF
Pseudo analog output
• PWM, pulse width modulation
• Control HIGH and LOW rapidly
– 1000 times a second
0.1 msec.
50% HIGH 50% LOW
Change brightness
• Change brightness => Change duty ratio
Time
1 msec.
Duty=1
Duty=2
Duty=1023
Duty=1022
Duty=1
Duty=0
Duty=0
PWM example
led1 = PWM.new(15)
led1.frequency 10000
while true do
for i in 0..1023 do
led1.duty i
sleep 0.001
end
for i in 0..1023 do
led1.duty 1023-i
sleep 0.001
end
end
duty: 0 to 1023
0: 0% HIGH
1023: 100% HIGH
Brightness Sensor
CdS
• CdS: Resistance changes with varying light
levels.
• Microcontroller can detect VOLTAGE
CdS circuit
CdS
3.3V
Pin20
GND
Resistor
1K ohm
R ohm
Bright: small R
Dark: large R
𝑃𝑖𝑛20 𝑣𝑜𝑙𝑡𝑎𝑔𝑒 = 3.3 ×
1𝐾
1𝐾 + 𝑅
3.3V
Use this Pin
ADC
• ADC: Analog Digital Converter
– Read voltage at Pin20
– Voltage v
0 < v < 1.5
adc = ADC.new(20)
v = adc.read
CdS example
led1 = GPIO.new(0)
adc = ADC.new(20)
while true do
v = adc.read
if v<0.5 then
led1.write 1
else
led1.write 0
end
sleep 0.1
end
Read voltage
from Pin20
Voltage: 0 < v < 1.5
Pin20 for ADC
Exercises
• Brightness sensor
• LED changes by brightness
– Green: bright
– Yellow: a little dark
– Red: dark
• adc.read returns around 0.2 in dark, and
returns around 0.9 in bright
Conclusion
Embedded systems
• Software and Hardware integration
• Software controls hardware
– Requires both software and hardware knowledge
workshop slide.pdf

More Related Content

PPTX
Calculator design with lcd using fpga
PPTX
Grid solving robot
PPT
arduino
PPTX
Introduction to Arduino Hardware and Programming
PPTX
Introduction to Arduino
PDF
ARM Architecture Instruction Set
PPTX
PPTX
Getting Started with Raspberry Pi
Calculator design with lcd using fpga
Grid solving robot
arduino
Introduction to Arduino Hardware and Programming
Introduction to Arduino
ARM Architecture Instruction Set
Getting Started with Raspberry Pi

What's hot (20)

PPT
L12 programmable+logic+devices+(pld)
PPTX
Design of Printed Circuit Boards
PPT
1347 Assembly Language Programming Of 8051
PDF
Programmable Logic Array(PLA), digital circuits
PPTX
I2C BUS
PPTX
Introduction to Arduino
DOCX
Manual basico de practicas con Arduino uno
PPTX
Printed circuit Board Description
PPTX
Second order effects
PPTX
LCD Theory and Working Principles
PDF
Arduino Workshop Day 1 - Basic Arduino
PDF
PPTX
8085 microprocessor(1)
PPTX
PIC Microcontroller | ADC Interfacing
PDF
Mp lab manual
ODP
Introduction to Arduino
PPTX
Latch & Flip-Flop.pptx
PPTX
ESP32 IoT presentation @ dev.bg
L12 programmable+logic+devices+(pld)
Design of Printed Circuit Boards
1347 Assembly Language Programming Of 8051
Programmable Logic Array(PLA), digital circuits
I2C BUS
Introduction to Arduino
Manual basico de practicas con Arduino uno
Printed circuit Board Description
Second order effects
LCD Theory and Working Principles
Arduino Workshop Day 1 - Basic Arduino
8085 microprocessor(1)
PIC Microcontroller | ADC Interfacing
Mp lab manual
Introduction to Arduino
Latch & Flip-Flop.pptx
ESP32 IoT presentation @ dev.bg
Ad

Similar to workshop slide.pdf (20)

PDF
workshop slide.pdf
PPTX
Basic arduino components and more things about arduino
PDF
arduinoworkshop-160204051621.pdf
PPTX
Ardui no
PPTX
internship report and presentation for electronics students
PDF
Lab2ppt
PPTX
Intro_to_Arduino_-_v30.pptx
DOCX
Measurements upload
PDF
02 Sensors and Actuators Understand .pdf
PDF
Iot 101
PPTX
Digital clock workshop
PDF
Making things sense - Day 1 (May 2011)
PDF
To measure the intensity of light using LDR sensor by calibrating voltage wit...
PPTX
Arduino with brief description of sensorsppt.pptx
PPTX
Arduino plus Delphi Mobile Apps - Beyond Basics
PPTX
POWER EFFICIENT SOFTWARE DEFINED RADIO FOR DISASTER AFFECTED REGIONS USING R...
PPTX
Arduino Workshop (3).pptx
PDF
ADC, PWM & Deep Sleep.pdfxsdffgnbmnbbbnmnnm
PPTX
Fingerprint Biometrics
PPTX
04 Arduino Peripheral Interfacing
workshop slide.pdf
Basic arduino components and more things about arduino
arduinoworkshop-160204051621.pdf
Ardui no
internship report and presentation for electronics students
Lab2ppt
Intro_to_Arduino_-_v30.pptx
Measurements upload
02 Sensors and Actuators Understand .pdf
Iot 101
Digital clock workshop
Making things sense - Day 1 (May 2011)
To measure the intensity of light using LDR sensor by calibrating voltage wit...
Arduino with brief description of sensorsppt.pptx
Arduino plus Delphi Mobile Apps - Beyond Basics
POWER EFFICIENT SOFTWARE DEFINED RADIO FOR DISASTER AFFECTED REGIONS USING R...
Arduino Workshop (3).pptx
ADC, PWM & Deep Sleep.pdfxsdffgnbmnbbbnmnnm
Fingerprint Biometrics
04 Arduino Peripheral Interfacing
Ad

More from Kazuaki Tanaka (6)

PDF
mruby/c and data-flow programming for small devices
PDF
下関中等教育学校 出前講義の資料(2023/8/18)
PDF
組込みシステムの高効率開発を可能とする開発フレームワークの研究開発
PDF
mruby/c in TokyoRubyKaigi#11
PDF
Ruby東京プレゼン 資料
PDF
ET2014資料: mruby プログラム言語Rubyによる組込みソト開発
mruby/c and data-flow programming for small devices
下関中等教育学校 出前講義の資料(2023/8/18)
組込みシステムの高効率開発を可能とする開発フレームワークの研究開発
mruby/c in TokyoRubyKaigi#11
Ruby東京プレゼン 資料
ET2014資料: mruby プログラム言語Rubyによる組込みソト開発

Recently uploaded (20)

PDF
Accra-Kumasi Expressway - Prefeasibility Report Volume 1 of 7.11.2018.pdf
PDF
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
PDF
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
PPTX
Module 8- Technological and Communication Skills.pptx
PPTX
AUTOMOTIVE ENGINE MANAGEMENT (MECHATRONICS).pptx
PDF
distributed database system" (DDBS) is often used to refer to both the distri...
PPTX
Graph Data Structures with Types, Traversals, Connectivity, and Real-Life App...
PDF
Design Guidelines and solutions for Plastics parts
PPTX
introduction to high performance computing
PPTX
Management Information system : MIS-e-Business Systems.pptx
PPTX
Current and future trends in Computer Vision.pptx
PPTX
Feature types and data preprocessing steps
PDF
Influence of Green Infrastructure on Residents’ Endorsement of the New Ecolog...
PPT
Total quality management ppt for engineering students
PPTX
tack Data Structure with Array and Linked List Implementation, Push and Pop O...
PPTX
ASME PCC-02 TRAINING -DESKTOP-NLE5HNP.pptx
PPT
INTRODUCTION -Data Warehousing and Mining-M.Tech- VTU.ppt
PDF
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
PDF
Visual Aids for Exploratory Data Analysis.pdf
PDF
August -2025_Top10 Read_Articles_ijait.pdf
Accra-Kumasi Expressway - Prefeasibility Report Volume 1 of 7.11.2018.pdf
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
Module 8- Technological and Communication Skills.pptx
AUTOMOTIVE ENGINE MANAGEMENT (MECHATRONICS).pptx
distributed database system" (DDBS) is often used to refer to both the distri...
Graph Data Structures with Types, Traversals, Connectivity, and Real-Life App...
Design Guidelines and solutions for Plastics parts
introduction to high performance computing
Management Information system : MIS-e-Business Systems.pptx
Current and future trends in Computer Vision.pptx
Feature types and data preprocessing steps
Influence of Green Infrastructure on Residents’ Endorsement of the New Ecolog...
Total quality management ppt for engineering students
tack Data Structure with Array and Linked List Implementation, Push and Pop O...
ASME PCC-02 TRAINING -DESKTOP-NLE5HNP.pptx
INTRODUCTION -Data Warehousing and Mining-M.Tech- VTU.ppt
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
Visual Aids for Exploratory Data Analysis.pdf
August -2025_Top10 Read_Articles_ijait.pdf

workshop slide.pdf

  • 1. Workshop Kyushu Institute of Technology Kazuaki Tanaka 2023/9/11-2023/9/15
  • 2. About Me • Kazuaki TANAKA(たなか かずあき) • Kyushu Institute of Technology, JAPAN Associate Professor • Ph. D in Information Science • Research topics: embedded systems, IoT, mruby, wireless communication
  • 3. Research topic: mruby and mruby/c • Ruby language for small devices • OO Programming Language • Target: one-chip microcontroller PIC, ESP32, STM32, etc. • Small memory footprint minimum 20KB • Open-Source Software https://github.com/mruby/mruby https://github.com/mrubyc/mrubyc
  • 4. What is Ruby language? • Object Oriented Programming Language – Scripting language – Web application, Ruby on Rails • Matsumoto has said that Ruby is designed for programmer productivity and fun. led1 = GPIO.new(0) while true do led1.write 1 sleep 0.5 led1.write 0 sleep 0.5 end Ruby code example:
  • 5. Research topic: wireless communication • LPWA(Low Power Wide Area) communication network
  • 6. LPWA • Long range wireless communication – ~10km by small wireless module – Using 920MHz band 24mm 17mm Low power Tx: 43mA Rx: 20mA Sleep: 1.7μA Speed: 1kbps
  • 8. This workshop • Experience in embedded software development. • mruby programming • Controlling electronic circuits • Brightness sensor
  • 10. Electrical circuit • Micro controller board • Electrical parts and circuit – LED, sensors – Breadboard (prototyping board)
  • 11. Run the first program • Coding • Compile and Download Download= transfer compiled program into microcontroller board • Execute
  • 12. Programming environment • Open following URL or https://mrubyc-ide.ddns.net/editor/rboard https://bit.ly/45InC1H
  • 13. Blinking LED • program1 • First, run this program led1 = GPIO.new(0) while true do led1.write 1 sleep 0.5 led1.write 0 sleep 0.5 end
  • 14. Microcontroller board • RBoard • Features – Execute program – Store data – I/O of Pins – Input= Measure voltage – Output= Set voltage HIGH(1) or LOW(0) Pin
  • 15. Onboard LEDs • 4 LEDs, each LED is connected to Pin – LED 1: Pin 0 – LED 2: Pin 1 – LED 3: Pin 5 – LED 4: Pin 6 • Set pin voltage to HIGH, then turn on LED Set to LOW, then turn off LED
  • 16. Program • GPIO: General Purpose Input and Output led1 = GPIO.new(0) while true do led1.write 1 sleep 0.5 led1.write 0 sleep 0.5 end Pin0 is assigned to variable led1 Iteration write: set voltage sleep: stop execution
  • 17. Exercises • Blink two LEDs alternately • Blink four LEDs LED 1: Pin 0 LED 2: Pin 1 LED 3: Pin 5 LED 4: Pin 6
  • 18. LED • Light Emitting Diode Current flows from Anode to Cathode Longer: Anode Anode Cathode
  • 19. LED Circuit • Make LED on – Current flowing through the LED • Rboard feature – Set voltage of Pin – Set HIGH or LOW
  • 20. Wrong circuit Board Pin (HIGH) Pin (LOW) LED The resistance of LED is almost 0. Many current flows, cause damages to LED
  • 21. LED circuit Board Pin (HIGH) Pin (LOW) LED Resistor 1K ohm Resistor limits current flowing.
  • 22. LED circuit Board Pin (HIGH/LOW) GND LED Resistor 1K ohm GND is always LOW LED on if Pin is HIGH LED off if Pin is LOW
  • 24. Using breadboard • Connecting a LED and a resistor LED Resistor Longer leg Shorter leg
  • 26. Connecting • Use jumper wires Pin 15 GND LED Resistor Pin 15 GND
  • 27. Implement your code led1 = GPIO.new(15) led1.setmode(0) while true do led1.write 1 sleep 0.5 led1.write 0 sleep 0.5 end Set pin mode 0: Output voltage 1: Input voltage Pin 15
  • 28. Exercises • Blink several LEDs on breadboard You can use Pin15, Pin16, Pin17, Pin18, Pin19, Pin20
  • 29. PWM
  • 30. PWM Analog output • Output of microcontrollers: Digital – HIGH or LOW voltage – In LED, ON or OFF • We want: Analog – Change voltage – In LED, ON…bright…dark…OFF
  • 31. Pseudo analog output • PWM, pulse width modulation • Control HIGH and LOW rapidly – 1000 times a second 0.1 msec. 50% HIGH 50% LOW
  • 32. Change brightness • Change brightness => Change duty ratio Time 1 msec. Duty=1 Duty=2 Duty=1023 Duty=1022 Duty=1 Duty=0 Duty=0
  • 33. PWM example led1 = PWM.new(15) led1.frequency 10000 while true do for i in 0..1023 do led1.duty i sleep 0.001 end for i in 0..1023 do led1.duty 1023-i sleep 0.001 end end duty: 0 to 1023 0: 0% HIGH 1023: 100% HIGH
  • 35. CdS • CdS: Resistance changes with varying light levels. • Microcontroller can detect VOLTAGE
  • 36. CdS circuit CdS 3.3V Pin20 GND Resistor 1K ohm R ohm Bright: small R Dark: large R 𝑃𝑖𝑛20 𝑣𝑜𝑙𝑡𝑎𝑔𝑒 = 3.3 × 1𝐾 1𝐾 + 𝑅
  • 38. ADC • ADC: Analog Digital Converter – Read voltage at Pin20 – Voltage v 0 < v < 1.5 adc = ADC.new(20) v = adc.read
  • 39. CdS example led1 = GPIO.new(0) adc = ADC.new(20) while true do v = adc.read if v<0.5 then led1.write 1 else led1.write 0 end sleep 0.1 end Read voltage from Pin20 Voltage: 0 < v < 1.5 Pin20 for ADC
  • 40. Exercises • Brightness sensor • LED changes by brightness – Green: bright – Yellow: a little dark – Red: dark • adc.read returns around 0.2 in dark, and returns around 0.9 in bright
  • 42. Embedded systems • Software and Hardware integration • Software controls hardware – Requires both software and hardware knowledge