INPUT DEVICES RECITATION
HTMaA 2021 - Week 7
What we will talk about
What we will talk about
What sort of things would you like to measure?
Analog to Digital Converter (ADC) - Voltage* (an ADC is in the loop for most digital measurement). Here's how an ADC works.
Remember that you can mix and match! A light sensor can measure proximity and a hall effect sensor can measure displacement, etc.
What sort of things would you like to measure?
Cedric made this excellent HTMSTMaA writeup on sensors
What sort of things would you like to measure?
What sort of things would you like to measure?
Measuring an Analog Input
Measuring an Analog Input
So in practice, for a 10 bit resolution measurement, half might be lost to your signal range, and 10 counts to noise, leaving 1024*(0.5)/(10) = 51.2 true resolution.
Measuring an Analog Input
Measuring an Analog Input
Measuring an Analog Input
Filtering
Filtering
Filtering
Filtering
Filtering
Low Pass Filter
High Pass + Band Pass Filters
High Pass
Band Pass
Hardware Filtering
Teensy PWMs at either 3.6kHz or 4.5kHz
What do we see on the scope?
Linearity
Linearity
Linearity
Configuring Advanced Input Devices
Let's change gears and talk about configuring a more sophisticated sensor with its own logic and communication protocol.
We might want to do this because:
Configuring Advanced Input Devices
Let's use TI's TMAG5170-Q1 3-Axis Linear Hall Effect Sensor With SPI Interface as a case study for the rest of recitation.
Configuring Advanced Input Devices
Configuring Advanced Input Devices
Configuring Advanced Input Devices
Configuring Advanced Input Devices
Configuring Advanced Input Devices
Configuring Advanced Input Devices
Configuring Advanced Input Devices
Configuring Advanced Input Devices
#include "HX711.h"
#define calibration_factor -7050.0 // This value is obtained using the SparkFun_HX711_Calibration sketch
#define DOUT 3
#define CLK 2
HX711 scale;
void setup() {
Serial.begin(9600);
Serial.println("HX711 scale demo");
scale.begin(DOUT, CLK);
scale.set_scale(calibration_factor); //This value is obtained by using the SparkFun_HX711_Calibration sketch
scale.tare(); //Assuming there is no weight on the scale at start up, reset the scale to 0
Serial.println("Readings:");
}
void loop() {
Serial.print("Reading: ");
Serial.print(scale.get_units(), 1); //scale.get_units() returns a float
Serial.print(" lbs"); //You can change this to kg but you'll need to refactor the calibration_factor
Serial.println();
}
Questions