Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I am trying to find a piece of hardware that will signal a program to start a timer when it is moving and stop when it stops. The hardware can just be a ball that moves and is connected to the computer through USB, I was thinking of something similar to the way a mouse would work. For the programing I would like to use c# or possibly ActionScript with adobe air. I am a web developer and have not had any experience with hardware or drivers and would appreciate any ideas on where to start. Maybe there is some piece of simple hardware out there that I can use to send signals to the computer or some literature of articles for beginners that you can point me to. Thanks in advance

share|improve this question
1  
Look for "Arduino" and "Motion Sensors." –  Robert Harvey Aug 23 '12 at 21:51
2  
Why can't you use a mouse? –  Karl Bielefeldt Aug 23 '12 at 22:05
    
Because the mouse would need to be plugged in as well, Thanks –  Christopher Aug 24 '12 at 13:49
add comment

3 Answers

It's difficult to suggest a solution without knowing exactly what it is you are trying to communicate with. There may be existing hardware that you can use, or you may need to create your own.

If there is an existing hardware that you can use, such as a mouse as a simple example, then all you need to do is communicate with the driver via it's API.

If you plan to make your own hardware, then depending on your budget, you may be able to create a custom device and create your own driver and API.

The easiest and most flexible option however, is to use an Arduino, or similar PIC product. An Arduino is a microcontroller, that can be used to interface with and control various sensors and input devices. You would create your custom sensors to detect the movement, and connect these to the arduino. You can then interface to the Arduino via a serial connection within a C# application on the PC.

See www.arduino.cc for more information and lots of tutorials on how to use an Arduino.

Arduino's are great for experimenting or one of projects, but may not be suitable for a commercial product.

share|improve this answer
    
I think a mouse would work, I need to have a real mouse plugged in as well though to control the computer. Is it possible to change the way a mouse behaves, for example where it only communicates with my program and does not display on the computer screen. –  Christopher Aug 24 '12 at 13:58
    
@Christopher - if you right click on the second mouse in Device Manager, you can disable it. I think you can probably still talk to it directly over USB from a C# program, but not sure. –  Scott Whitlock Aug 24 '12 at 14:04
    
Yea I was thinking more like reverse engineering it to just work that way without having to disable it every time, is that possible –  Christopher Aug 24 '12 at 14:09
    
@Christopher - if you're going to start taking apart a mouse, then consider buying an FTDI chip breakout cable - they're the same cable used to program an Arduino and they're less than $20. Using the free FTDI driver software from C#, you can read the digital I/O lines directly. If you wire 2 of them up to the optical sensors in an old style ball mouse, you should see pulses when the mouse moves. –  Scott Whitlock Aug 24 '12 at 14:14
    
Thanks for the suggestion, I will have to look more into that. –  Christopher Aug 24 '12 at 14:44
add comment

You could also go for a Digital USB-Module that you can directly address hardware via USB.

share|improve this answer
2  
Please review the question again and be more specific in your answer. As a new users you can benefit by reading the FAQ and guidelines like those at programmers.stackexchange.com/questions/how-to-answer. Questions and answer guidelines in the FAQ can help lead to higher reputation scores, and there is a badge for completely reading the FAQ. –  DeveloperDon Aug 25 '12 at 5:22
add comment

For USB I/O that you can interface with .NET, check out Phidgets. For instance, there are accelerometer motion sensors that connect directly over USB. They have documentation about their .NET SDK on their site. I've used it with success.

You could also just use a mouse, right? :)

I also thought this project on kickstarter is similar to what you're describing, and wouldn't require any coding.

If you wanted to go wireless, consider buying a Wiimote and using the wiimotelib library written in C#. You'll need a bluetooth connection on the PC.

If you have an Android phone, you could access the accelerometer and use that for motion detection. You could use it in a tethered only mode... not sure how to interface it directly over the USB cable. Alternatively it could be wireless over a WiFi connection.

share|improve this answer
    
The gadgeteer suite should interface well with C#, too. –  Falcon Aug 24 '12 at 9:30
    
The Phidgets look promising, I will look into it further tonight, Thanks for your help. –  Christopher Aug 24 '12 at 14:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.