0% found this document useful (0 votes)
11 views4 pages

Embedded Systems Project Guidelines

Students are required to submit a 4,000-word report on their embedded systems projects, detailing the problem addressed, solutions considered, and testing methods. Support is available through provided resources, including a PCB and various microcontrollers, with advice on project development, power consumption, and common pitfalls. The document emphasizes the importance of thorough planning, incremental testing, and proper documentation throughout the project lifecycle.

Uploaded by

aziz.khlaifia
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views4 pages

Embedded Systems Project Guidelines

Students are required to submit a 4,000-word report on their embedded systems projects, detailing the problem addressed, solutions considered, and testing methods. Support is available through provided resources, including a PCB and various microcontrollers, with advice on project development, power consumption, and common pitfalls. The document emphasizes the importance of thorough planning, incremental testing, and proper documentation throughout the project lifecycle.

Uploaded by

aziz.khlaifia
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Embedded systems Projects

Administration and Evaluation


You will need to submit a formal report concerning your project work. The report should be approximately
4,000 words in length, and should be submitted to the Teaching Office on the first teaching day of the
Lent Term. Students are also encouraged to submit their lab books.

The report will normally contain sections detailing the problem being addressed, the options considered
for solving the problem, the calculations made to ensure that the proposed solution can meet the
technical limits and requirements (for example memory capacites, limits of throughput on connections),
and the way in which it is proposed to test to show that the solution does in fact work.

Since some of these projects have not been tried before, it may well be that the eventual solution is
different from the one originally envisaged. If this is the case, then add a section explaining the difficulty
encountered with the original approach to the problem, and details of the workaround or improvement
made.

Support
Many of the projects use the same basic functionality. We have made a Printed Circuit Board [PCB]
available, which may help you. Details are available here: [Link]
project/project_pcb.pdf

You may have ideas for a project other than the ones on the project_suggestions list. If so, talk to Dr
Wassell or Brian Jones early on, to make sure both that the project is suitable, and that we can get hold
os any parts required. There is a huge range of sensors available, many of which produce a voltage,
and so are easy to interface to a microcontroller, plus a large number of sensors and peripherals use
interconnections for which there is support built into the microcontroller, for example I2C bus or SPI bus.

To make writing your report easier, and also to make it easier for the demonstrators to help you with
your project, keep paper or electronic copies of relevant datasheets, and keep notes in a lab book of
key items which are relevant to the project, such as any unusual properties for the parts you are using.

General project advice


Choice of microcontroller

There are basically 4 choices which we have available in a Dual In Line (DIL) package. (There are
lots more available in surface mount packages, but they require Printed Circuit Boards rather than the
prototyping boards we have). All 4 devices have a built in temerature sensor, and all three are available
in a 'V' version with a lower maximum clock speed but the ability to work at supply voltages down to
1.8V instead of 2.7V All 4 devices have much the same functionality available. Data sheets for each
are in the docs folder.

• ATMEGA168 - the one you have been using. 1K of ram, 1 USART

The makefile settings for the MCU (line2 of the Makefile) and the avrdude programming are:
MCU=atmega168 avrdude -p m168p

• ATMEGA328 - the one you have been using, but with 2K of ram, 1 USART

The makefile settings for the MCU (line2 of the Makefile) and the avrdude programming are:
MCU=atmega328 avrdude -p m328p

• ATTINY45 - a physically small, 8 pin device, with much the same functionality as the ATMEGA168,
but usually the pin count . Only 256 bytes of ram on this device. You might want to use this one

1
Embedded systems Projects

where space is at a premium, or where you are using it as a sensor. When using this device it may
be necessary to move it to a programmer rather than program it in place.

The makefile settings for the MCU (line2 of the Makefile) and the avrdude programming are:
MCU=attiny45 avrdude -p t45

• ATMEGA644 - 2 USARTs, 4K of RAM, physically large (50 mm long x 18 mm wide). GPS and serial
interfacing projects may need to use 2 USARTS. Data logging projects which write large amounts of
data to SD cards will need the RAM capacity.

The makefile settings for the MCU (line2 of the Makefile) and the avrdude programming are:
MCU=atmega644p avrdude -F -p m644p

Choice of speed

If the project will eventually be battery powered, choose a frequency for the microcontroller within the
range suitable for the battery voltage. You can always test on the bench using 5V, but changing the
operating speed part way through the project is likely to cause problems. In general you should choose
top operate the CPU as fast as possible, unless you are really trying to minimise the current drawn.
It uses the same power to finish the processing in half the time and go into sleep mode, as to run at
half the CPU speed.

Storage

If you can process your data on the microcontroller, do that. If you need to store up to 2 Mbytes, you
can add flash memory to the SPI bus, but will need to write a 256 bytes page at a time. If you need to
store up to 2 Gbytes, then you can use an external MicroSD card, but will need to use a microcontroller
with at least 2K RAM, plus you need to provide a function to provide a timestamp for your files (you can
either add a Real Time Clock (RTC) or provide a dummy function to write a plausible timestamp.

Libraries

There is software support in the form of example implementations or libraries for the following devices:

• DS1302 Real Time Clock [Link]

• M25P16 SPI Flash memory [Link] requires SPI


support [Link]

• MicroSD memory card and FAT 16 filesystem [Link]


Requires a real time clock (or dummy functions), and SPI support [Link]
teaching/1011/P31/lib/spi2.c

• SCA3000-E01 3 axis accelerometer [Link]


requires SPI support [Link]

Soldering a row of 5 pins in to JP3/4 and connecting 2->3 with a shunt will form a loopback (echo)
connection.

Serial

You have used serial communications using the RS232 protocol, using the serial_to_USB converters.
If you need to use the COM1 ports on the PC instead, then you need to know that they are device /
dev/ttyS0 in Linux. They are there permanently - they do not appear and disappear on plug in/out like
USB devices. You will find on first use that you don't have access to /dev/ttyS0. To fix this type sudo
chown <crsid> /dev/ttyS0 replacing <crsid> with your crsid. You will be asked for your login password
- this is the Operating system's way of getting confimation that you want to run a priveleged command
(in this case chown)

2
Embedded systems Projects

If you are using the level converter PCB, then, once connected to the PC you can look at JP3 and JP4
pin3 to see the incoming signal from the PC. Typing characters into minicom with the port set to /dev/
ttyS0 should be visible with an oscilloscope.

6 pin programming header

The Tuxgraphics programmers you have used so far have a 5 pin connector. On some of the Printed
Circuit boards, you may see a 6 way connector, whose pin connections are as follows: GND Reset
(+5V) rarely used or connected SCK MISO MOSI I will provide adaptors where necessary

Devices

We buy most of our devices from Farnell ([Link]) or RS components ([Link]) If the
part or the bag it is in has a 6 or 7 digit number, it is very likely to be either the Farnell or RS part number
and you can use the website to look up data for the part.

Development

During the planning stage, work out a series of steps to get to the eventual goal, and how you will test
each stage. Take notes as you go, which should help you when writing the report at the end of the project.

Work incrementally, testing as you go, or you run the risk of getting stuck at a complex part of the project,
and after considerable time discovering that the fault was in something simple from an earlier stage
which is not working as expected.

Even if the project will eventually be battery powered and mobile, do as much development and testing
as possible in the lab environment, and only go mobile when you can do no more in the lab.

You should consider using several computers to speed your development - develop, read code and
program your device from one, and have minicom or other test programs ready to go on another.
Remember that you can be logged in to multiple computers, and that you can have multiple terminal
windows open on each.

When developing, as you get to a stage where something is working, add a brief comment to the file,
and store a copy. That way you can go back to a working version later.

Notes on power consumption


1. Sleep. Spend as much time as possible in the lowest power sleep mode. Beware though, of turning
off the clock which is running the wake-up source.

2. Turn off parts of the microcontroller which aren't in use. As above, beware turning off the clock which
runs the timer which you need to wake. There are no warnings to tell you that you have done this.

3. Don't let inputs float. Pull them up, or turn them into outputs, and assign them to be high or low
depending whether the load is attached to the supply or ground respectively.

4. Beware of switches on inputs. As inputs the pullups will cost power if the switch is closed. If you aren't
using a switch, make the pin an output and set it low. Alternatively, choose the default position of
the switch to be all open.

5. The eye will detect a 20mS flash on an LED, so you can keep flashes to this length to save power.
LEDs need a few mA to light up.

6. On the project PCB, if you aren't using the voltage reference IC2, remove the link to the positive
supply, as the reference needs 210uA to work.

7. Also on the project PCB, be aware that if C1 is fitted it will take time to charge through the resistor,
which will disrupt any current measurements you make.

3
Embedded systems Projects

Common pitfalls
Here is a list of common pitfalls, in no particular order.

Speed vs power and working voltage


The microcontroller uses much less power at 3.3 Volts than at 5 Volts, and less still at lower voltages,
but beware that below 2.7 Volts it cannot run at full speed.

If your project needs to be battery powered, use the Lithium batteries, and run the micro either at battery
voltage, or at 3.3 Volts through a voltage regulator. A voltage regulator costs 17uA of idle current, but
the reduction in consumption of the other circuitry probably saves you more.

Interrupts
One of the easiest traps to fall into is to spend so long in the interrupt routine, that another interrupt
has occurred before the first one is finished. If timing is critcal, then the extra latency before the second
interrupt is serviced will probably cause a failure. This suggests doing the minimum possible in the
interrupt service routine (ISR), eg setting flags, and the maximum outside the ISR.

A different strategy to the above is as follows:

Do everything in the interrupt routines, and nothing in main. Make sure that each interrupt handler sets
up the conditions for the next interrupt to occur. If only one interrupt is enabled at a time, then there
is no potential to clash.

Make sure that all interrupts are set up and conditions cleared before the Master Interrupt Enable bit is
set, otherwise an interrupt may occur immediately.

If you use global variables which are changed in more than one place, declare such variables as
volatile, otherwise the compiler will optimise the code, and not notice that the variable has changed.

I/O
It is very easy when modifying code to forget to define a new output. Everything will compile correctly,
but the pin will not behave as you expect.

It is useful to copy a line such as PORTB |= (1<<PB1), changing it to PORTB &= ~(1<<PB1).
However, omitting the brackets in the second case will cause problems because of operator precedence.

Except while initialising, it is very rare that you will need assignment such as PORTB = (1<<PB2);
You almost always need |= or &=

Analogue to Digital converter


The most common pitfall with the A to D is forgetting to supply a reference volatge at AVcc. Zero or
very low readings are a symptom of this.

The next most common is having too high a clock rate. If it is too fast then only the first few bits of the
data will be correct.

Selecting the wrong analogue input is the next most common error.

Fuse errors
If you can no longer program the fuses, have you disabled the clock by mistake ? This is particularly
easy to do when chaning from an internal to an external or crystal derived clock.

If you reprogram the fuses, the device does not automatically restart. You must power cycle it. Changing
the program does however force a restart.

Common questions

Powered by AI

When selecting a microcontroller, one should consider the RAM capacity, USART availability, physical size, and specific project needs like data logging or serial interfacing, which might require multiple USARTs or large RAM . For battery-operated projects, the power consumption versus operating voltage also needs consideration, as does the compatibility of the microcontroller's speed with the project's environmental conditions . Each microcontroller's functional requirements, potential power consumption savings from lower operating voltages, and component interaction like sensors need analysis for efficient device operation .

The advantages of using embedded systems as described in the project guidelines include flexibility and customization since a wide range of sensors and peripherals can interface with microcontrollers through supported connections like I2C or SPI buses . The variety of microcontrollers available, such as ATMEGA168, ATMEGA328, ATTINY45, and ATMEGA644, allows for projects requiring different specifications regarding memory, speed, and size constraints . However, challenges include ensuring compatibility with technical limits like memory capacities and throughput on connections . Additionally, if projects are battery powered, selecting the correct operating frequency and managing power consumption to extend battery life can be complex .

Incremental testing positively impacts the success of embedded systems projects by allowing early identification and rectification of errors during each development stage, preventing larger systemic issues later . This strategy minimizes risks associated with complex integration at later stages by providing a clear, systematic validation of functionality, ensuring that each component works as intended before proceeding. Using multiple computers and documenting working stages and testing paths also facilitates easier debugging and return to a previous operational state if issues arise . Minimizing technical debt through structured testing directly contributes to project stability and efficiency, ensuring better adherence to project timelines and outcomes .

Interfacing with sensors and peripherals requires strategic decision-making involving selecting appropriate microcontrollers and buses like I2C or SPI for compatibility and data throughput needs . The variety of sensors available necessitates careful selection to match technical requirements such as voltage output compatibility with microcontrollers . Considering microcontroller RAM limitations, additional peripherals like flash memory can be interfaced to extend capabilities, directly impacting data handling and processing required by the project's scope . Choosing the correct sensors often involves evaluating their data accuracy and ease of integration with the existing communications protocols supported by the microcontroller .

Clock management is fundamental in embedded systems, influencing both performance and reliability. Appropriately selecting clock sources and managing power consumed by these clocks can greatly enhance power efficiency and control over system timing. Disabling or improperly configuring clocks may lead to loss of functionality or system stability, especially for timing-sensitive operations . Real-time clock usage for timestamp functionality in data logging requires coexistence with main system operations without causing resource conflicts or leading to incorrect data recording or system timeouts . Effective clock management ensures predictable system behavior and aids in optimal power usage, enhancing system reliability, especially in battery-operated designs .

Power management principles significantly impact the design and operation of battery-powered embedded systems by necessitating strategies to reduce power consumption, such as spending as much time as possible in low power sleep modes and shutting off unused parts of the microcontroller . Additionally, it is crucial to regulate inputs to prevent floating, which can consume power, and strategically manage LEDs for visible indicators due to their high power consumption . Managing operating frequencies to cut power consumption while maintaining system performance is also important, such as running microcontrollers at 3.3 Volts, which uses less power than 5 Volts .

Programming strategies, especially how interrupts are managed, play a crucial role in system performance. Efficient use involves executing as little as possible during interrupt service routines (ISRs) to avoid long delay times that can cause clashes with successive interrupts, especially if timing is critical . Alternatively, ensuring each ISR sets up conditions for the next is vital to avoid service lags and system fails . Careful management through minimalism in ISRs, adequate setup before enabling interrupts, and using volatile declarations for globally changed variables prevent timing failures and functional discrepancies .

Real-time data logging provides immediate feedback and valuable insights into the system's operation, enabling quick diagnosis and system adjustments if required. Efficient implementation involves using external storage like a MicroSD card, particularly if a large data capacity is needed beyond 2MB, although it requires a microcontroller with at least 2K RAM . Integration of a real-time clock or implementing dummy timestamp functions for file management ensures data logging accuracy and sequence tracking. Optimizing flash memory writes through correctly paged data storage also maintains performance .

Efficient power consumption in microcontroller design can be ensured through several strategies: implementing low power or sleep modes to minimize energy use during idle periods, dynamically disabling unused microcontroller modules, and handling input states to avoid power drains from floating inputs . For LED indicators, brief flashes are sufficient for visibility while reducing power consumption . Lowering the operating voltage of the microcontroller, either to match battery output directly or via a low idle current voltage regulator, further enhances power efficiency . Prioritizing low frequency operations aligns with battery constraints without sacrificing necessary processing power .

Common pitfalls in analogue to digital (A/D) conversion, such as failing to supply a reference voltage at AVcc or operating at too high a clock rate, can lead to inaccurate or zero readings, consequently affecting data integrity . To address these issues, ensuring a stable reference voltage and selecting an appropriate clock rate that aligns with the microcontroller's specifications prevent errors and data loss . Furthermore, accurately selecting and configuring analogue input channels ensures that the intended signals are processed correctly. Continuous validation and calibration against known standards can improve conversion accuracy, ensuring reliable and valid readings .

You might also like