Monday, August 17, 2009

Automotive Electronics

In automotive electronics networking, the commonly networking standard used is called CAN or controller area network which uses a baud rate of up to 1Mbps. This speed is needed in the control of engine and other critical components of the automobile that requires fast transfer of information. However, there are some areas of control which does not require that kind of speed and hence a slower speed standard can be utilised to save control cost. Some of these areas are the mirrors control, Window lift, seat control and door lock amongst others.

Due to this requirements, a consortium was formed in 1998 consisting of 5 automotive manufacturers (Volvo, BMW, Audi, VW and Daimler-Chrysler), 1 tool supplier (VCT) and 1 semiconductor supplier (Motorola) to look into this. As a result, the LIN (Local Interconnect Network) specifications was finalised on 2 February 2000. The first version of LIN was 1.1 and currently version 2.0 is in use. The most recent development
in LIN is the use of it over the vehicle's battery line using a DC-LIN transceiver. Some of the main features of LIN are listed below.

* One master and up to 16 slaves. No collision detection feature is needed as master initiated all messages communication with slaves. The master is usually implemented with a more powerful microcontroller compared to the slaves as it has to handle more tasks.

* Baudrate of up to 20kbps. Slower speed is chosen to reduce the effect of electromagnetic interference.

* Single wire implementation based on enhanced ISO 9141.

* Simple SCI or UART hardware interface which is available in most microcontroller chips making its implementation cost effective.

* Self synchronization in the slave nodes without the need to have crystal or ceramic resonator. Internal RC oscillator for the microcontroller is good enough and hence making its implementation lower cost.

Zigbee - Emerging Simple Wireless System

Introduction To Zigbee

In the wireless world, the name Bluetooth
and WIFI have become a household name in recent years. They quickly find applications amongst others in mobile computing and mobile phones.

Zigbee is the result of the demand from industry and consumer for wireless applications that demand for lower data rate, longer battery life, simple design, shorter range and low cost solutions.

Introduction To IEEE 802.15.4

IEEE 802.15.4 is a simple standard that specifies the Media Access Controller (MAC) and Physical (PHY) networking layers for packet data protocol. Its license free frequency bands are:

2.4 GHz (16 channels with baud rate of 250 kps)
902 MHz - 928 MHz (10 channels with baud rate of 40 kps)
868 MHz - 870 MHz (1 channel with baud rate of 20 kps)

North America, Europe, Australia and New Zealand use the sub 1 GHz bands whereas the rest of the world uses 2.4 GHz bands.

It uses Carrier Sense Multiple Access with Collison Avoidance for Channel Access.

The security method used is AES-128.

Has message acknowledgement and a host of other features.

Zigbee Applications

Zigbee technology is based on IEEE 802.15.4 industry standard. It incorporates the standard, adding the logical network, security and software to it. It supports up to 3 network topologies namely STAR, MESH and CLUSTER tree. Developers need only have to focus on application while the MCU/Microprocessor/RF Transceiver makers and Zigbee Alliance take care of the RF Transmitter, RF Receiver, RF Channel and its protocol.

There are 3 types of traffics that can be used.

a) Periodic data

An example of this traffic is a wireless sensor to read the water meter. The sensor is programmed to wake up at certain interval to transmit the information needed and goes back to sleep after this is done.

b) Intermittent data

An example of this traffic is a wireless light switch to ON or OFF a light manually. It is triggered only by external input and hence wakes up to transmit the message to the network. When done, it is disconnected to the network and hence save energy.

c) Repetitive data

An example of this traffic is the security system monitoring. The devices are time multiplex to return its status to the network. This type uses more energy.

There are numerous applications that can be implemented using Zigbee. Amongst others are in the industry and home applications.

In the industry, the applications include utility and metering where gas/water/electricity meter readings are automated and send back to utility headquarter for further action. This saves the time it takes for their personnel to come to the premises to take its reading. In the area of warehousing/inventory management , the wireless technology will enable accurate and hassle free management of goods. Security and access control, building management system and lighting control are among the applications that can be implemented with ease.

In the home, a total home automation system to control lightings, blinds, air conditioning, security system, remote control and appliances can be implemented.

Home Lighting System Project

Introduction To Home Lighting System

In recent year, the control of Home Lighting System
has developed from standalone type to more complicated networking controls. Many building management system
and even the security system have incorporate the control of lighting into their system as a total solution to their customers. However, there are still no single universal protocol for the building or lighting control system.

The lighting industry has developed a new standard for communication with electronic ballast. Electronic ballast is a common lighting device that is used in practically every building, factory or residential house. This standard called IEC 929 is an interface standard for communication between a controller and the electronic ballast. The standard for the control is called DALI, an acronym for Digital Addressable Lighting Interface. DALI is meant for home or industry use which has 2 wire communication connection between the master-slave and slave-slave. It is developed to reduce the cost of implementation.

Among the features that can be applied are dimming features and control for different grouping/section of the building.

The electronic ballasts can have up to 16 groups and each group can have up to 16 different lighting parameters for the lighting scenes. Each controller can controlled up to 64 electronic ballasts.

There are many ways to implement the DALI depending on the cost and requirements of a home or building. Most of the time, a microcontroller is used at both the slave and the master controller units as this is one of the most cost effective ways to implement the system.

Sensorless BLDC Motor Power Inverter Circuit Design Project

Introduction To Power Inverter Circuit Design

Power electronics motor control have evolved from simple ON/OFF control to more complex electronic control circuitry in recent years. In the area of consumer electronics, the products that have been impacted by inverter based technology are air conditioners and washing machines and refrigerator.

The inverter technology development has been moving at a fast pace in the quest for more efficient and environmental friendly products. Energy savings have been the key drivers as our the oil and gas resources of our earth is fast depleting. The inverter development started from AC inverter control which evolved to DC inverter control and recently sensorless brushless DC motor control. The sensorless BLDC motor inverter control has more complex circuitry but is far more efficient and long lasting compared to AC inverter control.

Brushless DC Vs Sensorless Brushless DC Control

In BLDC control, a few Hall sensors are placed on the stator of the motor to detect the position of the rotor during the operation of the motor. The sensors are normally build into the printed circuit board and mounted onto the enclosure cap of the non driving end of the motor. The setback of this method is that the sensors and PCB need to be placed in a location where the temperature of the motor will not build up and thus affect the lifetime and operation of the PCB.

In Sensorless BLDC control, there is no need to have any Hall sensors to sense the position of the rotor. The sensing of the rotor position is by the analysis of the back electromotive force that is generated at the stator of the motor windings. By using this method, the reliability of the control system is enhanced. The setback of this method is that the algorithm and control circuit to detect the back EMF is complex, hence requiring more powerful microcontroller and software knowledge.

Power Inverter Circuit Design Application

A good sensorless BLDC motor Power Inverter Circuit Design Application Notes and its source codes can be downloaded from Microchip website. The control circuitry functions include the sensing of Back EMF, the driving of DC Motor using IGBTs, detection of overcurrent and RS 232 communications interface.

X10 Home Automation Project

Introduction To X10 Home Automation

X-10 is a communication protocol designed for sending signals over 120 VAC wiring. X-10 uses 120 kHz bursts timed with the power line zero-crossings to represent digital information. X10 components send signals through your home electrical wiring. There are 16 house codes and 16 unit numbers per house code available on your network for a total of 256 addresses. You can control multiple devices by setting them the same house code.

X10 plug in modules are now commonly used in the area of security, lighting, control of TV, motion detectors and other applications. It should be noted if there is no filter at the house breaker box, signals can pass from one house to another and cause odd behavior. If you have problems with a device on a given house and unit code, experiment with other codes and see if the problem goes away.

X-10 transmissions are synchronized with the zero-crossings on the AC power line. By monitoring for the zero-crossings, X-10 devices know when to transmit or receive X-10 information. A binary ‘1’ is represented by a 1 ms long burst of 120 kHz, near the zero-crossing point of the AC. A binary zero is represented by the lack of the 120 kHz burst.


X10 Home Automation Project

This application note discusses the implementation of X-10 on a PICmicro MCU to create a home controller that can both send and receive X-10 signals. The reader may implement the home controller as is, or adapt the circuits and firmware to other applications. A library of X-10 functions is provided to facilitate development of other X-10 applications using PICmicro microcontrollers.

It allows the user to program on and off times for up to sixteen devices, using a 2 x 16 liquid crystal display and five push buttons. A built-in light sensor can be used to turn on lights at dusk, and turn them off at The home controller is designed to facilitate experimentation with home automation using the PIC16F877A.

It will be a good project for final year students to embark on and hence gain a considerable experience in X10 wireless technology.

USB Circuit Design

Introduction To USB Circuit Design

USB is an acronym for Universal Serial Bus and is the technology that enables the connections between computer and external devices over a cable using bi serial transmission.

It has 4 connections to it i.e. Vcc, Gnd, Data + and Data -. The devices can be connected to the computer without turning OFF the personal computer. It is able to support data speed from 12Mbps (USB1.0, USB1.1) up to 480Mbps(USB2.0). This type of connection is fast replacing RS232 and parallel port in many PCs. As it is now, many laptops no longer has any provision for RS232 connections.

Peripheral devices that are designed to USB complaint are increasing every day. Some of them that are commonly seen by consumers are keyboard, mouse, modem, joystick, digital camera, microphone, scanners, printers, storage devices, web camera and telephones.

USB was implemented in all personal computers since 1997. Windows 98 was the first Windows that has built in drivers to support its implementation. One big advantage of the USB is its capability to be connected up to 127 devices to a computer.

USB can have 2 types of connections. They are type A (rectangular) and type B (square). Type A is usually connected to the PC and type B to peripheral devices. Expansion of the USB is done by using a USB port hub.

In a typical design, if a device is using less than 500mA/5V supply, it is usually better to tap the power from the computer. The type of data transfer between the computer and the devices are interrupt (e.g. mouse), bulk (e.g. printer) or isochronous (e.g. speakers).

USB Circuit Design (USB2.0)

USB2.0 version standard was released on April 2000 and is an upgrade version of USB1.1. It has better bandwidth and data transmission speed up to 480 Mbps compared to USB1.1 which has only 12 Mbps. This makes it an ideal applications for multimedia and storage devices. It is backward compatible to USB1.0/USB1.1 as it supports 1.5Mbps, 12Mbps and 480Mbps.

The following USB2.0 reference project from Freescale Semiconductor describes in detailed the design of a USB2.0 Card Reader. It support cards such as Compactflash, Memory Stick, Memory Stick Duo, Magic Gate, Secure Digital, MultimediaCard and SmartMedia. The schematic and source code of the reference projects are provided. This USB Circuit Design Project is a good reference for students who need to do an electronics project in their final year of studies.

Bluetooth Technology

Introduction To Bluetooth Technology

Bluetooth technology is a radio frequency short range communications technology that was created with the intention of replacing wired cables that are used to connect various portable and fixed devices. The use of this technology will do away with the physical cables that connect devices. The key features are its low cost, low power and robustness in maintaining high level of security.

Bluetooth was made possible by the Bluetooth Special Interest Group(SIG) which was founded by Ericsson, IBM, Intel, Nokia and Toshiba in the year 1998. The objective was to develop an open specifications for short range wireless connectivity. More than 1900 companies have since joined the SIG and the numbers are increasing day by day.

Specifications

The specifications provide developers the link layer and application layer definitions which are used to support both voice and data applications. The spectrum of frequency used is in the unlicensed ISM(Industrial, Scientific and Medical) band at 2.4 Ghz to 2.485 GHz using spread spectrum and frequency hopping. As this is a free band, there is no cost for the use of Bluetooth compared to cellular phones where one must subscribe to use the network of GSM or CDMA.

IEEE 802.15.1 standard is used in the development of Bluetooth enabled products. The versions used are Ver 1.2 with data rate of 1 Mbps and ver 2.0 with data rate of up to 3 Mbps. The range of operation depends on the device classes. They are:

Class 3 – 1 meter range with maximum permitted power set at 1mW.
Class 2 – 10 meters range with maximum permitted power set at 2.5mW.
Class 1 – 100 meters range with maximum permitted power set at 5mW.

Bluetooth Applications

The technology allows the data and voice transmissions to be handled simultaneously. Hence, Bluetooth applications have been used in communications solutions such as hands free headset, mobile phones, laptop, PDA, printers
, mouse, keyboard, MP3 players and fax machines amongst others. As this technology is made available in the global scale, one will be able to find many products that exhibit such capability.

In Voice over IP (VOIP) application, Bluetooth headsets are being used as wireless extensions to the PC audio system. As VOIP becomes more popular compared to wired phone, Bluetooth may be used in Cordless handsets, with a base station
connected to the Internet link.

One good link for free downloading of Bluetooth technology design is from IVT Corporation. It is a world leader in providing Bluetooth Technology and Fixed-Mobile Convergence(FMC) Solutions.

Digital Signal Processing Biometrics Applications

Introduction To Digital Signal Processing

DSP or Digital Signal Processing is the technology
of manipulating analog information that has been obtained from sources such as sound or photography data that have been converted into digital format. It uses complex mathematical formulas to the raw data to form another type of modified output. It uses the compression technique to transmits and display information effectively.

Products such as video conferencing uses complex hardware and software DSP processing. Many of these products have dedicated DSP chips where they are placed into the sound card that provide extra audio processing power to reduce the loading of processing in the CPU. In the total system solution, the DSP technology collects the raw data, process it, compress it, trasmit it and display it once again in the various digital display devices.

Digital Signal Processing In Biometrics

Biometrics is the technology used to analyze biological data. Its most recent application is in the area of security where the biological data of a person is used for personal identification and authentication before the person is allowed to proceed to enter a building or do any business transactions. Fingerprint, iris scan and facial features are among some of the human biometrics used.

The development
of single chip DSP microcontroller that processes the electrical signals generated by the transducers such as digital camera CCD devices and fingerprint sensors have helped to speed up the processing power and hence make authentication easy and efficient.

One of the industry leader in DSP technology is Texas Instruments which have developed dedicated microcontroller for DSP application. The technology that have been developed in Biometrics are discussed in great details and is a great source of design references for students or even electronics designers who are keen to develop a biometrics based DSP system.

Final Year Electronic Projects

It is usually the norm of students in the field of electrical, electronics, telecommunication, computer or communication of most universities and colleges to complete a final year project. Each must synthesize the theory and experimental work they learned during the first two to three years in order to complete the project. Under the supervision of their faculty supervisor, they must research, design, execute, document, and then present their work to the supervising committee.

A list of suitable topics will be offered by the university, from which preferred topics may be selected. Students sometimes will also have the opportunity to propose topics of their own devising, subject to approval for suitability.

Some of the projects which students may want to consider and get some ideas from are listed below. It usually involves the use of a microcontroller or a microprocessor in these projects. A lot of applications and ideas can be modified and build once they are familiar with circuit theory and operation.

Among the projects that one can consider is the utility metering projects which will become a norm in the near future. Hands-on of microcontroller projects will enable one to familiarise himself with the assembly language, C language and other tools that are used in the project.

Some of the final year electronic projects that one can get some ideas from are listed below.

Final Year Electronic Projects - Metering Project
Electronic meters compared to traditional mechanical solutions in use offer several additional advantages to the utility market. The metering utilities that can be replaced are gas, water and electricity meters.


Biometrics Digital Signal Processing Project
Biometrics is the technology used to analyze biological data. Its most recent application is in the area of security where the biological data of a person is used for personal identification and authentication before the person is allowed to proceed to enter a building or do any business transactions.


Bluetooth Technology
Bluetooth technology is a radio frequency short range communications technology that was created with the intention of replacing wired cables that are used to connect various portable and fixed devices. Get some reference design for your final year electronic projects here.


USB2.0 Card Reader Design Project
This project provides a reference USB2.0 Card Reader design with schematics and source codes
for Compactflash, Memory Stick, Memory Stick Duo, Magic Gate, Secure Digital, MultimediaCard and SmartMedia.


X10 Home Automation Project
This project discusses the implementation of X-10 on a PIC microcontroller to create a home controller that can both send and receive X-10 signals.


Sensorless Brushless DC Motor Control Project
This project provides the application notes on the control of 3 phase sensorless brushless DC Motor.


Lighting Networking System Project
This project provides the application notes on the networking control of lighting devices using Digitally Addressable Lighting Interface Standard.


Zigbee Wireless Project
This project provides the application notes on the free frequency band wireless networking using Zigbee Standard.

block diagram of mc controlled led driver

Microcontroller Based Project LED Driver

Microcontroller Based Project LED Driver

This project uses Microchip Flash based microcontroller PIC16F785 that uses buck boost converter
circuit to drive a superbright 5.5W LED module that consumes up to 700mA of current. The LED used in this project is BL-4000 series White 5500K LED Light from Lamina. The buck boost converter circuit is derived from switching power supply
applications which is becoming more common as the overall solution is smaller in size and more efficient compared to linear power supply solutions.

The 20 Pin Flash PIC16F785 is a good device to use as it offers many features some of which are listed below.

* 2048 Words Program Memory, 128 bytes Static RAM, 256 bytes EEPROM.
* Wide Operating Voltage from 2.0V to 5.5V DC.
* 18 I/O.
* 12 channels of 10 bit Analog to Digital Converter.
* 2 operation amplifiers.
* 2 high speed analog comparators and Bandgap voltage reference.
* Capture/Compare/PWM module.
* 2 phase PWM with asynchronous feedback.
* 1 16-bit timer.
* 2 8-bit timers.

The BL-4000 series LED module has a forward voltage drop of approximately 8V for a current limit of 700mA. The on chip operational amplifier is used to amplify the voltage across the resistor that is used to sense the current of the circuit.

This application note from Microchip provides the schematics, source code and some theoretical aspects of buck boost converter for those who are new to switching mode power supplies and its principles of operation. This project is a good hands-on for electronics designer or hobbyist who are keen to go into the detailed operation of a switching mode power supplies and the latest technology of superbright power LEDs.

Microcontroller Design Printed Circuit Board Design

* Placed each component as close as possible to each other as this will reduce the looping and tracks and hence the parasitic and capacitive inductance will be reduced. Each loop or track will radiate and absorb energy once it is exposed to a variation of current, voltage or electromagnetic flux.

* Place the crystal or ceramic oscillator as close possible to the microcontroller. The tracks used to connect the resonator to the clocks should be as short and close as possible.

* As far as possible, do not use any socket between the MCU and the PCB. Use of socket introduces parasitic inductance and capacitance to the circuit.

* Use a 0.1uF ceramic capacitor across the power supply(VCC-Ground) of each integrated circuit as a high frequency decoupling device. The capacitor should be placed as close as possible to the integrated circuit.

* IO ports of MCU that are not used should be tied to Ground or connected to VCC through a high impedance resistor (100-200 kohm). This is to reduce the effect of voltage spike to the unused port that may cause wrong logic to be read by the MCU.

* Separate the grounding of digital and analog tracks.

* It is good to put a large ground underneath the MCU to create a stable tank to divert the noise to the ground.

* In critical application, use a reset IC that will reset the circuit once the power supply drops below a certain level.

* The power supply to the system should be stable by using large filtering capacitors and bypass ceramic capacitors and ensuring that the ripple is minimal(less than 100mV).

Microcontroller Design Software Consideration

* As far as possible, try to reconfigure the ports configuration, timer configuration and other registers regularly in the software loop. In a noisy environment, the setting of the registers may be flipped and changed from input to output and vice versa.

* Place a certain value in the RAM of the MCU and check for its integrity regularly. If the values changed, it means that the noise have altered the values and the integrity of the rest of the RAM is questionable. You may make a decision to reset the RAM to a predetermine value.

* Use a MCU with a hardware reset watchdog feature. A timer routine is placed in a certain part of the software where it will be refresh at a certain time. If this is not updated, it means that the program has runaway and a hardware reset should be triggered.

* Unused memory should be filled with "1111...." or "0000...."

* Unused program memory should be filled NOP(No operation) instruction codes. This is to ensure that if the program counter of the MCU is corrupted and jumped to these areas of the program memory, it will not end in endless loop.

Microcontroller Design Tips In EMC

Introduction To Microcontroller Design Tips

As the electronic components continue to shrink in size with the advancement of semiconductor
and packaging technology, the ability of these smaller MCU to withstand the effect of electromagnetic interference is less compared to its bigger size counterparts. Hence the importance of designing electronic devices that can withstand a certain level of immunity in noisy environment has to be considered at the start of a design.

The cycle of a product development using microcontroller design starts at specifications definition, to circuit design, components selection, printed circuit board design, making prototype, reliability and EMC testing, market testing and finally product launch. The cost of EMC consideration and solutions are lowest at design stage and will escalate exponentially when products have been launched to the market. If a device failed due to electromagnetic interference in the market, it will have to be solved on site by using more expensive solutions for instance standalone filters, shieldings etc or even recall from the market if it is a major defect. Hence it is of extreme importance that the EMC design is taken into consideration at the design stage. The followings are some tips that one may consider when designing any electronics device.

Microcontroller Design Component Selection

As far as possible, the components used should be leadless type instead of leaded type as the leaded type have more parasitic and capacitive effect at high frequencies. Surface mount resistors, capacitors, inductors, and other SMT components are preferred. MCU selection is done based on the assurance and specifications from the manufacturer that the EMC aspects are taken into consideration in the design of the device. For instance, build in clamping diodes at the inputs of the ports to reduce the effect of electrostatic discharge on the ports.

Electronic Time Clock


This application note from Microchip Technology
uses an 18 pin PIC16C54 microcontroller as its core in the display and settings of a simple 4 digits electronic clock. The four 7 segment displays are connected in a multiplexing method and each segment is sequentially by controlling the Common Cathode of each 7 segment.

The common cathodes are connected to 4 pins of PORTA of the microcontroller. When the pin in PORTA is LOW, the transistor connected to it will turn ON and that particular 7 segment is turn ON. PortB will activate the segments of that particular 7 segment that has been chosen. By multiplexing the selection of the 7 segment sequentially, an equal brightness of all the 7 segments display will be achieved.

Multiplexing has the advantage in that it helps to reduce the number of ports needed to connect to the 7 segments. It also keep the cost of a device low as fewer parts are needed. The setback is that the display may not be as bright as if it is driven directly without multiplexing.

The 3 switches are also connected to PORTB. They are pulled down to logic "0" by using a 10k ohm resistors. Inputs of the switches are detected as logic "1" by the MCU by connecting a pull up resistor to the VDD. Pressing SW1 changes the seconds setting, SW2 the minutes setting and SW3 the hour setting. The full schematic and source code listing can be obtained from Microchip website.

hardware of pic microcontroller

PIC Microcontroller Circuit Hardware Description

There are two I/O ports in the 16C54 - one 8 bit & the other 4 bit. The 8 bit port, Port B, is connected to the 7 segment display. Three pins of the 4 bit Port A are used. The other pin is tied high. Pin 4 of the PIC is also tied high to give a power-on reset.

A 150 ohm resistor acts as a current limiting resistor for each display. PIC ports have a maximum sourcing current of 40mA. The maximum current for the LED display is 200mA so it is the PIC that R1 and R2 is protecting, not the display.

The PIC uses its internal RC clock oscillator option (with the 10K resistor, R3, and the 330pF capacitor, C2) and runs at about 330kHz. The switch is connected to input RA0. Normally this line is pulled high via R4 to +5V, but when the switch is closed the input is pulled low. The software detects the falling edge as a dice roll.

Software Description

When power is first applied, the PIC does a power-on reset. It goes to Start. The first task is to initialize the various internal options such as the direction of the I/O ports and the status of any outputs (high or low.) The watchdog timer
is switched on and the initial value of some RAM locations are set.

The dice now settles down in the main program loop, Main. It continuously loops about 4000 times a second to see if the switch has been pressed, flash the decimal point, generate the next random number and reset the watchdog timer. Then when a Roll (switch press) is detected, the program jumps through to Main02. The two dice are rolled and displayed sequentially in Output. Note how the second random number is generated by the length of time the roll switch is depressed. Display outputs the random numbers to the 7 segment LED displays by multiplexing to them. At the end of Output the program returns to Main.

Various subroutines - Display, Delay, Roll, Flash, Random and two look-up tables for the display, Look_Up_Seg and Look_Up_Digit are listed in the final part of the program. Note the Rand01 code segment in Random and why it is there.

If there is no keypress for 50 flashes then the PIC goes into sleep mode at the end of the Flash subroutine. The oscillator is turned off and ports A & B are configured as inputs.

Now with the PIC in sleep mode the watchdog timer is not being reset anymore. It was not turned off when the PIC went to sleep. It now times out about every 1.3 seconds to check if the key is being pressed. If no keypress is found then it goes back to sleep. But if it is then the PIC wakesup, resets the ports, starts to flash the decimal point and it is ready to roll again on the next keypress.

Electronic Dice Using PIC Microcontroller Circuit


Introduction To PIC Microcontroller Circuit

This PIC Microcontroller Circuit is a good project for those who have yet to have any practical hands-on of using a microcontroller in their electronic project. Once you are familiar with how a microcontroller works, you will be able to do any project using any brand of microcontroller. The price of microcontroller has dropped significantly as the demand for its use increases day by day. They are used in computers, home appliances, mobile phone, control circuitry...... In other words, the use of microcontroller will become more common in our daily lives.

In this project, we want to generate two random numbers between 1 and 6 everytime the Roll switch is pressed and to display the numbers on the 7 segment LED displays for a few seconds. Then we want to be able to press Roll again and get another pair of numbers.

If the Roll is not pressed for about a minute then we want to reduce the power consumption of the circuit. This is done by using the sleep mode available in the PIC IC to save power and hence a longer battery life. Pressing the switch for about a second should wake the PIC from sleep mode and be ready to roll the 2 dice again. A slide switch is built into the circuit so that the unit can be turned completely off when it is not in use. The PIC Microcontroller Circuit diagram is as shown below.

Using Reset IC in Microcontroller Application Circuit



Reset IC in Microcontroller Application Circuitry

In the design of microcontroller based electronics project, the use of Reset IC is critical for highly critical applications
that need to ensure that the MCU will only operate at its optimum voltage. Without the use of reset circuitry, the MCU may go into a tristate of which it may go into abnormal operation.

One example of the use of the Reset IC is that when the input voltage drops below a fixed threshold, the reset IC will asserts a reset signal for a fixed period of time after Vcc rises above the fixed threshold value. An example of how a reset circuit is connected is as shown below.




Using Reset IC in Microcontroller Application Circuit


Reset IC in Microcontroller Application Circuitry

In the design of microcontroller based electronics
project, the use of Reset IC is critical for highly critical applications
that need to ensure that the MCU will only operate at its optimum voltage. Without the use of reset circuitry, the MCU may go into a tristate of which it may go into abnormal operation.

One example of the use of the Reset IC is that when the input voltage drops below a fixed threshold, the reset IC will asserts a reset signal for a fixed period of time after Vcc rises above the fixed threshold value. An example of how a reset circuit is connected is as shown below.







During power up, once Vcc exceeds the reset threshold, the reset line will be kept low for a period after which the line will be pulled high. This resets the MCU afterwhich it will go into normal operation.

If the Vcc drops below the reset threshold, the reset pin will go low. It will stay low for at least the reset time out period and go back to high again. This operation will ensure that the MCU power supply is monitored and will only go into operation when the Vcc is within the range of its operation. The threshold voltage of the IC is chosen based on the minimum Vcc of the MCU. MCU supply can range from 1.8V to 5.0V and a suitable IC can be chosen to monitor the supply voltage to the MCU. A typical range of RESET IC from ST is as shown below.

Microcontroller Programming Keypad Decoding Techniques


In the design of electronics project, it is very common to use a keypad matrix as a means for user to interface
to the product. In order to minimize the number of pins used in the microcontroller, the keys should be arranged in as square a matrix as possible. One example is the use of 4 X 4 matrix arrangement in a 16 keys keypad. This arrangement require only 8 pins. If it is arrange in a 2 X 8 matrix, 10 pins will be needed instead of 8.

The microcontroller programming keypad decoding method is as shown in the figure above. There are 4 inputs pins designated as row 1 to row 4 and 4 output pins designated as column 1 to column 4. The 4 input ports need to have a pulldowns resistor to ensure that they are always at a deterministic state either login "0" or login "1". This is achieved by having an internal pulldown resistor in the MCU itself or by having 4 external resisors connected to each of the input pin and ground.

At the start of the scanning, column 1 will be turned ON(login "1") and column 2, 3, and 4 turn OFF (logic "0"). When this happen, the input ports row 1 to row 4 are scanned for its status. If key 7 is pressed, the pin PA2 at row 3 will return as logic "1" and the rest of the rows will return logic "0". By having a debouncing routine as a means of confirmation that the particular key has been pressed, the MCU will know which key is pressed and thus is able to proceed to determine the next action to take.

Low Power Consumption Consideration

In the design of key interface, it is also important to choose a MCU that is able to go into power down mode after a certain time has elapsed. This will ensure that the batteries that are used to power up the MCU will last longer. It will only wake up when a key is pressed. Power down mode typically takes a fraction of current compared to when it is in active mode.

The PDF article below is an example of Motorola MC68HC705J1A Keypad decoding techniques that can be studied and used for any other MCU. The flow chart
and examples of the assembly code are also given.

parts required for light sensitive alarm project


Parts Required

* resistors: 10k, 47k, 1M ×3
* presets: 100k, 1M
* capacitors: 0.01µF, 0.1µF, 10µF 25V radial
* transistor: BC108 (or equivalent)
* 7555 low-power timer IC
* 8-pin DIL socket for IC
* LDR (light-dependant resistor) type ORP12
* bleeper 9-12V
* on/off switch
* battery clip for 9V PP3
* stripboard 12 rows × 25 holes

Light-sensitive Alarm Project

The circuit detects a sudden shadow falling on the light-sensor and sounds the bleeper when this happens. The circuit will not respond to gradual changes in brightness to avoid false alarms. The bleeper sounds for only a short time to prevent the battery running flat. Normal lighting can be used, but the circuit will work best if a beam of light is arranged to fall on the light-sensor. Breaking this beam will then cause the bleeper to sound. The light sensor is an LDR (light-dependant resistor), this has a low resistance in bright light and a high resistance in dim light.

* The light-sensitivity of the circuit can be adjusted by varying the 100k preset.
* The length of bleep can be varied from 0.5 to 10 seconds using the 1M preset.

Using the 7555 low-power timer ensures that the circuit draws very little current (about 0.5mA) except for the short times when the bleeper is sounding (this uses about 7mA). If the circuit is switched on continuously an alkaline PP3 9V battery should last about a month, but for longer life (about 6 months) you can use a pack of 6 AA alkaline batteries.

block diagram Model Railway Level Crossing Lights




PCB component layout

The reed switches can be held in place between the rails with a small piece of blu tac.
Each locomotive will need a miniature magnet glued to its underside, test first with blu tac, then use superglue.

Model Railway Level Crossing Lights

A magnet under the train operates reed switches positioned on the track. The trigger reed switch starts the sequence by switching on the amber light, a few seconds later the two red lights start to flash. When the train has passed the level crossing it operates the cancel reed switch which switches off the lights until the next train arrives.

There is a PCB pattern for this project, but if you don't have facilities to make PCBs you can build this project on stripboard instead.

Parts Required
Level crossing lights

* resistors: 680 ×3, 1k ×3, 33k, 47k, 82k, 270k
* capacitors: 0.1µF ×3, 10µF radial ×2
* red LED (3mm best) ×2
* amber* (or yellow) LED (3mm best)
* some amber LEDs are too orange to look correct, yellow may be better
* 555 timer IC ×3
* 8-pin DIL socket for IC ×3
* on/off switch
* battery clip
* reed switch ×2
* miniature magnet - each locomotive needs one
* printed circuit board (PCB)

block diagram of valentine heart project



Stripboard Layout

Building the Circuit

1. Begin by soldering the components onto the stripboard as shown in the diagram above. Do not insert the 4060B IC at this stage.

Arranging the LEDs:

2. Cut out a suitable shape from stiff card (or similar material), such as the Valentine Heart template. Paint or colour the card at this stage if necessary.
3. Plan the layout of the 18 LEDs (suggested positions are marked on the template).
4. Drill 5mm holes for the LEDs - put the card on a piece of scrap wood to do this without damaging the card or the table.
5. Push LEDs into the holes, they should be a fairly tight fit and glue should not be necessary.
6. Label the LEDs D1 - D18 at random on the back of the card.

Wiring of the LEDs:

Use stranded wire for all the connections to the LEDs and solder all wires near to the LED body so the leads can be trimmed short later on.

The wire colours are suggested to avoid confusion but you can use other colours if you wish, the electricity won't mind! For example you could use red and black as suggested but substitute yellow and white for the blue and green suggested.

Valentine Heart Project

This project flashes 18 LEDs at three different rates and you can use these to create an eye-catching Valentine Heart. The circuit is kept simple (and low cost) by using the 4060B IC which is a counter and oscillator (clock) in one package. The circuit requires a 9V supply, such as a PP3 battery. It will not work with lower voltages and a higher voltage will destroy the LEDs.

The preset variable resistor can be used to adjust the oscillator frequency and this determines the flash rate of the LEDs. The IC limits the current to and from its outputs so the LEDs can be safely connected without resistors in series to limit the current. The stripboard part of the circuit is easy to build but the wiring for the LEDs needs care so detailed instructions are provided below.

Parts Required

* resistors: 10k, 470k
* preset: 47k (this could be 100k if necessary)
* capacitor: 0.1µF
* 4060B IC
* 16-pin DIL socket for IC
* LEDs × 18, 5mm diameter, red (or any mix of red, orange, yellow and green)
* on/off switch
* battery clip for 9V PP3
* stripboard 13 rows × 18 holes

robo project

Intelligent spy robo project has been desighed for the spying purpose .it is radio controlled and can be operated at a radial distance of 50 yards. Many time our army jawan need to venture into the enemy area just to track their activities. Which is often a very risky job, it may cost precious life. Such dangerous job could be done using small spy robo all the developed and advance nations are in the process of making combat robo design, a robo who can fight against enemy. Our robo us just a step towards similar activity.
This robo is radio operated , self powered , and has all the controls like a normal car. A laser gun has been installed on it so that it can fire on enemy remotely when required, this is not possible until a wireless camera is installed. Wireless camera will send real time video and audio signals which could be seen on a remote monitor and action can be taken accordingly. Being in size small, will not be tracked by enemy on his radar. It can silently enter into enemy canopy or tent and send us all the information through its’ tiny camera eyes. It can also be used for suicide attack, if required.It has all the control like normal car, self powered through rechargable battery ,stops instantly when stop applied , moving in both the direction turning left and right speed control through pwm.Laser gun for firing purpose wireless camera is installed, sends contineusly audio and video can be monitored on any tv. remotely controlled by looking at remote tv through radio remote control .forward and reverse bumpers are provided,.robo stops instantly in case of bump.saving battery power.

Thursday, July 2, 2009

concern and results of robot final year project

Upon the first few simulations and tests, we noticed a significant problem. Mechanically, the structure was shaky and rattled a little bit when the gears turned. This was because we did not fit the acrylic with a ball bearing because the price of ball bearings on McMaster for the size we needed were a bit too high. So, we simply drilled a hole and put an axle through. The reason the wheels were a bit shaky was a result of the rod being slightly smaller than the hole, which causes angling of the axle and added resistance to the torque motion of the wheel.


While we used it to remedy an issue before, another possible problem was the front wheel. The front wheel was cut out of acrylic using the laser cutter. This implies that the wheel is actually not symmetric. When cutting, the laser is pointing straight down and melting through, but the residual acrylic will actually collect towards the bottom while it is still in the machine. This causes for a slight unevenness which results in different resistances when turning in different directions.


A third concern is regarding the precision of the gears and the external environment. Ideally, the gear would act as a perfect wheel with a nice traction so that it would turn a perfect amount every time. Unfortunately, not only is the gear non-ideal, the environment is as well, which causes the gears to “slip-n-slide” occasionally when turning. There were also times when only one gear would drive the car while the other gear was driving in place. Problems such as this one probably could have been resolved with a better wheel system.


The robot often takes very long to execute all the drawing instructions in part because we set motor speed to low on purpose for stability in mechanical parts. This had made this project impossible to demo full execution of 5 color drawing.

Future Improvement

Result and Concerns

Feedback System:

A proper feedback system would have improved the accuracy of our machine. The idea behind a feedback system would be to gather input from the external environment and tell the car what to do next based on this reading. Since our car did not always go perfectly straight, there was a good chance that after every line increment, the car would slowly begin to deviate from the path and these errors would sum up as the program ran for longer. A feedback system would have prevented, or at the very least, alleviated such things since the car would then have an idea of how to correct itself as it was printing instructions.


Wireless Transmission:

As a result of the bulky serial port cable, the car was occasionally dragged to cause some sliding when turning. It would be best if we could eliminate any wires or cables that could have been transmitted through air instead of a physical cable, but we had enough trouble attempting the optical mouse feedback which resulted in a time crunch. Otherwise, this would have been a good idea and might have fixed a few errors regarding cables from before.


Movement System:

We are currently relying on two stepper motors. However there are implementation that allows very flexible and a system with large freedom of movement by using balls and drivers. By using 3 balls that are 60 degrees, we can have any kind of motion using vector calculation of three different motion.


Multiple pen:

Instead of using one pen if we had 5 pens, we are guaranteed to have 5 parallel lines. This would minimize number of turns the robot have to make but this design is not a solution but mere improvement to the performance.


A More Robust Hardware Design:

Due to the fact that the car wobbled a bit, possibly causing deviation from the real path, it would make more sense to make the hardware such that it was more stable when traveling. This could be done by using actual wheels instead of gears, refining the third wheel, sockets for all loose parts such as the MCU, the battery, and the breadboard. Most importantly, ball bearings in place of a hole would probably have reduced the wobbling quite a bit when shaking it.


Flexible Software:

Current design of software DOES NOT only any circular drawing or arc-like drawing. For more practical purpose, we should start considering more flexible movement and no more dot matrix printing.

software

Picture Processing & Instruction Generation

When a user loads a picture, our software samples 64x64 linearly spaced points. Unlike an inkjet printer, we cannot control the nozzle on the ink, but instead we are using pen or a pencil. Since we cannot express the coloring, we have crudely estimated RGB to 0 for values lower than 64, 255 for values greater than 192, and 128 for values in between. After sampling, software begins to generate series of the instruction. Before explaining generation of the instruction, we need to discuss limitations of the hardware.


First the precision is a large drawback of our design. For couple of weeks, we tried utilizing the optical mouse as a feedback system. But as due date for the project comes near, we could not open PS/2 communication between optical mouse and MCU; however we have strong sense of what to do.


Precision without a feedback system is very delicate. Although this concern is mentioned in the hardware part, we had implemented two independent wheel operations for movement and one dummy wheel to support the structure. We had reached this conclusion in part because of budget, which limited our purchase of motors, and we wanted a rapid 90 degrees turn rather than a gradual turn. If we were to draw two parallel lines separated by 0.1 inches we need to turn 90 degrees at the end of the first line, move 0.1 inches, and then turn another 90 degrees to start the second line. In order to execute these series of rotation, we rapid turn is more precise than gradual turn.


This delicacy of the hardware made it virtually impossible to make intricate instructions to draw arcs, circles, or a flexible image. Instead we decided to do straight lines approach. In the movie “I, Robot,” there is a scene when a robot sketches its dream and the sketch was drawn using only horizontal lines.


Writing an Instruction Making method was not too hard after all. A general idea is if there is color on consecutive horizontal data points, it will draw a line and if there is no color, then it will just move. When the robot reaches end of the sample (index of either 0 or 63), then it will have series of rotation instructions described above.


GUI

In order to achieve good user interface, we had developed a simple GUI using GUIDE function of the Matlab. A great advantage of using GUI is it is an event-triggered interface. Event-triggered nature of GUI is very useful while Matlab is sending instructions to the MCU.


When the Matlab side of the program is transmitting instructions, it is in a while loop for instruction transmission and transmission validation. Also there is a case when robot’s memory is full (will be discussed below in MCU) when robot cannot take further instruction and Matlab has to wait in a while loop to check status of the robot. In either case, the transmission of the data defers any user intervention.


However like Lab 3, Security System, concurrency is a priority in this system. For instance, even if robot is behaving oddly, a user should be able to easily stop immediately. Also robot must be able to start at any instance when user sends a correct command.


If the User Interface was written in a simple function, above blocking loop may have made the concurrency impossible. But we made our own command window, which is based on callback.


Extra: Instead of user setting COM Port manually, our GUI detects usable port and fills in the box below. However there are times when serial port is locked or need special setting and in that case, the GUI asks user to manually type the name of the port and makes a connection.


MCU

MCU code was written as generic as possible so it can be used for any hardware setting

There are two main softwares: one is Matlab and another in MCU. The software on Matlab part provides a GUI to a user that allows the user to select a picture and execute the robot to draw crude version of the picture. Matlab and MCU communicate using RS232 serial port.

Matlab GUI


Made on a Mac

void motor(char dir, char motorSel);

Motor function is the most generic function possible. It has a stepper motor driving function whose direction is determined by variable dir. This function is capable of controlling two motors independently using variable motorSel. Also if you examine the code carefully, you can find out that each motor can rotate different number of times.


void rotate(void);

This function consists of series of motor controls. In order to rotate, we first make right motor and left motor move in a different direction. That way, the robots turns and we purposely make it direct slightly to the left. Then robot moves backwards (since we have 64 samples) more than 64 sample distance. It will draw large triangle with very small angle. Then again move right motor and left motor move in a different direction but in an opposite direction than how we rotated in the beginning. In that case, the robot will now face straight again.


Currently the MCU has a role of communication and motor control. Due to the nature of the project, we are not concerned with timing or accuracy of ADC data or anything like that. All the accuracy and timing concern is more of an hardware problem

hardware

An easiest way to build a robot is to use an already built RC car. It is sturdy and reasonably accurate in motion. However with budget of $75, we could not purchase a RC car. Instead, we decide to build a robot from the scratch to meet our requirements.


Requirements

•Accuracy

•Must be able to turn in place (or at least 90° turn)

•Hold pen and must be able to lift it up fast

•$75 budget


We have used Rapid-Proto-Typing to make bodies and basic structures easily. After simply designing parts with Solidworks, we can use laser cutting on acrylics to produce reasonably accurate parts. Also the Rapid-Proto-Typing was very favorable since we do not have any machining experience and mechanical professor had let us use the machine without any cost.


Our largest concern was the motor implementation. DC motors are very easy to use but it is very inadequate for system that requires accuracy. In terms of accuracy, the servomotors are very favorable, however, the cheapest servomotor cost about $15 and it takes significant part of the budget. Instead of servomotors, we had chosen a stepper motor, which is accurate enough for our use and it was very cheap (we had scavenged it from previous project).


How can we rotate a body by 90° with minimum number of motors (since number of motor is limited by budget)? This is a question that we had struggled to find an answer. The rotation motion is crucial since any error can lead to a larger error after long run of drawing. Robot can be indifferent of its sensitivity to error if there is a feedback system. Originally we had decided to use optical mouse sensor as a feedback system but we had failed to decode PS/2 communication initialization of the optical mouse sensor. The most sensible answer to the question is using two stepper motors to rotate in different directions.


While scavenging previous projects, we had found very interesting part, a solenoid (191172-001). Current induced through the solenoid pushes the pin of the solenoid while pin becomes loose without any current. Using these characteristics, we built a simple lever system that goes up when pin is pushing.

robot plotter




Deciding a direction of the final project in ECE 4760 can be very difficult. With small Micro Controller Unit, we can build anything and everything. We felt compelled to find something very creative and ingenious and had looked around our surrounding and have found something interesting, printer.

There is a conventional printer that moves paper to move and ink that moves across the printer. Also there has been project that prints using motors and two string, XY plotter. But, what if a robot moving around on a paper on your desk and start to draw a picture? This was to create a robot from a scratch and be able to draw a crude image of any picture.

conclusions

Analysis

Our prototype traction control system demonstrates how a high speed microcontroller can be used to accurately control a varying and possibly unstable system. Our controller effectively throttled wheel speed when a slip was detected as well as actively controlled wheel rotation to maintain the desired speed. Although our results demonstrated the functioning of our code, we originally hoped for a faster response ideally being able to correct wheel slip within one rotation. The slow response was mainly caused by adjusting the PWM pulses by 1% each time a measurement was recorded. We sacrificed a fast responding system for a more stable one. This is always a careful balance to choose for many engineering problems. The addition of higher accuracy encoders as well as implementing a more sophisticated control algorithm would help us achieve more desirable results. Due to our implementation of a four wheel, independent drive system, our project would require some significant overhead to be integrated with other commercial vehicle stability systems such as ABS (anti-lock breaking system) and ESC (electronic stability control) systems. This again was a trade-off as integrating with the various automotive communication standards and devices would in itself be a substantial design project.

Standards and Intellectual Property

Our project did not require the use of any public or private domain software or any proprietary hardware. Although our specific implementation of a traction control system itself would not be sufficient for a patent, it does serve as a strong baseline for further development on traction control. Traction control itself is a fairly new technology and is just now becoming main-stream in consumer automobiles. There is certainly substantial opportunity for improvement to the current algorithms and systems used today, especially if the focus is moved to include performance (most traction control systems are for safety only and can negatively affect performance).

Ethics

During the design of our traction control system we had to keep in mind the use of such systems and the ethical responsibilities of design. Most traction control systems are used on consumer motor vehicles as a safety system. Our system, as well as commercial grade systems, has the ability to over-ride driver control. A malfunction of this system could significantly compromise the safety of the passengers as well as others on the road. Even if the system was not used on a passenger vehicle, it is still partially or wholly responsible for the movement of a potentially dangerous object. Therefore during our design we constantly had to keep safety in mind and try to design such that failures are minimized and will not result in an out of control vehicle. This was reflected in our decision to keep the less aggressive method of throttling up wheel speed and using small accepted margins of error. This means that our model car’s acceleration was significantly less than the motors where capable of doing, but the slower accelerating vehicle would have better slip protection favoring safety over performance.

results



In general, the end result of our traction control was a success. The vehicle was able to ramp up its velocity uniformly without any major slipping. When the vehicle reached its desired speed, the wheels maintained their velocity and generally stayed in balance with each other. In order to test that out system was working, we performed two tests. First, we placed tightly fitting rubber bands around the outside rims of the left two wheels and kept the plastic wheels on the right side unmodified. We then started up the vehicle in the hallway on hard tile flooring. As the car started up, the velocity of each wheel was maintained a constant rate and the car moved in a relatively straight path for about 2 meters.

The results of the start-up can be seen in the plot below. When the car first starts, wheel number 4, shown in turquoise, is established as the fastest wheel and wheel number 3, shown in red is the slowest wheel. Almost immediately, wheel 4 jumps up to 14 rpm and is promptly slowed to run at the same speed as the other wheels. The wheels continue to pick up speed, until they reach a programmed desired speed. It is held at this speed for a few seconds. Looking at the region between 3 and 7 seconds, wheel number 2 naturally tries to run at a speed faster than desired. This is recognized by the microcontroller and the PWM is adjusted to make the wheel run slower. The reverse is true for wheel 3 and the microcontroller sends more power to the motor to account for this.

The second test involved pushing down on a single wheel and slowing it down to a very low velocity. The system would pass this test if the other wheels recognized that they were rotating too quickly and slowed down appropriately. The results of this test are also shown in the graph below. At about 7 seconds, the second wheel is held down and its velocity drops to about 6 rpm. The response of the other wheels 1 and 3 is pretty fast and responds to the velocity change within a couple of measurement cycles. Wheel 4 was the slowest to respond to the change, taking less than 1 second. Although there is a fast response time to the velocity change, the time it takes to actually slow the other wheels to the slowest level takes a very long time. As shown in the graph, it takes well above 2 seconds for the other wheels to drop down to 10 rpm.

The results of our second traction control test are shown above. At about 1 second, the 4th wheel is held down and it slows to 20 rpm. The other wheels respond in about the same manner as the first test. Overall, we can see that it takes around 3 seconds to the wheels to completely adjust to a large change in velocity. Then, at 12 seconds the wheel is released. Since wheel 4 naturally ran the fastest of all the wheels, there was a large acceleration. The system tries to respond to the situation, but it takes over 8 seconds just for the wheels to recover about ¾ of the velocity difference. This was a worst case scenario for our traction control system.

Servo Motors



To rotate the wheels of our vehicle, we used four continuous rotation servo motors. They run on a maximum of 6 volts DC and rotate a full 0 to 180 degrees. An image of the motor is shown below. To attach the rotary encoder, we modified each motor by removing the back plate and attaching a metal rod to the back side of the rotating gear. We then used flexible clear plastic tubing to form a connection between the metal rod and the rotary encoder. A picture of the modification is shown below.

The Atmel Mega644 was used to control and monitor the acceleration and velocity of our vehicle. The major features of the Mega644 that were used for our project included one 8-bit timer, 4 PWM output pins, one Analog to Digital converter, and four standard I/O pins. The Mega644 chip was built on a prototype board provided by Bruce Land. It features an easy way to power, attach a crystal clock, connect to a RS232 interface, and program the Atmel chip. A schematic of the board can be found here.

We chose to attach the optional interface for serial communication because it provided critical debugging features and we had extra money to budget.

Rotary Encoder

The rotary encoders are used to resolve wheel velocity and acceleration. The encoders output a two bit binary quadrature signal, meaning they output two pulse width signals that are 90 degrees out of phase. The pulses are generated by opening and closing switches to a common ground. Therefore, in order to generate a readable signal from the encoders, we used pull-up resistors on the signal lines. Also, since the two phases were not sufficiently accurate relative to eachother, we only use 1 signal from each encoder. This cuts the number of pulses per rotation in half, but gives us a more consistent signal for accurate timing.

The specific encoders we used had 16 pulses per rotation. This means that there were four periods per rotation. The repetition would be insufficient for us to determine the position of the wheel (it is ambiguous which quadrant the wheel is in) but satisfactory for determining velocity. An example signal and rotary position is shown below. Velocity is determined by timing the difference between the rising and falling edges. Similarly, acceleration can be determined by calculating the difference in velocity between two adjacent pulses. Note the acceleration between the orange phase and green phase.

Hardware Design



The hardware was designed to create a robotic car with four individually controlled servo motors using PWM signals and H-bridge circuits. The rotation of each motor was measured with a 2-bit (gray code) rotary encoder. Additionally, the acceleration of the vehicle was measured with a z-axis 1.5g acceleration sensor. A basic schematic of the hardware setup is shown below.

H-Bridge Motor Driver

The H-Bridge circuit allows the microcontroller to run a two-terminal motor without any large noise spikes feeding back into the microcontroller circuitry. When the motor is switched on and off, there is a large change in voltage in a short period of time. Since the motor can be modeled as an inductor, the big change in voltage will cause a huge spike in current, which can destroy the input terminal of the microcontroller. This is prevented by wiring diodes across four MOSFET in the configuration shown below to stop current from flowing when the MOSFET is turned off. These devices have similar properties of a switch because they can limit or amplify the flow of current depending on the voltage across the gate to body terminals.

The H-Bridge came in a 8-pin SOP package with inputs for Vcc, ground, forward pulse width modulation (PWM), and reverse PWM. There were two outputs to wire across the terminals of the motor. Since there were two separate inputs for forward and reverse PWM signals, our design was utilized only the forward PWM signal to control how the vehicle moved in the forward direction.

Deciding torque adjustments


The main purpose of a traction control system is to maintain wheel grip. In order to do this we must detect when a wheel is moving faster than the car. We use two references to control the duty cycle of the PWMs sent to the wheels. First, the car has a desired speed. In order to make calculations as simple as possible we refer everything to the inverse of velocity, which once distance is normalized out, are simply our timed pulse widths. Our desired speed is therefore recorded as a pulse width and all wheels accelerate or decelerate in order to stay within a defined margin of the desired speed. If a wheel is moving significantly slower than the desired speed, then we ensure that no wheel is moving faster than a different pre-defined margin of this slowest wheel. This process allows the car to quickly reach its desired speed without slipping.

Below is a timing diagram for our PWM signal. We programmed the TCNT1 and TCNT2 registers to count from 0 to 256. When we wanted to increase the speed of the wheel and thus the increase the duty cycle on the PWM signal, we would increment the OCRnx register by a fixed value. This was true for the inverse. When we decremented the OCRnx register, the duty cycle of the PWM would decrease. Also note that the frequency of the pulses is identical no matter the duty cycle. We used a frequency of about 31 kHz to optimize the H-bridge functionality.

Software Design

The software can be broken up into three major sections, timers, PWM signal edge detection, and wheel torque adjustments. In combination these parts are able to accurately read each wheel’s velocity and acceleration and allocate the proper amount of torque to reach and maintain a desired speed while improving traction by reducing wheel slip.

Interrupts and Timers

Due to the relatively slow servo motor maximum speed, encoder signal noise, and difficulties with edge triggered interrupts, we decided it would be sufficient to poll the rotary encoders. Therefore we maintained a counter for each wheel that was incremented in our interrupt every 0.2ms. Placing the counters in the interrupt ensures that the few hundred to roughly two thousands increments were done consistently, and any timing accuracy lost was only during the processing of these counts. For example, during our testing we underestimated the length of time to send data to Hyper Term. Before placing the counters in the interrupt we saw a very large margin of error with our elapsed time measurements as the hyperterm task influenced each increment. After moving the counters to the interrupt we only had one delay per encoder phase instead of a delay for each additional timer increment. This gave much more consistent speed measurements (although we decided to remove Hyper Term functionality all together for the final car).

Detecting Encoder Edges and Recording Data

Due to budget constraints we were forced to use the less expensive and reliably mechanical type encoder instead of the more advanced optical encoders. During our debugging process we noticed that the edges during phase transitions were very inconsistent as the switches would make and break a connection multiple times at each transition. This variability would often continue for around 1ms (see diagram).

layout


Finally, we identified a tradeoff with our threshold settings. The more we allowed wheel velocity to vary, the faster the wheels would reach the target speed. This is truly a tradeoff as both results are desired. We simultaneously want fast response as well as matched wheel speeds. Of course the solution to this problem is to implement a sophisticated algorithm and feedback control. Unfortunately we did not have the time, nor the expertise required to properly characterize the system and develop the stable and efficient algorithms needed to fully utilize the system and perfect the design.

Standards

Our project was not required to follow any standards when it is under operation. It consists of a self contained system that does not transmit or receive any external data. Additionally, our robotic vehicle obeyed all speed limits and local traffic laws. When programming and debugging our software, we followed the RS-232 standards for serial data.

Existing Patents and Copyrights

The ideas used in our project were considered to be in the public domain and we did not copy any patented designs to accomplish our goals. This project was used for educational and demonstrational purposes only. At the conclusion of our project, we are not considering to pursue any copyrights or patents on our design.

Hardware/Software Tradeoffs

There were many trade-offs that had to be made in our design, many of which we discovered while debugging and testing. One major trade-off was the rotary encoders we used to determine wheel velocity. There are two major classes of encoders, optical and mechanical. Optical encoders offer significantly higher accuracy, can offer much faster maximum rotational speeds and most importantly for this project, must higher pulses per revolution (easily exceeding 128 ppr). The greater the pulses per revolution, the quicker the response, and/or the more accurate the velocity reading. Unfortunately these encoders are priced outside of our budget and we were forced to use a mechanical encoder with 16 pulses per rotation. This means that we would require two full rotations of the wheel to gather as much data as 1/4 revolution of a fairly common optical encoder. The additional information could help the effectiveness of a traction control system on two accounts. First we could detect a slip quicker, apply a duty cycle change, and check the effectiveness of that change in a much shorter time frame and more importantly, a much smaller wheel rotation. Or, if there are inaccuracies in our time readings (as we see with our current encoders) we could average 16 readings in 1/8 revolution with the optical and a maximum of two readings with the mechanical encoder. We can easily see the disadvantage of so few pulses in our prototype as it takes multiple revolutions to reach the desired speed.

We also encountered tradeoffs that had to be made within the design of our software. We started out designing an edge triggered interrupt to accurately detect a phase change on the encoder signal and get an accurate time reading. Since the Mega644 only has one comparator we had to combine the pulses from the four wheels onto 1 signal wire. We found a hardware solution to implement this (by XORing the previously read data points and ORing the XOR’s outputs). But this required us to allow our edge-triggered interrupt to be interrupted. Another difficulty with our edge triggered interrupt was the significant switch bounce seen on the encoders during a phase change. This problem is described in greater detail in the software section. The combination of our re-entrant interrupt and significant bounce noise required us to switch to polling the encoders. This gives us much less accurate timing, but is significantly easier to implement.

High Level Design


An electronic limited slip differential system controls the rotational velocity of the output shafts of a vehicle using speed sensors, anti-lock brakes, and microcontrollers. By electronically monitoring slipping, the microcontroller can activate the anti-lock brakes to slow down the wheel that is moving too quickly. An electronic system has the ability to be adjusted for different applications or conditions, such as on and off-road terrain, slippery weather, or driving at different speeds. This makes it much more attractive than a mechanical system. While the dynamics of modern day traction control systems are very complex, the basic idea motivated our project. The applications for this design are very practical and universal. Any vehicle with two or more wheels will benefit from greater stability and movement control with our traction control system.

The main component of our traction control system is a feedback loop that adjusts the velocity of each individual wheel to the velocity of the slowest wheel on the vehicle. It contains both positive and negative feedback by slowing down the fastest wheel motor and speeding up the slowest. A basic schematic of our system is shown in Figure 1. This block diagram is implemented four times in software for each wheel.

Logical Structure

This is a basic block diagram of our traction control system. The Mega644 microcontroller was used to generate four PWM signals to be sent to the H-Bridges and to read the rotary encoder signals. Electrical connections are shown in blue and mechanical connections are shown in red. Inputs to the microcontroller are labeled as PINxn and outputs are labeled as PORTxn. OCRnx are the PWM output registers that control the motor speed. This diagram is explained in detail in the software and hardware design sections of the report.

traction control system


Introduction

For our ECE 4760 Final project we have developed a traction control system that detects wheel slip and adjusts the velocity of the wheels accordingly.

Robotic vehicles are becoming increasingly complex and often need high levels of movement control. Specifically, when the wheels of a vehicle begin to slip, it is optimal to adjust their speed so that the vehicle moves towards its intended direction. Applications include vehicles traveling over rough terrain, exploratory robots, and remote controlled cars. The purpose of our project is to design and implement a four wheel drive robot that monitors the rotational velocity of each wheel and limits the amount of slip when the vehicle is accelerating.

Electronics Project Design References and Tips

Good Electronics Project Design References and Tips Can Accelerate Your Practical Know-How in Electronics.

Getting good and timely information on the electronics project that you are embarking on sometimes can be time consuming and frustrating. Hence, the objective of this site is to bridge this gap. This site is dedicated to all electronics enthusiasts whether you are a student, a teacher, hobbyist or even an electronics engineer.

The end result of an electronics project is determined by a few factors. It normally starts with the strong enthusiasm in the project chosen, going on to schematic or circuit design, printed circuit board design, software programming if microcontroller is involved and building protoypes.

This site provides schematics and parts lists of various projects that you can experiment yourself. It also include articles on the importance of reliability testing, electromagnetic compatibility (EMC) testing, failure mode effect and Analysis (FMEA), fundamental of electronic parts and test/measurement tools that are needed before you embark on your journey of building your own electronics project.

This Electroncs Project Design site will be updated from time to time with new articles and tips, so remember to check back here occasionally.

If you find this site useful and would like to contribute ideas to be included in this site, you are most welcome to email the author. Your comment on the contents of this Electronics Project Design site is most welcome.

Sunday, June 21, 2009

Liquid crystal display


A liquid crystal display (LCD) is an electronically-modulated optical device shaped into a thin, flat panel made up of any number of color or monochrome pixels filled with liquid crystals and arrayed in front of a light source (backlight) or reflector. It is often used in battery-powered electronic devices because it requires very small amounts of electric power.

A comprehensive classification of the various types and electro-optical modes of LCDs is provided in the article LCD classification.

Inverter

An inverter is an electrical device that converts direct current (DC) to alternating current (AC); the resulting AC can be at any required voltage and frequency with the use of appropriate transformers, switching, and control circuits.

Static inverters have no moving parts and are used in a wide range of applications, from small switching power supplies in computers, to large electric utility high-voltage direct current applications that transport bulk power. Inverters are commonly used to supply AC power from DC sources such as solar panels or batteries.

The electrical inverter is a high-power electronic oscillator. It is so named because early mechanical AC to DC converters were made to work in reverse, and thus were "inverted", to convert DC to AC.

The inverter performs the opposite function of a rectifier.

Australia

Whereas the original bobbers and choppers were mostly home built on a budget, the modern development of the chopper tends to be shop built and very expensive. It differs from what has gone before in the technology employed in frame construction and the use of billet aluminium parts... headlights, foot and hand controls etc. Almost all 'Longbikes' have 'Big Inch' after market or current Harley Davidson motors. Paint work styles tend to favour ghostly air brushing techniques and the Longbikes are almost exclusively solo.

However the home built Bobber, Old School and Classic choppers are enjoying a comeback around the world and in Australia.

In Australia, many choppers built in the seventies are being brought out of 'retirement' and appearing again on our streets. Older bikes from this period; Honda CB750/4's, Yamaha XS 650's and Triumphs 750's and 650's are being purchased and chopped like they were 'back then'. Because of their reliability, modern Japanese and British 'cruisers' are also getting chopped, though this is more difficult because of Australia's restrictive regulations on modern machines. This current crop of home builders is a fairly even mix of guys in their 40's and 50's who built a chopper in the 70's and 80's and young blokes who've been inspired to emulate a unique period of Australian motorcycle history.

In most Australian states, Australian Design Rules limit frame modifications (engineer's certificate required), and fork extension (6"). The most restrictive rule is one that allows a maximum distance of 550mm from the front axle horizontally back to the steering head. Noise restrictions and handlebar dimensions are also regulated. In some states ADR's do not apply to pre 1977 motorcycles, so some of the older more radical choppers are still seen on Australian roads.