BlueOptics Bo65j33660d 10gbase-bx-d xfp transceiver tx1330nm-rx1270nm 60 km s...
EE40_Final_Hack_Writeup
1. Final Hack Writeup
Project Name: Popsicle-stick Vibrating
Hopper Robot (with band pass filters)
Authors: Yanbo Yao, Chunming Lin
Description
Two motors will move and cause the robot to bounce, when there is a sound
with the frequency above 600 Hz. When the motors move, the yellow LED
will also light up. The red and green LEDs are controlled by the right and left
photocells. The code inside the MSP430 combines the functions of the
photocells and LEDs. For example, when the photocells are on, the LEDs turn
on.
Materials
• Capacitors: one 1uF
• Resistors: two 200 ohm, two 51K ohm, one 100 ohm, two 330 ohm
• LEDs: one yellow, one red, one green
• Op Amp: LMC6484
• Two Bread Board
Instructions
1. Build a High Pass Filter Circuit.
2. 2. Build two LEDs Circuits (Build separately with all the other circuits).
3. Build a LED circuit, which is parallel with the right motor.
4. Write a code, which tells the motors to move when there is a sound, also,
the code turns on the LED when the there is a light above the photocell, and
turns off the LED, when there is no light.
Documentation
4. //Choose P1.0 (channel 5) as an analog input pin:
ADC10AE0 |= BIT5;
BCSCTL1 = CALBC1_1MHZ; // Set range
DCOCTL = CALDCO_1MHZ;
BCSCTL2 &= ~(DIVS_3); // SMCLK = DCO = 1MHz
P1SEL |= BIT5;
P1DIR |= (BIT1 + LLED + RLED + LMOTOR + RMOTOR); // set P1.1 and
LEDs as output
P1DIR &= ~(LPHOTO + RPHOTO); // set these bits to inputs
P1REN |= (LPHOTO + RPHOTO); // enable pull up resistors
for ( ; ; )
{
ADC10CTL0 |= ENC + ADC10SC;
//pulse motor if the digitized level is high enough
if (ADC10MEM >= 530) // 2 5K omh
{
pwm_pulse(5000, LMOTOR);
pwm_pulse(5000, RMOTOR);
}
else
{
P1OUT &= ~LMOTOR;
P1OUT &= ~RMOTOR;
}
//turn off the LEFT LED if left photocell is covered by hand.
if (P1IN & LPHOTO)
P1OUT |= LLED;
else
P1OUT &= ~LLED;
//turn off the RIGHT LED if right photocell is covered by hand.
if (P1IN & RPHOTO)
P1OUT |= RLED;
else
5. P1OUT &= ~RLED;
}
return 0;
}
void pwm_pulse(unsigned int ms, unsigned int pins) //pulse on for ms
number of miliseconds
{
unsigned int i;
for (i=0;i<ms/10;i++)
{
//Complete this loop to make the motors pulse on 80% of the time and off
20% of the time!
P1OUT |= (pins); //set buzzer pin
}
}