Skip to content

This repository contains code for the assignment 03 in the course of "Laboratory of Electronic Technologies and Biosensors" of the first semester of the academic year 2020/2021.

AndreaRescalli/AY2021_I_HW_03

Repository files navigation

Electronic Technologies and Biosensors Laboratory

Academic Year 2020/2021 - I Semester


Assignment 03

This repository contains the PSoC Creator workspace to be used as a starting point for the successfull submission of the Assignment 03 of the course "Electronic Technologies and Biosensors Laboratory" of the I Semester of the academic year 2020/2021.


Objective

In this assignment you are required to create a project using PSoC Creator, the CY8CKIT-059 KIT, a RGB LED and three 330 Ohm resistors.

Context

The LTEBS srl positevely evaluated your efforts in designing the system for the control of the RED and GREEN LEDs in the RGB LED. You are now asked to improve on that project and design a system able to control the color of the RGB LED through a serial port. The first time the system is powered after programming, the RGB LED should be on with a "black" color (RGB: 0,0,0). Then, with the protocol described here below, the color emitted with the RGB LED could be changed by sending commands through the serial port. The RGB LED you are provided with has a common anode configuration, and must be connected as follows:

Schermata-2020-10-13-alle-17-08-08

The pins 2.5, 2.6, and 2.7 are the pins on the CY8CKIT-059 KIT that you must use to control the channels of the RGB LED.

Connections

The RED channel of the RGB Led must be connected to pin 2.7. The GREEN channel of the RGB Led must be connected to pin 2.6. The BLUE channel of the RGB Led must be connected to pin 2.5. The UART must use the pins 12.6 and 12.7 in order to communicate through the KitProg.

Serial Port Communication

1. RGB Color Packet

The commands to be sent through the serial port must be structured as follows:

Byte (HEX) Description
0xA0 Packet header (decimal value: 160)
R Red light (0x00-0xFF in Hex, 0-255 in decimal)
G Green light (0x00-0xFF in Hex, 0-255 in decimal)
B Blue light (0x00-0xFF in Hex, 0-255 in decimal)
0xC0 Packet tail (decimal value: 192)

The UART peripheral must be configured so as to trigger an interrupt when receiving a single byte (you can configure this kind of behaviour in the Advanced Tab of the UART component in PSoC Creator). A simple state machine will then allow you to perform a parsing of the received data packet:

Schermata-2020-10-13-alle-09-51-44

Depending on the received bytes, it is necessary to control the duty cycle of the PWM components that are connected to the RGB LED channels. Here are some working examples:

Received Packet Color
[0xA0, 0xFF, 0x00, 0x00, 0xC0] RED
[0xA0, 0x00, 0xFF, 0x00, 0xC0] GREEN
[0xA0, 0x7F, 0x00, 0x7F, 0xC0] PURPLE

If the system finds itself in one of the intermediate states of the state machine (i.e., exlcuding the IDLE and TAIL states), a 5 seconds timeout must be started in order to allow the system to go back to the idle state if no command is received in 5 seconds.

2. Connection Command

Upon receiving the character v, the system must send this string on the serial port:

RGB LED Program $$$

This is required for the subsequent testing of the program through a simple GUI.

Test

You can test your program using a GUI designed in Kivy that we provide to you. You are required to download the zip file of the GUI, named RGB_Led_Control.zip from the course webpage. Unzip the file, and inside the folder rgbledcontrol, double click on rgbcontrol.exe. The GUI will automatically scan all the available serial ports, connect to the right one and will allow you to send a new color with the described packet structure.

Schermata-2020-10-13-alle-17-01-23

The GUI only work on Windows. For those of you who are using VirtualBox, please configure the display settings as follows:

2020-10-13-17-02-35

Setup and Assignment Delivery

  • Fork this repository

  • Clone the repository you just forked by entering the following command in your terminal:

    git clone https://github.com/[your_username]/AY2021_I_HW_03.git

  • Open up the workspace in PSoC Creator

  • Activate the project with your name and surname

  • Work on your project

  • The last commit must be named 'NAME_SURNAME Final Delivery'

  • Propose a pull request before the deadline for the assignment, which is on October 20 at 6PM

Evaluation

The evaluation of the assignment will take into consideration the following aspects of the project:

  • successful build process without any warning/error generated
  • successful programming without any error generated
  • correct functioning of the device as per the requirements
  • code organization (header and source files, useful comments)
  • schematic organization and documentation
  • successful use of git for version control (use of branches, ...)
  • successful pull request on GitHub

Additional Resources:

About

This repository contains code for the assignment 03 in the course of "Laboratory of Electronic Technologies and Biosensors" of the first semester of the academic year 2020/2021.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages