Motion Sensor Lights Basys3

Intro: Motion Sensor Lights Basys3

For our final project in digital design, we decided on simulating motion sensors lights.They activate not only when an object is near it, but also activate only during a certain time of the day. We're able to model this by using FPGA(Basys3 board).While using the FPGA we allowed a user to input a time in which the motion sensors can begin to activate, and then the sensors will send a signal depending on which sensor it is to turn on that specific light in that room or area. We modeled this by allowing only one motion sensor to be activated at a given time, and turning on the given lights accordingly. Because of time constriction we're unable to make the time inputted by the user affect the activation of the motion sensor. However, the basis of our logic should allow someone to easily replicate, and improve it.

### Link below shows a video of the Project

https://drive.google.com/file/d/1FnDwKFfFFDo8mg25j1sW61lUyEqdavQG/view?usp=sharing

Step 1: Equipment Needed

For this project, you will need the following:

-Basys3 Board

-USB to microusb cable

-8 breadboard jumper wires

-Breadboard

-2 diffused LED

Step 2: Blackbox Diagram/Finite State Machine

This black box diagram shows the required inputs needed for the led lights to turn on. The Hour input and Min inputs represents the time the user inputted on the basys3 board(using switches). As, for the sw input represents in which part of the room user is in(again using switches to represent the location object is at).

The FSM shows the transition from one area to another area of a room where an object is located at a given time. There are 4 different sensors in the different rooms that are represented as (s1, s2, s3, s4). Which control the outputs, or the lights in the different rooms for example light (L1, L2, L3). The initial state the sensors does not detect anyone, so all the lights are off. To move to the next state (State 1), s1 has to detect someone, s2, s3, and s4 will be off. This will output L1 (turn on light 1), L2 and L3 will be off. To move to state 2 from state 1, s1, s3 and s4 must be off, s2 must be on. This will turn on L1 and L2. To move to the next state from this state s3 must be on and all other sensors off. This will turn on L2 and L3, L1 will be off. To move to the final state S4 must be on and all other sensors must be off. This will turn on L3 only, all other lights will be off. If a person enters the room from the s4 side and exiting through s1 all steps will be in reverse order.

Step 3: BlackBox Digital Clock

The purpose of the digital clock we created is so that sensors lights would not activate during the day, and only work during the time the user inputted. The digital clock takes in hour_in input and mins_in using switches on basys3 board, and to be able to load it onto the board you need to press the (led_btn) so it displays it on board. We also added reset button(rst_b) so you can re-upload a different time. As the basys3 does have enough space to display 3 different instances of information we implemented the seconds in the background. For this purpose, we implemented a seconds switch so it will only increment in time when the user decides to switch on (e_sec)input on the basys3 board. The internal frame work inside the digital clock is made up of flip-flops that store time inputted and counters that increment the time the user inputted only when (e_sec) is on. We will be adding the code so you can view how it was implemented exactly.

Step 4: Components Together and Description

The above pictures show how the components are connected together. It starts by first taking in inputs hours and mins. The signals from those inputs get sent to counter hour and counter mins where it adds up the bits together, and counters output signal get sent to the SSEG component where it converts bits to specific characters that will be displayed on basys3 board. However, the signal from the counters will not be sent to the SSEG component until the user has pressed input(led_btn) this is was done because we didn't create FSM for digital clock. Also, the time inputted will not increment until input switch(e_sec) is on because otherwise seconds counter would always run in the background. Once the counter sec has reached ‘59’ it will send signal to the mins so that it increments mins same is done from mins to hours. Also, there is motion sensor inputs, and the signals get sent to the FSM component where it determines what state to go to depending on the sensor on. Its initial state is when all sensors are off. All description of FSM was described in step 2.

Step 5: Code

Step 6: Future Modifications

In the future, adding actual motion sensors with combination of LEDs to the project would be improvement.So that we can increase the complexity of project, and to see if we can create a modern motion light sensor. This would create more problems as you'll have to think of proximity of the object as well so that the lights turn on accordingly. In addition,all other functionalities prior. Also, improving the functionality of digital clock using a FSM as well instead of waiting for the user turn on seconds(e_sec). The FSM for a digital clock would be similar to that of the motion sensor.

Step 7: Conclusion

Overall, this project has helped us have a better understanding of how finite state machines operate. In addition, with FSM you always have to keep in mind that you need to know what state you're in , and when you want to change to another state. In other words, you need to know where you're at a given time, and where you'll be at later in time. Keeping in mind what factors will allow you (inputs) to change to another state, and what its going to do when it gets there(output). We also learned how to store information within the basys3 board using flip-flops which are registers, and how to increment time using counters which adds binary numbers together.

Step 8: Citiation

The two_sseg.vhdl = universal_sseg_dec.vhd

Ratner, James and Cheng Samuel..Ratface Engineering.universal_sseg_dec.vhd

Share

    Recommendations

    • Metalworking Contest

      Metalworking Contest
    • Audio Contest 2018

      Audio Contest 2018
    • Tiny Home Contest

      Tiny Home Contest

    2 Discussions