Jump to content

username

Members
  • Content Count

    305
  • Joined

  • Last visited

  • Days Won

    8

Reputation Activity

  1. Like
    username got a reaction from pine in Laser Security V2 Msp430   
    Hey pine,
     
    Pretty much any micro that has 10 gpio ports should work with this. Everything is digital and bit banged.
  2. Like
    username reacted to Fe2o3Fish in Simple LED Fader?   
    "normally", the LP runs at 1-MHz but, honestly (and hopefully the MSP gods won't zap me), you'd be better
    off with an Atmel Tiny13 (8-pins) or one of the newer ATTiny9 (6-pins but no DIP package). You'd wind up
    with far fewer components and it runs about the same speed sans crystal. It's a shame that TI doesn't
    make an 8-pin '430.
     
    -Rusty-
  3. Like
    username got a reaction from pine in Laser modules   
    This is what I used in my design. They work decently. 5mW is pretty much all you need. If you make some 100mW+ laser your probably going to end up burning out the LED or your eyes for that matter.
     
    *note, there pretty darn hard to break apart and mod the insides. Currently they have a cap on the line.... not sure how big. So your going to run into problems if you try to PWM it at a very high speed.
  4. Like
    username got a reaction from RobG in Laser Security V2 Msp430   
    Hey All,
    Nate here. I'm currently a junior in EE and decided to use the msp430 in my Design 1 project(not senior design).
    Built a PCB and finalized most of the design.
    -Some basic features : LCD 16x2
    -120 db alarm (freaking loud)
    -1 5mw legal red laser
    -1 red led recieving diode
    -2 push buttons to enter in a code on the lcd screen
    Here some pics: (will upload a video of the operation when I get some time)
     


     

     

     

     

     
    Here is the schematic: (to big for site)
    http://img254.imageshack.us/img254/9838/lasersspdf.png
     
    and source code ( still in beta... needs abit of work as you tell)
     
    main.c

    // Laser Security System: // Code By Natahn Zimmerman // 11/9/11 /////////////Includes/////////////////// #include "msp430g2231.h" #include "lcd.h" /////////////LCD Defines//////////////// #define DATAPIN BIT6 #define CLOCKPIN BIT5 #define ENABLEPIN BIT4 //////////Other Micro Defines/////////// #define GLED BIT6 // Green LED saying that SS is good and active #define RLED BIT7 // Red LED saying that SS has been breached and alarm is high #define ALARM BIT7 // Also attached to RLED. #define TXD BIT0 // Serial Output #define RXD BIT1 // Serial Input #define SW1 BIT2 // Disable SS #define SW2 BIT3 // Disable SS //////////////Variables///////////////// volatile unsigned int i=1; // Variable for TXD Funciton. If this value goes above a certain point, security is breached. volatile unsigned int j=0; // Low State Check variable. This variable should increment to a certain point, if not, security is breached. volatile unsigned int t=0; // For loop variable for j. volatile unsigned int ticks=0; // Variable for Timer function. After this gets to a certain point alarm sounds. volatile unsigned int password=0; // value for number being keyed in on keypad. volatile unsigned int a = 0; // Password compare value volatile unsigned int c = 0; // Increment based upon password being correct. volatile unsigned int b = (0x80 | 0x40 | 0xA); // HD44780 Cursor location. char ptext[2]; // Password Char array. Bit 1 = password #, Bit 2 = null. //////////////PROTOS//////////////////// void TXD_RXD(void); // Prototype TXD Function void dis_alarm(void); //////////////Main////////////////////// void main(void) { _delay_cycles(20000); // debug delay WDTCTL = WDTPW + WDTHOLD; // turn off watchdog so micro does not reset _delay_cycles(100000); // debug delay P1OUT &= ~(CLOCKPIN + DATAPIN + RLED); //Set these pins low (ensures low when defined as output) P1OUT |= ENABLEPIN; // Set enable pin high. (ensures high when defined as output) P1DIR |= ENABLEPIN + CLOCKPIN + DATAPIN +RLED; // Define as outputs P1DIR &= ~(SW2 + SW1); // Define as perm inputs P1IE |= (SW1); // P1.2 interrupt enabled P1IFG &= ~(SW1); // P1.2 IFG cleared P1IE |= (SW2); // P1.3 interrupt enabled P1IFG &= ~(SW2); // P1.3 IFG cleared __enable_interrupt(); // enable all interrupts P2SEL = 0x00; // Set functionality of Port 2 to GPIO P2DIR |= GLED; // Set Green LED, AKA P2.6 AKA XIN to a output. P2OUT = 0; // Set all outputs on port 2 to 0. AKA GLED. P1DIR |= ( RLED + TXD); // All outputs except DIS_ALARM and RXD P1OUT &= ~(RLED +TXD); // All bits set high initally, need to set all bits low. P2OUT |= GLED; // Turns Green LED ON initDisplay(); // Turn on display. clearDisplay(); // Clear Display Print_Screen("Zalous Laser"); second_line(); Print_Screen("Security System"); _delay_cycles(5000000); clearDisplay(); Print_Screen("Laser System"); second_line(); Print_Screen("Now Activated"); _delay_cycles(20000); TXD_RXD(); // Should always stay in this state unless TXD != RXD. In which case the following happens: P2OUT &= ~GLED; // Green LED Turns off clearDisplay(); // Clear display for new text Print_Screen("Security System"); second_line(); Print_Screen("Breached! "); while(1) { P2OUT ^= GLED; // Blink Green LED CCTL0 = CCIE; // CCR0 interrupt enabled ( TIMER 1) CCR0 = 50000; // Set Timer Value TACTL = TASSEL_2 + MC_1; // Initialize Timer _delay_cycles(5000000); //Pause before enter password screen. clearDisplay(); Print_Screen("Please Enter"); second_line(); Print_Screen("Password: "); while(1) { if(ticks>500) // Ticks is a Timer Variable. User has 30 seconds to enter password before alarm sounds. { while(1) { P1OUT ^= RLED; //Pulse alarm. _delay_cycles(500000); } } } } } // End main void TXD_RXD(void) { while(i < 10) { P1OUT |= TXD; __delay_cycles(5); if((RXD & P1IN)==0) { i++; } P1OUT &= ~TXD; __delay_cycles(20); for(t=0;t<10;t++) { if((RXD & P1IN)==0) { j++; } } if(j>5) { j=0; } else { i++; } __delay_cycles(20); } // End While } // End Function void dis_alarm(void) { P1OUT &= ~TXD; for(i=0;i<10;i++) { _delay_cycles(300000); P2OUT ^= GLED; } WDTCTL = WDT_MRST_32 + ~WDTHOLD; } // Port 1 interrupt service routine #pragma vector=PORT1_VECTOR __interrupt void Port_1(void) { _delay_cycles(10); if(((SW1 & P1IN)) == 0) { password++; ptext[0] = password + '0'; ptext[1] = 0; _delay_cycles(2000); sendInstruction(b+a); _delay_cycles(2000); Print_Screen(ptext); _delay_cycles(2000); P2OUT ^= GLED; } if(((SW2 & P1IN)) == 0) { a++; _delay_cycles(2000); sendInstruction(b+a); _delay_cycles(2000); P2OUT ^= GLED; Print_Screen("_"); if(a==1) { if(password==3) { c++; } } if(a==2) { if(password==8) { c++; } } if(a==3) { if(password==9) { c++; } } if(a==4) { if(password==1) { c++; } } if(a==4) { if(password==2) { c++; c++; } } if(c==4) { CCTL0 &= ~CCIE; _delay_cycles(20000); __disable_interrupt(); _delay_cycles(120000); WDTCTL = WDT_MRST_32 + ~WDTHOLD; _delay_cycles(120000); } if(c==5) // debug feature. laser = always on. useful for { P1OUT = TXD; } // end if(a==4) { sendInstruction(b+a); Print_Screen(" "); a=0; c=0; sendInstruction(b+a); Print_Screen("_"); } // End If a == 4 password=0; } _delay_cycles(200000); P1IFG &= ~SW1; // P1.2 IFG cleared P1IFG &= ~SW2; // P1.3 IFG cleared } // End ISR #pragma vector=TIMERA0_VECTOR __interrupt void Timer_A (void) { P2OUT ^= GLED; // Toggle P1.0 ticks++; }
     
    and lcd.h (many thanks to RobG for his LCD code. Modified it abit and it works incredibly well! )
     

    #ifndef LCD_H_ #define LCD_H_ #define sendData(data) send(data, 1) #define sendInstruction(data) send(data, 0) #define initDisplay() sendInstruction(0x3C); sendInstruction(0x0C); clearDisplay(); sendInstruction(0x06) #define clearDisplay() sendInstruction(0x01); _delay_cycles(2000) #define second_line() sendInstruction((0x80 | 0x40)); _delay_cycles(2000) #define DATAPIN BIT6 #define CLOCKPIN BIT5 #define ENABLEPIN BIT4 void send(char data, char registerSelect); void sendDataArray(char data[], char length); void Print_Screen(char *texts); char charIndex = 0; char bitCounter = 0; void sendDataArray(char data[], char length) { charIndex = 0; while(charIndex < length) { sendData(data[charIndex]); charIndex++; } } void send(char data, char registerSelect) { bitCounter = 0; while(bitCounter < 8) { (data & BIT7) ? (P1OUT |= DATAPIN) : (P1OUT &= ~DATAPIN); data <<= 1; P1OUT |= CLOCKPIN; P1OUT &= ~CLOCKPIN; bitCounter++; } registerSelect ? (P1OUT |= DATAPIN) : (P1OUT &= ~DATAPIN); P1OUT &= ~ENABLEPIN; P1OUT |= ENABLEPIN; } void Print_Screen(char *texts) { volatile int i=0; char *h; h=texts; for(i=0;i<16;i++) { if(h[i]==0) { break; } } sendDataArray(h, i); } #endif /*LCD_H_*/

  5. Like
    username got a reaction from bluehash in Laser Security V2 Msp430   
    Hey All,
    Nate here. I'm currently a junior in EE and decided to use the msp430 in my Design 1 project(not senior design).
    Built a PCB and finalized most of the design.
    -Some basic features : LCD 16x2
    -120 db alarm (freaking loud)
    -1 5mw legal red laser
    -1 red led recieving diode
    -2 push buttons to enter in a code on the lcd screen
    Here some pics: (will upload a video of the operation when I get some time)
     


     

     

     

     

     
    Here is the schematic: (to big for site)
    http://img254.imageshack.us/img254/9838/lasersspdf.png
     
    and source code ( still in beta... needs abit of work as you tell)
     
    main.c

    // Laser Security System: // Code By Natahn Zimmerman // 11/9/11 /////////////Includes/////////////////// #include "msp430g2231.h" #include "lcd.h" /////////////LCD Defines//////////////// #define DATAPIN BIT6 #define CLOCKPIN BIT5 #define ENABLEPIN BIT4 //////////Other Micro Defines/////////// #define GLED BIT6 // Green LED saying that SS is good and active #define RLED BIT7 // Red LED saying that SS has been breached and alarm is high #define ALARM BIT7 // Also attached to RLED. #define TXD BIT0 // Serial Output #define RXD BIT1 // Serial Input #define SW1 BIT2 // Disable SS #define SW2 BIT3 // Disable SS //////////////Variables///////////////// volatile unsigned int i=1; // Variable for TXD Funciton. If this value goes above a certain point, security is breached. volatile unsigned int j=0; // Low State Check variable. This variable should increment to a certain point, if not, security is breached. volatile unsigned int t=0; // For loop variable for j. volatile unsigned int ticks=0; // Variable for Timer function. After this gets to a certain point alarm sounds. volatile unsigned int password=0; // value for number being keyed in on keypad. volatile unsigned int a = 0; // Password compare value volatile unsigned int c = 0; // Increment based upon password being correct. volatile unsigned int b = (0x80 | 0x40 | 0xA); // HD44780 Cursor location. char ptext[2]; // Password Char array. Bit 1 = password #, Bit 2 = null. //////////////PROTOS//////////////////// void TXD_RXD(void); // Prototype TXD Function void dis_alarm(void); //////////////Main////////////////////// void main(void) { _delay_cycles(20000); // debug delay WDTCTL = WDTPW + WDTHOLD; // turn off watchdog so micro does not reset _delay_cycles(100000); // debug delay P1OUT &= ~(CLOCKPIN + DATAPIN + RLED); //Set these pins low (ensures low when defined as output) P1OUT |= ENABLEPIN; // Set enable pin high. (ensures high when defined as output) P1DIR |= ENABLEPIN + CLOCKPIN + DATAPIN +RLED; // Define as outputs P1DIR &= ~(SW2 + SW1); // Define as perm inputs P1IE |= (SW1); // P1.2 interrupt enabled P1IFG &= ~(SW1); // P1.2 IFG cleared P1IE |= (SW2); // P1.3 interrupt enabled P1IFG &= ~(SW2); // P1.3 IFG cleared __enable_interrupt(); // enable all interrupts P2SEL = 0x00; // Set functionality of Port 2 to GPIO P2DIR |= GLED; // Set Green LED, AKA P2.6 AKA XIN to a output. P2OUT = 0; // Set all outputs on port 2 to 0. AKA GLED. P1DIR |= ( RLED + TXD); // All outputs except DIS_ALARM and RXD P1OUT &= ~(RLED +TXD); // All bits set high initally, need to set all bits low. P2OUT |= GLED; // Turns Green LED ON initDisplay(); // Turn on display. clearDisplay(); // Clear Display Print_Screen("Zalous Laser"); second_line(); Print_Screen("Security System"); _delay_cycles(5000000); clearDisplay(); Print_Screen("Laser System"); second_line(); Print_Screen("Now Activated"); _delay_cycles(20000); TXD_RXD(); // Should always stay in this state unless TXD != RXD. In which case the following happens: P2OUT &= ~GLED; // Green LED Turns off clearDisplay(); // Clear display for new text Print_Screen("Security System"); second_line(); Print_Screen("Breached! "); while(1) { P2OUT ^= GLED; // Blink Green LED CCTL0 = CCIE; // CCR0 interrupt enabled ( TIMER 1) CCR0 = 50000; // Set Timer Value TACTL = TASSEL_2 + MC_1; // Initialize Timer _delay_cycles(5000000); //Pause before enter password screen. clearDisplay(); Print_Screen("Please Enter"); second_line(); Print_Screen("Password: "); while(1) { if(ticks>500) // Ticks is a Timer Variable. User has 30 seconds to enter password before alarm sounds. { while(1) { P1OUT ^= RLED; //Pulse alarm. _delay_cycles(500000); } } } } } // End main void TXD_RXD(void) { while(i < 10) { P1OUT |= TXD; __delay_cycles(5); if((RXD & P1IN)==0) { i++; } P1OUT &= ~TXD; __delay_cycles(20); for(t=0;t<10;t++) { if((RXD & P1IN)==0) { j++; } } if(j>5) { j=0; } else { i++; } __delay_cycles(20); } // End While } // End Function void dis_alarm(void) { P1OUT &= ~TXD; for(i=0;i<10;i++) { _delay_cycles(300000); P2OUT ^= GLED; } WDTCTL = WDT_MRST_32 + ~WDTHOLD; } // Port 1 interrupt service routine #pragma vector=PORT1_VECTOR __interrupt void Port_1(void) { _delay_cycles(10); if(((SW1 & P1IN)) == 0) { password++; ptext[0] = password + '0'; ptext[1] = 0; _delay_cycles(2000); sendInstruction(b+a); _delay_cycles(2000); Print_Screen(ptext); _delay_cycles(2000); P2OUT ^= GLED; } if(((SW2 & P1IN)) == 0) { a++; _delay_cycles(2000); sendInstruction(b+a); _delay_cycles(2000); P2OUT ^= GLED; Print_Screen("_"); if(a==1) { if(password==3) { c++; } } if(a==2) { if(password==8) { c++; } } if(a==3) { if(password==9) { c++; } } if(a==4) { if(password==1) { c++; } } if(a==4) { if(password==2) { c++; c++; } } if(c==4) { CCTL0 &= ~CCIE; _delay_cycles(20000); __disable_interrupt(); _delay_cycles(120000); WDTCTL = WDT_MRST_32 + ~WDTHOLD; _delay_cycles(120000); } if(c==5) // debug feature. laser = always on. useful for { P1OUT = TXD; } // end if(a==4) { sendInstruction(b+a); Print_Screen(" "); a=0; c=0; sendInstruction(b+a); Print_Screen("_"); } // End If a == 4 password=0; } _delay_cycles(200000); P1IFG &= ~SW1; // P1.2 IFG cleared P1IFG &= ~SW2; // P1.3 IFG cleared } // End ISR #pragma vector=TIMERA0_VECTOR __interrupt void Timer_A (void) { P2OUT ^= GLED; // Toggle P1.0 ticks++; }
     
    and lcd.h (many thanks to RobG for his LCD code. Modified it abit and it works incredibly well! )
     

    #ifndef LCD_H_ #define LCD_H_ #define sendData(data) send(data, 1) #define sendInstruction(data) send(data, 0) #define initDisplay() sendInstruction(0x3C); sendInstruction(0x0C); clearDisplay(); sendInstruction(0x06) #define clearDisplay() sendInstruction(0x01); _delay_cycles(2000) #define second_line() sendInstruction((0x80 | 0x40)); _delay_cycles(2000) #define DATAPIN BIT6 #define CLOCKPIN BIT5 #define ENABLEPIN BIT4 void send(char data, char registerSelect); void sendDataArray(char data[], char length); void Print_Screen(char *texts); char charIndex = 0; char bitCounter = 0; void sendDataArray(char data[], char length) { charIndex = 0; while(charIndex < length) { sendData(data[charIndex]); charIndex++; } } void send(char data, char registerSelect) { bitCounter = 0; while(bitCounter < 8) { (data & BIT7) ? (P1OUT |= DATAPIN) : (P1OUT &= ~DATAPIN); data <<= 1; P1OUT |= CLOCKPIN; P1OUT &= ~CLOCKPIN; bitCounter++; } registerSelect ? (P1OUT |= DATAPIN) : (P1OUT &= ~DATAPIN); P1OUT &= ~ENABLEPIN; P1OUT |= ENABLEPIN; } void Print_Screen(char *texts) { volatile int i=0; char *h; h=texts; for(i=0;i<16;i++) { if(h[i]==0) { break; } } sendDataArray(h, i); } #endif /*LCD_H_*/

  6. Like
    username got a reaction from mbonnin in Laser Security V2 Msp430   
    yup, its 110mA at 9V. Got the ebay link below. There probably better options out there but this worked for me and was under 7usd. http://www.ebay.com/itm/120741728178?ss ... 1497.l2649
  7. Like
    username got a reaction from tingo in Laser Security V2 Msp430   
    Hey All,
    Nate here. I'm currently a junior in EE and decided to use the msp430 in my Design 1 project(not senior design).
    Built a PCB and finalized most of the design.
    -Some basic features : LCD 16x2
    -120 db alarm (freaking loud)
    -1 5mw legal red laser
    -1 red led recieving diode
    -2 push buttons to enter in a code on the lcd screen
    Here some pics: (will upload a video of the operation when I get some time)
     


     

     

     

     

     
    Here is the schematic: (to big for site)
    http://img254.imageshack.us/img254/9838/lasersspdf.png
     
    and source code ( still in beta... needs abit of work as you tell)
     
    main.c

    // Laser Security System: // Code By Natahn Zimmerman // 11/9/11 /////////////Includes/////////////////// #include "msp430g2231.h" #include "lcd.h" /////////////LCD Defines//////////////// #define DATAPIN BIT6 #define CLOCKPIN BIT5 #define ENABLEPIN BIT4 //////////Other Micro Defines/////////// #define GLED BIT6 // Green LED saying that SS is good and active #define RLED BIT7 // Red LED saying that SS has been breached and alarm is high #define ALARM BIT7 // Also attached to RLED. #define TXD BIT0 // Serial Output #define RXD BIT1 // Serial Input #define SW1 BIT2 // Disable SS #define SW2 BIT3 // Disable SS //////////////Variables///////////////// volatile unsigned int i=1; // Variable for TXD Funciton. If this value goes above a certain point, security is breached. volatile unsigned int j=0; // Low State Check variable. This variable should increment to a certain point, if not, security is breached. volatile unsigned int t=0; // For loop variable for j. volatile unsigned int ticks=0; // Variable for Timer function. After this gets to a certain point alarm sounds. volatile unsigned int password=0; // value for number being keyed in on keypad. volatile unsigned int a = 0; // Password compare value volatile unsigned int c = 0; // Increment based upon password being correct. volatile unsigned int b = (0x80 | 0x40 | 0xA); // HD44780 Cursor location. char ptext[2]; // Password Char array. Bit 1 = password #, Bit 2 = null. //////////////PROTOS//////////////////// void TXD_RXD(void); // Prototype TXD Function void dis_alarm(void); //////////////Main////////////////////// void main(void) { _delay_cycles(20000); // debug delay WDTCTL = WDTPW + WDTHOLD; // turn off watchdog so micro does not reset _delay_cycles(100000); // debug delay P1OUT &= ~(CLOCKPIN + DATAPIN + RLED); //Set these pins low (ensures low when defined as output) P1OUT |= ENABLEPIN; // Set enable pin high. (ensures high when defined as output) P1DIR |= ENABLEPIN + CLOCKPIN + DATAPIN +RLED; // Define as outputs P1DIR &= ~(SW2 + SW1); // Define as perm inputs P1IE |= (SW1); // P1.2 interrupt enabled P1IFG &= ~(SW1); // P1.2 IFG cleared P1IE |= (SW2); // P1.3 interrupt enabled P1IFG &= ~(SW2); // P1.3 IFG cleared __enable_interrupt(); // enable all interrupts P2SEL = 0x00; // Set functionality of Port 2 to GPIO P2DIR |= GLED; // Set Green LED, AKA P2.6 AKA XIN to a output. P2OUT = 0; // Set all outputs on port 2 to 0. AKA GLED. P1DIR |= ( RLED + TXD); // All outputs except DIS_ALARM and RXD P1OUT &= ~(RLED +TXD); // All bits set high initally, need to set all bits low. P2OUT |= GLED; // Turns Green LED ON initDisplay(); // Turn on display. clearDisplay(); // Clear Display Print_Screen("Zalous Laser"); second_line(); Print_Screen("Security System"); _delay_cycles(5000000); clearDisplay(); Print_Screen("Laser System"); second_line(); Print_Screen("Now Activated"); _delay_cycles(20000); TXD_RXD(); // Should always stay in this state unless TXD != RXD. In which case the following happens: P2OUT &= ~GLED; // Green LED Turns off clearDisplay(); // Clear display for new text Print_Screen("Security System"); second_line(); Print_Screen("Breached! "); while(1) { P2OUT ^= GLED; // Blink Green LED CCTL0 = CCIE; // CCR0 interrupt enabled ( TIMER 1) CCR0 = 50000; // Set Timer Value TACTL = TASSEL_2 + MC_1; // Initialize Timer _delay_cycles(5000000); //Pause before enter password screen. clearDisplay(); Print_Screen("Please Enter"); second_line(); Print_Screen("Password: "); while(1) { if(ticks>500) // Ticks is a Timer Variable. User has 30 seconds to enter password before alarm sounds. { while(1) { P1OUT ^= RLED; //Pulse alarm. _delay_cycles(500000); } } } } } // End main void TXD_RXD(void) { while(i < 10) { P1OUT |= TXD; __delay_cycles(5); if((RXD & P1IN)==0) { i++; } P1OUT &= ~TXD; __delay_cycles(20); for(t=0;t<10;t++) { if((RXD & P1IN)==0) { j++; } } if(j>5) { j=0; } else { i++; } __delay_cycles(20); } // End While } // End Function void dis_alarm(void) { P1OUT &= ~TXD; for(i=0;i<10;i++) { _delay_cycles(300000); P2OUT ^= GLED; } WDTCTL = WDT_MRST_32 + ~WDTHOLD; } // Port 1 interrupt service routine #pragma vector=PORT1_VECTOR __interrupt void Port_1(void) { _delay_cycles(10); if(((SW1 & P1IN)) == 0) { password++; ptext[0] = password + '0'; ptext[1] = 0; _delay_cycles(2000); sendInstruction(b+a); _delay_cycles(2000); Print_Screen(ptext); _delay_cycles(2000); P2OUT ^= GLED; } if(((SW2 & P1IN)) == 0) { a++; _delay_cycles(2000); sendInstruction(b+a); _delay_cycles(2000); P2OUT ^= GLED; Print_Screen("_"); if(a==1) { if(password==3) { c++; } } if(a==2) { if(password==8) { c++; } } if(a==3) { if(password==9) { c++; } } if(a==4) { if(password==1) { c++; } } if(a==4) { if(password==2) { c++; c++; } } if(c==4) { CCTL0 &= ~CCIE; _delay_cycles(20000); __disable_interrupt(); _delay_cycles(120000); WDTCTL = WDT_MRST_32 + ~WDTHOLD; _delay_cycles(120000); } if(c==5) // debug feature. laser = always on. useful for { P1OUT = TXD; } // end if(a==4) { sendInstruction(b+a); Print_Screen(" "); a=0; c=0; sendInstruction(b+a); Print_Screen("_"); } // End If a == 4 password=0; } _delay_cycles(200000); P1IFG &= ~SW1; // P1.2 IFG cleared P1IFG &= ~SW2; // P1.3 IFG cleared } // End ISR #pragma vector=TIMERA0_VECTOR __interrupt void Timer_A (void) { P2OUT ^= GLED; // Toggle P1.0 ticks++; }
     
    and lcd.h (many thanks to RobG for his LCD code. Modified it abit and it works incredibly well! )
     

    #ifndef LCD_H_ #define LCD_H_ #define sendData(data) send(data, 1) #define sendInstruction(data) send(data, 0) #define initDisplay() sendInstruction(0x3C); sendInstruction(0x0C); clearDisplay(); sendInstruction(0x06) #define clearDisplay() sendInstruction(0x01); _delay_cycles(2000) #define second_line() sendInstruction((0x80 | 0x40)); _delay_cycles(2000) #define DATAPIN BIT6 #define CLOCKPIN BIT5 #define ENABLEPIN BIT4 void send(char data, char registerSelect); void sendDataArray(char data[], char length); void Print_Screen(char *texts); char charIndex = 0; char bitCounter = 0; void sendDataArray(char data[], char length) { charIndex = 0; while(charIndex < length) { sendData(data[charIndex]); charIndex++; } } void send(char data, char registerSelect) { bitCounter = 0; while(bitCounter < 8) { (data & BIT7) ? (P1OUT |= DATAPIN) : (P1OUT &= ~DATAPIN); data <<= 1; P1OUT |= CLOCKPIN; P1OUT &= ~CLOCKPIN; bitCounter++; } registerSelect ? (P1OUT |= DATAPIN) : (P1OUT &= ~DATAPIN); P1OUT &= ~ENABLEPIN; P1OUT |= ENABLEPIN; } void Print_Screen(char *texts) { volatile int i=0; char *h; h=texts; for(i=0;i<16;i++) { if(h[i]==0) { break; } } sendDataArray(h, i); } #endif /*LCD_H_*/

  8. Like
    username reacted to RobG in Using 3 wires to control parallel LCD display   
    I have seen this done other ways, but I didn't want to deal with 7 pins, or 4 bits, etc., so I did it my way.
    You send 8 bits to shift register, then set data out to whatever RS should be, and finally pulse E, that simple.
    I will add my code later, once I clean it up.
    BTW, if you are interested, the display is LMB162 and was purchased from ebay for $7.99 with free S/H to US of A (it took a week to get to NC.)
    It requires 3.3V Vcc with 5V BL, that's why I like it (well, I don't like the fact that I need separate power for BL.)
     


     

     
    My next step is to reduce number of required pins to 2 by adding missing pulse detector (555 I think will do well here.)

  9. Like
    username got a reaction from RobG in Dual H-Bridge Booster Pack   
    Mind explaining your circuit abit? I'm kinda confused by it. Why use 8 BJTs and resistor bridges on the base inputs?
     
    Wouldn't this be the most efficient way to drive a hbridge motor part wise? (be easy on me... i'm still new to EE design)
     

  10. Like
    username got a reaction from RobG in Dual H-Bridge Booster Pack   
    yea... my brain is pretty small so I require a simple schematic or else it doesn't make much sense to me :cry:
     
    ahh so your combining parts then I assume? Thats how your at 11? Looking at your schematic, excluding the diodes and the logic ICs I count more than 12?
     
    To reduce parts for my schematic, the mosfets hooked up to CNTRL lines 2 and 4 are simply drivers for the pnp bjts so those could be a double fet and at a low power. (-1 component net). Then the 10k resistors are simple PD resistors to ensure the gates don't float high so those could be an array. (- 3 components net). That would reduce the parts down to 8.
     
    As for the main LSD mosfets hooked up to CNTRL 1 and 3, I would use http://search.digikey.com/us/en/product ... ND/2538166 (SOT23). Provided you bought 100, they would be at 15cents. If you only bought 10, they would be at 23cents which would still be in your price range.
     
    According to the plots in the datasheet they also should be able to drive 5+A at 3V vgs.
  11. Like
    username got a reaction from mbonnin in Laser Security V2 Msp430   
    Hey All,
    Nate here. I'm currently a junior in EE and decided to use the msp430 in my Design 1 project(not senior design).
    Built a PCB and finalized most of the design.
    -Some basic features : LCD 16x2
    -120 db alarm (freaking loud)
    -1 5mw legal red laser
    -1 red led recieving diode
    -2 push buttons to enter in a code on the lcd screen
    Here some pics: (will upload a video of the operation when I get some time)
     


     

     

     

     

     
    Here is the schematic: (to big for site)
    http://img254.imageshack.us/img254/9838/lasersspdf.png
     
    and source code ( still in beta... needs abit of work as you tell)
     
    main.c

    // Laser Security System: // Code By Natahn Zimmerman // 11/9/11 /////////////Includes/////////////////// #include "msp430g2231.h" #include "lcd.h" /////////////LCD Defines//////////////// #define DATAPIN BIT6 #define CLOCKPIN BIT5 #define ENABLEPIN BIT4 //////////Other Micro Defines/////////// #define GLED BIT6 // Green LED saying that SS is good and active #define RLED BIT7 // Red LED saying that SS has been breached and alarm is high #define ALARM BIT7 // Also attached to RLED. #define TXD BIT0 // Serial Output #define RXD BIT1 // Serial Input #define SW1 BIT2 // Disable SS #define SW2 BIT3 // Disable SS //////////////Variables///////////////// volatile unsigned int i=1; // Variable for TXD Funciton. If this value goes above a certain point, security is breached. volatile unsigned int j=0; // Low State Check variable. This variable should increment to a certain point, if not, security is breached. volatile unsigned int t=0; // For loop variable for j. volatile unsigned int ticks=0; // Variable for Timer function. After this gets to a certain point alarm sounds. volatile unsigned int password=0; // value for number being keyed in on keypad. volatile unsigned int a = 0; // Password compare value volatile unsigned int c = 0; // Increment based upon password being correct. volatile unsigned int b = (0x80 | 0x40 | 0xA); // HD44780 Cursor location. char ptext[2]; // Password Char array. Bit 1 = password #, Bit 2 = null. //////////////PROTOS//////////////////// void TXD_RXD(void); // Prototype TXD Function void dis_alarm(void); //////////////Main////////////////////// void main(void) { _delay_cycles(20000); // debug delay WDTCTL = WDTPW + WDTHOLD; // turn off watchdog so micro does not reset _delay_cycles(100000); // debug delay P1OUT &= ~(CLOCKPIN + DATAPIN + RLED); //Set these pins low (ensures low when defined as output) P1OUT |= ENABLEPIN; // Set enable pin high. (ensures high when defined as output) P1DIR |= ENABLEPIN + CLOCKPIN + DATAPIN +RLED; // Define as outputs P1DIR &= ~(SW2 + SW1); // Define as perm inputs P1IE |= (SW1); // P1.2 interrupt enabled P1IFG &= ~(SW1); // P1.2 IFG cleared P1IE |= (SW2); // P1.3 interrupt enabled P1IFG &= ~(SW2); // P1.3 IFG cleared __enable_interrupt(); // enable all interrupts P2SEL = 0x00; // Set functionality of Port 2 to GPIO P2DIR |= GLED; // Set Green LED, AKA P2.6 AKA XIN to a output. P2OUT = 0; // Set all outputs on port 2 to 0. AKA GLED. P1DIR |= ( RLED + TXD); // All outputs except DIS_ALARM and RXD P1OUT &= ~(RLED +TXD); // All bits set high initally, need to set all bits low. P2OUT |= GLED; // Turns Green LED ON initDisplay(); // Turn on display. clearDisplay(); // Clear Display Print_Screen("Zalous Laser"); second_line(); Print_Screen("Security System"); _delay_cycles(5000000); clearDisplay(); Print_Screen("Laser System"); second_line(); Print_Screen("Now Activated"); _delay_cycles(20000); TXD_RXD(); // Should always stay in this state unless TXD != RXD. In which case the following happens: P2OUT &= ~GLED; // Green LED Turns off clearDisplay(); // Clear display for new text Print_Screen("Security System"); second_line(); Print_Screen("Breached! "); while(1) { P2OUT ^= GLED; // Blink Green LED CCTL0 = CCIE; // CCR0 interrupt enabled ( TIMER 1) CCR0 = 50000; // Set Timer Value TACTL = TASSEL_2 + MC_1; // Initialize Timer _delay_cycles(5000000); //Pause before enter password screen. clearDisplay(); Print_Screen("Please Enter"); second_line(); Print_Screen("Password: "); while(1) { if(ticks>500) // Ticks is a Timer Variable. User has 30 seconds to enter password before alarm sounds. { while(1) { P1OUT ^= RLED; //Pulse alarm. _delay_cycles(500000); } } } } } // End main void TXD_RXD(void) { while(i < 10) { P1OUT |= TXD; __delay_cycles(5); if((RXD & P1IN)==0) { i++; } P1OUT &= ~TXD; __delay_cycles(20); for(t=0;t<10;t++) { if((RXD & P1IN)==0) { j++; } } if(j>5) { j=0; } else { i++; } __delay_cycles(20); } // End While } // End Function void dis_alarm(void) { P1OUT &= ~TXD; for(i=0;i<10;i++) { _delay_cycles(300000); P2OUT ^= GLED; } WDTCTL = WDT_MRST_32 + ~WDTHOLD; } // Port 1 interrupt service routine #pragma vector=PORT1_VECTOR __interrupt void Port_1(void) { _delay_cycles(10); if(((SW1 & P1IN)) == 0) { password++; ptext[0] = password + '0'; ptext[1] = 0; _delay_cycles(2000); sendInstruction(b+a); _delay_cycles(2000); Print_Screen(ptext); _delay_cycles(2000); P2OUT ^= GLED; } if(((SW2 & P1IN)) == 0) { a++; _delay_cycles(2000); sendInstruction(b+a); _delay_cycles(2000); P2OUT ^= GLED; Print_Screen("_"); if(a==1) { if(password==3) { c++; } } if(a==2) { if(password==8) { c++; } } if(a==3) { if(password==9) { c++; } } if(a==4) { if(password==1) { c++; } } if(a==4) { if(password==2) { c++; c++; } } if(c==4) { CCTL0 &= ~CCIE; _delay_cycles(20000); __disable_interrupt(); _delay_cycles(120000); WDTCTL = WDT_MRST_32 + ~WDTHOLD; _delay_cycles(120000); } if(c==5) // debug feature. laser = always on. useful for { P1OUT = TXD; } // end if(a==4) { sendInstruction(b+a); Print_Screen(" "); a=0; c=0; sendInstruction(b+a); Print_Screen("_"); } // End If a == 4 password=0; } _delay_cycles(200000); P1IFG &= ~SW1; // P1.2 IFG cleared P1IFG &= ~SW2; // P1.3 IFG cleared } // End ISR #pragma vector=TIMERA0_VECTOR __interrupt void Timer_A (void) { P2OUT ^= GLED; // Toggle P1.0 ticks++; }
     
    and lcd.h (many thanks to RobG for his LCD code. Modified it abit and it works incredibly well! )
     

    #ifndef LCD_H_ #define LCD_H_ #define sendData(data) send(data, 1) #define sendInstruction(data) send(data, 0) #define initDisplay() sendInstruction(0x3C); sendInstruction(0x0C); clearDisplay(); sendInstruction(0x06) #define clearDisplay() sendInstruction(0x01); _delay_cycles(2000) #define second_line() sendInstruction((0x80 | 0x40)); _delay_cycles(2000) #define DATAPIN BIT6 #define CLOCKPIN BIT5 #define ENABLEPIN BIT4 void send(char data, char registerSelect); void sendDataArray(char data[], char length); void Print_Screen(char *texts); char charIndex = 0; char bitCounter = 0; void sendDataArray(char data[], char length) { charIndex = 0; while(charIndex < length) { sendData(data[charIndex]); charIndex++; } } void send(char data, char registerSelect) { bitCounter = 0; while(bitCounter < 8) { (data & BIT7) ? (P1OUT |= DATAPIN) : (P1OUT &= ~DATAPIN); data <<= 1; P1OUT |= CLOCKPIN; P1OUT &= ~CLOCKPIN; bitCounter++; } registerSelect ? (P1OUT |= DATAPIN) : (P1OUT &= ~DATAPIN); P1OUT &= ~ENABLEPIN; P1OUT |= ENABLEPIN; } void Print_Screen(char *texts) { volatile int i=0; char *h; h=texts; for(i=0;i<16;i++) { if(h[i]==0) { break; } } sendDataArray(h, i); } #endif /*LCD_H_*/

  12. Like
    username got a reaction from TopHatHacker in Laser Security V2 Msp430   
    Hey All,
    Nate here. I'm currently a junior in EE and decided to use the msp430 in my Design 1 project(not senior design).
    Built a PCB and finalized most of the design.
    -Some basic features : LCD 16x2
    -120 db alarm (freaking loud)
    -1 5mw legal red laser
    -1 red led recieving diode
    -2 push buttons to enter in a code on the lcd screen
    Here some pics: (will upload a video of the operation when I get some time)
     


     

     

     

     

     
    Here is the schematic: (to big for site)
    http://img254.imageshack.us/img254/9838/lasersspdf.png
     
    and source code ( still in beta... needs abit of work as you tell)
     
    main.c

    // Laser Security System: // Code By Natahn Zimmerman // 11/9/11 /////////////Includes/////////////////// #include "msp430g2231.h" #include "lcd.h" /////////////LCD Defines//////////////// #define DATAPIN BIT6 #define CLOCKPIN BIT5 #define ENABLEPIN BIT4 //////////Other Micro Defines/////////// #define GLED BIT6 // Green LED saying that SS is good and active #define RLED BIT7 // Red LED saying that SS has been breached and alarm is high #define ALARM BIT7 // Also attached to RLED. #define TXD BIT0 // Serial Output #define RXD BIT1 // Serial Input #define SW1 BIT2 // Disable SS #define SW2 BIT3 // Disable SS //////////////Variables///////////////// volatile unsigned int i=1; // Variable for TXD Funciton. If this value goes above a certain point, security is breached. volatile unsigned int j=0; // Low State Check variable. This variable should increment to a certain point, if not, security is breached. volatile unsigned int t=0; // For loop variable for j. volatile unsigned int ticks=0; // Variable for Timer function. After this gets to a certain point alarm sounds. volatile unsigned int password=0; // value for number being keyed in on keypad. volatile unsigned int a = 0; // Password compare value volatile unsigned int c = 0; // Increment based upon password being correct. volatile unsigned int b = (0x80 | 0x40 | 0xA); // HD44780 Cursor location. char ptext[2]; // Password Char array. Bit 1 = password #, Bit 2 = null. //////////////PROTOS//////////////////// void TXD_RXD(void); // Prototype TXD Function void dis_alarm(void); //////////////Main////////////////////// void main(void) { _delay_cycles(20000); // debug delay WDTCTL = WDTPW + WDTHOLD; // turn off watchdog so micro does not reset _delay_cycles(100000); // debug delay P1OUT &= ~(CLOCKPIN + DATAPIN + RLED); //Set these pins low (ensures low when defined as output) P1OUT |= ENABLEPIN; // Set enable pin high. (ensures high when defined as output) P1DIR |= ENABLEPIN + CLOCKPIN + DATAPIN +RLED; // Define as outputs P1DIR &= ~(SW2 + SW1); // Define as perm inputs P1IE |= (SW1); // P1.2 interrupt enabled P1IFG &= ~(SW1); // P1.2 IFG cleared P1IE |= (SW2); // P1.3 interrupt enabled P1IFG &= ~(SW2); // P1.3 IFG cleared __enable_interrupt(); // enable all interrupts P2SEL = 0x00; // Set functionality of Port 2 to GPIO P2DIR |= GLED; // Set Green LED, AKA P2.6 AKA XIN to a output. P2OUT = 0; // Set all outputs on port 2 to 0. AKA GLED. P1DIR |= ( RLED + TXD); // All outputs except DIS_ALARM and RXD P1OUT &= ~(RLED +TXD); // All bits set high initally, need to set all bits low. P2OUT |= GLED; // Turns Green LED ON initDisplay(); // Turn on display. clearDisplay(); // Clear Display Print_Screen("Zalous Laser"); second_line(); Print_Screen("Security System"); _delay_cycles(5000000); clearDisplay(); Print_Screen("Laser System"); second_line(); Print_Screen("Now Activated"); _delay_cycles(20000); TXD_RXD(); // Should always stay in this state unless TXD != RXD. In which case the following happens: P2OUT &= ~GLED; // Green LED Turns off clearDisplay(); // Clear display for new text Print_Screen("Security System"); second_line(); Print_Screen("Breached! "); while(1) { P2OUT ^= GLED; // Blink Green LED CCTL0 = CCIE; // CCR0 interrupt enabled ( TIMER 1) CCR0 = 50000; // Set Timer Value TACTL = TASSEL_2 + MC_1; // Initialize Timer _delay_cycles(5000000); //Pause before enter password screen. clearDisplay(); Print_Screen("Please Enter"); second_line(); Print_Screen("Password: "); while(1) { if(ticks>500) // Ticks is a Timer Variable. User has 30 seconds to enter password before alarm sounds. { while(1) { P1OUT ^= RLED; //Pulse alarm. _delay_cycles(500000); } } } } } // End main void TXD_RXD(void) { while(i < 10) { P1OUT |= TXD; __delay_cycles(5); if((RXD & P1IN)==0) { i++; } P1OUT &= ~TXD; __delay_cycles(20); for(t=0;t<10;t++) { if((RXD & P1IN)==0) { j++; } } if(j>5) { j=0; } else { i++; } __delay_cycles(20); } // End While } // End Function void dis_alarm(void) { P1OUT &= ~TXD; for(i=0;i<10;i++) { _delay_cycles(300000); P2OUT ^= GLED; } WDTCTL = WDT_MRST_32 + ~WDTHOLD; } // Port 1 interrupt service routine #pragma vector=PORT1_VECTOR __interrupt void Port_1(void) { _delay_cycles(10); if(((SW1 & P1IN)) == 0) { password++; ptext[0] = password + '0'; ptext[1] = 0; _delay_cycles(2000); sendInstruction(b+a); _delay_cycles(2000); Print_Screen(ptext); _delay_cycles(2000); P2OUT ^= GLED; } if(((SW2 & P1IN)) == 0) { a++; _delay_cycles(2000); sendInstruction(b+a); _delay_cycles(2000); P2OUT ^= GLED; Print_Screen("_"); if(a==1) { if(password==3) { c++; } } if(a==2) { if(password==8) { c++; } } if(a==3) { if(password==9) { c++; } } if(a==4) { if(password==1) { c++; } } if(a==4) { if(password==2) { c++; c++; } } if(c==4) { CCTL0 &= ~CCIE; _delay_cycles(20000); __disable_interrupt(); _delay_cycles(120000); WDTCTL = WDT_MRST_32 + ~WDTHOLD; _delay_cycles(120000); } if(c==5) // debug feature. laser = always on. useful for { P1OUT = TXD; } // end if(a==4) { sendInstruction(b+a); Print_Screen(" "); a=0; c=0; sendInstruction(b+a); Print_Screen("_"); } // End If a == 4 password=0; } _delay_cycles(200000); P1IFG &= ~SW1; // P1.2 IFG cleared P1IFG &= ~SW2; // P1.3 IFG cleared } // End ISR #pragma vector=TIMERA0_VECTOR __interrupt void Timer_A (void) { P2OUT ^= GLED; // Toggle P1.0 ticks++; }
     
    and lcd.h (many thanks to RobG for his LCD code. Modified it abit and it works incredibly well! )
     

    #ifndef LCD_H_ #define LCD_H_ #define sendData(data) send(data, 1) #define sendInstruction(data) send(data, 0) #define initDisplay() sendInstruction(0x3C); sendInstruction(0x0C); clearDisplay(); sendInstruction(0x06) #define clearDisplay() sendInstruction(0x01); _delay_cycles(2000) #define second_line() sendInstruction((0x80 | 0x40)); _delay_cycles(2000) #define DATAPIN BIT6 #define CLOCKPIN BIT5 #define ENABLEPIN BIT4 void send(char data, char registerSelect); void sendDataArray(char data[], char length); void Print_Screen(char *texts); char charIndex = 0; char bitCounter = 0; void sendDataArray(char data[], char length) { charIndex = 0; while(charIndex < length) { sendData(data[charIndex]); charIndex++; } } void send(char data, char registerSelect) { bitCounter = 0; while(bitCounter < 8) { (data & BIT7) ? (P1OUT |= DATAPIN) : (P1OUT &= ~DATAPIN); data <<= 1; P1OUT |= CLOCKPIN; P1OUT &= ~CLOCKPIN; bitCounter++; } registerSelect ? (P1OUT |= DATAPIN) : (P1OUT &= ~DATAPIN); P1OUT &= ~ENABLEPIN; P1OUT |= ENABLEPIN; } void Print_Screen(char *texts) { volatile int i=0; char *h; h=texts; for(i=0;i<16;i++) { if(h[i]==0) { break; } } sendDataArray(h, i); } #endif /*LCD_H_*/

  13. Like
    username reacted to nobody in HD44780 issues   
    ...and HERE, or HERE, is another one.
     
    BTW: You need to improve our skills in using Google...
  14. Like
    username got a reaction from nuetron in simple laser security system   
    Sending an analog transmission via a laser would be a rather large pain in the butt... would require some careful calibration of the LED head. Or you could PWM the laser and have a RC filter on the output... that would equally be painful.
     
    Anyhow, for my project I just used a digital signal as observed in the youtube clip. Here is a schematic representation of my input + the laser.
     
    *(note the fun site is clipping my image .. link below to full image )
     

  15. Like
    username got a reaction from kenemon in simple laser security system   
    Sending an analog transmission via a laser would be a rather large pain in the butt... would require some careful calibration of the LED head. Or you could PWM the laser and have a RC filter on the output... that would equally be painful.
     
    Anyhow, for my project I just used a digital signal as observed in the youtube clip. Here is a schematic representation of my input + the laser.
     
    *(note the fun site is clipping my image .. link below to full image )
     

  16. Like
    username got a reaction from bluehash in simple laser security system   
    Made a basic laser security system with the msp430 launchpad.
     
    Video here:

     


     
    Going to use this for a school design project so i'll have to add some flashey features such as a nice loud alarm, a laser deactivation code and 2 layer pcb +enclosure to pretty it all up.
×
×
  • Create New...