The group was able to prototype something for each major section. The group prototyped the I2C interface which is a key technology used in the remote sensor module. The group also prototyped using the Google App Engine which is a major part of making the control system internet capable. Finally the group became familiar with the Texas Instruments’ Stellaris LM3S8962 Ethernet+CAN Evaluation kit at a Texas Instruments’ workshop. The Stellaris kit will be used extensively with the main control unit.
5.1 Thermostat Prototyping
The thermostat will make great use of the I2C protocol and as such it was determined that energy should be devoted to prototyping with a device that used the I2C interface. To this end a TMP275 temperature sensor was acquired from Texas Instruments (TI). TI supplied the sensors free of charge as samples. The TMP275 is a digital temperature sensor that requires extensive initialization, and communicates via an I2C bus.
The TMP275 was a great choice for prototyping, but it can in a sot-8 package. The sot-8 package has eight SMD pads and the leads are too small to solder to in the ‘dead bug’ style. This means that a custom PCB was required simply to get access to the leads of the TMP275. Figure 5.1-1 is a picture of the breakout board that was used. The group decided that it would be wasteful and irresponsible to purchase one custom breakout board that would not be used again. The group decided to make the breakout board using copper-clad, toner, and an etching solution. The PCB was laid out in Eagle CAD and then transferred to the copper-clad. After etching the PCB, the IC and eight male headers were soldered onto it.
Once the PCB was made and populated, it was placed on a breadboard and connected to two general purpose I/O pins on the MSP430 Launchpad. Once the physical system was prepared, the coding began. After much work, the group was able to get data from the TMP275. The I2C protocol was emulated using a brute force (bit bang) approach. The TMP275 requires several registers be set when powered on, the accuracy of the conversion must be set, and a few other status registers need to be adjusted. Once communication was established the MSP430 requested temperature data from the TMP275. Once the MSP430 received the temperature data, it decoded the binary value and compared it to a preset temperature set when it was programmed. The preset was sixty degrees fahrenheit, and if the temperature measurement taken by the TMP275 was higher than the preset, the red LED was turned on. After the red LED to turned on and it was confirmed that the I2C bus worked, the preset temperature was set to one hundred degrees fahrenheit, and the green LED was made to turn on if the measured temperature was less than the preset. When the green LED turned on, it was shown that the I2C bus worked, and the program on the MSP430 was capable of accurately requesting, gathering, and processing data from the I2C bus.
5.2 System UI & Intelligence Prototyping
The decision to leverage Google App Engine greatly simplified the hardware design of the MCU, but also brought a shift in how the System UI & Intelligence would be developed. For developing web applications Google provides Google App Engine SDKs (Software Development Kits) for various operating systems. The SDK includes a web server that provides a local sandboxed environment with elements found in the Google App Engine runtime environment like APIs, libraries and the datastore. Also, it provides the means for deploying the application directly on the Google App Engine.
The group proceeded to setup a local development environment for further testing Google App Engine’s features and capabilities. The Google App Engine Python SDK requires at minimum a computer with Python version 2.5. For this, the group chose the Windows 7 operating system and installed the latest windows binary of Python 2.7.
Once Python was installed the group tested the Python installation to make sure it was working correctly. For this, the group tested the included IDLE interactive shell and created a short Python script that would output “Hello World!” to the screen.
For testing IDLE the group launched it from the Python 2.5 directory in the All Programs list. Once inside the IDLE shell they called the “help()” function to test if the interpreter was working correctly and quickly quit the help() function by typing “quit” to go back to the shell and then quit the shell by typing “quit()”.
To test the execution of Python scripts, a simple Hello World! script was created on the Desktop with the following line of Python code:
print("Hello World!")
To run the script the group opened a command line window and ran the following commands:
> cd Desktop
> python helloworld.py
The Python interpreter should read the script and output “Hello World!” in the command line.
After ensuring the correct installation of Python on the development computer the group proceeded to download and install Google App Engine SDK for Python from the Google App Engine website. Once installed, the SDK can be managed by opening the Google App Engine Launcher application which can be found in the All Programs list.
For testing the group created a sample application using web2py by clicking File->Create a New Application. The application was named web2py and was stored in its own folder located inside the Documents folder. It was also set to listen on port 8080. With the creation of the web2py folder, the application files automatically generated by Google App Engine Launcher needed to be replaced with the web2py source files. These files were downloaded from the web2py website and extracted to the web2py folder. In order for the application to work, the contents of the app.yaml file in the web2py folder needed to be replaced with the contents of the app.example.yaml file. Once the application was setup it was launched from the Google App Engine Launcher. To access the application the group used a web browser and accessed http://localhost:8080 where they were greeted to a welcome page generated by web2py.
Share with your friends: |