Arduino Yun only detects Motion when the Arduino its connected to pc

Hi,

I have uploaded a script to my arduino yun. if its connected to my pc and arduino software is running it works perfect.

If I connect the arduino on normal power and not on my pc, so the script does not work. The Arduino has normal power but he can not detect motion.

How to solve that?

Could you please explain what you mean by:

If I connect the arduino on normal power

Is that an external power supply and if so, is it regulated 5 volts?

Hi, yes its an external power supply. Its my Iphone power supply. Is that a problem for arduino?

The power supply needs to be a regulated 5 volt power supply. Many of the phone chargers are not regulated. Also, it needs to provide an adequate amount of current to support the Yun as well as the sensor.

In a project I am working on, I am using a battery supply with this voltage regulator: Pololu 5V Step-Up/Step-Down Voltage Regulator S7V8F5

@etrust;-

your code please?

etrust:
Hi, yes its an external power supply. Its my Iphone power supply. Is that a problem for arduino?

Iphone chargers are crap, specially if it's an after-market one, not original.
Get a real 5V one, with at least 1A (better 2A) and verify that you really get 5V.
An iPad charger is better, as it has a higher amperage and those are commonly more stable with the provided voltage than those iPhone chargers.

Ralf