Electronic Technologies for Art II (electric boogaloo)
Mark Allen
UCSD
Intro
- Analog Input
- RCTIME
- Connection Methods
- Using Relays
Measuring analog input
- The I/O pins on the stamp can only measure high/low values
- Often we want to read analog data, that have a range of values rather than on/off
- To measure the resistance at an input (many sensors give data as resistance) we use RC Time
- By measuring how long a capacitor of known value takes to charge (to go from a low state to a high state) we can determine the value of the resistor in the rc time circuit
Analog input schematic
the lower resistor is a potentiometer (note that it has three leads)
RCTIME
- To measure capacitor charge time we use the RCTIME command
- RCTIME is somewhat more complicated than commands we've used previously as it uses three parameters
- RCTIME pin state variable
- pin is the i/o pin than we've hooked up our circuit to
- state is the condition (high or low) that we're looking for. Once pin is longer in state the command ends and the result is stored in variable
- variable holds how long it took for the pin to switch states (how long the capacitor took to discharge)
- variable must be declared before using RCTIME, just like any other variable
RCTIME code example
- charge_time var word ' word variable to hold result
- sensor con 7 ' we've got the circuit hooked up to pin 7
- main:
- high sensor ' discharge capacitor
- pause 1 ' give the capacitor a little bit of time to discharge
- RCTIME sensor, 1, charge_time
- debug DEC charge_time, CR
- goto main
Connection Methods
- Soldering refresher
- Advanced Crimping with Molex connectors
- Jacks
- Heat Shrink
Relays
- Switch operated by an electromagnet.
- Control signal is electrically isolated from switched current.
- Relatively slow and electrically noisy.
- Can pass oodles of AC or DC current.
- Generates unfriendly voltage spike when magnetic field in coil collapses.
Solid State Relay
- Functions like a mechanical relay
- Can be driven directly from a microcontroller
- Less electrically noisy than a mechanical relay
Solid State Relay Circuit