1 Reply Latest reply on Feb 21, 2017 12:20 AM by user_411084576

    PsOC4 Project - Alarm Loop


      As part of my current education as an Electronic Engineer, I am currently attending a course in Embedded Systems. For this course, we are required to complete several projects concerning the PSoC4 Pioneer Kit and multiple Shields (including the Arduino MultiFunctionShield); my final assignment for this course is to simulate an alarm system, which must be monitored via at least three methods (see below). However, I am currently experiencing several recurring problems, which have caused me to restart my project multiple times.




      As such, I thought it might prove fruitful to ask for your advice concerning the project. To be specific, the hard requirements for the project are as follows:




      - The system has to detect/simulate the status of the loop via three methods; the Capsense present on the PSoC4 (loop 1), the PotMeter present on the Shield (loop 2) and an additional slider which has to be configured on the Shield via Input Gate A5 (loop 3).




      - In each loop, five specific voltage/current intervals have been defined. As these are applied in relation to a 5V power supply, these are as follows:


                1; Sabotage 1 --> 2,483 V - 4,999 V


                2; Alarm open --> 2,246 V - 2,482 V


                3; Sabotage 2 --> 1,345 V - 2,245 V


                4; Alarm active --> 1,161 V - 1,283 V


                5; Sabotage 3 --> 0,001 V - 1,160 V




      - If Key 1 on the Shield is pressed, the RGB-LED on the PsOC4 has to turn Green after a 10-second delay; As long as this is not the case, the RGB-LED has to turn Blue, EXCEPT when any of the loops is subject to Sabotage. In case of Sabotage, the RGB-LED has to turn Red and the Buzzer on the Shield has to produce a continuous signal, which can be turned of by pressing Key 2 on the Shield. Once all loops are in correct current ranges (either Alarm open or Alarm active), the Buzzer has to turn off automatically and the RGB-LED has to turn Blue once again. 




      - Each of the specified areas has to produce specific visual messages via the 7-segmentsdisplays (present on the Shield), as well as turning on LED's on the shield in binary code. These messages/LED's are as follows:


                1; Sabotage 1 --> "S1" --> LED1 


                2; Alarm open --> "OPEN" --> None


                3; Sabotage 2 --> "S2" --> LED2


                4; Alarm active --> "AAN" --> None


                5; Sabotage 3 --> "S3" --> LED3




      - When sabotage is detected, the display has to be followed by a space, after which the respective loop is also displayed. Each of the aforementioned visual messages must be displayed for exactly the duration of 1 second, which is followed by the actual Voltage meassured in that specific loop (varying between 0,000 V and 5,000 V); the programme itself continuously alternates between each of the three loops. 




      FOR EXAMPLE: when the PotMeter is adjusted to create 1,500 V, the text "S2 2" is displayed; Exactly one second later, the text 1.500 is displayed; afterwards, the correct message for loop 3 (the slider) is displayed, after which the correct voltage is displayed; the same follows for loop 1 (CapSense), and so forth. I have been able to construct the necessary components and Pin Configuration for the project (see the attached project). It is mainly, and perhaps purely, the software programme itself that presents the challenges I can't seem to overcome.




      As such, the realisation of the system presents the following challenges;


           I. To construct a scanning-program that puts data obtained via inputs in array(s).


           II. To create a display-programme that can relay data from the array(s) dynamically per second.


           III. Loop both programmes continuously.


           IV. Control the 7-segmentsdisplays with the help of an interrupt-routine. 






      Additional Requirements:


      - Incorporation of a Deep Sleep Mode into the system --> By pressing both Key 1 and Key 2 simultaneously for three seconds, the system has to put itself into Deep Sleep Mode to preserve energy; after pressing both buttons for three seconds once again, Deep Sleep Mode is lifted and the system functions normally.


      - Incorporate Hard Reset into the system --> by pressing the Reset-button, the user has to be able to completely reset the entire system.




      As an enthousiast technician (who seriously attempts to obtain as much knowledge in as little time as possible), I sincerely hope you might be able to help me in creating the project. Sincerely and many, many thanks in advance.

        • 1. Re: PsOC4 Project - Alarm Loop

          Hi Frank,

          Too big project I guess. What all went wrong when you tried to implement these functionalities ?

          I can give you some suggestions

          1. As you are implementing same functionality in different loops, set a flag in the functions for capsense read, potmeter read and slider read. You can turn off the alarm using the flag itself once values come in the right range. Using single loop set the flags, and the flags should control all the actions. So your problems with multiple loops will not arise.


          2. While using seven segment, use a "Pin" component, name it "SevenSeg" and set the number of pins to 8 (7 segments + DP). Then you can use a single SevenSeg_Write(Pattern) to set all pins with a single instruction.