Mobile Sun-Seeking Robot




About: I tinker with things at Instructables.

Your plant can navigate to the sunniest spot in the house with this sunshine seeking indoor planter. It's controlled by an Arduino Micro and driven by two continuous rotation servo motors. The planter seeks sunshine with the help of two solar panels that detect sunlight and differentiate true sunshine from indoor lighting. Two ultrasonic range detectors keep the planter from running into obstacles or falling off ledges.

However, a robotic planter doesn't have to look like a boring terracotta planter at your local hardware store.This planter is designed to look like a log cabin, complete with log walls, faux grass, and a watering pail that holds your plant.

Parts List

Materials for decoration

  • (x2) 4-ft long 1” diameter wooden dowels
  • 24”x 24” 3/16” thick plywood
  • Wood glue
  • Astroturf
  • Watering can
  • Epoxy

Other useful things

  • Snippers
  • Aul
  • Scissors
  • Ruler
  • X-Acto knife
  • Probably a plant for the planter

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Make the Robot's Base

The planter's electronics are kept safe and dry inside a custom-built base. The watering pail sits on top of the base and holds a plant. The pail is water-tight but can drain excess water out through its spout.

I designed the planter's base with Inventor and BoxMaker. The design is included here as an Illustrator file. To give the box a "log cabin feel", I cut 1" thick wooden dowels in half and glued them to a 3/16" piece of plywood. The walls of the box are cut from the dowel-covered plywood with a 450W laser cutter. The box's nice shading comes from placing the plywood dowel-side down onto the laser cutter's platform. The top and bottom of the box are cut from a smooth piece of 3/16" plywood with a 150W laser cutter.

Step 2: "Grow" a Box

Use scissors to cut an 8" x 8" piece of astroturf and place it onto the box top. Cut slits with an X-Acto knife into the astroturf through the top's two ovals. Wires from the robot's solar panels will run though these slits and into the planter's base. Use an awl to poke holes in the astroturf. Screws will be driven though these holes to hold 3D printed parts and mounts.

Next, make a mark on the astroturf where the watering pail will be placed. Use a cup to draw a circle around this mark and cut it out with an X-Acto knife.

Step 3: Glue the Case Together

For all the box faces except the top, paint the tabs with wood glue and clamp the walls together. Let the box dry for 2 hours.

Step 4: Attach the Grass and Watering Pail

Use two-part epoxy to secure the astroturf and pail to the box top. Squeeze quarter-size dollops of epoxy close together and mix. Apply epoxy over box top, lay grass onto the epoxy, and weigh down to ensure the bond. Let the top dry for 30 minutes to 1 hour. Repeat this process with the pail. The pail and grass should both be securely bonded to the box top.

Step 5: Attach Stabilizers

Print stabilizers for the bottom of the base. I used an Afinia 3D printer and ABS plastic from RadioShack.

Step 6: 3D Print Mounts

I designed mounts and brackets that are easily screwed onto the planter's base. The stl files are included here. Ultrasonic range sensors are screwed onto square mounts that are placed inside the base. The mounts are angled so that the robot knows if it is about to run into an object or fall off a table's edge. Solar cells easily slide into L-shaped mounts that are screwed into the top of the planter's base. Servo clamps keep the robot's servos secure while in motion. All clamps and mounts are printed on a RadioShack Afinia 3D Printer.

Step 7: Assemble the Wheels

Print the wheel holders and inserts that are included here on an Afinia 3D printer. Press fit the wheel holder into the hub of a 60mm rubber luggage wheel, flip, and press fit the remaining piece into the other side. Press fit the new hub into the servo shaft. Do this for both servos.

Step 8: Add Components Inside Box

Attach the range sensors and servos to their mounts and secure them to the bottom of the box with screws. Strap down a 12V rechargeable battery pack with a piece of velcro that slips through two cutouts. Screw the solar mounts to the top of the board, slide the solar cells into the mounts, and thread their wires through the incisions cut into the grass. Wiring will be outlined in the steps to come.

Step 9: Circuit

The circuit for this bot is very simple. An Arduino Micro controls the bot and is powered by a 12V rechargeable battery. The Arduino pins being used are listed below and connections are shown in the circuit diagram.

Analog Pins: A0, A2

Digital Pins: 5, 7, 9, 10

Other Pins: Vin, GND

Step 10: Preparing the Protoboard

Fit the Arduino Micro into a row of female header pins cut to size. Solder the pins into the protoboard. Next, cut four 3-pin male-to-male header pins and solder them into the board. These pins will connect the range detectors and servos to the Arduino. Next, cut a pair of 3-pin female header pins and solder these into the board. These pins will connect the solar cells to the Arduino. Solder connections from the pins to 5V, GND, and the appropriate digital or analog pins, as shown previously in the circuit diagram.

Finally, solder a 12V battery connector to the Arduino's VIN and GND pins. No need for a voltage regulator; the Micro can handle an input of 5-12V.

Step 11: Making Ultrasonic Range Finder Connectors

Strip 3 wires from a 10-wire ribbon cable. Solder a 3-pin male-to-female header pin to the ribbon cable. Protect with shrink wrap. Repeat for the other end of the cable. Make two for both range detectors

Step 12: Make Solar Cell Connectors

Solder extra lengths of braided wire to extend the reach of a solar cell. Solder a 2-pin male-to-male header pin to the end of the extension wires.

Step 13: Overview of Code

The planter first triggers its ultrasonic range detectors to check its location in space. If the planter will crash or fall the robot backs up and turns to reposition itself. It all is well, the robot begins finding the sunniest spot on the table.

The robot has a solar cell on each side of its body. The solar cells detect the number of photons hitting them. The higher the number, the sunnier it is. The robot uses the sum of both solar cell readings to detect the overall "sunniness" of its current location. It uses individual cell readings to decide whether to turn left or right. If it is in the sunniest spot, it waits 10 minutes until looping back through the code. It iterates through this process repeatedly.

This piece of code is it's structure is based on the program found here. It gives a wonderful description of what the code is doing. I tried to emulate this by also heavily commenting my code.

Step 14: Calibrating the Servos

This robot uses Parallax Continuous Rotation Servos. You communicate to these servos through pulse width modulation. Pulse width modulation, in essence, let's us get a variety of output voltages by only using a voltage that is "pulsed" high and low. The average value of the pulse returns a variety of voltages between the high and low value. For this project, the duration of these pulses is what controls the speed and direction of the servos. Each pulse is from 1300 to 1700 microseconds (μs) in duration — one microsecond is one millionth of a second. These servos are built such that:

  • 1300 μs: Turn clockwise
  • 1500 μs: Stops the motor
  • 1700 μs: Turn counterclockwise

However, some servos will not stop at exactly 1500 μs due to slight differences in electronic circuitry. You may need to adjust the servo mechanics so that the motor stops moving when pulses of exactly 1500 μs are supplied.

Use the potentiometer located on the top of the servo (see image included) to calibrate its stop point. First, connect the servo's red wire to the power supply you will be using (I used a 12V rechargeable battery back), its black wire to ground, and its white wire to pwm pin 10. Run the calibration code included here to apply a stream of 500 μs pulses to the servo, 20 ms apart. The Arduino code can also be found at the Parallax Website here. While the code is running, slowly adjust the potentiometer using a small (#0 or #1) Phillips screwdriver. Adjust the pot until the motor stalls.

Step 15: You Are Ready to Go

Now your plants can always enjoy the sunniest spot on the table.

Be the First to Share


    • Instrument Contest

      Instrument Contest
    • Make it Glow Contest

      Make it Glow Contest
    • STEM Contest

      STEM Contest

    19 Discussions

    Solar panels as light sensors, connected straight to the ground (on your schema, the diodes are oriented to the ground, blocking towards A0/A2)? Do you really have anything on A0/A2?

    Wouldn't it be wiser to use photoresistors (e.g. GL5516, ridiculously cheap and appropriate resistance) connected with a 10K resistor in the middle from ARef to A0 and A2?

    Also, how long does the battery last? Servos are fairly greedy, and the 7805 drains my batteries in a day or two (I'm not feeding my ATMega with 12V, ever), how often do you recharge it?

    Thank you for your enlightenments.

    4 replies

    I'm curious about choosing solar panels over a simple photo-resistor voltage divider also. Does the author have a response to this design decision?

    "I'm not feeding my ATMega with 12V, ever" I ddo it all the time from a car battery . The regulator warms up but thats what it is supposed to do. Convenience is the factor when you have a handy 12 Volts why build a 9 volts also?

    My point was... There is no regulator mentioned here, the 12V are gonna burn the AVR, the servos and the sensors.
    A regulator is a simple 7805, 2 tiny capacitors (0.330µ and 0.100µF) and... a heatsink if you really don't want to fry your plant (that's why you may want a regulator down to 9V before, but it's just gonna kill the battery life, so it's not great either). I'm powering all my stuff from an Apple 24V adapter, it starts "smelling funny" very quickly when anything is wrong, believe me...

    However, a 7.4V LiPo battery pack would just need a zener diode and a resistor before the AVR, require no reduction before the servos and would probably be cheaper.

    This is a normal arduino board with regulator

    Microcontroller ATmega32u4
    Operating Voltage 5V
    Input Voltage (recommended) 7-12V
    Input Voltage (limits) 6-20V
    Digital I/O Pins 20
    PWM Channels 7
    Analog Input Channels 12
    DC Current per I/O Pin 40 mA
    DC Current for 3.3V Pin 50 mA
    Flash Memory 32 KB (ATmega32u4) of which 4 KB used by bootloader
    SRAM 2.5 KB (ATmega32u4)
    EEPROM 1 KB (ATmega32u4)
    Clock Speed 16 MHz


    Reply 5 years ago on Step 9

    What power do you mean? Do you ask about connected servos? They are fed from the battery, AVR is connected only to their control line. And if you wonder the Arduino is connected to 12V - it is because it has voltage regulator onboard.


    Reply 5 years ago on Step 9

    Something has to sink those servos, so the AVR is handling that. WRT the onboard voltage regulator, that’s a huge voltage drop for an SMT component with no heatsink. I realize recommended operating voltage is up to 20v, but why burden the component like that?


    Reply 5 years ago on Introduction

    Arduino micro can handle it. Its onboard volt. regulator according to its datasheet can handle this: (Vin = 6.5 V to 12 V, Iout = 0 mA to 800 mA). But I aggree it would be more components-friendly to use less voltage battery. :-)


    5 years ago on Introduction

    Very nice work.

    All the ways you used 3D printed stuff here makes me think I need to move a printer up on my list of "need to get" tools...

    2 replies

    Reply 5 years ago on Introduction

    You will not regret. I built my 3D printer some months ago and now I know I must have one forever :-)


    Reply 5 years ago on Introduction

    Think thats what you were supposed to think. Easy to do with a bandsaw ply and alum angle


    5 years ago on Introduction

    Thanks for post and clear code . Giving it a look over now