I am using an accelerometer and a Leonardo as a remote control for my laptop. The code works great until I plug in my projector then the code returns false positives (causing the video to pause and play randomly). Any suggestions on how to avoid this?
CameronSStone:
Any suggestions on how to avoid this?
You will have to provide a lot more information.
For example
- what is "my projector"?
- What is it plugged into?
- What operating system is on the laptop?
- What program are you running on the Leonardo?
and everything else that you know about your project but have not told us.
...R
The projector is a WiMiuS LED projector model P18 being connected to my HP ENVY m6 Notebook PC with an HDMI cable. The length of the extension cord used as well as the outlet the projector is plugged into does not change the readings. The laptop is running off of its own battery and has a solid state drive. The program detects acceleration of the accelerometer and sends a keystroke to my laptop which pauses the video for 15 seconds. The. It sends another keystroke which plays the video uninterrupted for 5 seconds then it returns to checking. The program looks for an acceleration value greater than a variable "R". When the projector is not plugged in the values of x,y and z never leave the range of -3 to 3 when the accelerometer is motionless. However, as soon as I plug in the HDMI cable to my laptop, the x, y and z values detect random spikes up to 44. The current input I am using (what I want to cause the video to pause) requires a value of 15 from the X, Y or Z input. Thank you for your help.
That is a much better description of the problem however I can't think of any solutions myself.
Is it possible that the projector is causing vibration in whatever the accelerometer is connected to?
Or that the projector is having an affect on the voltage in the USB connection?
I suggest the following
- post a link to the datasheet for the accelerometer
- make a pencil drawing showing how everything is connected to the Leonardo and post a photo of the drawing. See this Simple Image Posting Guide
- post a photo of your hardware so we can see how the wiring is laid out.
For the future it is a good idea to include whitespace to break up the ideas in text - it makes it much easier to read. Like this, for example
The projector is a WiMiuS LED projector model P18 being connected to my HP ENVY m6 Notebook PC with an HDMI cable. The length of the extension cord used as well as the outlet the projector is plugged into does not change the readings.
The laptop is running off of its own battery and has a solid state drive.
The program detects acceleration of the accelerometer and sends a keystroke to my laptop which pauses the video for 15 seconds. The. It sends another keystroke which plays the video uninterrupted for 5 seconds then it returns to checking.
The program looks for an acceleration value greater than a variable "R". When the projector is not plugged in the values of x,y and z never leave the range of -3 to 3 when the accelerometer is motionless. However, as soon as I plug in the HDMI cable to my laptop, the x, y and z values detect random spikes up to 44. The current input I am using (what I want to cause the video to pause) requires a value of 15 from the X, Y or Z input.
Thank you for your help.
A good way to review the readability of a piece of text is to read it aloud to yourself.
...R