Home Blog Page 17

Building an 8x8x8 LED Cube from an Amazon Kit – Arduino Compatible

I bought this kit a while ago when I was looking at building an Arduino based 8x8x8 LED cube. This one was listed on Amazon as Arduino compatible, meaning that I should be able to re-program it using the Arduino IDE after assembling it to display what I want.

LED Cube Kit As It Arrived

The kit was delivered quite quickly, but there was one pretty obvious thing missing, the assembly manual. I had a look on the product page on Amazon, emailed the supplier, and Googled the supplier and other 8x8x8 cube kits to try and find the manual. The supplier never got back to me and although I found a few similar cubes, I never found an assembly manual for this particular cube, so I packed the kit away and forgot about it for a few months.

A week ago, I found the kit again and decided to try assembling it. At worst, I’d have a cube that didn’t work and would just be a dead shelf decoration.

Here’s a video of the build and the 8x8x8 LED cube working, read on for the detailed assembly.

Buy Your Own 8x8x8 LED Cube Kit

  • 8x8x8 LED Cube Kit (Like The One In The Video, Probably Has No Instructions Either) – Buy Here
  • 8x8x8 LED Cube Kit (Better Quality, Not Arduino Compatible) – Buy Here

Assembling The 8x8x8 LED Cube

So let’s get started with putting the cube together.

The kit arrived quite quickly and this is what was delivered.

LED Cube Kit, What Was Delivered

There was a bag of LEDs, they said that 550 LEDs are supplied in case some are faulty, the PCB to mount the components, and then a small case with the chips and other electronic components.

The product page said that the cube was Arduino compatible, although the chip supplied is a STC12C5A60S2 micro-controller. You’ll need a USB-2-TTL programming module to re-flash this micro-controller. There is guide a good guide and software to re-programming the STC micro-controller on GitHub.

Soldering The LED Layers

I started out by testing all of the LEDs. I’ve never found a new LED to be dead, but since they said that they included 550 LEDs in case some were faulty, I decided to test them all first to avoid have to replace LEDs once it was all assembled. I set up a simple 5V power supply and 220 ohm resistor on a breadboard and got testing.

Testing The LEDs

I didn’t find any faulty LEDs, but I still think it was worthwhile to save the frustration if I had.

All LEDs Tested

Next, I laser cut a template to lay out the LEDs. Rather than trying to get the placing right for each individual LEDs, having an MDF board which I could press the LEDs into and then connect up while they’re held in place would dramatically speed up the process and hopefully result in nice straight and evenly spaced grids of LEDs.

Laser Cutting A Template

I cut two layers, one with 3mm holes to hold the LEDs and one with 5mm holes to be the bottom spacer layer so that the LEDs don’t touch the table underneath them when they’re pushed into the template.

I then layed out the 64 LEDs on the template, making sure that the LEDs were all facing the same direction.

Laying Out LEDs In Grid

So with the longer positive leg or anode on the right side and the negative leg, or cathode on the left side.

LED Cube LEDs Positioned On Template

Next, the idea is to connect all of the positive legs together in each column and all of the negative legs together in each row, making sure that they don’t touch each other. I started with the negatives, bending them all down so that there was some overlap between them.

Bending Legs Down

I then soldered them together.

LED Cube Soldering LED Legs
LEDs All Cathodes Soldered

Once all of the negatives were done, I did the positives. I used a pair of pliers to space the bend a little away from the back of the LED so that the positive connections were spaced about a millimeters away from the negative connections. In hindsight, these legs should have been bent in the opposite direction in order to keep the connections on the back side of the cube when it’s on display, but this isn’t particularly noticeable in the end.

Bend All Anodes To Make Rows

I continued this until all of the columns and rows on this layer were connected.

Completing Rows and Columns of LEDs

I then tested the LEDs again, this time testing the soldered connections. I used a small battery pack for this and just ran the leads over the columns and rows, checking that each LED lit up. I was glad I did this as I found two bad connections on my first layer.

Testing The LEDs Once Assembled Into Grid

I then carefully removed the layer of LEDs from the template, trying not to bend the legs of the LEDs.

Removing LED Grid From Template

I was worried that I might have damaged some of the joints when removing the LEDs, so I tested this layer again once I removed it from the template.

Testing LEDs Again

I tested the subsequent layers only after removing them from the template. The next few went a lot better, but I did still find one or two bad connections, and one LED installed the wrong way around.

Creating these layers is the most time-consuming part of the build, but time spent here will result in a much neater looking cube down the line. It’s also definitely worth taking the extra minute or two between layers to test all of the connections. Even fixing a single bad joint once the cube is assembled will be near impossible without damaging it when taking it apart again.

Soldering The PCB Components

Once all of the layers of LEDs were made, I got started with soldering the components into place.

This was where some guesswork came in. It was pretty obvious when making the layers that the LEDs had to be connected in a particular way, but it’s less obvious which capacitors and resistors go in which places on the PCB when it isn’t labeled.

The two electrolytic capacitors were the same value, despite the markings on the PCB being different sizes, so I just installed those in the two available spots. The ceramic capacitors were all the same size, although there were three supplied and only two spots on the PCB for them. I also noticed that there were two different value resistors supplied, 2 of one resistance and 8 of another. I noticed that the PCB had two resistors on one side and 8 on the other, so I decided to install them with two of the same on one side and the 8 others on the other side and hope for the best.

Soldering Front Components

There are three different size chips. The ones that are the same size are all the same, so those are quite easy to figure out and the remaining components could be figured out based on the PCB holes.

Soldering Back Components
Adding IC Chips

The final part of the PCB assembly is to mount these LED leg holders onto the board to plug the LEDs into. I cut the strips up into individual pins and then broke the plastic off of them. I then installed one on each of the holes on the PCB. Luckily these could be installed from the component side of the PCB as the back side of some of these pins were covered by the IC sockets, something which I hadn’t thought about earlier.

Adding The LED Holders

I also noticed that on the PCB there are laocations for some header pins and two pushbuttons, but the components weren’t supplied. I assumed that the header pins are for programming the chip and the pushbuttons could be used to change the display currently being run on the cube, but this probably wasn’t preloaded onto the chip either. I decided to install these components as I had some pushbuttons and pins lying around and I wanted to be able to re-program the chip later as well.

Adding Pushbuttons and Header Pins

Assembling The Cube Layers

Now that the components are all in place, I could plug the LED layers in.

From other cubes I’ve seen online, I assumed that the positive legs of the LEDs went into the holes directly underneath the cube for the columns and that the negative legs would get joined in layers and connected to the holders alongside the cube. It turned out that the negative legs on my LED layers should have been on the other side, as that was the back side of the cube, but this doesn’t really make much difference.

First LED layer in place.

Installing First LED Layer

I then installed them remaining LED layers.

Installing Additional Layers
Completing The Installation Of The Layers

Once the layers were installed, I bent the negative legs at 90 degrees to join each layer together and soldered them together.

Joining The LED Layers Together

The next mystery was to decide which layer to connect to which numbered holder. I wasn’t sure if pin 8 was to go to the bottom layer or top layer? One diagram in another cube’s manual had the layers labelled with 1 being the top layer and the image alongside clearly showing the bottom layer being wired to 1.

All LED Layers Joined

I decided to temporarily connect these are there was a good chance my guess would be wrong.

Connecting The Layers To The Pins on the 8x8x8 LED Cube

Another issue was that the red insulated wire supplied to connect the layers to the holders was too short by 2-3cm. I didn’t waste any of it with incorrect lengths or stripping too much wire, so I’m not sure why it was too short. I made a plan for the shortest connection and was then ready to power up the cube.

Powering Up the Cube

I plugged the power supply into a USB charger and pushed the switch to turn it on.

Pattern Displayed When First Turned On 8x8x8 LED Cube

The built-in program is a bit odd in the beginning and its not really clear if the of the layers are working or not working correctly. I would have thought that a good initial test would be to light up all LEDs or at least the layers sequentially.

8x8x8 LED Cube Assembled Flashing

I left it running and eventually some recognizable patterns started emerging and it looked like I had guessed the layers correctly. There was a typical “rain” type animation where the LEDs drop from the lit-up top layer, and the top layer was actually at the top of the cube, so I assume that I’ve got the layer numbers correct. If they were the wrong way around then the rain would fall upwards.

8x8x8 LED Cube Rain Animation

As expected, the buttons don’t seem to do anything, but I’ll be looking to program them to change what is being displayed on the cube once I figure out how to program it. It also seems like the resistors are correctly installed, there aren’t any obvious bright or dim rows or columns.

8x8x8 LED Cube Working

Next I’m going to try and figure out how to program it and I’ll be making a clear acrylic case for it as well.

8x8x8 LED Cube Revolving Lights

Have you tried building your own 8x8x8 LED Cube? How did it go and did you build it from scratch or use a kit? Let me know in the comments section below.

How To Make A Raspberry Pi Zero WiFi Security Camera

In this project, I’ll be showing you how to assemble and configure a Raspberry Pi Zero W to be used as a WiFi security camera, which is also accessible over the internet.

We’ll be using an operating system called MotionEyeOS on the Raspberry Pi, which is a web-based, mobile and tablet friendly surveillance system. It can be used with both the Raspberry Pi camera or any USB web camera plugged into the Raspberry Pi. You can also set up motion detection with email notifications, take still images and time-lapse movies, and even configure it to upload media files to network storage locations or to cloud storage services.

Here’s a video of the build and the camera in operation, read on for the full step by step instructions.

What You Need To Build Your Camera

Optional Alternative (You’ll still need to buy the camera):

  • Pi Zero W Kit (Includes Pi Zero W, Case, SD Card, Power Supply & Camera Ribbon Cable) – Buy Here
What You Need To Build Your Pi Zero WiFi Security Camera

Assembling The Raspberry Pi Zero WiFi Security Camera

I’ve used a Raspberry Pi Zero W for this project because they’re relatively cheap and compact, making them perfect to mount discretely around your home. You can set up a couple of cameras around your home for less than $100. The W version has built-in WiFi, so there’s no need for an external WiFi or Ethernet adaptor to connect it to your home network.

Raspberry Pi Zero W

Let’s start by assembling the components into the Raspberry Pi Zero case.

If your Pi Zero came with a heat-sink, attach it to the board using the adhesive tape on the heat-sink.

Stick The Heatsink To Your Raspberry Pi Zero W

Once you’ve done that, you’ll need to connect the camera to the Pi.

The ribbon cable just slides into the connector with the contacts facing towards the board.

Clip The Ribbon Cable Into The Camera

Make sure that the black clip is pulled away from the connector to open it. Then push the black clip back into place to grip the ribbon cable once it is seated correctly in the connector.

Secure The Ribbon Cable Connector

Now do the same on the connector on the Raspberry Pi to connect the camera module to the Pi.

Plug The Camera Into The Raspberry Pi

Next open up the case and push the Pi into the back of the case. There are small pegs on the case which align with the screw holes on the Pi and the ports should all be aligned with the cutouts on the side of the case.

Install The Pi Into The Case

Next, clip the camera into place on the top cover and then close up the case to check that it all fits correctly.

Close Up Of The Case

We can now move on to preparing the SD card with the MotionEyeOS operating system.

Loading The Operating System Onto The SD Card

Use a card reader to plug the card into your computer.

Now you’ll need to download the MotionEyeOS software.

If you’re not using a Raspberry Pi Zero, or you’d like to use a different board, have a look at the list of Supported Devices to see which version of the operating system you should download.

MotionEyeOS Supported Devices

Go to the list of latest releases and make sure that you download the latest version of the software which is compatible with your board.

We’ll be using the Raspberry Pi version which was released on the 6th of June.

Latest Release For MotionEyeOS

Once you’ve downloaded the software, you’ll need to unzip it to a folder on your computer. I used Easy 7-Zip for this. Don’t try to flash the zipped image to your SD card, it won’t work.

You’ll then need to use an image flasher to flash the disk image to your SD card. The one recommended in the installation instructions on GitHub is Balena Etcher. Once you’ve downloaded and installed the software, you can flash the disk image.

You’ll need to first select the source file, which is the disk image that you unzipped in the previous step.

Download & Use Balena Etcher

Then select your destination target, which is your SD card.

Then click on Flash and wait for the software to write the disk image to your SD card.

Flashing The Image To The SD Card

Finally, you’ll need to tell your Raspberry Pi how to connect to your WiFi network.

To do this, use the template below. It’s a basic text file in which you’ll need to add your country code and then your Network name or ID and the network password.

You can find a list of country codes on Wikipedia.

Rename the file to wpa_supplicant.conf, making sure to change the extension as well and then put it into the 30MB settings partition which you’re able to write to on your SD card.

Once you’ve done this, your SD card is ready to be installed into your Pi for the first boot up.

Booting & Configuring Your Pi Zero Security Camera

You don’t need to attach a monitor for this next step, but it is helpful to check that you don’t get any error messages and to make sure that the Pi has finished booting up.

Boot Up Pi For The First Time

The first boot up takes about a minute or two to complete, it’ll boot up much faster than this after the first boot.

Boot Up Log

If you haven’t used a monitor then you’ll need to find the IP address of the Pi using a network analysing tool on your computer.

Once you’ve found the address, type it into your browser to access the Pi and it’s video feed.

MotionEyeOS Running

If everything is working correctly, the video feed from your camera should show up after a few seconds.

Test Camera Loading

If you open up the settings menu, you can also shutdown or restart your Pi, which you’ll need to do if you’re going to be disconnecting it to install elsewhere. If you’re asked for login details, the default username is admin, with no password.

Mounting Your Camera

I 3D printed a small GoPro adaptor to stick onto the back of the Pi case so that it can be mounted onto any standard GoPro mounts.

GoPro Mount For Back Of Pi Camera
GoPro Mount On Back Of Raspberry Pi Zero

I’m going to be using a suction cup mount to mount the Pi onto an outside window. It’s under cover, so it’s protected from direct sunlight and rain.

This mount also enables the camera to be positioned so that it’s pointing in the right direction.

Mount Raspberry Pi Zero WiFi Camera Onto Window Outside

You’ll need to power it using a USB power supply. You can also use a power bank to temporarily power it for a mobile surveillance system.

Raspberry Pi Zero WiFi Security Camera

Let’s have a look at the video feed outside.

MotionEyeOS Video Feed Outside
MotionEyeOs Camera Feed

You can also access the camera using your mobile phone or tablet by typing the same IP address into your device’s browser.

Configuring Port Forwarding To Access Your Camera Over The Internet

The last step is to configure port forwarding on your router, so that you can access the camera from the internet.

You’ll need to start by assigning a fixed IP address to your camera, so that it doesn’t change every time it re-connects to the network. This can be done in the MotionEyeOS settings menu. Set the IP configuration to manual and then change the IP address to the address you want to always assign to the camera. This should be out of the range that your router typically assigns addresses to otherwise you’ll land up with a conflict it that address has already been used.

For example, if your router typically assigns IP addresses in the 192.168.10.1 to 192.168.10.20 range then you should pick an address higher than 20, so something like 192.168.10.21 and onward for your cameras.

You might also need to change your Default Gateway to your Router’s address.

Next, you’ll need to set up port forwarding on your router. This is something I can’t really show you how to do because it’s very different for each router make and model. But you essentially need to login to your routers configuration page and then add a port forwarding instruction so that requests from outside your local network on a specific port are forwarded to a particular device, in this case, your Raspberry Pi camera.

Setting Up Port Forwarding On NetComm Router

Here’s the general idea of what you need to do:

  • You’ve got your Raspberry Pi’s local IP address (this is what you’ve been using to access the camera through your browser), you now need to know what port number it is communicating on. This is usually Port 80 by default. Since this is the default, it’s a good idea to change it to a port number that is unused by any other services as a security measure.
  • Next, you’ll need to find your router’s external IP address. This can be done by googling – “What’s My IP” from any device connected to the same internet-connected network.
    • This is the IP address you’ll need to type in over the internet in order to access your camera while you’re away from home. It is the IP address which your provider has assigned to your router. So this might change if you don’t have a fixed IP address arrangement with them.
  • Lastly, you need to choose an external port to forward. Again, you can choose any unused port. You’ll use the combination of your router’s IP address and this port number in your mobile device’s browser in order to access the camera.

Now that you have an external IP address and port as well as your internal IP address and port, you should have all of the information that you need to configure the port forwarding instruction on your router. This is the part that is very different for each router manufacturer and model, so you’ll need to figure out how to do this on your own router.

Essentially what you’re doing is telling the router that when an external request is sent to it on the particular port you’ve chosen, the router should forward the “web page” which is served to it when it calls the local IP address and port number so that you’re able to see it from outside the network.

Once this is done, you should be able to access your camera over the internet in the same way you could do it locally. If you’re still unsure how to do this, try searching for setting up Port Forwarding on your specific router make and model.

Let me know if you’ve built your own Raspberry Pi Zero WiFi Security Camera in the comments section. What are you using it for?

Share This Guide

Raspberry Pi Zero WiFi Security Camera Social

How Fast Can An Arduino React? Tested Using My Reaction Timer Game

Last month, I built an Arduino based reaction timer game, which allows you to challenge your friends and family to see who has the fastest reaction time. We managed to get our times down to around 160 milliseconds and I’ve seen videos of people who can get down to 120 milliseconds, but now I want to know – How fast can an Arduino react to the same game?

Here’s a video of the test, have a look at it to see the Arduino react to the reaction timer’s LED, otherwise read on for the full write-up and details.

What You Need For This Test

Components Required

Setting Up The Test Rig

In order to test the Arduino’s reaction time, we’d need a sensor to detect the light coming from the LED on the game and then an actuator to push the button to stop the timer.

Arduino Reaction Time Reactor Schematic

I built a simple setup with an LDR to detect the LED’s light and a micro-servo to push the button. I also included an LED so that we can see if there is any delay between the Arduino telling the servo to move and the servo actually pushing the button since there is a motor to spin up and a number of gears between the motor and the servo arm.

Solder Components Together To Make A Wiring Harness

I soldered the components together using a few strips of ribbon cable and some header pins.

Glued The Servo To A Box

I then found a plastic base which was the right height to mount the servo on so that it could be positioned just above the button.

Placed The Reaction Timer Under The Servo

Next you’ll need to position the LDR as close to the LED as possible. I glued the resistor onto the side of the game using a glue gun and could then adjust the legs of the LDR to position it directly over the LED.

Set Up The LDR On The LED

Now let’s have a look at the code.

//Michael Klements
//The DIY Life
//7 May 2020

#include <Servo.h>

Servo react;        //Create a servo object to control the reaction servo
int lightOn = 0;    //Variable to read in LDR value

void setup()
{
  //Serial.begin(9600);
  react.attach(6);    //Set the servo pin to pin 9
  pinMode(7, OUTPUT);   //Output pin for LED
  react.write(80);    //Set the servo to an initial position just above the button
}

void loop()
{
  lightOn = analogRead(A0);   //Read the output from the LDR
  //Serial.println(lightOn);
  if (lightOn > 800)
  {
    digitalWrite(7, HIGH);            //Light up the LED
    react.write(65);                  //Move the servo to push the reaction button
    delay(600);                       //Wait 400 milliseconds
    react.write(80);                  //Move the servo back to the initial position
    digitalWrite(7, LOW);             //Turn the LED off
  }
}

We start by including the servo library to control the servo.

We then create a servo object called react to control the servo and create a variable to store the value read from the LDR.

In the setup function we set the servo pin number, then set the LED pin as an output and set the servo position slightly above the reaction button.

In the loop function, we read in the LDR sensor level, then compare it to the light set point. If the measured level is greater than the set point, then we turn the LED on and then move the servo downwards to push the button. We then wait 400 milliseconds for the servo to move and then move the servo back up for the next push and turn the LED off again..

I’ve also included a serial monitor printout of the sensor value which is used initially to measure the game’s LED set point. You’ll need to run the game and see what value is measured by the sensor when the reaction timer’s LED is on and then update this value in the code accordingly. Once you’ve done this, then remove or comment out this code so that it is now slowing down the loop for the actual test. We’ll look at this in the next step.

Calibrating The Light Sensor

If we upload the code and then open the Serial Monitor, we get a stream of input values read from the sensor, detecting the ambient light. Now press the button on the reaction timer to start a game and look out for the change in values when the LED comes on.

Results When Calibrating The Arduino

You can see that we get a reading of around 775 when the LED is off and it goes up to around 830 when the LED is on.

We can now go change the setpoint value to a value just above the off value so that it triggers the servo movement as soon as the LDR starts to register the change in light. You want it to trigger as the LDR starts detecting the light change as the LDR will “slowly” ramp up to the maximum value over a couple of milliseconds.

Remember to comment out the Serial communication for the final version as you want the code to be as quick as possible.

Let’s upload the code and see how it quick it is.

Testing The Reaction Time Of The Arduino

Press the button once to start the game and then quickly position it under the reaction servo.

Reaction Time of 54 Milliseconds

For the first run, we get a reaction time of 54 milliseconds, which is pretty quick considering we have to wait for the servo to move to push the button as well.

I tested it a couple of times like this and consistently got around 50 to 60 millisecond reaction times.

Some Delay In The Movement Time On The Servo

Watching one in slow motion (included in the video at the beginning), you can see that the LED comes on really quickly after the reaction timer’s LED turns on, but there is a bit of a delay in getting the servo to move. By looking at the individual frames, I calculated that it takes around 8 milliseconds LED to come on after the reaction timer’s LED is turned on, the servo then takes around 50 milliseconds to press the button after this.

I Tried Taping Over The LDR To Make It Darker

I then tried to see if making it darker around the LDR with some tape would result in a faster response time. It didn’t really make much of a difference, although there was a very slight improvement of around 1-3 milliseconds.

Turning Off The Reaction LED As Well

I also tried disabling the LED so that the Arduino just had to move the servo, this improved the reaction time by almost 10 milliseconds, so I got times around the mid-forties.

Conclusion

So from this test, we can see an Arduino react to an external light source in under 10 milliseconds, the servo movement takes up most of the reaction time from there. With the movement of a servo, the response time is just less than 50 milliseconds.

Arduino Reacting To Reaction Timer

There are ways to further improve an Arduino’s response time by using Direct Port Manipulation, but this is probably not going to make a significant difference in this example, as the delays in the LED lighting up, the LDR responding to the light and the second LED lighting up is much more significant than the amount of time the Arduino takes to respond to the input.

Have you tried building any projects which required your Arduino to react quickly? What have you built? Let me know in the comments section below.

Can I Get An Arduino To Run For A Year On A Single 18650 Battery?

I recently looked at how much power some common Arduino boards consume and how long we’d be able to power them using one or two 18650 batteries. I found that I could power a 3.3V Arduino Pro Mini using a single 3.7V lithium-ion 18650 battery for 117 days in lower power mode. This got me thinking. What else could be done to make the Arduino Pro Mini even more power-efficient? How long could I get it to last? So I did some research and testing to find out.

For each test, I’ve included two battery capacities in my calculations, one for the 4200mAh claimed on the test batteries and one for the more commonly available 3500mAh batteries. I’ve then calculated the number of hours, days and years of run time for each modification and each battery. I’ve put these results into a table at the end.

Here’s the video of the modifications and the results, otherwise read on for the full write-up.

Testing The Standard Board With A Single 18650 Battery

Let’s start with the standard board with no power-saving or sleep mode active and no hardware modifications to use as a baseline.

I loaded a basic sketch onto the Arduino which simply waits 8 seconds, then flashes the onboard LED for 100 milliseconds.

Arduino-Power-Consumption-Sketch-Delay

I then connected the single lithium-ion 18650 battery to the GND and RAW pins with the multimeter hooked up on the GND lead to measure the current being supplied to the Arduino.

Arduino Pro Mini Normal Operation

So with no modifications, a 3.3V Arduino Pro Mini uses around 5.4 milliamps. Meaning that it could run for around a month on either the 4200mAh or the 3500mAh battery, the difference is only a couple of days.

Testing Low-Power Sleep Mode

The Atmega chips on the Arduino Pro Mini supports a number of different sleep modes that turn off any unused peripherals in order to conserve power when the Arduino is running on batteries. So let’s try putting the Arduino into a low power sleep mode between flashing the LED, using the following sketch and the LowPower library.

Arduino-Power-Consumption-Sketch-Low-Power-Mode

We’ll keep all of the connections and hardware the same the same for this test.

Arduino Pro Mini Low Power Sleep Mode 18650 Battery

So this mode has decreased the current draw to around 1.5 milliamps, which means that the Arduino will last almost 4 months on the 4200mAh battery and a little over 3 months on the 3500mAh battery.

Remove The Built-In Power LED

Now let’s try making some physical modifications to the board in order to conserve more power.

The first and probably most obvious thing to do is to get rid of the on-board power LED. These small LEDs don’t draw much power, but when we’re trying to power the board for over a month using a single battery then even small consumption items like these can become significant. It’s also not particularly useful to have an onboard power LED if the board is going to be in a housing or box.

Remove Power LED From Arduino

Because its a surface-mounted component and there are components alongside it, the easiest way to disable it is to break it off of the board with pliers or some wire cutters. You could also cut through one of the supply traces on the PCB.

Power LED Removed From Arduino Pro Mini

Now let’s see what improvement we’ve made.

Here’s the current draw shown in milliamps.

No Power LED Current Draw In mA On 18650 Battery

Let’s try switching the multimeter to microamps to get better resolution.

No Power LED Current Draw uA On 18650 Battery

So the supply current has reduced from 1.5 milliamps to 0.058 milliamps or 58 microamps, which is a substantial saving. We’re now using 25 times less power than with just the power-saving mode activated, and all we’ve done is remove an LED which we probably wouldn’t have seen anyway.

So we’ve got an extra 2900 days of run-time by removing the LED. Your Arduino should now last for 8 years on a single charge on the 4200mAh battery and 7 years on the 3500mAh battery.

In practice, this will obviously be less, because your Arduino will also be doing some more complicated processing between sleep cycles, not just flashing an LED, but depending on how often and for how long it wakes up, this is what is possible.

You’ll also need to consider that an 18650 battery has a charge life of around 1 year, meaning that it slowly loses its charge over about a year to a year and a half. So your battery is actually losing its charge faster than the Arduino is using the power. If you’re going to be building really long term projects then you’ll probably want to use non-rechargeable batteries as these typically have a longer shelf life. Non-rechargeable lithium batteries generally have a shelf life of around 10-12 years.

For most projects, 8 years is more than enough and your components will likely pack up before the battery is empty. But why stop there? Let’s see if there is any other way we can further improve battery life.

Remove The Onboard Voltage Regulator

The next thing I’m going to try is to remove the voltage regulator. The 3.3V regulators which are typically used on these boards are not very efficient at very low currents, you usually only get around 10-20% efficiency on the low end of thecurve. Replacing the regulator with a linear regulator, such as an MCP1700 will dramatically improve the battery life of your Arduino as well. This is a bit more complicated to do, you’ll need a steady hand and some patience to remove the surface mount voltage regulator from the board and replace it with a new one.

The other option is to remove the voltage regulator altogether. The ATmega328P chip can actually support input voltage levels between 2.7V and 5.5V, however the voltage on the IO pins will vary with the input voltage as well. This may not be a problem if your IO devices can handle the fluctuating voltages, as is often the case with LEDs, pushbuttons and relatively simple OLED displays. We’re going to try this method and see if the Arduino will still run and flash the onboard LED while using less power during sleep.

In order to remove the voltage regulator, I also just used some wire cutters and pulled the regulator off of the PCB.

Removing The Voltage Regulator From An Arduino Pro Mini
Voltage Regulator Removed From Arduino Pro Mini

You’ll also need to make a slight modification on your breadboard. With the voltage regulator removed, you’ll now need to power your board by connecting the 18650 battery to the GND and VCC pins. Connecting the battery to the GND and RAW pins will do nothing.

With the multimeter in milliamps, it doesn’t even register the current draw, but the LED is flashing, so the Arduino is still working.

Arduino Pro Mini Without A Voltage Regulator In Milliamps

Let’s try switch it to microamps.

With the voltage regulator removed, our board is now drawing 5 microamps in sleep mode.

At 5 microamps we’re now up to 35,000 days on a single 4200mAh 18650 battery. This is also now pretty close to what the ATmega datasheet claims for power down sleep mode, so it’s unlikely that we’ll be able to reduce this much further.

You’ll notice a brief spike in the current reading when the LED flashes as the Arduino wakes up and supplies power to the LED.

Current Spike When Arduino Wakes Up And Powers LED

So we now have an Arduino which will theoretically run for 96 years on a single 18650 battery. That’s way better than I thought we’d be able to do!

Let me know in the comments section what low power projects you’ve built using an Arduino and how long your batteries typically last.

Sustainable Home Perks to Use on Your Own House

With environmental consciousness rising globally, many homeowners are starting to recognize the importance of building a sustainable home. Even the Hollywood stars are seeing the impact of their lavish lifestyles and realizing how they can sometimes be unsustainable. While some are putting effort into creating energy-neutral homes, others are becoming green activists. While us, regular folks, may not change the homes we live in entirely, we may improve our ecological footprint by borrowing some ideas from sustainable homes. And the best part – most of these ideas involve DIY in one way or another.

Food

The first thing that comes to mind is food. Organic, locally grown food is your aim. Every patch of land around your home can be used to grow your own food. Even the inside of your home can serve this purpose. While you may not be able to make this the only source of your food, you can reduce your costs a lot. Investing in a greenhouse will provide you with vegetables throughout the year. More ambitious people can consider building a DIY fishpond or even growing a couple of chickens. It doesn’t take that much work. Of course, these are the options for those that have the space for this.

Sustainable Home Perks

Energy

First, keep the energy and heat lost that you already spend to the lowest. This is achieved by insulation, responsible consumption and eco-friendly appliances. These are the things that every sustainable household has. The next steps are the solar panels and wind turbines. Needless to say, investing in these energy sources pays off in many ways. A lot of people choose to install these systems themselves, especially when it comes to home insulation. Making and installing your own home insulation can save you a lot of money, and the best part is that it can be done in an eco-friendly way by using cellulose fiber.

Solar power

One of the cleanest, greenest, and most sustainable ways to power your home is by relying on solar energy. The best place to start would be to learn more about your home’s energy efficiency. Next, you want to assess your home’s solar potential and estimate how much solar electricity your home will need. After that, you can proceed to obtain bids from solar installers. In order for your home solar power system to perform at an optimal level, you’ll also need to invest in high-quality components such as a high-powered solar inverter while keeping in mind the size, capacity, input voltage, and the type of inverter. Installing a home solar power system can also earn you rebates and tax credits, not to mention the giant favor you’ll be doing to Mother Nature by switching to renewable energy sources.

Solar Power

Water

Water is recycled and harvested from the rain. The water that you use for showering and washing your clothes and dishes is cleared and used to water the plants in your greenhouse. A rainwater harvesting system can provide you with the majority of the water you need. This will cut down the yearly bills for water significantly. For this system to work, you need to make sure you have all the filters needed to avoid polluting the greenhouse with cleaning products you use. Perhaps you don’t have a garden to water or but you can build the system that will reuse that water for flushing. You can even build it yourself.

Comfort

Some people have prejudice when it comes to sustainable living. Regardless of their thinking, it doesn’t have to be basic and cave-like. All the perks of modern life are still there for you to use. You use energy and water in a smart way and get hold of it in a way that doesn’t involve paying for it. This is true for fully sustainable households. Yours doesn’t have to be that way, but it will definitely benefit from some of these things.

Living free from bills, costs and credit rates in your own solar home is a dream come true for many people. Some of them even managed to pull this off and now they live fully sustainable lives. However, this kind of life means changing all your habits entirely. For the time being, using the experience of sustainable living to save some money and improve your home will be enough.

Sustainable Home Comfort

How Long Can An Arduino Run On Batteries? I Tested 6 Of The Most Common Boards

I recently built a soil moisture monitor, which relies on a 18650 lithium-ion battery to power it. This got me wondering which Arduino would be best to use for a battery-based project and what can be done to improve the battery life. So, in this test, we’re going to be looking at the power consumption of a number of different Arduino boards with the aim being to try and power them for as long as possible using two 18650 lithium-ion batteries.

Here’s a video of the test, read on for the test write-up:

Setting Up The Test Rig

Let’s get started by showing you what I’m going to be using for the test and how I’m going to be testing each Arduino using the batteries.

These 18650 batteries are 3.7 voltage each and come in a range of capacities from around 1800 to 4500mAh. The ones used for this test are on the higher end, at 4200mAh, meaning that they can supply 4.2mA for 1000 hours or 420mA for ten hours or any combination of current and time for which the product is 4200.

Two 18650 Lithium Ion Batteries

Most Arduino boards require a minimum input voltage of around 6V, so we’ll be powering each Arduino using two batteries connected in series, with an input voltage of 7.4V to power these boards. I’ve also included a 3.3V Pro Mini, which is able to run on a single battery as a comparison.

4000mAh 18650 Lithium Ion Batteries – Buy Here

We’re going to be testing the power consumption of 6 different Arduino boards:

Arduino Power Consumption On 6 Boards

I’m going to be loading a basic sketch onto each Arduino which has has an 8 second delay and then flashes the onboard LED for 100milliseconds just to tell us that the sketch running and this will just loop repeatedly.

Arduino Power Consumption Sketch - Delay

The Atmega chips on these boards support a number of different sleep modes that turn off any unused peripherals in order to conserve power when the Arduino is running on batteries.

Atmega Chip Sleep Mode

I’m not going to go into too much detail on how this works, but we’ll be using a low power library that enables you to put the Arduino to sleep for a certain amount of time or until an interrupt is triggered.

So, I’ll include two tests for each board, one without sleep mode and one in which the Arduino is put to sleep for the 8 seconds between flashes instead of running a delay. I’ll discuss this option a bit later when we look at the difference in power consumption.

Arduino Power Consumption Sketch - Low Power Mode

I’ve connected the two batteries in series and then connected them to my multimeter to measure the current draw. The multimeter is going to be showing the current drawn in milliamps.

Arduino Power Consumption Test Rig

Fluke 17B+ Multimeter – Buy Here

Testing The Arduino’s Current Draw

Now that the test rig and sketches are ready, let’s start testing the Arduinos.

We’ll start off with the Arduino Uno, since it’s one of the most common boards available. This board is designed to be robust and easy to use rather than power efficient or compact, so I doubt it’s going to do very well in the power test, but let’s try it out as a starting point.

Arduino Uno Normal Mode

In each test, I’ll allow the current to stabilise for a bit and then record the average current drawn during the delay time. We’ll ignore the peak current drawn while the led flashes as this only happens for 100 milliseconds every 8 seconds, which is only around 1% of the time.

On the Uno in normal mode, we get a current draw of 54.4mA, which means it would run for about 77 hours or three days on the two 18650 batteries.

Now let’s load the sleep sketch and see if there is any difference.

Arduino Uno Low Power Mode

If you watch the video, you’ll notice the current spike briefly when the LED flashes and then return to the low power mode current draw.

So if we use the sleep mode between flashes, the current consumption goes down to 38.2mA. So we expect it to be able to run for around 110 hours or 5 days.

Now let’s try an Arduino Mega. We’d expect the Mega to be the worst performer as it’s the largest board, has the most IO and the most complex chip on it.

Arduino Mega Normal Mode

As expected, this board draws a bit more power than the Uno, it draws around 77.7mA, so it would only last for 54 hours or 2 days.

Now let’s look at the Mega in low power mode.

Arduino Mega Low Power Mode

So in low power mode, an Arduino Mega draws around 31.7mA and would run for about 132 hours or 6 days.

Next we have a Nano. I’d expect the Nano to be the most efficient board so far as it’s designed for smaller, more portable projects and is a lot more compact than the Uno or Mega.

Arduino-Nano-Normal-Mode

The Nano seems to be a lot more efficient than the Uno or the Mega. The Nano draws 25.5 milliamps, so we’d expect it to run for 165 hours or 7 days.

Now let’s try the Nano in low power mode.

Arduino Nano Low Power Mode

Using the sleep mode sketch, the Nano draws only 6.4 milliamps, so it would run for around 656 hours or 27 days. So we’re almost at a month. Let’s see if the Pro Micro can get to a month.

Next let’s try a Pro Micro in normal mode.

Arduino Pro Micro Normal Mode

The Pro Micro actually did a lot worse than the Nano, which I didn’t expect. I thought that it would be similar, if not better, than the Nano. It drew around 43.4mA, so it would last for only 97 hours or 4 days.

Now let’s try low power mode.

Arduino Pro Micro Low Power Mode

In low power mode, the Pro Micro drew 9.25mA, so it’s much better than the Mega and Uno but the Nano is still the most efficient.

Next, we’re going to try powering a Pro Mini. This is a very similar form factor to the Pro Micro but it has a different chip and the onboard USB host has been removed, so you need an external programmer to connect it to your computer.

First we’ll try the 5V Pro Mini in normal mode.

Arduino Pro Mini 5V Normal Mode

The Pro Mini uses just 19.1mA, which is a little less than the Nano, and means that it will last around 220 hours or 9 days.

Now let’s try the 5V Pro Mini in low power mode.

If we put the Pro Mini to sleep between flashes, it uses just 3.2mA, which means that it will run for 1313 hours or 55 days, we’re now getting closer to 2 months.

Lastly, let’s try the 3.3V Arduino Pro Mini and see if it does better than the 5V version. We’ll still be powering the 3.3V Pro Mini using the two 18650 batteries for this first test.

Arduino Pro Mini 3.3V Normal Mode

The 3.3V Pro Mini draws substantially less current than the 5V version, just 5.5mA, which is even better than the Nano in low power mode. So it will run for a month in normal mode, let’s see how long it will run in low power mode.

Arduino Pro Mini 3.3V Low Power Mode

The 3.3V Pro Mini uses just 1.6mA in low power mode, so it will run for around 109 days, which is a bit over 3 months.

Let’s see if that changes if we power it with just one battery. Remember that if we’re halving the input voltage, we’d expect the current to increase to supply the same amount of power to the Arduino.

Arduino Pro Mini 3.3V at 3.7V Low Power Mode

Strangely, there was actually a slight decrease in input current. This is probably due to the onboard voltage regulator being more efficient at voltages closer to the operating voltage. So you’ll actually get better battery life by powering a 3.3V pro mini with a single 18650 battery. You’ll get almost 4 months.

The Results, How Long Can Each Arduino Run On Batteries?

Now that we’ve completed the test for each board, lets look at how long each Arduino can run on batteries.

Arduino Boards Current Draw Comparison Table - Arduino Running on Batteries

The most power-efficient board in both modes is the 3.3V Pro Mini, lasting almost 4 months on a single 18650 battery.

There’s also a significant decrease in power consumption when using sleep mode, so you should definitely consider using it if you’re designing battery-based projects.

Now you obviously can’t have the Arduino sleeping the whole time, it’s actually expected to do something if it’s connected up to a project. But, on most projects where you’d be looking to power the Arduino using batteries, you’re only using the Arduino for a fraction of the time that the system is powered up.

Soil Moisture Monitor

For example, if we look at a soil moisture monitor, the soil doesn’t suddenly dry up in a couple of milliseconds, and even watering the plant takes a minute or two for the water to be evenly soaked up into all of the soil. Also, your plant isn’t going to die if its roots are dry for 2 seconds. So, you really only need to take soil moisture readings in minute intervals rather than every couple of hundred milliseconds. You could, therefore, have your Arudino sleep for a minute, then take the measurements over a few hundred milliseconds and then sleep again, so your Arduino would be sleeping for most of it’s “on” time.

Weather Station

Similarly, for weather stations, even rapid outdoor temperature changes only change over a number of minutes. So, you can set your Arduino to wake up every 5 minutes and take a new temperature and humidity measurements, rather than take measurements on every loop cycle.

It’s also important to note that there’s a difference between putting the Arduino to sleep and simply putting delays into your code. Delays don’t stop the Arduino from processing operations, they just tell the Arduino not to proceed until an amount of time has passed.

You can think of the two like this; putting a delay into your code is like having a child asking “are we there yet”, “are we there yet”, “are we there yet” over and over until the answer is yes and it’s able to proceed. Putting the Arduino to sleep is like setting an alarm and allowing the Arduino to do nothing until the alarm rings and wakes it up again. You’ll get much longer battery life by allowing your Arduino to do nothing between readings rather than constantly checking if the amount of time has elapsed.

Look out for the next test, in which I’m going to try and further reduce the power consumption of a 3.3V Arduino Pro Mini and see if we can get it to run for over a year on a single 18650 battery.

Let me know in the comments section what battery based Arduino projects you’ve built.

Hanging Gear Weather Station – Driven By Stepper Motors & An Arduino

In this project, I’ll be showing you how to build your own hanging gear weather station, which is made from laser-cut MDF components. An Arduino Pro Micro uses a DHT11 sensor to take temperature and humidity measurements and then drives two stepper motors to turn the hanging gears to indicate the measured values.

The weather station is supported by two legs on a flat base, making it perfect to stand on your desk, or on a shelf or side table.

The DHT sensor has a range of 20-95% relative humidity and can measure temperatures between 0-50°C. I’ve designed the gears for the full humidity range and with a negative temperature range so that you can easily use a different sensor if you’d like to place the sensor outside to measure the outdoor conditions.

The stepper motors are almost silent and their noise level can be adjusted by slowing down their movement, so you won’t be bugged by them if you use the weather station on your desk.

Here’s a video of the build and weather station in operation:

What You Need To Build Your Weather Station

Building Your Hanging Gear Weather Station

We’ll start off by laser cutting the MDF components, then assemble the electronics and install these onto the MDF components, then finish the assembly of the weather station and then finally program and set up the Arduino.

Laser Cut The MDF Components

I designed the laser cut components in Inkscape. The components are all on a single sheet in the download, so you’ll need to split them up to suit the bed size of your laser cutter.

Designed The Weather Station Components In Inkscape

I used a cheap K40 laser cutter to cut and engrave these components. If you don’t have access to a laser cutter, consider using an online laser cutting service. There are a number of services available online and most will even deliver the components to you once they’re cut.

I started out by engraving and then cutting the gears. I always use masking tape over the MDF when engraving or cutting so that the smoke doesn’t mark the surface.

Laser Engraving The Gears
Laser Cutting The Gears

I then engraved and cut out the front panel, and finally cut out the remaining stand components.

Laser Cut Weather Station Components

Once all of the parts have been cut, you’ll need to remove the masking tape from them.

Remove The Masking Tape

Installing The Stepper Motors

Next secure the two stepper motors to the front plate using two M3 x 10mm machine screws for each motor.

Install The Stepper Motors With Screws

It’s a good idea to glue the stand support plate with the cutout for the motors to the back-side of the front panel before adding the motors, as it’s a bit easier than having to work around the motors later. It’s best to use wood glue to glue the MDF components together.

Back Plate For Motors

Next, you’ll need to assemble the gears.

Stack your gear pieces onto your servos with a drop of wood glue between each. Start with the disc with a hole in it and then the gear.

Assemble The Motor Gears

You’ll then need to add a small spacer between the gear and the front disc to create a bit of room for the gears to move freely. I used a flat washer for each of these. You could even use a small circle of thick card or plastic.

Install The Spacer Washers
There Should Be Some Space Between The Gear Components

Assemble The Electronic Components

Here is a sketch of the connections between the Arduino and the DHT sensor and stepper motor drivers:

Wiring Connection Diagram

The circuit is quite simple and includes basic connections from digital IO pins 2 to 9 to the two stepper drivers and then a connection between the DHT11 sensor data pin and digital IO pin 10. You’ll also need to add your power connections to the sensor and stepper drivers as well as a 10k resistor between the connection to digital pin 10 and 5V.

I assembled the header pin connections and DHT sensor onto a prototyping PCB so that the Arduino and stepper motor drivers could just be plugged into it.

Assembled PCB And Headers For Motors On Weather Station

I then made up some Dupont connector cables to connect the PCB and the stepper motor drivers. You can use jumpers or create your own header cables by soldering some ribbon cable to the female header pin connectors.

Connector Cables

Now that the electronics are complete, let’s install them onto the MDF components and complete the assembly of the weather station.

Complete The Assembly Of The Weather Station

I used a glue gun to glue the Arduino PCB to the back plate of the weather station and the two stepper motor drivers onto the two side stand pieces.

Use A Glue Gun To Stick Electronic Components To MDF
Stick Motor Drivers Into Place

Once you’ve got the electronics glued into place, we can assemble the rest of the weather station using wood glue.

Components Stuck Into Place

Glue the two legs into the base and then add the front plate onto the legs.

Assemble Wooden Components Using A Glue Gun

Finally, glue the back plate into place and allow the glue to dry. Make sure that the Arduino’s micro USB port is facing towards the base of the weather station.

Assembled Wooden Components For Weather Station

Once the glue is dry, plug the stepper motors into the drivers and then connect the drivers to your Arduino using the cables you’ve made up.

Plug In Motor Cables

Try to tuck the cabling in so that it doesn’t hang out of the bottom or protrude out of the top of the back area.

Plug In The Additional Wiring

If you’d like to close up the top, use the piece cut out of the support stand plate. Don’t glue this into place until you’ve tested out your stepper drivers and connections as you may need to access the cables again to make changes.

Add A Top Cover To The Back Of The Weather Station If Required
Cover Back Of Housing

Plug your micro USB cable into the bottom of your weather station and you’re now ready to upload the code.

Programming Your Hanging Gear Weather Station

Now that your hanging gear weather station is built, you need to program the Arduino to take temperature and humidity measurements from the sensor and move the stepper motors to display the measured values.

Here is the sketch:

//The DIY Life
//Weather Station
//28 July 2020

#include "DHT.h"          //Import the required libraries for the sensor

#define DHTPIN 10         //DHT Sensor Pin
#define DHTTYPE DHT11     //DHT 11 Temperature & Humidity Sensor
DHT dht(DHTPIN, DHTTYPE);

int tempPins[] = {2,3,4,5};   //Define the temperature motor pins
int humidPins[] = {9,8,7,6};  //Define the humidity motor pins

int temp = 25;                //Create a variable for the temperature
int stepsPerDeg = 338;        //The number of motor steps for 1 degree celcius on the gear
int humid = 50;               //Create a variable for the humidity
int stepsPerPer = 69;         //The number of motor steps for 1 percent on the gear
int movementSpeed = 30;       //The motor movement delay in milliseconds

void setup(void) 
{
  Serial.begin(9600);         //Used initially to display measured values
  for (int i = 0; i <= 3; i++) 
  { 
    pinMode(tempPins[i], OUTPUT);   //Assign the motor pin functions
    pinMode(humidPins[i], OUTPUT);
  }
  dht.begin();                      //Connect to the DHT Sensor
  delay(2000);
}

void loop(void) 
{
  float startTime = millis();
  int newTemp = dht.readTemperature();   //Read in the current temperature
  int newHumid = dht.readHumidity();     //Read in the current humidity
  Serial.println(newTemp);               //Display values on serial monitor
  Serial.println(newHumid);
  int tempDiff = newTemp-temp;           //Calculate the difference between the actual indicated values
  int humidDiff = newHumid-humid;
  temp = newTemp;                        //Set the current values to the updated values
  humid = newHumid;
  int tempSteps = abs(stepsPerDeg*tempDiff);  //Calculate the number of motor steps to get to the new value
  int humidSteps = abs(stepsPerPer*humidDiff);
  bool tempDir = 0;                      //Create variables for the motor movement directions
  bool humidDir = 0;
  if (tempDiff < 0)                      //Set the motor movement directions
  {
    tempDir = 1;
  }
  if (humidDiff < 0)
  {
    humidDir = 1;
  }
  moveMotors(tempSteps, tempDir, humidSteps, humidDir);   //Call the moveMotors function to move the two motors
  float endTime = millis();
  if (endTime-startTime < 5000)    //Wait at least 5 seconds between updates
    delay(5000-(endTime-startTime));
}

void moveMotors(int tempSteps, bool tempDir, int humidSteps, bool humidDir) 
 //Function to move motors
{
  for(int i=0; i<tempSteps ; i++)      //Move the temperature motor the required number of steps
  {
    static byte out = 0x01;
    if (tempDir)                       //Set the temperature motor direction
    {
      out != 0x08 ? out = out << 1 : out = 0x01; 
    }
    else
    {
      out != 0x01 ? out = out >> 1 : out = 0x08; 
    }
    for (int i = 0; i < 4; i++)        //Ring out the motor movement
    {
      digitalWrite(tempPins[i], (out & (0x01 << i)) ? HIGH : LOW);
    }
    delay(movementSpeed);              //Wait the delay time between steps
  }
  for(int i=0; i<humidSteps ; i++)     //Move the humidity motor the required number of steps
  {
    static byte out = 0x01;
    if (humidDir)                      //Set the humidity motor direction
    {
      out != 0x08 ? out = out << 1 : out = 0x01; 
    }
    else
    {
      out != 0x01 ? out = out >> 1 : out = 0x08;
    }
    for (int i = 0; i < 4; i++)        //Ring out the motor movement
    {
      digitalWrite(humidPins[i], (out & (0x01 << i)) ? HIGH : LOW);
    }
    delay(movementSpeed);              //Wait the delay time between steps
  }
}

We start by importing the library for the DHT11 sensor. We then assign the sensor pin and create a sensor object using the correct sensor type.

We then assign the pins for the two stepper motor drivers.

We then create variables for the temperature and humidity measurements as well as two values for the number of steps the stepper motors need to make in order to move the temperature gear by one degree and the humidity gear by one percent.

The values set as the temperature and humidity here are the initial values that should be set when you place the gears onto the motors before powering up the weather station. The gears will then move to the correct measured values from these starting values. You can make adjustments to these values if you’d like to more accurately suit the measured values you expect.

We also have a motor movement speed. The speed is essentially a delay between steps in milliseconds, so a higher value is a slower speed.

In the setup function, we start serial communication, which is used to see what the actual measured values are in order to compare them with what is displayed during the initial calibration and setup.

We then assign the stepper motor driver pins numbers and then connect to the DHT sensor.

In the loop function, we record the start time for the cycle. Then take a new temperature and humidity measurement. We display these on the serial monitor and then calculate the difference in temperature and humidity from the last measurements taken. We can then replace the old measurements with the new measurements.

We then take the differences and convert them into a number of steps required to get to that indication on each gear, then set the directions of motor movement and then call a function called moveMotors to move each of the motors the required number of steps and in a particular direction.

Finally, we check to see that at least five seconds have passed between each update. If not, because neither gear moved in that cycle, the delay waits out the additional time until 5 seconds have passed. This delay can be increased or decreased depending on how quickly your environment is likely to change. If you’re in a large room of outdoors then you could change the update time to be every couple of minutes rather.

The move motors function just rings out the movement of each motor by the required number of steps and in the required direction, with a short delay between each pulse to slow the motors down.

That’s the code, now let’s see how it works.

Setting Up And Using The Weather Station

Before you upload the code, place the two gears onto the motors, setting them to indicate the values set up initially in the code, these were 25°C and 50% humidity in my code.

Add Gears At Correct Starting Points

You can then upload the code.

If you open up your serial monitor, you’ll see the first measurement taken by the sensor and the motors will then start moving the gears to get to these values from the initial values. Mine were 22°C and 62% relative humidity.

Weather Station Gears Will Then Move Into Position

Once the movement finishes, you should see a second set of values and the gears may move again.

Temperature And Humdity Shown On Two Gears

It usually takes a couple of minutes for the sensor readings to stabilise and you’ll then get move consistent data and less movement of the gears.

Calibrating The Gear Movement

If you notice that your displayed values are not the same as those shown in the serial monitor, first check that your motor movement directions are correct, then check your initial values are correct. If both of those are correct, you may need to make adjustments to the number of steps per degree or percent values in order to calibrate your weather station.

To do this, set the gear you’re calibrating to a known position, say 0°C or 0% humidity, and then set the corresponding motor to move a certain number of steps, the more the better. I’d suggest using around 5000 steps for each as a starting point. Wait for the motor to move the set number of steps and then make a note of the finishing position. In order to calculate the stepsPerDeg or stepsPerPer, simply divide the total number of steps moved by the motor by the number of degrees or percent moved on the gear.

For example, if I set my temperature motor to move 5000 steps and it moved from 0°C to 14.8°C, then my stepsPerDeg value should be 5000/14.8 = 338. Meaning that the motor needs to move 338 steps to move the temperature gear by one-degree celsius.

That’s it! Your weather station can now be set up on your desk or shelf to indicate the current temperature and humidity.

Let me know in the comments section if you’ve built a weather station before and what you used to display the values.

Share This Project

Hanging-Gear-Weather-Station-Social

Arduino Soil Moisture Monitor – Never Forget To Water Your Indoor Plants

Do you often forget to water your indoor plants? Or perhaps you give them too much attention and over-water them. If you do, then you need to make yourself a soil moisture monitor. This Arduino based, battery-powered monitor uses a captive sensor to measure the moisture level of the soil it is stuck into and then flashes LEDs and provides an OLED display readout telling you whether you’re over or under watering your plant.

Two potentiometers on the monitor allow you to set a maximum and minimum moisture level which then activates either the red LED, to indicate a low moisture level, to tell you that you need to water your plant, or the yellow LED on a high moisture level, to tell you that you’re overwatering your plant. You can also push the button next to the display to turn on the OLED display and to see the exact moisture level as well as the two set points.

Here’s a video of the build and the monitor being turn on and used, read on for the step by step instructions to build your own.

What You Need To Build Your Own Soil Moisture Monitor

Components Required

To Power The Monitor

How To Build Your Soil Moisture Monitor

Assembling The Electronics

I started out by designing the circuit, with the intention of making it into a PCB. There are quite a few external components to this monitor, so a PCB helps make assembly easy, with fewer loose wires, and makes the monitor into a more robust device that can be mounted onto the moisture sensor spike.

Soil Moisture Monitor Schematic

If you don’t want to build the monitor onto a PCB, it can also be easily assembled onto a breadboard and you can just use the lead included with the capacitive moisture sensor to connect the sensor to the breadboard.

Soil Moisture Monitor PCB

I ordered the boards from PCB Way, which charges only $5 for 5 basic PCBs up to 100 x 100mm. They were manufactured and shipped out just three days later and arrived in less than a week.

PCB Way PCB Delivery

I was also really happy with the quality of the boards, they’re a lot better quality than the typical cheap PCBs available online.

Unpacking The PCBs

I’d really recommend trying them out for your own PCBs. I’ve put links to my PCB files which you can order from PCB Way if you’d like to try build your own moisture monitor.

PCB Quality

The board is designed for a 3.3V Arduino Pro Mini to be run on a single 18650 lithium battery, but you can also use a 5V Pro Mini, you’ll just need to use a higher voltage battery pack to supply the board and use 220Ω LED resistors.

If your Arduino Pro Mini came without the header pins attached, you’ll need to start by attaching them. Also, remember that this design needs the two analog pins A4 and A5 to communicate with the OLED display, so don’t forget to add these two pins as well.

Ensure that pins A4 and A5 Are Added

Solder the components into place on the circuit board, paying attention to the orientation of the LEDs and the tactile push-button.

Solder All Components To The Board

In order to connect the moisture sensor to your circuit board, you’ll need to remove the connector which comes pre-soldered onto the sensor. You can then add three male header pins and solder the sensor directly onto your circuit board.

Once you’re done, use some side cutters to clip the ends off of the header pins to make the board more compact.

Trim the pins on the back of the PCB

Your soil moisture monitor is now complete and just needs a power source.

Completed Soil Moisture Monitor

I powered my monitor using a single 18650 lithium cell mounted into one of these USB charging boards. You can use a different battery if you’d like or power your monitor using a USB charger or power bank.

Powered with an 18650 Lithium Battery Holder

Connect your battery pack or power supply to the power supply terminals on the side of the circuit board, paying attention to the polarity.

If you’re using a single battery, or a compact battery pack, try glue the battery to the back of the circuit board so that it’s all one unit.

Programming Your Monitor

To program the Arduino Pro Mini, you’ll need to use a USB programmer. Plug jumpers between the programmer and the header strip on the circuit board, making sure that the programmer pins go to the correct Arduino pins and that you use the correct Vcc voltage pin on the programmer to suite the board you are using, 3.3V for the 3.3V Pro Mini and 5V for the 5V Pro Mini.

Use A USB Programmer To Program The Arduino

You’ll also need to use the programmer when you’re using Serial communication to transmit the sensor values to your computer in order to calibrate your moisture monitor.

Here is the code:

//The DIY Life
//Michael Klements
//31 July 2020

#include <SPI.h>                                  //Import the libraries required for the display and low power mode
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <LowPower.h>

#define SCREEN_WIDTH  128                         //OLED display width, in pixels
#define SCREEN_HEIGHT 32                          //OLED display height, in pixels

#define OLED_RESET     -1                         //Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); //Create the display object

#define statusLED 4                               //Define the LED & sensor pins
#define lowLED 5
#define highLED 6
#define sensorPin 10                              //Only used for the additional low power settings

#define dryCal 1000                               //Define the wet and dry calibration limits
#define wetCal 500

#define buttonPin 2                               //Define the button pin number

#define moisturePin A0                            //Define the analog input pin numbers
#define lowSetPin A1
#define highSetPin A2

int moisture = 0;                                 //Create variables for the analog inputs
int lowSet = 0;
int highSet = 0;

int cycleCount = 0;                               //Create a counter to flash the status LED

void setup() 
{
  Serial.begin(9600);
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);      //Connect to the display
  display.clearDisplay();                         //Clear the display
  display.setTextSize(1);                         //Normal 1:1 pixel scale
  display.setTextColor(SSD1306_WHITE);            //Draw white text
  display.setCursor(10,5);                        //Display splash screen
  display.print(F("The DIY Life"));
  display.setCursor(10,15);
  display.print(F("Soil Moisture Meter"));
  display.display();
  delay(2000);
  display.clearDisplay();                         //Clear display
  display.display();
  pinMode(statusLED, OUTPUT);                     //Set the pin modes
  pinMode(lowLED, OUTPUT);
  pinMode(highLED, OUTPUT);
  pinMode(sensorPin, OUTPUT);
  pinMode(buttonPin, INPUT);
}

void loop()
{
  updateValues();                                 //Call the function to update the analog input values
  if (digitalRead(buttonPin) == HIGH)             //If the button is pushed
  {
    while(digitalRead(buttonPin) == HIGH)         //While the button stays pushed
    {
      display.clearDisplay();                     //Display the analog input values
      display.setCursor(10,3);
      display.print(F("Moisture: "));
      display.print(moisture);
      display.print(F("%"));
      display.setCursor(10,13);
      display.print(F("Low Setpoint: "));
      display.print(lowSet);
      display.print(F("%"));
      display.setCursor(10,23);
      display.print(F("High Setpoint: "));
      display.print(highSet);
      display.print(F("%"));
      display.display();
      delay(1000);                                //Wait 1000ms between each display update
      updateValues();                             //Get updated analog input values, allows pots adjustments to be seen
    }
    display.clearDisplay();                       //When button is released, clear the display to turn it off
    display.display();
  }
  if(moisture<=lowSet)                            //If the soil moisture level is low, flash the low LED
  {
    digitalWrite(lowLED, HIGH);
    delay(50);
    digitalWrite(lowLED, LOW);
  }
  if(moisture>=highSet)                           //If the soil moisture level is high, flash the high LED
  {
    digitalWrite(highLED, HIGH);
    delay(50);
    digitalWrite(highLED, LOW);
  }
  if(cycleCount>=5)                               //Every 5 cycles, flash the status LED and reset the counter
  {
    digitalWrite(statusLED, HIGH);
    delay(50);
    digitalWrite(statusLED, LOW);
    cycleCount=0;
  }
  LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF); //Enter low power mode for 8 seconds
  cycleCount++;                                   //Increment the cycle counter
}

void updateValues ()                                              //Function to update the analog input values
{
  //digitalWrite(sensorPin, HIGH);                                //LOW Power Mode - Turn the moisture sensor on
  //delay(200);                                                   //LOW Power Mode - Wait for it to power up and stabilise
  moisture = map(analogRead(moisturePin),wetCal,dryCal,100,0);    //Read the soil moisture measurement
  Serial.println(moisture);
  //delay(50);
  //digitalWrite(sensorPin, LOW);                                 //LOW Power Mode - Turn the moisture sensor off
  lowSet = map(analogRead(lowSetPin),0,1023,0,100);               //Read in the low setpoint pot value
  if (lowSet>=highSet)                                            //Make sure that the low setpoint cannot be greater than the high
    lowSet=highSet-1;
  highSet = map(analogRead(highSetPin),0,1023,0,100);             //Read in the high setpoint pot value
  if (highSet<=lowSet)                                            //Make sure that the high setpoint cannot be less than the low
    highSet=lowSet+1;
}

We start by importing the libraries required for the OLED display and the low power mode. The library for low power mode is used to put the Arduino into a state where it uses less power than usual in order to prolong the battery life of the monitor.

We then set up the display parameters and create the display object.

We then define the LED and sensor PIN numbers. The sensorPin is only required for the additional low power settings which are explained later on.

We then have the wet and dry calibration set points, the button pin and then the analog input pin numbers.

Finally, we have variables to read in the analog inputs and a counter which is used to flash the status LED every 5 cycles.

In the setup function, we start Serial communication, which is used during setup to get the raw sensor values to set up the calibration, then connect to the display and show a splash screen. After two seconds of displaying the splash screen, we clear the display and then define the pin modes.

The loop function is quite simple. We call a function called updateValues to update the sensor and potentiometer readings, then check if the button has been pushed. If the button has been pushed, we then have a while loop which runs until the button is released again, which displays the soil moisture reading and potentiometer set points on the OLED display and updates the displayed values once every second.

When the button is released, the OLED display is turned off again to save power and the LED set points are then checked. If the soil moisture level is higher than the high set point, then the high LED is flashed and if the soil moisture level is lower than the low set point then the low LED is flashed.

We also have an if statement which flashes the status LED every 5 cycles or around 40 seconds to tell us that the monitor is still on. This is useful if you remove the Arduino’s power LED, are described in the additional low power settings, in order to further prolong battery life.

We then put the Arduino into a low power sleep for 8 seconds in order to save battery power and then increment the cycle counter.

The update values function reads in the soil moisture level and maps the reading between the two calibration values to a moisture level between 0 and 100%.

We also read in the two potentiometer set points and map them to a 0 to 100% range and have checks to ensure that the low set point can’t be set higher than the high set point and that the high set point can’t be set lower than the low set point.

Additional Low Power Settings

You’ll notice that there are a couple of lines which have bee commented out and some notes mentioning some further low power settings.

The current setup without any code or hardware modifications draws around 8-10mA. This means that a 4200mA battery will last around 20 days before needing to be recharged.

This can be extended by connecting the Vcc pin on the sensor to the Arduino’s digital IO pin 10 so that the sensor is only turned on during readings.

Connect the moisture sensor VCC pin to the Arduino IO pin 10

The sensor alone draws about 5mA, so turning it off for 8 seconds between readings dramatically increases the battery life. This will slow the code down a bit too as you’ll need to wait for the sensor to startup and stabilise before getting meaningful readings from it. This won’t really affect the normal operation of the monitor but will be noticeable when the OLED display is on, as you’ll need to wait longer for readings to update.

Another thing to do to further improve the battery life is to physically remove the Arduino’s green power LED or cut through the PCB trace to it to turn it off. This reduces another 2-3mA.

Remove The LED From The Arduino

Doing both of the above modifications will allow this monitor to run for around 50-60 days on a single charge.

Using The Soil Moisture Monitor

When powering the soil moisture monitor on, you should first see the splash screen and then the display should turn off.

Soil Moisture Monitor Startup Splash Screen

Once off, you can push the button and then wait a few seconds for it to finish the sleep cycle and then turn the display on. You can then see the actual measured moisture level and the two set points.

Moisture Level & Setpoints Being Displayed

Calibrate The Wet & Dry Levels

Before you get meaningful information from the monitor, you’ll need to calibrate the wet and dry limits and update the values in the code.

Use the USB programmer and your Serial monitor to display the raw sensor values being read on the analog input. Start by taking readings in dry air and then in glass or jug of water, making sure that you don’t submerge any of the components. Use the maximum and minimum values displayed as the two calibration limits in the code.

Calibrate The Soil Moisture Monitor

Try The Monitor Out

Once you’ve updated the calibration limits, you should be getting more meaningful results from your monitor. You can see the moisture level go up if you put your hand around the sensor.

Use a screwdriver to set the high and low setpoints on the two potentiometers.

Use A Screwdriver To Adjust The Two Setpoints

You’ll notice that you can’t set the high potentiometers lower than the low setpoint and likewise, you can’t set the low setpoint to be higher than the high set point.

Stick the sensor into the soil in your indoor plant, making sure that the soil does not touch the electronics, and then leave it for a few seconds to stabilise.

Test Your Moisture Meter Out In A Pot

You should then get a soil moisture reading and you can start setting the correct set points depending on the type of plant you have. This may require some trial and error in the beginning as certain plants like more water than others.

I also added a simple acrylic faceplate to screw over the PCB to protect the electronic components from leaves and water droplets

Acrylic Face Plate To Protect Soil Moisture Monitor Components

Have you tried making your own soil moisture monitor? Let me know what you built and how you used it in the comments section below.

Share This Project

Soil Moisture Monitor Pinterest

The Easiest Way To Get Started With Arduino – Grove Beginner Kit

If you’ve been looking at getting into Arduino, but have been intimidated by the idea of having to learn both electronics and programming at the same time, then the Grove Beginner Kit for Arduino may be the answer. This kit makes it really easy to get started with learning how to connect and program a number of different sensors and output devices, without having to worry about breadboards, jumpers, and the smaller electronic components required to interface with the Arduino.

Watch my video unboxing and using the Grove Beginner Kit, else read on for the written review.

Unboxing The Grove Beginner Kit

The kit is called a Grove Beginner Kit and is available from Seeed Studio.

You can buy one of the Grove Beginner Kits from Seeed Studio for $19.95 at the time of writing this review – Buy Here

Grove Beginner Kit

The kit comes in the form of a single PCB which includes a Seeduino in the middle, which is essentially an Arduino Uno clone that has been adapted to include 12 Grove connectors, surrounded by 10 Grove modules.

Grove Beginner Kit Inside

Briefly looking at the included modules, you get an LED, a buzzer, an OLED display module, a pushbutton, a rotary potentiometer, a light sensor, a microphone or sound sensor, a temperature and humidity sensor, an air pressure sensor and finally a 3-axis accelerometer. All of these modules are already connected to the Arduino, so you don’t need to worry about doing any wiring.

Seeeduino - Grove

The kit comes with 6 included Grove cables to connect the Grove modules once removed and a micro USB cable to program the Arduino. All of the cables are neatly packed into the sides of the box.

6 Included Grove Cables
Included Mico-USB Cable

Grove modules are essentially a rapid prototyping platform, with each module designed to be a plug and play device which is connected to the microcontroller using a four-wire Grove cable. The modules are standalone components and therefore don’t require any further electronic components to work, so you can move right on to programming.

Grove Modules

The system has grown to over 300 modules and can be used across a number of different platforms, including Arduino, Raspberry Pi, Microbit and Beaglebone.

What makes this kit particularly easy to use is that the modules are already wired to the various power supply and IO pins on the Arduino through the PCB, so you can literally start programming it immediately.

Prewired To The Arduino - Seeeduino

Each module is labeled with it’s associated IO port or interface and a set of example lessons guide you through using and programming each module.

Each Module Is Labelled With It's IO Pin

What separates this kit from other pre-wired kits, is that you can also break the Grove modules and Arduino off of the PCB and use the included grove cables to connect the modules with the PCB in order to create actual projects. So you’re not limited to using all of the components in place on the PCB. You can also buy additional Grove modules and use them with the included modules and Arduino to build more complex projects.

The modules and the Arduino are designed with through-hole “tabs” which make them easy to break out of the main PCB to use on their own.

Modules Can Be Removed Afterwards

The 6 included grove cables can then be used to connect the modules to the Arduino once they have been removed. They also don’t need to only be used with the IO port assigned to them in this kit. Once removed, each module can be used with any available digital, analog, or I2C Grove port, depending on the module type.

Grove Cables Can Be Used Once Modules Are Removed

Powering It Up & Programming It

When you first plug in the included USB cable to power up the board, a demo program allows you to fiddle around with all of the sensors, using the pushbutton and potentiometer to scroll between and select different options.

Grove Beginner Kit Demo Program To Start With

This gives you some idea of what each modules does and what it could potentially be used for.

Grove Beginner Kit Demo Program

There is a digital copy of the user manual available for download from the product page. I’d suggest downloading the last file, called all resources in one, which includes all of the required libraries and the example lessons and projects referenced in the manual. There is also some other documentation on the sensors used on the Grove modules as well as the Arduino IDE.

Download The All In One File

The Grove Beginner Kit manual is pretty good and explains how to install the Arduino IDE as well as how to program and use each of the included Grove modules, along with example code and explanations.

Grove Beginner Kit User Manual

There are also two basic projects included at the end, which each make use of multiple modules and give you an idea of how the modules can be used in your own projects.

Using The Kit For Your Own Projects

Rather than take you through one of the included projects, I’ve put together an example that makes use of the temperature and humidity sensor, the potentiometer, LED, buzzer, and OLED display. All of the elements used in the code were copied over from the example Lessons and modified slightly to work together as a single project.

The OLED display shows the current humidity and temperature, read from the DHT sensor, and the potentiometer allows you to adjust a temperature set-point. If the temperature fluctuates 5 degrees above or below the set-point then the LED will light up and if it fluctuates 10 degrees above or below the set-point then the buzzer will also sound.

//The DIY Life
//Temperature & Pressure Example
//25 July 2020

#include "DHT.h"                                                          //Import the required libraries for the sensor and OLED display
#include <Arduino.h>
#include <U8x8lib.h>

#define DHTPIN 3                                                          //DHT Sensor Pin
#define DHTTYPE DHT11                                                     //DHT 11 Temperature & Humidity Sensor
DHT dht(DHTPIN, DHTTYPE);

int potPin = A0;                                                          //Set the potentiometer pin number
int ledPin = 4;                                                           //Set the LED pin number
int buzzerPin = 5;                                                        //Set the buzzer pin number

U8X8_SSD1306_128X64_ALT0_HW_I2C u8x8(/* reset=*/ U8X8_PIN_NONE);          //Create an object to control the OLED display

int setPoint = 0;                                                         //Variable for the target temperature
int alertRange = 5;                                                       //Range above or below the target to light up the LED
int alarmRange = 10;                                                      //Range above or below the target to sound the alarm buzzer

void setup(void) 
{
  pinMode(ledPin, OUTPUT);                                                //Define the component pin modes
  pinMode(potPin, INPUT);
  pinMode(buzzerPin, OUTPUT);
  dht.begin();                                                            //Connect to the DHT Sensor
  u8x8.begin();                                                           //Connect to the OLED display
  u8x8.setPowerSave(0);                                                   //Set the display modes
  u8x8.setFlipMode(1);
}

void loop(void) 
{
  float temp, humi;                                                       //Create variables to store the temperature & humidity
  temp = dht.readTemperature();                                           //Read in the current temperature
  humi = dht.readHumidity();                                              //Read in the current humidity
  setPoint = map(analogRead(potPin),0,1023,0,50);                         //Read in the pot value and scale it to a temperature range of 0-50C

  if (temp >= setPoint+alertRange || temp <= setPoint-alertRange)         //If the temperature reading is above or below the alert range, turn on the LED
  {
    digitalWrite(ledPin, HIGH);
  }
  else
  {
    digitalWrite(ledPin, LOW);
  }

  if (temp >= setPoint+alarmRange || temp <= setPoint-alarmRange)         //If the temperature reading is above or below the alarm range, sound the buzzer
  {
    analogWrite(buzzerPin, 150);
  }
  else
  {
    analogWrite(buzzerPin, 0);
  }
  
  u8x8.setFont(u8x8_font_chroma48medium8_r);                              //Set the display font
  u8x8.setCursor(0, 33);                                                  //Set the cursor positions and display the text
  u8x8.print("T:");
  u8x8.print(int(temp));
  u8x8.print("C ");
  u8x8.print("H:");
  u8x8.print(int(humi));
  u8x8.print("%");
  u8x8.setCursor(0,50);
  u8x8.print("T Set: ");
  u8x8.print(setPoint);
  u8x8.print("C");
  u8x8.refreshDisplay();
  
  delay(200);                                                               //Wait 200 milliseconds between updates
}

Upload the above code and try it out on your own Grove Beginner kit. Try adjusting the set-point to be 5 or 10 degrees above or below the actual measured temperature and you’ll see the LED light up and hear the buzzer sound at the different stages.

Test Program Running

This isn’t a particularly complex project, but it shows how easy it is to get a project up and running using this kit. The code literally took ten minutes to write up by combining pieces from the included example lessons.

Conclusion

This is probably one of the best kits for new beginners as it not only makes getting started really simple, but it still includes a number of useful modules that can be separated and used in actual projects.

It’s also a fantastic design for classroom environments, where learners can get started with connecting sensors and programming the Arduino without having to worry about getting the wiring wrong and potentially destroying the components or the Arduino. You could literally have a half-hour lesson with this kit and leave having connected a couple of sensors and programmed an Arduino with little to no prior experience.

So if having to learn electronics and programming to get into Arduino sounds intimidating to you, then this kit is perfect to break the ice and get started.

All you need is one of these kits and a computer.

Let me know in the comments section if you have a favourite beginners kit and what you like about it.

Grove Beginner Kit Unpacked

Make a Celebrity Style Lounge Area in Your Backyard

If you have a backyard, you can consider yourself lucky, as you’re already blessed with extra space in the fresh air that you can use to relax or have guests over. Sometimes people get too distracted with various ideas that they tend to make mistakes when it comes to designing the lounge. It’s understandable, since suggestions are everywhere, so it’s easy to get carried away. But do you know who seldom makes a mistake? Celebrities. Their homes and backyards are always immaculate, so if you’re looking to redesign your lounge area, take some advice from the most stylish people in Hollywood.

Reese Witherspoon’s dreamy backyard with a vegetable garden

Well, of course, we’re starting this list with Reese, the ultimate queen of everything cool. Her California property boasts a gorgeous backyard equipped with an outdoor kitchen, a swimming pool, an outdoor fireplace, a spa, and a vegetable garden. What’s not to love there? Obviously, no one expects you to have all that. After all, you’re not a Hollywood celebrity. But, what you can do is take some inspiration from Reese. For example, you can build your own DIY fireplace to replicate the stylish celebrity home look. And if you’re just as obsessed with green smoothies as Reese is, you can start your own veggie garden so you always have some greens on hand.

Next to Reese’s swimming pool, there’s a beautiful lounge area, so if you already have a pool, make sure to create a sitting area where you can relax and sunbathe during the hot summer months. If not, you can still have a lovely place only for yourself and your family.

vegetable garden

Kristin Cavallari and Jay Cutler’s perfectly private backyard retreat

This reality star has a gorgeous Mediterranean-styled villa that, of course, has a breathtaking backyard with a huge plot of grass and a lounge area with sunbeds and potted plants. So it’s perfect for tanning and relaxing with a book. The whole area is super private and secluded, so it’s ideal for dinner parties and children playdates. If you think your backyard lounge could use some privacy, consider adding privacy panels or a screen of curtains. You could also go with a green living wall – simply plant some shrubs and plants and voila – you’ve got your own private retreat!

Since the style of this reality star’s house is inspired by Mediterranean Italy, it’s no wonder that the entire side of their home overlooking the lounge is covered with elegant stone wall cladding, which further ensures the Mediterranean vibe even in the middle of Nashville.

backyard retreat outdoor lounge area

Lea Michele’s beautifully decorated patio with cozy rugs

The former Glee actress said herself that, when she was looking to buy a home, she needed something that would be her refuge from the noise, close to mountains and nature. So her backyard has a pool (duh, it’s Hollywood, everyone has a pool!) and a lot of grass surfaces. However, all of that would be nothing without a lovely patio area. Equipped with stylish outdoor furnishings and chic outdoor rugs to cozy up the place, the California dream patio looks perfectly welcoming and is ideal for evening dinners with the closest friends. Since Lea is known to be a great hostess, it’s no wonder she wanted her secret garden to be both elegant and comfortable for her guests. To make your own patio area more inviting, try to incorporate chic textiles. Pillows, blankets, and floor coverings are all great finishing touches to a comfy patio – just make sure to stick to a limited color scheme so that everything looks cohesive.

cozy rugs

Jared Leto’s gorgeously outdoor lounge with tropical plants

We know he can transform himself into almost any character and that being in a band also suits him, but Jared Leto also knows how to make a perfect-looking backyard. His place looks more like tropical heaven rather than a typical Californian backyard somewhere in Hollywood Hills. He has a pool surrounded by a lot of greenery and everything’s paved in gorgeous dark stones which just adds even more elegance to the place.

If you want to transform your outdoor area into a tropical heaven à la Jared Leto, add palm trees, various bushes, ferns, begonias, and large-leaf plants. These will help create shade and add more privacy to your backyard. Aside from planting exotic-looking greenery, you can also add water features and tropical decor, install bamboo fencing, and build your own Tiki bar to create your own tropical paradise DIY-style.

tropical plants outdoor  lounge area

So, it’s obvious that celebrities have more resources to create their dream homes than us regular folks. But that doesn’t mean that you can’t and shouldn’t dream big!

Instead of spending obscene amounts of money, try to be as creative as possible, so that your friends will be stunned by your new outdoor lounge area. Aim to create a sitting space that’s stylish and relaxing and feel free to use these celebrity examples as an inspiration.