Tuesday, August 20, 2013

Arduino: Motion sensor, making it work

I had some problems getting this PIR motion sensor, which I'm pretty sure is the same as this working well, connected to either an Arduino Duemillanove or a Teensy 2.0 micro. It seemed to trigger randomly or not at all. Based on a clue from the Sparkfun comments on the item: provide the sensor with it's own or extra power as the micro board might not be providing enough volts to drive it properly.

This approach seems to provide the answer: power the PIR sensor with the positive side of a 9v battery, (disconnecting it from the micro board's power), whilst leaving the rest of the circuit (like this) in place.

In hindsight, I'm assuming the problem I had stemmed from the Arduino itself using up all the juice available from the USB connection to the computer. Powering the board from a DC adapter with current to spare would help too.

With a movement/presence detector like this, adding a big LED or a buzzer to your circuit and sketch, indicating when the sensor detects movement will help a lot when testing.


dual-powered: the PIR sensor connected to a Teensy. 9V battery for the sensor, an old phone charger provides +5v via the Teensy's mini USB connector.

Saturday, August 17, 2013

Arduino: Configuring on Linux

You want to install the Arduino development environment on a linux machine: there is the standard download and there are distro-specific installers available. There are also some instruction on setting up your environment linked from the official pages.

The route I followed on my usual distro (Centos 6) was to install Java, then the Arduino download. There were still a couple of non-functioning parts: errors from the rxtx library about lockfiles and greyed out serial port menu in the Arduino IDE.

These are RedHat/Fedora/Centos permissions issues that can be resolved easily:

* edit /etc/group

* add your username to the uucp, lock and dialout groups

That should fix it by giving your user the required access to the computer's lock directory and serial ports