Automatic Wing Mirrors

Pranav's prototype wing mirrors

Pranav Chandnani
Mount Roskill Grammar School
Year 13 Electronics
Teacher: Bill Collis

Sharing a family car is often a good idea, but catering to the different preferences of each driver can create some issues – particularly a new driver having to readjust the wing mirrors. This was the issue that Mt Roskill Grammar student Pranav Chandnani chose to solve for his Year 13 Technology project by creating a set of wing mirrors for his father's car that would automatically adjust to the preferences of three people of different sizes.

Issue

Pranav's client was his father, who used the car most and often found he had to readjust his side mirrors while driving after Pranav or his mother had used it. Not only did it take time to get the settings perfect, this could be quiet dangerous if done in heavy morning traffic.

Brief

This issue led to Pranav's brief: to create a wing mirror system that could remember set preferences and automatically return to them easily and quickly when required. As his father often set the mirrors imprecisely when in a hurry, improved accuracy was another important factor that would greatly benefit his client and improve driver safety.

Component 1 – Wing mirrors

Investigating wing mirrors

Pranav first wanted to see if the idea would be feasible, so he consulted an experienced mechanic with some of his initial ideas. The mechanic pointed out that adjustments to his father's existing control unit would require Pranav to hack into the system to control the infrared signals, an exercise that would be difficult, time consuming and costly. This led Pranav to a different approach.

"The mechanic told me that older cars used to communicate in much simpler ways, so I acquired a pair of wing mirrors from a Nissan at Pick-a-Part that had power cables coming out of them. This meant I could possibly control the power supplied to the mirrors using my own microcontroller," Pranav says.

As both mirrors shared a common ground, Pranav needed to find a way to alternate the direction of the voltage so that the left and right mirrors could be separately controlled. A friend suggested using an H bridge circuit as a simple way to alternate current direction but, realising he would have to make four H bridge boards for the up and down movement of both mirrors, Pranav decided to purchase a cheap L293D chip for each mirror that would perform the same function.

The issue of the common ground came up again as each mirror had two separate motors for the vertical and horizontal movement. Pranav's configuration meant that both operated at the same time, so only a diagonal movement could be achieved. Creating a separate ground wire for all the motors would be time consuming so Pranav programmed his microcontroller to turn one of the H bridges on to high impedance state, effectively switching it off when the other circuit was operated.

Pranav now had complete control over each mirror, which he controlled with four switches he added to his microcontroller board. Although his father was impressed by the design he thought that the four switches would be confusing while driving so Pranav decided to order a joystick controller to give a more intuitive and accurate control system.

Investigating wing mirrors

While waiting for the joystick to arrive, Pranav began work on the LCD panel for the device, choosing a 192x64mm screen size so his father could read the panel easily without his glasses. He then created a microcontroller board with the same dimensions as the LCD panel, allowing him to accommodate all of the components into one compact unit behind the display.

So many different components also needed different power supplies, so Pranav used a voltage regulator so that the microcontroller and LCD would not be overloaded by the 12 volt supply needed for the window mirrors.

Once the joystick arrived, Pranav was able to connect this to the main board. He then created a simple menu program that could be scrolled through using the joystick, with its built in push switch serving as the select key.

Component 2 – Automatic Setting

Pranav now had an effective side mirror control system, but still had to solve the key issue of having programmable settings. His research found that there few existing products that performed this function so he began looking into the system used for programmable car seats as a starting point.

The first challenge for Pranav was to create a reliable and accurate input of the mirror's current position. Pranav first trialled an accelerometer, a device that measures the acceleration of the mirror in three dimensions. Although fairly accurate, Pranav soon realised this system would not be practical as it also picked up movement from the car itself.

"This immediately ruled out an accelerometer as the input, as it would be unrealistic to have the car remain steady every time the mirror was moved. The position would also be relative to the force of gravity which would mean that it would give a different input if it were on a slope."

A potentiometer – a device that measured the angle travelled in each direction – was also trialled, but proved too bulky to be incorporated with the wing mirrors.
The last idea Pranav tested was to determine mirror position using the time taken to get to a certain point. The main disadvantage with this idea was that, to be accurate for each profile, the mirrors would have to go to a zero point each time the power was switched off before returning to the profiled position, taking up valuable seconds of driving time.

Pranav discussed this with his father who explained that part of his morning routine was to sit with the motor on for a short period to adjust the radio, seats and other settings in the car before beginning his commute. Therefore if the mirrors took less than ten seconds to get to the zero point while he was completing this routine, it would still be faster than adjusting the mirrors himself.
After several trials timing the mirrors movements, Pranav determined that the maximum time needed was 8.3 seconds and decided to go ahead with the timer and zero position system.

"I then made a program where the mirrors go to the top left when the power is switched on, then the user can move them where they want and the position of the mirrors is shown on the LCD display. I then configured into the program the maximum and minimum values for the position of the mirrors. So by limiting the position variable to a range, I could make sure that all the readings were realistic."

By looking into the 'help' files of his microcontroller, Pranav found he was able store variables of x and y for the mirror movements in its internal EEPROM (permanent memory), which retained the data when the power was turned off. He then created a menu to operate the new functions.

"The user could now move the mirrors to any position they wanted and save the setting by going back to the menu, and choosing a profile," Pranav explains.

Component 3 – RFID recognition system

Pranav's prototype wing mirrors

Pranav's father was impressed by what he had achieved, but he still had one issue: scrolling through the menu to find the right profile still took too long. He wanted to find a quick, easy way to identify the user and their profile. Pranav suggested three options to his father: a fingerprint scanner, an RFID tag swipe system, or three set switches for each profile.
The fingerprint scanner appealed to his father but the memory needed for this would significantly increase costs and was ruled out. The switches option was also eliminated, as it would clutter a device created for ease of use. This left the RFID system, where the user can swipe a card or keychain tag in front of a scanner to immediately go to their saved profile.

Pranav researched the pros and cons of several RFID chips available on the Sparkfun website (www.sparkfun.com) before choosing the ID 12 chip for its tidy internal antenna, 12cm reading range and passive power source that used magnetic fields to draw power from the chip instead of batteries.

Connecting the chip to an already crowded microcontroller wasn't easy, as the chip needed a UART circuit to function and the pins that would provide this were already in use. Pranav got around this by using a software hack that would duplicate the signals of the UART, allowing any pin on the microcontroller to serve as an input for the ID-12 chip.

Pranav's prototype wing mirrors

Once connected, Pranav had to reconfigure his program's settings to accept the chip's input, which used the ASC11 conversion code. He also had issues with the length of the code.

"When the tag was swiped in front of the RFID chip I realised that I was not giving the code enough space on the LCD display, and so it was overlapping and wouldn't compare with the code I had saved. I then saved the pre-configured code as an array and I was finally able to compare the input to the saved codes."
With the third component completed, Pranav's final outcome exceeded all his father's expectations for the project.

"The final program allowed the user to go in the program, enter the automatic settings mode, and swipe the card to select a profile. When my father tried this method, he said he found it much easier than when he had to use a joystick to choose a profile, and said that since the tag was a keychain, there was no way he could forget to take it when he entered the car."

Pranav's successful integration of three complex components into one device not only solved his client's problem butled to a New Zealand Scholarship Award in 2010.

Teacher comment

Several things have to fall into place quickly in the school year to make a complex technology project come together in the limited time available: a student with an inquiring mind, a high-quality client who can guide the project and an issue that provides the right balance in difficulty. Pranav is definitely a talented student and worked hard to meet the demands of his father who required much of Pranav as his technologist. Many students miss the importance of a strong client that will put the right level of demand on them to fully meet the needs of the issue. Early in the year I spend time with students where my goal is that these things come together well; it doesn't always work however in this case it was definitely having a high-quality client that made the big difference to Pranav's success. It was a real pleasure being able to work with Pranav and his father to help both meet their desires for a successful project and a successful academic year.