Weather-controlled LED strip

An ambient lighting system which turns on/off with the AWS IoT button, and the lighting intensity is calculated from prevailing weather conditions (cloud cover, time after sunset). I built this system because I frequently found myself reading in a very dark room, and I wanted automatically-adjusted ambient lighting.


Section 1: Hardware

Note: Instead of driving an entire LED strip, you can start off with a single LED on a breadboard, wired to your microcontroller.

Step 1: Purchase all the electronic components I’ve listed in the Things section.

Step 2: Build the MOSFET LED driver circuit. We require this because the LED strip works on 12V, and the microcontroller only supplied 3.3V – 5V. I haven’t gone into the details of this because it’s available on the Amazon page I’ve linked in the Things section. All the components are available as a single kit, and solder as per the image on the Amazon page. Then hook it up to the LED strip and microcontroller as mentioned in one of the Customer Reviews (and also look at the pics I’ve attached if you need further guidance). I’ve copied the same instructions here:


“C” = Gate, connect to microcontroller I/O pin 20

“-” = Source, for reference connect microcontroller’s GND and the power source’s GND

“+” = Vcc, connect to the “+” terminal of your power source


“-” = Drain, connect this to “R”, “G”, or “B” cathode (-) of the 12V LED strip

“+” = 12V, connect to “12V” pin of the 12V LED Strip

Once you’ve built the circuit and you’re convinced it works fine, you can set it aside, and let’s move on to the AWS pieces.

Section 2: AWS IoT button Configuration

Please follow this easy AWS tutorial which will show you how to configure your AWS IoT button, and trigger AWS Lambdas by pressing the Button. Don’t worry too much if you can’t make it work 100% (like the email bit) – the key is that the Lambda should trigger successfully with button clicks.

Section 3: AWS Lambda Weather Controller

Step 1: Clone this github repo and copy-paste the content of weather_controller_lambda.js into a new NodeJS 4.3 Lambda function.

Step 2: Like in the previous Section 2, make sure this new AWS Lambda can trigger with button clicks.

Step 3: Also setup a Cloudwatch Events – Schedule trigger, to fire the Lambda every 15 minutes. This is to ensure the LED intensity is updated regularly to match the prevailing weather conditions. More details on this step.

Step 4: Make sure the Lambda is responding to Button Clicks, Button DoubleClicks, and also the Cloudwatch Scheduled events.

Section 4: Setting up the IoT Button and Raspberry Pi as AWS IoT Things

Please follow the instructions here to connect your Raspberry Pi to AWS IoT.

PS: This part is a bit confusing if you’re not familiar with the IoT console, so I’ll add some extra details.

Step 1: Go to AWS IoT > Registry (on the left panel) > Types. Add two types, Input and Output respectively.


Step 2: Go to AWS IoT > Registry (on the left panel) > Things. You should already see the AWS IoT button registered as a consequence of finishing Section 2 successfully. Click on the button that reads iotbutton_G03*.

Read More:  Weather-controlled LED strip

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top