# Need an accelerometer to communicate with a PC..

#### PSUstudent

Joined Dec 1, 2008
7
I need to design a way for an accelerometer to communicate with a PC via USB or Serial ports... I know I could buy a DAQ board from nation instruments but they are WAY out of my price range, being over $1,000. And I am not very familiar with coding for microcontrollers... Any tips or suggestions? Oh and I don't think I could use a Wii remote since this is a school project. The overall project is a camera car system that will record video of an accident. The camera will, in theory, record 3 minutes intervals and loop over them to reduce memory storage. The accelerometer will be used to determine when a sudden change of velocity is introduced (a wreck) and in turn, the on-board single board computer will tell the device NOT to loop over the most recent video clip and store it for later review.. Please help! #### beenthere Joined Apr 20, 2004 15,808 Look up the line of accelerometers from Freescale Semiconductor. Digi-Key has a bunch in the$12-16 range, and evaluation kits for about $40.00. If this is to be a planned crash, there may be simpler ways to signal the SBC. Thread Starter #### PSUstudent Joined Dec 1, 2008 7 Well the idea is to make something marketable, so the crash wouldn't be planned. Where would I find an "evaluation kit"? #### KL7AJ Joined Nov 4, 2008 2,208 I need to design a way for an accelerometer to communicate with a PC via USB or Serial ports... I know I could buy a DAQ board from nation instruments but they are WAY out of my price range, being over$1,000. And I am not very familiar with coding for microcontrollers... Any tips or suggestions? Oh and I don't think I could use a Wii remote since this is a school project.

The overall project is a camera car system that will record video of an accident. The camera will, in theory, record 3 minutes intervals and loop over them to reduce memory storage. The accelerometer will be used to determine when a sudden change of velocity is introduced (a wreck) and in turn, the on-board single board computer will tell the device NOT to loop over the most recent video clip and store it for later review..

B&B electronics has a whole line of low cost serial port DAQ modules. Used them for years.

Eric

#### PSUstudent

Joined Dec 1, 2008
7
Is there a way I could make something on a protoboard to get an accelerometer to talk to a PC? The thing is the professors don't want everything to be "plug-and-play." They want some "hardware design" from our end.

#### beenthere

Joined Apr 20, 2004
15,808
Do you mean a PC, or an SBC? Accelerometers tend to have analog outputs. The input to a processor is through an A to D converter that converts the voltage level to a digital value.

My tag line suggests selecting hardware before worrying about the program. You might spend a bit of time looking into things like accelerometers and how to think about a place to mount it in a car to detect a crash. A two axis device might be better, as cars tend to be struck from any angle. Multiple cameras, too?

You may also find the accelerometer output needs to be amplified for proper detection. You might simply apply it to a voltage comparator that will signal an event greater than some preselected value. Then there is only one or two digital inputs to look for.

Some research into collision impacts might be helpful to decide just what is a likely level to look for to have a valid accident detection.

#### PSUstudent

Joined Dec 1, 2008
7
Well we figured that making the program on my laptop would be best for now, before we spent so much money on a SBC. We are using the program called LABview to interact the USB camera we have to the computer, and so far our program will record and save a video clip to the hard drive.

Are A to D converters easy to find? And I agree that a 2 axis accelerometer would be best. We did some research on how many G's a car crash can produce and I believe it can be up to 20-25 Gs, but we aren't going to be hooking our project up to a real car per se, maybe just a r/c car to prove it would work.

You have been a LOT of help thank you so much!

#### beenthere

Joined Apr 20, 2004
15,808
Once again, the conversion of the output to a digital input may be more work than it's worth. If some change in velocity is the only datum, then using a voltage comparator to signal when that level has been reached makes life easier. You only have to look for the comparator input/s going from low to high.

The interesting part is deciding how big a bump determines a crash. I think something less than 25 G's is reasonable. If you know anybody who drives in destruction derbies, you could think about instrumenting his car as a test bed. They bump pretty hard.

Then, your SBC can run an interrupt routine that saves the video. No conversion and test against a table, just wait for a signal.

#### leftyretro

Joined Nov 25, 2008
394
A simple microprocessor board that can read analog voltages and communicate with a PC via a serial port of USB serial converter will give you the missing piece you are looking for. There are several brands and modules to choose from and I currently like the Arduino series that can get you started for $20 for a RS232 serial kit model or$30 for a USB serial model assembled.
You can then write a simple C based program with the free IDE open source software and download it to the microprocessor. That program would just read the analog input channel(s) (up to six for the Arduino) you have wired your sensor to and send it on to the PC with the serial communications channel. You will have to define the format for the serial message (ASCII, binary,etc?). Also you have to define a protocol between the micro and the PC, do you want the micro to just continuously 'broadcast' the data to the PC or do you want the PC program to ask for it one reading at a time.

However the next task only you can answer. Are you and can you write the needed PC program to utilize this data or are you using some application program you already obtained?

Good luck

Lefty

#### PSUstudent

Joined Dec 1, 2008
7
A simple microprocessor board that can read analog voltages and communicate with a PC via a serial port of USB serial converter will give you the missing piece you are looking for. There are several brands and modules to choose from and I currently like the Arduino series that can get you started for $20 for a RS232 serial kit model or$30 for a USB serial model assembled.
You can then write a simple C based program with the free IDE open source software and download it to the microprocessor. That program would just read the analog input channel(s) (up to six for the Arduino) you have wired your sensor to and send it on to the PC with the serial communications channel. You will have to define the format for the serial message (ASCII, binary,etc?). Also you have to define a protocol between the micro and the PC, do you want the micro to just continuously 'broadcast' the data to the PC or do you want the PC program to ask for it one reading at a time.

However the next task only you can answer. Are you and can you write the needed PC program to utilize this data or are you using some application program you already obtained?

Good luck

Lefty
That's the problem, my partner and I both aren't fluent with programming language. We took a C++ class a few years ago but that knowledge has already disappeared. We were trying to avoid microprocessors but is that really possible with what we are trying to do?

#### PSUstudent

Joined Dec 1, 2008
7
Any suggestions on where I could buy a voltage comparator? Also, are they fairly simple to install with my project?

#### beenthere

Joined Apr 20, 2004
15,808
Digi-Key Corporation carries about anything you might need. So does Mouser Electronics. Both have on line catalogs.

You need to follow a process here. Decide on an accelerometer or two. Determine the output and a likely trip point. Get an op amp or two, to apply some buffering and gain to the accelerometer output. Then you are ready to apply the voltage to a comparator input. Those outputs go off the board as signals to your SBC.

Another decision is to go with surface mount or through hole devices. Makes a big difference for the printed circuit board. The SMT resistors and capacitors are no fun to handle, though. How are your soldering skills?

Hint: don't even think about lead free solder unless you are motivated and can solder very well.

Linear technologies make lots of op amps and comparators So do National Semiconductor and Texas Instrument). The LT1013 is a good dual op amp, as it will operate single-ended. The LT1011 is a good dual comparator. You could get data sheets for both and see how they work.

You should be able to make a printed circuit board with the accelerometers, op amp, and comparators all present (plus a regulator for the operating voltage, bound to be less than 12). It would be best to make the critter as a stand-alone board so the choice of another SBC/camera combo won't impact that design.

#### PSUstudent

Joined Dec 1, 2008
7
What kind of interface will the SBC recquire to connect to the voltage comparator? We just ordered a SBC, power supply, and a solid state 32 GB hard drive.

#### beenthere

Joined Apr 20, 2004
15,808
The comparator will switch between a logic low and a logic high (have to make sure of this in the pcb design) - no I/F needed.