Assignment title: Information


Temperature Sensor Assignment Learning Outcomes: 3. Design, breadboard and program a micro-controller system. 4. Evaluate and use various IO devices (e.g. keypads, ADC, LCD modules, relays). 5. Design basic IO device drivers (e.g. I2C, SPI, CAN) [LCD in this case]

System Specification: The assignment requires you to produce a temperature measuring and display system as might be used to monitor an industrial process or heating control system. The requirement is to monitor a temperature within the range 0 – 100° centigrade to a resolution of 1°C. The system should light a warning LED if the temperature rises above 25°C. The data is to be displayed locally on an LCD screen, and be transmitted over a serial connection to a PC running 'Terminal' for storage and analysis. Readings should be taken once per second, and displayed on LCD and PC like this: Temperature = xx (where xx is a two digit value in centigrade)

Equipment: STM32F103RE ARM board, with connectors for serial and LCD outputs 2 x 16 lines LCD display with Hitachi Interface and cable

LM35 analogue temperature sensor Serial cable for interfacing to PC Data: LM35 Temperature Sensor Data sheet

Hitachi LCD Interface notes ETT board manual (all available on Blackboard)

Assessment: You may work individually, or in groups of 2. In the case of a group, the same mark will be given to both group members unless it is clear that one has not contributed sufficiently to the work. If you wish to work as a group of two, you should complete and submit a form by 15th February where both of you sign to say you will work as a group. If there is no contact by then you will be assumed to be working individually. The assessment will consist of a demonstration of your system, on a date to be announced (early April) where you will be asked questions about your code and how your system works. If you cannot answer confidently you will lose marks. You will be required to submit your code as a zipped Keil project on the date of the demonstration. Poorly laid out code, or code that is difficult to interpret will reduce your overall mark, so make sure you use sensible variable names and partition your code into functions whose operation is logical and clear. The lab demo has three major parts; the analogue sensor and input system, the serial output system, and the LCD output and display system. In addition to the lab. demonstration, you will need to write a short report covering: 1. The method by which each I/O device was connected to the ARM board, and how you chose pins, etc. You should include a diagram which shows how you connected up your system

2. A brief description of the 'protocol' (means of data transfer) used by each I/O device, and any data conversion/interpretation you needed to implement, e.g. how was the data from the analogue port converted into a temperature?

3. A 'log' print out containing data captured by the serial port using the 'Terminal' program

You will be assessed separately on each aspect of the work as shown below. If necessary, you may demonstrate individual parts of the system if you are unable to get them to work together: Laboratory Demonstration – 9 th April 2016

Analogue temperature sensor and warning LED: 2 marks

Serial output: 2 marks LCD output: 2 marks

Integrated system: 4 marks Report – 9 th April 2016 5 marks Maximum score: 15 marks

There will be bonus marks if you can use additional buttons on the ARM board to control the temperature that the warning LED operates at.

  Advice: This assignment requires you to produce a more complex piece of code that you have been used to working with. Use Standard Peripheral Libraries (SPL) where possible, as this is less error prone and easier to read. Think about partitioning code into separate files. For instance, you may have once source code file which contains all the SPL initialisation functions for GPIO, etc. A final 'main.c' file might just contain the following lines (this is not to be a suggested solution): int main()

{ RCCconfig(); //I/O clocks,

GPIOBInit(); //LCD pins GPIOAInit(); //USART and ADC pins USART1_init(); ADC1_init();

LCDInit();

while (1)

{ measure(); //measure and output temperature

delay(nn); //wait 1 second }

} Development and testing: You are strongly advised to start by producing three individual programs that demonstrate your ability to produce code for each system. Once the individual parts are functioning, you can think about integrating them into a single project. You will be allocated marks for each individual system, and for the final integrated system. The LM35 temperature sensor has been selected because it is sensitive enough to respond to the small increase in temperature which happens if you hold it between your fingers. You can use this to test if the sensor is responding correctly. A warm soldering iron or freezer spray from the technicians will provide a greater temperature change.

The LCD is the most difficult to communicate with, so do not underestimate the effort required. You will need to implement a range of delays for various parts of the system. Recall that the SysTick timer can be used for producing delays. There are lots of examples of code available on the Internet for each of the systems – learn from them but do not copy them. Do not use 'libraries' of code from third parties – all the code must be your own. You will already have example lab. code for the analogue input and serial output – you will need to modify this in order to use the appropriate pins on the ARM board (for instance, there is a potentiometer attached to PA3, so use PA4 for analogue output because it has nothing else connected to it). Consult reference material to see which internal devices are connected to which I/O pins.