Amazon Dash Controlled Motion Sensing Camera (Part 0)

To cut costs in my motion sensing camera project, I opted to use the built-in LEDs of the Raspberry Pi as status indicators. One problem with the RPi 3 is that the power LED could not be disabled...unless you directly modify the firmware. This is a problem for me since the red power LED is pretty bright and makes it difficult to see the activity LED which for some reason is orange when the power LED is also on. I also experienced some weird issue where toggling the activity LED would make both LEDs go a bit crazy...

$> wget https://raw.githubusercontent.com/raspberrypi/firmware/master/extra/dt-blob.dts
$> nano dt-blob.dts

There seems to be some differences between revisions of the RPi 3, but basically every instances of the following

[email protected] { function = "input";  termination = "no_pulling"; polarity = "active_low"; }; // Power low

[email protected]_LOW {  
    type = "external";
    number = <7>;
};

Should be replaced with

[email protected] { function = "output";  termination = "pull_down"; startup_state = "inactive"; }; // Power low

[email protected]_LOW {  
    type = "absent";
};

Needless to say this is probably not for the faint of heart. In my case there were two instances I had to replace. Next, we need to compile the above.

$> sudo apt install device-tree-compiler
$> sudo dtc -I dts -O dtb -o /boot/dt-blob.bin dt-blob.dts

This will turn off the power LED. At this point I called it a day, but before I came up with the motion sensing camera project I did have plans to turn the LED on/off at sunrise/sunset, basically so that the lights don't distract me at night. To control the power LED in the current state is simple:

$> git clone https://github.com/6by9/rpi3-gpiovirtbuf.git
$> cd rpi3-gpiovirtbuf
$> ./configure
$> make
$> make install
# turn off power LED
$> rpi3-gpiovirtbuf s 135 1
# turn on power LED
$> rpi3-gpiovirtbuf s 135 0

The last two commands can simply be used as cron jobs, or if you want to be more fancy you could write a service that checks for sunrise/sunset every day and runs the appropriate command.