Mbed I2C Api: Many Newer I2C Devices and Mbed Apis Support Faster Multi-Byte R/W Cycles
Mbed I2C Api: Many Newer I2C Devices and Mbed Apis Support Faster Multi-Byte R/W Cycles
232
233
1
3/17/2020
234
235
2
3/17/2020
236
237
3
3/17/2020
238
239
4
3/17/2020
240
mbed Filesystem
• Filesystem drivers are available for SD cards or a USB
Flash drive – just add breakout board and plug in media
• PC can also R/W the files when media is mounted on PC
• Filesystem calls several C++ virtual functions for R/W–
so can be ported to other digital storage media with
additional work
241
5
3/17/2020
242
243
6
3/17/2020
244
245
7
3/17/2020
• PWM
– Dimming LEDs
– Using RBG LEDs
– Audio Output with a Speaker
– DC Motor Speed Control
– RC Servos
– Electronic Speed Control modules (ESC)
246
• Analog Input
– Potentiometer
– Temperature Sensor
– Light Sensor
– MEMs Microphone
– Analog Joystick
247
8
3/17/2020
• Analog Output
– Audio output using a speaker
248
• I2C
– I/O Expander
– Touch keypad
– LIDAR distance sensor
– 9 DOF IMU
249
9
3/17/2020
• SPI
– I/O Expander
– Using a uSD card for file I/O
250
251
10
3/17/2020
• Serial
– Using a TTL serial LCD module
– Using an RS232 serial device
– Using a GPS module
– Interfacing to other microprocessors
• Wi Fi module
• Bluetooth module
• iRobot Roomba or Create Robot
252
253
11
3/17/2020
Driver Circuits
• A higher current driver circuit must be added
after the digital output pin and before the device
• A driver circuit typically uses a discrete power
transistor to amplify current levels
• For DC motors, consider using an H-bridge
circuit module. It contains four power transistors
than can also reverse the motor.
• Diodes are often used for additional protection
across the load on motors and relays. When you
turn off the current in an inductive load it
generates a reverse voltage spike that might
damage the transistor (back EMF). The diode
shorts it out.
254
Vcc
Discrete Power
Digital Transistor
Logic LOAD
Control
Signal Optional Voltage
Suppression Diode
255
12
3/17/2020
256
Decoupling Capacitors
Vcc
10-1000uf .01-.1uf
Electrolytic Ceramic
GND
•Two capacitors (made of different dielectric materials) are
typically connected in parallel from Vcc to GND.
• A larger electrolytic capacitor (i.e., 100+ uf) and a smaller one
(i.e., .01 to .1 uf) in parallel are needed to filter noise
257
13
3/17/2020
258
259
14
3/17/2020
260
261
15
3/17/2020
HIGH LOW
262
LOW HIGH
263
16
3/17/2020
Figure 3.10 Fairchild FAN8100N Low Voltage Dual H-Bridge DC Motor Driver IC.
Images courtesy of Fairchild Semiconductor.
264
265
17
3/17/2020
266
Electromechanical Relays
267
18
3/17/2020
•They have slow ON/OFF times – around 20 per minute. Too slow for motor
speed control or dimming lights.
•Relay contacts can wear out due to arcing on inductive loads (perhaps as few
as 105 cycles) even on rated loads.
•Worn out relays will sometimes stick due to mechanical wear and an audible
click is typically heard during switching.
268
269
19
3/17/2020
270
271
20
3/17/2020
272
273
21
3/17/2020
274
22