Beruflich Dokumente
Kultur Dokumente
b. Limit Switches and Motor Direction Control = the idea is to stop the motor only in the direction the
limit switch is triggered so we are to disconnect only that part of the circuit.
c. Toggle Relay: the basic idea is to use one push-button to switch on/off a circuit.
- You use two DPDT switches.
- The poles of the two switches face each other i.e. they have different un-energized states.
- The first pole of both the switches is used to supply/disconnect power. The first one supplies power to
one of the two relays at one time. The second one either supplies power to the positive side of the
relays or the negative.
CASE 1 - Initial Button Press:
- The primary relay is initially energized as it is being supplied with power. This is because of the
switches of the secondary relay in their un-energized state. The power switch or the first pole of the
primary DPDT is connected to the positive side of the relays.
- Pressing the switch leads to the secondary relay energizing which ends up disconnecting the primary
relay and energizes the secondary relay.
- This leads to the primary relay de-energizing.
CASE 2 - Second Button Press:
- Pressing the button again leads to the bottom of the relays being energized. The secondary relay has
the same voltage on both of its ends so it de-energizes.
- This leads to the primary relay energizing once again. The power switch is also reset.
5. Ladder diagrams.
. Switches in series = AND.
. Switches in parallel = OR.
6. Temperature Sensors.
- Hysteresis is mainly used in temperature sensors/controls to prevent the system from toggling. For
example, a heater that needs to be turned off if the temperature exceeds 80 degree C will turn on once
again as the temperature goes down. So we use hysteresis to change the set point to turn the heater on
after say, the temperature becomes 25 degree C so toggling does not happen.
. LM35 and Ds18s20 are solid state temperature sensors.
. RTDs: PT-n where n is the nominal resistance or the resistance at 0 degree C. n = 100 or 1000 etc.
. Thermistors and RTDs require external excitation while thermocouples are active in nature.
. Voltmeters, Frequency Meters etc. on the AtMega16.
. Instrumentation.
7. DC Motor Control.
a. Servo Motors:
- They're mainly used for position control.
- Controlled via PWM.
- The width of the pulse corresponds to the servo angle. A servo motor can go up to 180 degrees.
- For an 8 bit timer, a pulse count or OCR value of 255 can be used to figure out the pulse width that
corresponds to 180 degrees.
- We use the PWM pins on the ATMEGA16 and the Fast PWM Mode to generate PWM for servo motor
control.
8. Timers.
a. The TCNTn register = the instantaneous value of the counter register. Timers are basically counters.
For NORMAL mode, TCNT functions like OCRn. TCNT in CTC mode needs to be initialized at 0.
b. The OCRn bit = the value to which you want the timer to count. An 8 bit timer can go up to 255 from
0. Allows you to adjust the size of a pulse. Two OCR registers for timer 1. You can use either one of
them.
c. TCCRn = holds the value of the time/counter control register. Used to configure the prescaler etc.
d. Timer 1 has two TCCR registers. Both need to be configured simultaneously if you are doing some
specialized stuff. Usually it is TCCR1B that needs to be configured.
e. Timer 0 has 3 clock select bits and 2 WGM bits. 3 CS bits + 1 WGM bit + gap of 2 bits + 1 WGM bit.
f. Timer 2 has 3 clock select bits and 2 WGM bits. 3 CS bits + 1 WGM bit + gap of 2 bits + 1 WGM bit.
g. Interrupt based timing operations use the OCIE bit to work. OCIE0, OCIE1A and B and OCIE2 need to
be high respectively in the TIMSK register.
h. You can use the FAST PWM mode and the ATMEGA16's builtin PWM generator pins to drive your
motors. Just configure the COM bits in the TCCR register and set WGM to FAST PWM.
Normal Mode:
. Set TCNT = the value you want your timer to count to.
. Set TCCR = configures the mode and the clock select.
. while loop until TIFR register's TOV is 0.
. Turn off timer by setting TCCR = 0.
. Clear timer by setting TIFR = 0.
CTC Mode:
. Set TCCR = configures the mode and the clock select.
. Set TCNT = 0.
. Set OCR = the value you want your timer to count to.
. while loop until TIFR register's OCF bit is 0.
. Turn off timer by setting TCCR = 0.
. Clear timer by setting TIFR's OCF register = 0.
CTC Mode via Interrupts:
. Set TCCR = configures the mode and the clock select.
. Set TCNT = 0.
. Set OCR = the value you want your timer to count to.
. Configure TIMSK. You are interested in the OCIEn bits. Enable sei or global interrupts. Format for the
interrupt subroutine: interrupt[TIMERn_COMP] void nameofthefunction(void).