Introduction: Motion Sensored LED

Background:

Do you ever forget to turn off a light before you head off to class or work or before you go to bed? Those hours with the lights on when you're not using them can really add up in cost and energy loss. For instance, according to solarcity.com, leaving the lights on all night for a week can add $25 to your electric bill! For our CPE133 project, we design a motion sensor light to help people conserve energy in their homes and use their lights efficiently.

Our system in practice:

In the practice, the lights would only turn on when a sensor detects motion in the room. Then the lights will stay on for a set amount of time, like around 30 minutes, and then turn off automatically. But let's say you were just passing through or wanted to leave the room early before the set amount of time was over. For those cases, we installed a button where you can turn the lights on or off manually. Note the lights will stay on for 30 minutes even when the lights are turned on manually or automatically (unless the lights are turned off manually).

Simulation on board:

To see that the timer works we changed the timer to 1 minute.

Materials:

  • 1 Basys board (you can find one here from Digilent)
  • 1 PIR motion sensor (you can find one here on Amazon)
  • 1 breadboard and kit (we suggest using this one from Amazon)
  • From the kit above
    • 1 LED
    • 3 female to male jumper cables
    • 6 male to male jumper cables

Step 1: Timer

In order for the LED to remain on for 1 minute, we must first create a timer. The Basys 3 board has an internal frequency of 100MHz thus making 100 million cycles equal to 1 second. This is then used as a variable that will acts as a maximum number for the “t_cnt”. The t_cnt increases by 1 as the Basys 3 board completes a cycle. Once it reaches the 100 million mark it will reset and another variable, “sec”, will increase by 1. This “sec” variable represents the number of seconds passed and once that variable is equal to 60, a full minute has passed.

Copy the code below into a vhdl source file named Timer.

<p>entity COUNT_8B is</p><p>    port ( RESET: in std_logic;
           CLK: in std_logic;
           T: out std_logic := '0');</p><p>end COUNT_8B;</p><p>architecture my_count of COUNT_8B is
    constant max_count : integer := (100000000);
    --signal t_cnt : std_logic_vector(7 downto 0) := "00000000";
    signal t_cnt : integer := (0);
begin
    process (CLK, RESET, t_cnt)
        variable sec : integer := 0;
    begin
        if (rising_edge(CLK)) then
            if (RESET = '1') then
                    t_cnt <= (0); -- clear 
                    
            elsif (t_cnt = max_count) then -- max_count is 100 million which is equal to 1 second
                t_cnt <= (0); -- Resets internal clock to 0
                sec := sec + 1; -- Increases our 'slow clock' by 1
                    if (sec = 60) then -- Once it reaches 60 seconds then it has reached the max time
                        sec := 0; -- Resets "slow clock" to 0
                        T <= '1'; 
                    end if;
            else
                t_cnt <= t_cnt + 1; -- increases the internal clock
                T <= '0';
            end if;
        end if;
    end process;
end my_count;</p>

Step 2: Button Optimization

Since the frequency in the Basys boards is so high (around 100 MHz) when you press for what you think is a short amount of time to the Basys board you would be pressing it 100,000 times. This causes the light to flicker between the on and off state rapidly. We attempted to optimize the button by creating a state diagram to reduce the flickering.

The d-flip-flops will hold each state and then we will specify the state transitions in the process statement.

Copy the code below into a vhdl source file named Button.

<p>library IEEE;<br>use IEEE.STD_LOGIC_1164.ALL;</p><p>entity button is
    Port ( btn : in STD_LOGIC;
           clk : in STD_LOGIC;
           E : out STD_LOGIC);
end button;</p><p>architecture Behavioral of button is
    type state_type is (PRESSED,NP); 
signal PS, NS : state_type:= NP; </p><p>begin
seq_proc: process(NS,clk)
begin                         
    if(rising_edge(clk)) then
        PS <= NS;
        end if;
end process seq_proc;</p><p>ns_proc: process(btn,PS)
begin
    case PS is
        when NP =>  
            if (btn = '1') then       
                NS <= PRESSED;
                E <= '1';  
            else
                NS <= NP;
                E <= '0';
           end if;
        when PRESSED => 
            if (btn = '0') then  
                NS <= NP;
                E <='0';
            else
                NS <= PRESSED;
                E <= '0';
           end if;
    end case;
end process ns_proc;</p><p>                  
end Behavioral;</p>

Step 3: LED

The LED has two states: OFF (or IDLE) and ON. As said before, the states are stored in a d-flip-flop. The light will turn if the sensor detects motion (S=1) or when a button is pressed (E=1). The LED will turn off automatically if the timer reaches 1 minute (T=1) or manually when a button is pressed (E=1).

Copy the code below into a vhdl source file named LED.

<p>entity motion_sensored_light is<br>    Port ( S : in STD_LOGIC; -- sesnor; Port JA10/Pin G3
           E : in STD_LOGIC; -- external button for manual function; Center Button
           T : in STD_LOGIC; -- when timer reaches max time; From timer
           LED : out STD_LOGIC; -- light
           TRST : out STD_LOGIC; -- resets timer
           clk : in STD_LOGIC); -- clk for flip flop which hold the states
end motion_sensored_light;</p><p>architecture Behavioral of motion_sensored_light is</p><p>    type state_type is (ST0,ST1); --ST0 = IDLE, ST1 = LED HIGH
    signal PS, NS : state_type:=ST0; -- PRESENT STATE AND NEXT STATE, starts in ST0 IDLE</p><p>begin
-- process block of flip flop
-- updates state on rising edge of clock
seq_proc: process(NS,clk)
    begin                         -- d flip flop that holds states
        if(rising_edge(clk)) then
            PS <= NS;
            end if;
end process seq_proc;</p><p>ns_proc: process(S,E,T,PS)
    begin
        case PS is
            when ST0 =>
                 LED <= '0';        -- outputs for idle state
                 TRST <= '1';  
                if (S = '0' OR E = '1') then       -- inputs to transition from st0 to st1
                    NS <= ST1;  
                else
                    NS <= ST0;
               end if;
            when ST1 => 
                LED <= '1';     -- outputs for on state
                TRST <= '0'; 
                if (E = '1' OR T = '1') then   -- inputs to to transition from st1 to st0
                    NS <= ST0;
                else
                    NS <= ST1;
               end if;
        end case;
end process ns_proc;</p><p>                      
end Behavioral;</p>

Step 4: Top File

Now we are going to port map all our other files into one.

Copy the code below into a vhdl source file named Top_File.

<p>library IEEE;<br>use IEEE.STD_LOGIC_1164.ALL;</p><p>entity Top_File is
    Port ( S : in STD_LOGIC := '1'; -- sesnor; Port JA10/Pin G3
           btn : in STD_LOGIC := '0'; -- external button for manual function; Center Button
           LED : out STD_LOGIC; -- light
           clk : in STD_LOGIC); -- clk for flip flop which hold the states
end Top_File;</p><p>architecture Behavioral of Top_File is</p><p>    component COUNT_8B is
        port ( RESET: in std_logic := '0';
               CLK: in std_logic;
               T: out std_logic := '0');
    end component;
    
    component motion_sensored_light is
        Port ( S : in STD_LOGIC; -- sesnor; Port JA10/Pin G3
               E : in STD_LOGIC; -- external button for manual function; Center Button
               T : in STD_LOGIC; -- when timer reaches max time; From timer
               LED : out STD_LOGIC; -- light
               TRST : out STD_LOGIC; -- resets timer
               clk : in STD_LOGIC); -- clk for flip flop which hold the states
    end component;
    
    component button is
        Port ( btn : in STD_LOGIC;
               clk : in STD_LOGIC;
               E : out STD_LOGIC);
        end component;
    
    signal t_reached_c : std_logic; --
    signal r_time_c : std_logic; --
    signal button_c : std_logic;</p><p>begin</p><p>timer: COUNT_8B port map(
    RESET => r_time_c,
    CLK => CLK,
    T => t_reached_c);
    
motion_sensor: motion_sensored_light port map(
    S => S,
    E => button_c,
    T => t_reached_c,
    LED => LED,
    TRST => r_time_c,
    clk => clk);
    
 button_controller : button port map(
    btn => btn,
    clk => clk,
    E => button_c);
    
end Behavioral;</p>

Step 5: Constraints File

Now we have to define where our inputs and outputs will be on the board.

Copy the code below into a vhdl constraints file named Constraints.

<p>## This file is a general .xdc for the Basys3 rev B board<br>## To use it in a project:
## - uncomment the lines corresponding to used pins
## - rename the used ports (in each line, after get_ports) according to the top level signal names in the project</p><p>## Clock signal
set_property PACKAGE_PIN W5 [get_ports clk]							
	set_property IOSTANDARD LVCMOS33 [get_ports clk]
	create_clock -add -name sys_clk_pin -period 10.00 -waveform {0 5} [get_ports clk]
 
## Switches
#set_property PACKAGE_PIN V17 [get_ports {sw[0]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {sw[0]}]
#set_property PACKAGE_PIN V16 [get_ports {sw[1]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {sw[1]}]
#set_property PACKAGE_PIN W16 [get_ports {sw[2]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {sw[2]}]
#set_property PACKAGE_PIN W17 [get_ports {sw[3]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {sw[3]}]
#set_property PACKAGE_PIN W15 [get_ports {sw[4]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {sw[4]}]
#set_property PACKAGE_PIN V15 [get_ports {sw[5]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {sw[5]}]
#set_property PACKAGE_PIN W14 [get_ports {sw[6]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {sw[6]}]
#set_property PACKAGE_PIN W13 [get_ports {sw[7]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {sw[7]}]
#set_property PACKAGE_PIN V2 [get_ports {sw[8]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {sw[8]}]
#set_property PACKAGE_PIN T3 [get_ports {sw[9]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {sw[9]}]
#set_property PACKAGE_PIN T2 [get_ports {sw[10]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {sw[10]}]
#set_property PACKAGE_PIN R3 [get_ports {sw[11]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {sw[11]}]
#set_property PACKAGE_PIN W2 [get_ports {sw[12]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {sw[12]}]
#set_property PACKAGE_PIN U1 [get_ports {sw[13]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {sw[13]}]
#set_property PACKAGE_PIN T1 [get_ports {sw[14]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {sw[14]}]
#set_property PACKAGE_PIN R2 [get_ports {sw[15]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {sw[15]}]
 </p><p>## LEDs
#set_property PACKAGE_PIN U16 [get_ports {led[0]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {led[0]}]
#set_property PACKAGE_PIN E19 [get_ports {led[1]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {led[1]}]
#set_property PACKAGE_PIN U19 [get_ports {led[2]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {led[2]}]
#set_property PACKAGE_PIN V19 [get_ports {led[3]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {led[3]}]
#set_property PACKAGE_PIN W18 [get_ports {led[4]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {led[4]}]
#set_property PACKAGE_PIN U15 [get_ports {led[5]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {led[5]}]
#set_property PACKAGE_PIN U14 [get_ports {led[6]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {led[6]}]
#set_property PACKAGE_PIN V14 [get_ports {led[7]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {led[7]}]
#set_property PACKAGE_PIN V13 [get_ports {led[8]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {led[8]}]
#set_property PACKAGE_PIN V3 [get_ports {led[9]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {led[9]}]
#set_property PACKAGE_PIN W3 [get_ports {led[10]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {led[10]}]
#set_property PACKAGE_PIN U3 [get_ports {led[11]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {led[11]}]
#set_property PACKAGE_PIN P3 [get_ports {led[12]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {led[12]}]
#set_property PACKAGE_PIN N3 [get_ports {led[13]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {led[13]}]
#set_property PACKAGE_PIN P1 [get_ports {led[14]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {led[14]}]
#set_property PACKAGE_PIN L1 [get_ports {led[15]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {led[15]}]
	
	
##7 segment display
#set_property PACKAGE_PIN W7 [get_ports {seg[0]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {seg[0]}]
#set_property PACKAGE_PIN W6 [get_ports {seg[1]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {seg[1]}]
#set_property PACKAGE_PIN U8 [get_ports {seg[2]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {seg[2]}]
#set_property PACKAGE_PIN V8 [get_ports {seg[3]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {seg[3]}]
#set_property PACKAGE_PIN U5 [get_ports {seg[4]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {seg[4]}]
#set_property PACKAGE_PIN V5 [get_ports {seg[5]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {seg[5]}]
#set_property PACKAGE_PIN U7 [get_ports {seg[6]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {seg[6]}]</p><p>#set_property PACKAGE_PIN V7 [get_ports dp]							
	#set_property IOSTANDARD LVCMOS33 [get_ports dp]</p><p>#set_property PACKAGE_PIN U2 [get_ports {an[0]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {an[0]}]
#set_property PACKAGE_PIN U4 [get_ports {an[1]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {an[1]}]
#set_property PACKAGE_PIN V4 [get_ports {an[2]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {an[2]}]
#set_property PACKAGE_PIN W4 [get_ports {an[3]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {an[3]}]</p><p>##Buttons
set_property PACKAGE_PIN U18 [get_ports btn]						
	set_property IOSTANDARD LVCMOS33 [get_ports btn]
#set_property PACKAGE_PIN T18 [get_ports btnU]						
	#set_property IOSTANDARD LVCMOS33 [get_ports btnU]
#set_property PACKAGE_PIN W19 [get_ports btnL]						
	#set_property IOSTANDARD LVCMOS33 [get_ports btnL]
#set_property PACKAGE_PIN T17 [get_ports btnR]						
	#set_property IOSTANDARD LVCMOS33 [get_ports btnR]
#set_property PACKAGE_PIN U17 [get_ports btnD]						
	#set_property IOSTANDARD LVCMOS33 [get_ports btnD]
 </p><p>##Pmod Header JA
##Sch name = JA1
#set_property PACKAGE_PIN J1 [get_ports {JA[0]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {JA[0]}]
##Sch name = JA2
#set_property PACKAGE_PIN L2 [get_ports {JA[1]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {JA[1]}]
##Sch name = JA3
#set_property PACKAGE_PIN J2 [get_ports {JA[2]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {JA[2]}]
##Sch name = JA4
#set_property PACKAGE_PIN G2 [get_ports {JA[3]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {JA[3]}]
##Sch name = JA7
#set_property PACKAGE_PIN H1 [get_ports {JA[4]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {JA[4]}]
##Sch name = JA8
set_property PACKAGE_PIN K2 [get_ports LED]					
	set_property IOSTANDARD LVCMOS33 [get_ports LED]
##Sch name = JA9
#set_property PACKAGE_PIN H2 [get_ports {JA[6]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {JA[6]}]
##Sch name = JA10
set_property PACKAGE_PIN G3 [get_ports S]					
	set_property IOSTANDARD LVCMOS33 [get_ports S]</p><p>##Pmod Header JB
##Sch name = JB1
#set_property PACKAGE_PIN A14 [get_ports {JB[0]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {JB[0]}]
##Sch name = JB2
#set_property PACKAGE_PIN A16 [get_ports {JB[1]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {JB[1]}]
##Sch name = JB3
#set_property PACKAGE_PIN B15 [get_ports {JB[2]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {JB[2]}]
##Sch name = JB4
#set_property PACKAGE_PIN B16 [get_ports {JB[3]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {JB[3]}]
##Sch name = JB7
#set_property PACKAGE_PIN A15 [get_ports {JB[4]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {JB[4]}]
##Sch name = JB8
#set_property PACKAGE_PIN A17 [get_ports {JB[5]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {JB[5]}]
##Sch name = JB9
#set_property PACKAGE_PIN C15 [get_ports {JB[6]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {JB[6]}]
##Sch name = JB10 
#set_property PACKAGE_PIN C16 [get_ports {JB[7]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {JB[7]}]
 </p><p>##Pmod Header JC
##Sch name = JC1
#set_property PACKAGE_PIN K17 [get_ports {JC[0]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {JC[0]}]
##Sch name = JC2
#set_property PACKAGE_PIN M18 [get_ports {JC[1]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {JC[1]}]
##Sch name = JC3
#set_property PACKAGE_PIN N17 [get_ports {JC[2]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {JC[2]}]
##Sch name = JC4
#set_property PACKAGE_PIN P18 [get_ports {JC[3]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {JC[3]}]
##Sch name = JC7
#set_property PACKAGE_PIN L17 [get_ports {JC[4]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {JC[4]}]
##Sch name = JC8
#set_property PACKAGE_PIN M19 [get_ports {JC[5]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {JC[5]}]
##Sch name = JC9
#set_property PACKAGE_PIN P17 [get_ports {JC[6]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {JC[6]}]
##Sch name = JC10
#set_property PACKAGE_PIN R18 [get_ports {JC[7]}]					
	#set_property IOSTANDARD LVCMOS33 [get_ports {JC[7]}]</p><p>##Pmod Header JXADC
##Sch name = XA1_P
#set_property PACKAGE_PIN J3 [get_ports {JXADC[0]}]				
	#set_property IOSTANDARD LVCMOS33 [get_ports {JXADC[0]}]
##Sch name = XA2_P
#set_property PACKAGE_PIN L3 [get_ports {JXADC[1]}]				
	#set_property IOSTANDARD LVCMOS33 [get_ports {JXADC[1]}]
##Sch name = XA3_P
#set_property PACKAGE_PIN M2 [get_ports {JXADC[2]}]				
	#set_property IOSTANDARD LVCMOS33 [get_ports {JXADC[2]}]
##Sch name = XA4_P
#set_property PACKAGE_PIN N2 [get_ports {JXADC[3]}]				
	#set_property IOSTANDARD LVCMOS33 [get_ports {JXADC[3]}]
##Sch name = XA1_N
#set_property PACKAGE_PIN K3 [get_ports {JXADC[4]}]				
	#set_property IOSTANDARD LVCMOS33 [get_ports {JXADC[4]}]
##Sch name = XA2_N
#set_property PACKAGE_PIN M3 [get_ports {JXADC[5]}]				
	#set_property IOSTANDARD LVCMOS33 [get_ports {JXADC[5]}]
##Sch name = XA3_N
#set_property PACKAGE_PIN M1 [get_ports {JXADC[6]}]				
	#set_property IOSTANDARD LVCMOS33 [get_ports {JXADC[6]}]
##Sch name = XA4_N
#set_property PACKAGE_PIN N1 [get_ports {JXADC[7]}]				
	#set_property IOSTANDARD LVCMOS33 [get_ports {JXADC[7]}]</p><p>##VGA Connector
#set_property PACKAGE_PIN G19 [get_ports {vgaRed[0]}]				
	#set_property IOSTANDARD LVCMOS33 [get_ports {vgaRed[0]}]
#set_property PACKAGE_PIN H19 [get_ports {vgaRed[1]}]				
	#set_property IOSTANDARD LVCMOS33 [get_ports {vgaRed[1]}]
#set_property PACKAGE_PIN J19 [get_ports {vgaRed[2]}]				
	#set_property IOSTANDARD LVCMOS33 [get_ports {vgaRed[2]}]
#set_property PACKAGE_PIN N19 [get_ports {vgaRed[3]}]				
	#set_property IOSTANDARD LVCMOS33 [get_ports {vgaRed[3]}]
#set_property PACKAGE_PIN N18 [get_ports {vgaBlue[0]}]				
	#set_property IOSTANDARD LVCMOS33 [get_ports {vgaBlue[0]}]
#set_property PACKAGE_PIN L18 [get_ports {vgaBlue[1]}]				
	#set_property IOSTANDARD LVCMOS33 [get_ports {vgaBlue[1]}]
#set_property PACKAGE_PIN K18 [get_ports {vgaBlue[2]}]				
	#set_property IOSTANDARD LVCMOS33 [get_ports {vgaBlue[2]}]
#set_property PACKAGE_PIN J18 [get_ports {vgaBlue[3]}]				
	#set_property IOSTANDARD LVCMOS33 [get_ports {vgaBlue[3]}]
#set_property PACKAGE_PIN J17 [get_ports {vgaGreen[0]}]				
	#set_property IOSTANDARD LVCMOS33 [get_ports {vgaGreen[0]}]
#set_property PACKAGE_PIN H17 [get_ports {vgaGreen[1]}]				
	#set_property IOSTANDARD LVCMOS33 [get_ports {vgaGreen[1]}]
#set_property PACKAGE_PIN G17 [get_ports {vgaGreen[2]}]				
	#set_property IOSTANDARD LVCMOS33 [get_ports {vgaGreen[2]}]
#set_property PACKAGE_PIN D17 [get_ports {vgaGreen[3]}]				
	#set_property IOSTANDARD LVCMOS33 [get_ports {vgaGreen[3]}]
#set_property PACKAGE_PIN P19 [get_ports Hsync]						
	#set_property IOSTANDARD LVCMOS33 [get_ports Hsync]
#set_property PACKAGE_PIN R19 [get_ports Vsync]						
	#set_property IOSTANDARD LVCMOS33 [get_ports Vsync]</p><p>##USB-RS232 Interface
#set_property PACKAGE_PIN B18 [get_ports RsRx]						
	#set_property IOSTANDARD LVCMOS33 [get_ports RsRx]
#set_property PACKAGE_PIN A18 [get_ports RsTx]						
	#set_property IOSTANDARD LVCMOS33 [get_ports RsTx]</p><p>##USB HID (PS/2)
#set_property PACKAGE_PIN C17 [get_ports PS2Clk]						
	#set_property IOSTANDARD LVCMOS33 [get_ports PS2Clk]
	#set_property PULLUP true [get_ports PS2Clk]
#set_property PACKAGE_PIN B17 [get_ports PS2Data]					
	#set_property IOSTANDARD LVCMOS33 [get_ports PS2Data]	
	#set_property PULLUP true [get_ports PS2Data]</p><p>##Quad SPI Flash
##Note that CCLK_0 cannot be placed in 7 series devices. You can access it using the
##STARTUPE2 primitive.
#set_property PACKAGE_PIN D18 [get_ports {QspiDB[0]}]				
	#set_property IOSTANDARD LVCMOS33 [get_ports {QspiDB[0]}]
#set_property PACKAGE_PIN D19 [get_ports {QspiDB[1]}]				
	#set_property IOSTANDARD LVCMOS33 [get_ports {QspiDB[1]}]
#set_property PACKAGE_PIN G18 [get_ports {QspiDB[2]}]				
	#set_property IOSTANDARD LVCMOS33 [get_ports {QspiDB[2]}]
#set_property PACKAGE_PIN F18 [get_ports {QspiDB[3]}]				
	#set_property IOSTANDARD LVCMOS33 [get_ports {QspiDB[3]}]
#set_property PACKAGE_PIN K19 [get_ports QspiCSn]					
	#set_property IOSTANDARD LVCMOS33 [get_ports QspiCSn]</p>

Step 6: Wiring Up the PIR Motion Sensor

The PIR motion sensor has three pins: power, gnd, and alarm respectively(see the first picture). The motion sensor suggested in this instructable can connect directly into the breadboard. But for the sensor we used we had to cut and strip the wires and then solder the exposed ends to keep them from fraying. On the breadboard insert a male to female jumper wire in series with the power and ground pins and then a male to male jumper wire in series with the alarm pin (see the second picture).

Step 7: Wiring Up the LED in the Breadboard

Plug in the LED into the breadboard. Insert a black male to male jumper cable in series with the short lead of the LED. Then plug in different colored male to male jumper cable in series with the long lead of the LED.

Step 8: Basys Board Connections

Connect the female ends of the PIR motion sensor into the 5 volt voltage source on the basys board. Then connect the male LED ground wire into the side port's ground then the alarm wire from the PIR motion sensor and then the LED input wire (as seen in the picture).