SlideShare a Scribd company logo
1 of 46
Download to read offline
Workshop
Kyushu Institute of Technology
Kazuaki Tanaka
2023/9/11-2023/9/15
• Slide
• Programming environment
https://bit.ly/3Rep87m
https://bit.ly/45InC1H
About Me
• Kazuaki TANAKA(たなか かずあき)
• Kyushu Institute of Technology, JAPAN
Associate Professor
• Ph. D in Information Science
• Research topics: embedded systems, IoT,
mruby, wireless communication
Kyushu Island
Our Campus
Kyushu Institute of Technology
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
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

Similar to workshop slide.pdf

Digital clock workshop
Digital clock workshopDigital clock workshop
Digital clock workshopKedarv
 
Arduino plus Delphi Mobile Apps - Beyond Basics
Arduino plus Delphi Mobile Apps - Beyond BasicsArduino plus Delphi Mobile Apps - Beyond Basics
Arduino plus Delphi Mobile Apps - Beyond BasicsVic Fernandes
 
Arduino spooky projects_class1
Arduino spooky projects_class1Arduino spooky projects_class1
Arduino spooky projects_class1Felipe Belarmino
 
Introduction to Arduino Webinar
Introduction to Arduino WebinarIntroduction to Arduino Webinar
Introduction to Arduino WebinarFragiskos Fourlas
 
Arduino with brief description of sensorsppt.pptx
Arduino with brief description of sensorsppt.pptxArduino with brief description of sensorsppt.pptx
Arduino with brief description of sensorsppt.pptxBhuvanaN12
 
Interfacing of a LED display with laptop using Arduino
Interfacing of a LED display with laptop using ArduinoInterfacing of a LED display with laptop using Arduino
Interfacing of a LED display with laptop using ArduinoDiksha Prakash
 
POWER EFFICIENT SOFTWARE DEFINED RADIO FOR DISASTER AFFECTED REGIONS USING R...
POWER EFFICIENT SOFTWARE DEFINED RADIO FOR DISASTER AFFECTED REGIONS  USING R...POWER EFFICIENT SOFTWARE DEFINED RADIO FOR DISASTER AFFECTED REGIONS  USING R...
POWER EFFICIENT SOFTWARE DEFINED RADIO FOR DISASTER AFFECTED REGIONS USING R...Nishmi Suresh
 
microbit Microbit programming Microbit programming
microbit Microbit programming Microbit programmingmicrobit Microbit programming Microbit programming
microbit Microbit programming Microbit programmingssuser5feb2c1
 
Arduino spooky projects_class3
Arduino spooky projects_class3Arduino spooky projects_class3
Arduino spooky projects_class3Anil Yadav
 
Arduino Workshop (3).pptx
Arduino Workshop (3).pptxArduino Workshop (3).pptx
Arduino Workshop (3).pptxHebaEng
 
Porte à puce - Automatic Door based on Arduino UNO R3
Porte à puce - Automatic Door based on Arduino UNO R3Porte à puce - Automatic Door based on Arduino UNO R3
Porte à puce - Automatic Door based on Arduino UNO R3Meifani Sumadijaya
 
Arduino embedded systems and advanced robotics
Arduino embedded systems and advanced roboticsArduino embedded systems and advanced robotics
Arduino embedded systems and advanced roboticsShubham Bhattacharya
 
LinnStrument : the ultimate open-source hacker instrument
LinnStrument : the ultimate open-source hacker instrumentLinnStrument : the ultimate open-source hacker instrument
LinnStrument : the ultimate open-source hacker instrumentGeert Bevin
 

Similar to workshop slide.pdf (20)

Digital clock workshop
Digital clock workshopDigital clock workshop
Digital clock workshop
 
Arduino plus Delphi Mobile Apps - Beyond Basics
Arduino plus Delphi Mobile Apps - Beyond BasicsArduino plus Delphi Mobile Apps - Beyond Basics
Arduino plus Delphi Mobile Apps - Beyond Basics
 
Arduino spooky projects_class1
Arduino spooky projects_class1Arduino spooky projects_class1
Arduino spooky projects_class1
 
Introduction to Arduino Webinar
Introduction to Arduino WebinarIntroduction to Arduino Webinar
Introduction to Arduino Webinar
 
Arduino with brief description of sensorsppt.pptx
Arduino with brief description of sensorsppt.pptxArduino with brief description of sensorsppt.pptx
Arduino with brief description of sensorsppt.pptx
 
Interfacing of a LED display with laptop using Arduino
Interfacing of a LED display with laptop using ArduinoInterfacing of a LED display with laptop using Arduino
Interfacing of a LED display with laptop using Arduino
 
POWER EFFICIENT SOFTWARE DEFINED RADIO FOR DISASTER AFFECTED REGIONS USING R...
POWER EFFICIENT SOFTWARE DEFINED RADIO FOR DISASTER AFFECTED REGIONS  USING R...POWER EFFICIENT SOFTWARE DEFINED RADIO FOR DISASTER AFFECTED REGIONS  USING R...
POWER EFFICIENT SOFTWARE DEFINED RADIO FOR DISASTER AFFECTED REGIONS USING R...
 
microbit Microbit programming Microbit programming
microbit Microbit programming Microbit programmingmicrobit Microbit programming Microbit programming
microbit Microbit programming Microbit programming
 
Intro_to_Arduino_-_v30.pptx
Intro_to_Arduino_-_v30.pptxIntro_to_Arduino_-_v30.pptx
Intro_to_Arduino_-_v30.pptx
 
Arduino spooky projects_class3
Arduino spooky projects_class3Arduino spooky projects_class3
Arduino spooky projects_class3
 
Arduino
ArduinoArduino
Arduino
 
Arduino Workshop (3).pptx
Arduino Workshop (3).pptxArduino Workshop (3).pptx
Arduino Workshop (3).pptx
 
Porte à puce
Porte à pucePorte à puce
Porte à puce
 
Porte à puce - Automatic Door based on Arduino UNO R3
Porte à puce - Automatic Door based on Arduino UNO R3Porte à puce - Automatic Door based on Arduino UNO R3
Porte à puce - Automatic Door based on Arduino UNO R3
 
Porte à puce
Porte à pucePorte à puce
Porte à puce
 
Measurements upload
Measurements uploadMeasurements upload
Measurements upload
 
Arduino embedded systems and advanced robotics
Arduino embedded systems and advanced roboticsArduino embedded systems and advanced robotics
Arduino embedded systems and advanced robotics
 
LinnStrument : the ultimate open-source hacker instrument
LinnStrument : the ultimate open-source hacker instrumentLinnStrument : the ultimate open-source hacker instrument
LinnStrument : the ultimate open-source hacker instrument
 
ArduinoPart1.ppt
ArduinoPart1.pptArduinoPart1.ppt
ArduinoPart1.ppt
 
ArduinoPart1.ppt
ArduinoPart1.pptArduinoPart1.ppt
ArduinoPart1.ppt
 

Recently uploaded

scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...HenryBriggs2
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Servicemeghakumariji156
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptxJIT KUMAR GUPTA
 
2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projectssmsksolar
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTbhaskargani46
 
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...Health
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxJuliansyahHarahap1
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"mphochane1998
 
Air Compressor reciprocating single stage
Air Compressor reciprocating single stageAir Compressor reciprocating single stage
Air Compressor reciprocating single stageAbc194748
 
Learn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic MarksLearn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic MarksMagic Marks
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxmaisarahman1
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationBhangaleSonal
 
Engineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesEngineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesRAJNEESHKUMAR341697
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsvanyagupta248
 
Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086anil_gaur
 

Recently uploaded (20)

scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
 
Air Compressor reciprocating single stage
Air Compressor reciprocating single stageAir Compressor reciprocating single stage
Air Compressor reciprocating single stage
 
Learn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic MarksLearn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic Marks
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
Engineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesEngineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planes
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
 
Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086
 

workshop slide.pdf