The first half of the class covered how to use an oscilloscope. We used the DSO Nano v3 by Seeed Studios. This pocket-sized oscilloscope is powerful despite its small size. We first discussed how to measure signals and then moved on to more complex topics, such as using the triggering functions and figuring out baud rates based on the oscilloscope readings. The small size is a major plus, as it will fit nicely in my hack box. It’s a big step up from the giant analog oscilloscope that my grandfather used back in the day.
The second half of the class covered how to use a multimeter. This is a must-have for anyone who likes to tinker with microcontrollers as I do. We covered how to measure AC and DC voltage, resistance and amperage, as well as continuity testing. Even though I already knew how to use one, this was a great refresher.
Of course, no class is complete without sticking something into the electric socket!
The best part of the class was that we got to keep the tools! I can’t wait to break things so I can use my new tools to fix them!
I’ve been busy putting the finishing touches on a class I am teaching at NYC Resistor called Arduino and Sensors. The purpose of this class is to teach people how to use common sensors with Arduino so they can build awesome interactive projects. The class features the Adafruit Sensor Pack 900, as this pack contains a nice selection of common sensors. I’ve written some sample code for each of the sensors in the pack. We will discuss both digital signal and analog signal sensors.
Digital signal sensors are the simplest to use. They simply return a 1 or a 0 based on the reading of the sensor (just like a switch, it’s on or off). Therefore, reading the state of one of these sensors is as simple as hooking the output of the sensor to a digital pin on the Arduino (pins 2-13 on the Uno) and calling digitalRead() on that pin. Here is a simple example – an IR sensor:
Analog signal sensors are more complex. These sensors return a voltage on an analog pin somewhere from 0 volts to the max voltage of the microcontroller (with the Uno, it’s 5 volts). In order to read an analog sensor value, the sensor output needs to be connected to an analog pin on the Arduino (pins A0-A5 on the Uno). In the code, calling analogRead() on the analog pin will give you the sensor reading. The Arduino automatically converts the voltage on the analog pin to an integer between 0 (no power) and 1023 (full power). Generally, the reading can be mapped back to some meaningful value. For example, here is a simple analog sensor – a temperature sensor:
According to the datasheet, this sensor returns 0 volts at -50 degrees Celsius and 1.75 volts at 125 degrees Celsius. It has a scale of 10 millivolts per degree Celsius. To get the raw voltage reading, we take our reading value, divide it by 1024 (to get the percentage of the full voltage) and then multiply that by 5 (since the microcontroller is supplying 5 volts). To scale the voltage to the range, we can simply multiply the voltage by 100 (according to our scale factor, 1/100 volt is 1 degree Celsius) and then subtract 50 (since zero volts is -50 degrees Celsius).
Of course, many sensors are more complex than just reading a simple pin. We’ll discuss a number of different scenarios and how to handle them. Did you ever wonder what the AREF pin is for? It’s the analog voltage reference pin and we will be discussing how to use it. We’re also going to use potentiometers to tune the sensitivity of some of the sensors.
The class is already almost sold out! If all goes well, I will hopefully teach it again soon!