CS 350 University of Phoenix Computer Science Worksheet

User Generated

rqjva_001

Computer Science

cs 350

University of Phoenix

CS

Description

The global smart thermostat market is forecast to reach almost $9 billion by 2026. The CEO of SysTec wants to get into this lucrative market and has tasked your engineering department with creating a smart thermostat using the TI board. SysTec develops analytics software for servers, but the CEO remembers from your interview that you took an embedded systems course and asks you to build a prototype. The final goal is to develop a thermostat that sends data to SysTec’s server software over Wi-Fi, but first they need a prototype of the low-level thermostat functionality working.

For the prototype, you will use the TMP006 temperature sensor to read the room temperature (via I2C), an LED to indicate the output to the thermostat where LED on = heat on (via GPIO), two buttons to increase and decrease the set temperature (via GPIO interrupt), and the UART to simulate the data being sent to the server.

You will also create a written report for your team to ensure that the system you created is based on SysTec’s business requirements and technical specifications. While your team is testing your code, you have been asked to architect the next phase of the project in your report: connecting the thermostat to the cloud. Although you prototyped on the TI development board, other manufacturers make integrated Wi-Fi solutions. In this next phase, you are going to analyze various hardware architectures (from TI, Microchip, and Freescale) and recommend and justify the architecture decision based on the following business requirements:

  • The thermostat must support the peripherals used in the project.
  • The thermostat must connect to the cloud via Wi-Fi.
  • The architecture chosen must have enough Flash and RAM to support the code

Directions

Begin your work by accessing the Project Thermostat Lab Guide PDF document. While this document was written for a Windows interface, the tools can be used on Mac or Linux as well. To accomplish the work outlined in the guide, you will need the following:

    • TI CC3220x LAUNCHXL
    • TI Code Composer Studio (installed)
    • USB connection between the PC and board

Specifically, you must address the following rubric criteria:

TASK SCHEDULER

The task scheduler should be created as a draw.io file and then exported as a PDF file for submission in Brightspace.

Unformatted Attachment Preview

CS 350 Project Thermostat Lab Guide It is important to note the distinct differences in the Cyber-Physical actions of a thermostat. When you select a button to increase or decrease the temperature in the room, what happens is the thermostat establishes a target temperature that is referred to as its 'set-point'. When the thermostat compares the temperature read from the sensor to the established set-point a decision is made. If the temperature is below the set-point, it turns the heater on. However, if the temperature is above the set-point, it turns the heater off. 1. Open TI Code Composer Studio (CCS). If you have not installed CCS, please install CCS by following installation guidance in Module One of your course. After CCS is installed you can open it by clicking Code Composer Studio xxxx, which can be found in the Texas Instruments folder. The CCS installer also added a Code Composer Studio icon on your desktop. It looks like a red die. You can click on that icon to open CCS as well. 2. Select a workspace, then click Launch. It is very important that you take note of your workspace location. You will need the information later in order to turn in your project. 3. Open the Getting Started Window in CCS. CCS takes about 30 seconds to fully open (it’s written in Java). You can review the loading process by looking at the lower right corner of the screen. You will see green progress bars popping up. After about 30 seconds, CCS should be fully loaded and you will not see any green progress bars. 4. Open the Resource Explorer by clicking on the Resource Explorer box (with the compass). In the Resource Explorer, find Software in the left pane. Click on the arrow to expand Software. Then, find the SimpleLink CC32xx SDK and expand it. Next, similarly locate and expand Examples, Development Tools, CC3220S Launchpad, and TI Drivers. 5. Verify you have the SDK installed. You should see a check mark by the SimpleLink CC32xx SDK. 6. Import the gpiointerrupt project. You should already have imported the gpiointerrupt project during your work in a previous milestone, which would allow you to review the project from the Project Explorer window. If you still need to import the gpiointerrupt project, complete steps 7 through 9. If you already have the gpiointerrupt project, you may skip to step 10. 7. Begin by expanding the SimpleLink CC32xx SDK, then the Examples folder, Development Tools, CC3220S LaunchPad, and finally TI Drivers. From here, locate the gpiointerrupt folder. Then the No RTOS sub-folder followed by the CSS Compiler. In here you will find the gpiointerrupt item illustrated with a red die icon. 8. Click on the three dots icon next to gpiointerrupt then click Import to CCS IDE. From the Select a target window that appears, choose CC3220S and click Apply to load the example into the CCS workspace. 9. Review the project. Note that you will only need to change the contents of gpiointerrupt.c for this lab. 10. Next, build the code by selecting Project from the top menu options. Then click Build All. 11. Add the appropriate drivers using system config. TI provides a tool called system config for adding and configuring drivers in your project. To open the tool, double-click on the gpiointerrupt.syscfg file in the project. 12. Your goal is to add the Timer and I2C drivers, but if you already had the gpiointerrupt project imported, you may also already have the Timer driver imported from your previous milestone work. If that is the case, you will only need to add the I2C driver during the subsequent steps. Note that the I2C driver is connected to the temperature sensor. In the following example screenshot of the TI Drivers list, you can ignore the RTOS and POWER drivers. Both drivers are installed but disabled as part of the driver library default configuration. To add the Timer and I2C drivers click the plus signs next to Timer and I2C. 13. For this project we will need a timer that is 32 bits. The default will likely say 16 bits, and if that is the case, click the drop down next to Timer Type. Then select 32 bits. 14. Configure the I2C driver as shown in the following image. Under Use Hardware, LaunchPad I2C should be selected. Under SDA Pin, P02/10 (LaunchPad I2C) should be selected. 15. When you return to the TI Drivers list, you will notice you have a resource conflict, indicated by a red X on the screen. Unfortunately, this is a very common occurrence in embedded system design. The I2C peripheral uses the same pins as one of the LED GPIOs. We will need to remove the driver for GPIO LED 1, which is the green LED. 16. Remove the driver by clicking on the trash can icon all the way to the right of the CONFIG_GPIO_LED_1 item. 17. With the driver for LED 1 now removed, the TI Drivers list should display all green check marks. 18. Add the UART by clicking the plus icon next to UART. Then configure the UART by selecting XDS110 UART under the Use Hardware option. 19. Verify you have the GPIO, I2C, Timer, and UART drivers enabled. Do not make any changes to the Power and RTOS driver configurations. Then save the configuration and build the project following the same instructions as shown in step 10. 20. Note that errors will appear when building the project. This is because we removed the driver in sysconfig but we did not remove references to the driver in the code. To solve this issue, delete the two lines referencing the LED 1 driver in the gpiointerrupt.c file. Then build the project one more time. Now you will have a clean build! 21. Open a serial console to communicate with the board. The USB connection to the board supports both the debug command protocol and a virtual com port for serial communications. In order to determine which com port the board is assigned to, open the Windows Device Manager by rightclicking on the Windows start icon in the lower left corner. In the device manager select Ports(COM & LPT). 22. The USB connection to the TI board is called XDS110. For this lab, look for XDS110 Class Application/User UART. In the provided example, the UART interface is COM5. However, it may be a different COM port on your computer. Make note of the COMx port assigned to XDS110 Class Application/User UART for your PC. 23. In CCS, select the View tab to open the Terminal window. 24. From the Terminal window, select the Open a Terminal button which appears with a blue monitor icon (shown first on the left of the row of icons in the upper right corner). 25. The Launch Terminal window will open. From here, choose Serial Terminal. Then select the COM port from earlier. Remember that while this example uses COM5, yours will likely be different. Every other field will remain as its default. Once complete, click Ok. 26. Integrate the driver code into gpiointerrupt.c. These drivers are installed with the Simplelink SDK. You can locate these drivers at the following locations: x C:\ti\simplelink_cc32xx_sdk_4_30_00_06\source\ti\drivers x C:\ti\simplelink_cc32xx_sdk_4_30_00_06\examples\nortos\CC3220S_LAUNCHXL\drivers x C:\ti\simplelink_cc32xx_sdk_4_30_00_06\examples\rtos\CC3220S_LAUNCHXL\drivers 27. For the I2C driver, copy the following code into CCS. You will need to call initUART() before calling initI2C(). Note that initI2C() initializes the I2C peripheral and readTemp() uses the I2C peripheral to read the temperature sensor. #include // I2C Global Variables static const struct { uint8_t address; uint8_t resultReg; char *id; } sensors[3] = { { 0x48, 0x0000, "11X" }, { 0x49, 0x0000, "116" }, { 0x41, 0x0001, "006" } }; uint8_t txBuffer[1]; uint8_t rxBuffer[2]; I2C_Transaction i2cTransaction; // Driver Handles - Global variables I2C_Handle i2c; // Make sure you call initUART() before calling this function. void initI2C(void) { int8_t i, found; I2C_Params i2cParams; DISPLAY(snprintf(output, 64, "Initializing I2C Driver - ")) // Init the driver I2C_init(); // Configure the driver I2C_Params_init(&i2cParams); i2cParams.bitRate = I2C_400kHz; // Open the driver i2c = I2C_open(CONFIG_I2C_0, &i2cParams); if (i2c == NULL) { DISPLAY(snprintf(output, 64, "Failed\n\r")) while (1); } DISPLAY(snprintf(output, 32, "Passed\n\r")) // // // // Boards were shipped with different sensors. Welcome to the world of embedded systems. Try to determine which sensor we have. Scan through the possible sensor addresses /* Common I2C transaction i2cTransaction.writeBuf i2cTransaction.writeCount i2cTransaction.readBuf i2cTransaction.readCount setup */ = txBuffer; = 1; = rxBuffer; = 0; found = false; for (i=0; i
Purchase answer to see full attachment
Explanation & Answer:
1 Database
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

View attached explanation and a...

Similar Content

Related Tags