owned this note
owned this note
Published
Linked with GitHub
Electronics concepts
====================
## Input devices #1 [Guillem]
**:date: 28/03/2019**
### Core ideas
* Why we need sensors
* Neurons, I/O and Bio indicators
* Sensing the environment
* Close loop systems
* Inferring metrics
* Bike speed from counting wheel turns
* Water tank distance from distance from above
* Composed sensors
* Radar: emitter (output) and receiver (input) working in sync
* Complex post processing: Compur vision
* From a list of colors (pixel matrix) to meaningful data (i.e. object location based in color tracking)
### How to choose and use a sensor
_The section is aimed at **INPUTS** (sensors) but many concepts work also for **OUTPUTS** (motors, LEDs)_
* How to choose sensor?
* Integrated circuits, breakout boards, and off-the-shelf devices
* [IC Component](https://eu.mouser.com/ProductDetail/Bosch-Sensortec/BNO055)
* [Adafruit IMU Breakout](https://www.adafruit.com/product/2472)
* [Wii Nunchuck](https://en.wikipedia.org/wiki/Wii_Remote#Nunchuk) (check in Wallapop, Cash converters, Ebay...)
* How to wire a sensor?
* We will always look for well documented sensors [learn.sparkfun.com](https://learn.sparkfun.com/), [learn.adafruit.com](https://learn.adafruit.com/)
* Download the EAGLES from the Breakout boards to help you, [example](https://github.com/adafruit/Adafruit-GUVA-Analog-UV-Sensor-Breakout-PCB)
* Electronic recipes
* [Voltage dividers](https://learn.sparkfun.com/tutorials/voltage-dividers/all)
* [Pull up and pull down resistors](https://learn.sparkfun.com/tutorials/pull-up-resistors/all)
* How to code for a sensor?
* [Fab Academy sensors](http://academy.cba.mit.edu/classes/input_devices/index.html)
* Sensor interfaces:
* Is it on? [DigitalRead](https://www.arduino.cc/reference/en/language/functions/digital-io/digitalread/)
* What's the voltage? Analog to Digital Converter [AnalogRead](https://www.arduino.cc/reference/en/language/functions/analog-io/analogread/)
* How many times on? [Pulses](https://www.arduino.cc/reference/en/language/functions/advanced-io/pulsein/)
* Tell me so[Digital Communication](https://learn.sparkfun.com/tutorials/serial-communication/all): [Serial / UART](https://www.arduino.cc/en/reference/serial), [SPI](https://www.arduino.cc/en/Reference/SPI), [I2C](https://www.arduino.cc/en/reference/wire) :warning: *We will always use an specific sensor library implementing the comunication*
## Input devices #2 [Guillem]
**:date: 29/03/2019**
### Playing with your Hello Board
* [Code Examples] https://github.com/fablabbcn/arduino-workshops/tree/master/Hello%2044
### When the ATtiny is not enough: Other microcontrollers!
_The ATtiny can do amazing things but will require us to optimize the code to an uncessary level when we just want a protoype..._
* [ATtiny44](https://www.microchip.com/wwwproducts/en/ATtiny44)
* Example board: [HelloBoard](http://academy.cba.mit.edu/classes/embedded_programming/index.html#echo)
* FLASH 4KB
* RAM 256B
* **Pro:** Digital and Analog Inputs and Outputs
* **Con:** No Hardware I2C or Serial
* [ATtiny84](https://www.microchip.com/wwwproducts/en/ATtiny44)
* Example board: [HelloBoard](http://academy.cba.mit.edu/classes/embedded_programming/index.html#echo)
* FLASH 8KB
* RAM 256B
* **Pro:** Digital and Analog Inputs and Outputs
* **Con:** No Hardware I2C or Serial
* [ATMEGA328](https://www.microchip.com/wwwproducts/en/ATmega328)
* Example board: [FabDuino](http://fabacademy.org/archives/2015/doc/projects/fabkit-0.4.html)
* FLASH 32KB
* RAM 2KB
* **Pro:** Hardware I2C, Serial and SPI
* **Con:** No USB Hardware (requires an FTDI)
* [ATSAMD21G18](https://www.adafruit.com/product/3405)
* Example board: [Adafruit Feather M0](https://www.adafruit.com/product/2772)
* FLASH 256KB
* RAM 32KB
* **Pro:** Multiple I2C, SPIs, Serial and full speed USB
* **Con:** No WIFI or Bluetooth
* [ESP32](https://www.espressif.com/en/products/hardware/esp32/overview)
* Example board: [ESP32 Feather Board](https://www.adafruit.com/product/3405)
* FLASH 4MB
* RAM 520KB
* **Pro:** WIFI and Bluetooth
* **Con:** No USB Hardware (requires an FTDI)
## Output devices #1 [Victor]
**:date: 04/04/2019**
* Actuating, closing the loop.
* Controlling electricity to generate movement or light.
### Types of actuator


* Electromagnetic
* DC motors
* Brushless motors
* Servo motors
* Stepper motors
* Relays, solenoids, valves, etc
* Speakers
* Electroluminescence
* Leds
* RGB
* Addressable
* LCD's (polarized light and liquid crystal)
* Piezoelectric
* Buzzer and speaker.
* [Fab Academy sensors](http://academy.cba.mit.edu/classes/output_devices/index.html)
### Controlling outputs
* LED's
* One color, PWM for intensity
* RGB, PWM
* Addressable -> libraries [guides](https://learn.adafruit.com/adafruit-neopixel-uberguide)
* Charlieplexing [image](https://upload.wikimedia.org/wikipedia/commons/thumb/3/3d/3-pin_Charlieplexing_with_common_resistors.svg/1920px-3-pin_Charlieplexing_with_common_resistors.svg.png)
* DC motor
* H-bridges

* Brushless motor
* Search
* Stepper Motor
* Unipolar
* Bipolar
* [IC Component](https://www.digikey.com/product-detail/en/allegro-microsystems-llc/A4982SETTR-T/620-1340-1-ND/2237994)
* [Step stick](https://www.pololu.com/product/1182)
* Buzzer and Speaker
* Arduino Tone function
* Amplifiers
### How to wire an output?
* We will always look for well documented output [learn.sparkfun.com](https://learn.sparkfun.com/), [learn.adafruit.com](https://learn.adafruit.com/)
* Download the EAGLES from the Breakout boards to help you, [example](https://github.com/adafruit/Adafruit-TB6612-Motor-Driver-Breakout-PCB)
* Electronic recipes
* [Voltage dividers](https://learn.sparkfun.com/tutorials/voltage-dividers/all)
* [Power Transistors](https://learn.sparkfun.com/tutorials/transistors/all)
* Integrated Circuits: H-Bridges, Darlington Arrays...
### How to code for an output?
* Output interfaces:
* On/Off: [DigitalWrite](https://www.arduino.cc/reference/en/language/functions/digital-io/digitalwrite/)
* Pulse With Modulation: [AnalogWrite](https://www.arduino.cc/reference/en/language/functions/analog-io/analogwrite/)
* [Pulses](https://www.arduino.cc/reference/en/language/functions/advanced-io/pulsein/)
* [Digital Communication](https://learn.sparkfun.com/tutorials/serial-communication/all): [Serial / UART](https://www.arduino.cc/en/reference/serial), [SPI](https://www.arduino.cc/en/Reference/SPI), [I2C](https://www.arduino.cc/en/reference/wire) :warning: *We will always use an specific sensor library implementing the comunication*
### More outputs recipes














## Debugging inputs and outputs [Victor]
**:date: 05/04/2019**
* Divide and conquer.
* Always subdivide the system as much as posible.
* Metodic tests
### Hardware
* Prototyping before building
 vs 
* Multimeter checks
* Continuity before and after soldering components
* Voltages
* Isolating hardware parts, cutting traces, solder bridges, jumpers, designing for debug.
* Unconsistent tests --> heat or power problems.
### Software
* Creating small sketches for testing specific parts
* Using Serial print.
* Using defines to build a better Serial Print debug
* Using comments to disable code
* Structuring the code in functions
* Always review compiler error messages.
* Get someone else to review your code
## Advanced inputs and outputs recipes and coding [Guillem]
* Notes [here](https://hackmd.io/Uw1XxGa7S3qNrL7nChGrcA)