Arduino-and-Matlab-for-prototyping-and-manufacturing
Arduino-and-Matlab-for-prototyping-and-manufacturing
prototyping and
manufacturing
Enrique Chacón Tanarro
1. Arduino
2. Arduino programming
3. Matlab controlling arduino
Sensors: Actuators:
• Temperature • Motors
• Pressure • Relays
• Light • Valves
• Proximity • Piezoelectrics
• Acceleration • Diode led
• … • …
11th - 15th December 2017 UBORA First Design School - Nairobi 3
1.1. Enviroment
Sensors: Actuators:
• Temperature • Motors
• Pressure • Relays
• Light • Valves
• Proximity • Piezoelectrics
• Acceleration • Diode led
• … • …
11th - 15th December 2017 UBORA First Design School - Nairobi 4
1.1. Enviroment
• Virtual
Arduino PC - Matlab
Piezoelectric Encoder
Position /
Pressure
Velocity
Mechanical contact Fluids
Accelerometers Fotoresistence
Light Ω
Sensors: Actuators:
• Temperature • Motors
• Pressure • Relays
• Light • Valves
• Proximity • Piezoelectrics
• Acceleration • Diode led
• … • …
11th - 15th December 2017 UBORA First Design School - Nairobi 8
1.2. Arduino board
Digital
Information Arduino ONE board
Arduino board
https://www.robomart.com selection
Analogical Information
11th - 15th December 2017 UBORA First Design School - Nairobi 9
1.2. Arduino board
• Arduino Gemma
• Arduino Leonardo
• Arduino Yún (ethernet)
• Arduino Cactus (WiFi)
Digital input/output
• 14 pins 0-13
• Sensors and actuators are connected in these pins.
They must declared (software) is INPUT or OUTPUT.
• Voltage: 5V (HIGH) - 0V (LOW).
• Max. pin current: 40 mA. Max. total pins current: 200
mA.
Sensors: Actuators:
Protoboard
• Temperature • Motors
• Pressure • Relays
• Light • Valves
• Proximity • Piezoelectrics
• Acceleration ELECTRONIC • Diode led
• … COMPONENTS • …
11th - 15th December 2017 UBORA First Design School - Nairobi 12
1.2.1. Electronic components
Generate an output signal in response to an input signal
Functions: switch, amplifier, oscillator or rectifier collector
power
base
Transistors
emitter
Low input
signal Great output signal Switch
application
power
Current direction
Current circulation is only allowed in one direction
Many types: Generic
Photodiode
LED
Diodes Zener
(light emitting diode) Cathode Anode
Mostly used as rectifier for
Used as a constant Allows reverse current converting AC to DC and
voltage source when light falls on it motor protection
Resistences
I = V/R
Sensors: Actuators:
• Temperature • Motors
• Pressure • Relays
• Light • Valves
• Proximity • Piezoelectrics
• Acceleration • Diode led
• … • …
11th - 15th December 2017 UBORA First Design School - Nairobi 14
1.3. Environment interaction
• Relays
• Valves Servomotor
• Motors or
• Etc.
Movement
• Display
• Leds
• Buzzer
• Etc.
Signal
Transistor with
protection resistance
Save
New
• Variables y constants
• Control structures
(conditionals, cycles)
• Functions
Both functions are usually preceded by void These are functions without an output
or result.
• Mathematical operators: = , - , + , / ,…
• Logical operators: == , > , != , <= ,…
• Boolean operators: && (and) , II (or) ,…
For
Switch/case
for (int a=0; a>10; a++)
If switch (var) { {
case 1: // repeated action
if (input<500)
// action A }
{
break;
// action A
case 2:
} else
// action B
{ While
break;
// action B
default: while (a<10) {
}
// action B // repeated action
} a++;
}
Mathematical
Advance
External interruptions
NOTES:
• Is our arduino board compatible? https://es.mathworks.com/hardware-support/arduino-
matlab.html
• Only allowed Matlab 2014 and later versions
Examples Ultrasonic
distance
• Mapping your surroundings using MATLAB and Arduino sensor
https://www.youtube.com/watch?v=iaF81W-l6Xg
Servomotor
11th - 15th December 2017 UBORA First Design School - Nairobi 26
4. Practical studies
Steps:
1. Open arduino software
2. Open “blink” example
3. Read the code and understand it
4. Select the board and the port.
5. Load the code on the Arduino board. Few seconds after the
"uploaded“ message appears, we see the LED blinking