This site is outdated. A new version is coming soon... [close]

Linear Camera - USB Device

I graduated at University of Sofia, Bulgaria as a major of BEng in Electronics Engineering. This page is dedicated to my graduation project.

The device in action

So for my graduation thesis I wanted to work on designing a device and I wanted to focus on mostly digital stuff (analog design is not for me). So I talked with my professor in Optoelectronics and he gave me a very cool idea for a device that would utilize a Linear Camera and be able to measure the dimensions of the object we put in front of it.
I'll talk more about the project later. Let's start with a video of the finished device in action:

I'd like to give kudos to my project supervisor: Assoc. Prof Todor Djamijkov(Technical University - Sofia) and to all friends that helped me with this project.

USB HID - Experimental Board

So I wanted the device to be able to transfer data using USB. I started reading tons of datasheets and tutorials on the net. Eventually I managed to create my first USB device. It's a simple board with the PIC18F4550 microcontroller. The board which I made at home is my first selfmade PCB - how cool is that :)

Anyhow, the device gets detected from Windows as HID and works fine. I am able to send data to it as well as read information back. I tried the ADC and was able to control it just fine. I used the Microchip USB Bootloader and modified it a bit to work with the free version of C18 compiler. And so the device is able to update/program it's firmware/memory using the PC thought USB. There was a design fault. I used a very big capacitor on the USB power line to ground. The device would make a short circuit for a few milliseconds and becomes unrecognizable by the computer. Unfortunatelly by the time I figured what's happening I broke one of my netbooks usb ports. Other than that I haven't had any major hardware flaws. I then changed it with a 100nF capacitor and everything worked fine.
DSC00227 DSC00228
Related blog post here

The idea of the project

After making the experimental board I connected the TSL202R Linear Array Photodiode sensor. It has 128 photodiodes(pixels) that tells us how much light there is on each one of the pixels. This is very useful as it can be used for example for OCR, measuring the angle of a light source, movement tracking etc. In this project I’m interesting in measuring the dimensions of an object. It’s actually a very simple method. Just take a look at this figure:
sheme1
We have a source of light, an optic system and a sensor. When we put an object in front of the light we get its shadow projected on the sensor. By measuring the size of the shadow we can calculate the size of the object.
Here’s how the sensor looks like and a simple result of its output in my application:

Related blog post here

LCD and PCB Design

The next step of the project was to connect a display and make it able to work on it's own using a battery. Doing it this way is cool as you don't have to have a computer around. You can carry it whereever you go and take measurements.
I looked at several options and all were very expensive for my student budget. I eventually found out that I can use parts of old phones and those are really cheap (atleast there are in some places). Yay! All phones have screen. Plus it's a nice way to recylce - right... :) I googled for an easy to control display and I found that Nokia 3310 LCD is a very good option. I went to a small service shop and they were happy to give me a few from some old broken phones. I found a datasheet somewhere around the internet and spend some time to write a driver for the display. It worked! This was very nice step in the project because this display is graphical and I can draw stuff on it. Not to mention it's much cheaper than the Text Displays that most students use for similar projects. Not only that but it also uses less power meaning my device will require less battery and operate longer.
Here's the display in action. By the way - it felt really cool to see it work for the first time:

Later I threw in some chips (a voltage regulator, a battery charger etc) and made the PCB using the free version of Eagle.
nokialcd board01
Related blog post here

PCB and Assembly

Here are some pictures of the PCB as I received it from the factory:

It was my first time soldering SMD components but I managaed to do it just fine. Not as hard as I thought. I rushed to find a PIC-KIT programmer so I see if everything is OK and that the device will run properly. Fortunately - it ran "out of the box".
Here's the board with the elements soldered:

Related blog post here

Device Software

Last step was the software for the device. The first picture shows the device booting up with my University logo (TU-Sofia), the second one is the main menu, the third one shows the linear sensor output. Notice the three icons on top. The first one (the emoticon) shows that the device is calibrated or not. The second one (the lamp) shows that the “flash light” is activated and the third one shows how much battery we have left. The last image shows the results of the measurements. It’s only in Cyrillic – I got rid of the Latin alphabet because I wanted to free some space for the logo.
08072010256 08072010256
08072010256 08072010256
Related blog post here