The Ribbit Robot: Soil Moisture Sensor

by goldbeas in Circuits > Microcontrollers

151 Views, 2 Favorites, 0 Comments

The Ribbit Robot: Soil Moisture Sensor

Screenshot 2024-12-11 at 2.12.49 PM.png

Welcome to my Instructable! I'm Annalise and this project is part of the final project assignment from a class at Boston College called Physical Computing. For this project, I made a soil moisture sensor that I call the Ribbit Robot. It works by using a capacitive touch soil moisture sensor to monitor the water content and temperature of soil it is in. On the front of the robot, there is servo motor that shows how wet the soil is. When the soil moisture content gets too low, the robot will ribbit at you until you water the plant!

Supplies

Green 3D printing filament (I used PLA)

wires

servo motor

Adafruit capacitive touch soil moisture sensor

2 small speakers

Adafruit CircuitPlayground Bluefruit

Soldering materials

power bank

data and charging cables

Drill and drill bits

Small cylindrical magnets

Mirrored Pink 1/8th inch Acrylic

Write Your Code

For our first step, we need to write the code that our CircuitPlayground Bluefruit (CPB) will use. I have attached a copy of it to this step, so feel free to download it and use it for your own project!

The code itself has two functions: One to set the servo motor to the correct angle and one to play the mp3. The servo angle is set by using the moisture sensor reading. The reading is a number from 0-2000. I've found that you never really hit the highest or lowest possible reading, so the function divides its reading by 1500 and then multiplies it by 180 (the number of degrees of motion the servo has). This creates an angle relative to the moisture sensor. The rest of the code is quite simple. If the reading gets below a certain number (I set mine to 600), the mp3 function will be called and the ribbit sound will play.

A few things to keep in mind if you do use my code are the file name and location of the mp3 ribbit noise you use. On my CPB, I have a folder named "sounds" and called the mp3 "ribbit2.mp3". If your file or folder are named something else, you have to change the code to reflect this.

For the mp3, I found a file online at FreeSound and then edited it using Audacity. I changed the file from a .ogg to .mp3 and made sure that all aspects of the clip were compatible with my board (bit rate, Hz, mono/stereo channels, etc). I attached my mp3 with the correct settings below. If you would like to use a different one and aren't comfortable using audio editing software just yet, there are plenty of ribbit files on FreeSound that are already the correct file type and will likely also have the correct settings!

Assemble Electronic Components

Screenshot 2024-12-11 at 11.50.10 PM.png

Now, we will assemble the electronic components of our board. It's important to do this early in the process, so you can troubleshoot or change any broken parts. I've attached a wiring diagram that you can replicate (The speaker ports are labelled with pink and the rest are coordinated to the actual color that the wires on the servo and sensor are). We have to wire our soil moisture sensor, servo, and speaker to the board. This uses most of the wiring ports available but is very doable.

To make this possible, I included a secret design feature: only one of the speakers on the frog is actually wired to the board. The other one is just for display purposes. I did this for a few reasons. First, The one speaker alone is already quite loud, so it didn't make sense to include two if I would just have to turn the volume down. Second, I figured if a speaker that's only for appearances works for Apple (as they do this with their iPhones), it works for me.

After wiring your board and testing to make sure all components work, you can solder it. I soldered everything but the speaker to the board. This is actually pretty essential, as alligator clips take up a lot of space. The case for our robot is pretty small, and thus needs the extra room that soldering requires. Once you do solder your board, everything should fit quite well.

3D Print Your Frog

Screenshot 2024-12-11 at 11.52.23 PM.png
927C4F83-8F8A-41D3-B324-D320D6EB6787_1_105_c.jpeg

Next, we have to 3D print our frog. I have attached an STL to this step that I modeled! The process of modeling it was very simple with my electronic components already set up. I made a cardboard prototype and, once it was able to fit all parts of the project, I just replicated the design on Tikercad.

The little box-shaped hole on the side of my model is for my power bank to slide in and out for charging. If you aren't using the same one, feel free to alter the model to fit your power bank!

Downloads

Lasercut the Frog Tongue

Screenshot 2024-12-12 at 12.00.27 AM.png

As a small addition to the overall design of the project, I decided to make the servo motor visible on the front shaped like a tongue and cut it out of pink acrylic using a laser cutter. This is optional, but I think it really adds to the project.

My Illustrator File for the tongue is attached to this step.

Downloads

Assemble the 3D Print

To assemble the print, first we have to attach the small semi-circle 3D printed piece into the larger one. It shouldn't need glue, as the pieces are designed to have a really tight fit. Next, use a drill to make two holes on the top of the largest 3D printed piece, placing them where you want the eyes to be. Don't put the back panel on quite yet, as its designed to be water tight and is thus very difficult to take off.

Assemble the Project

Screenshot 2024-12-11 at 11.59.58 PM.png
Screenshot 2024-12-12 at 12.01.26 AM.png

We're almost done! To assemble the project, first we have to attach the speakers. Pull their wires through the two holes you've just drilled and use hot glue to attach it. Make sure the black part of the speakers is facing forward (away from the open back of the piece) so the sound comes out the correct direction.

Next, slide the moisture sensor into the small rectangular hole on the bottom of the body and secure it with a dab of glue.

Pull the arm off of your servo and glue a magnet there to replace it. Then, place the servo into the body, with the spinning part (the part with the magnet that you just glued) poking out of the hole in the front. Secure this with a bit of glue, making sure that the servo can still spin. This is pictured above! Glue a magnet onto the back of the tongue piece as well.

Carefully put the rest of the electronic components into the piece and attach the speaker to the CPB using small alligator clips. Make sure that you have a data cable plugged into the CPB that you can attach to a power source (I left mine hanging out of the piece so I could access it).

Once you are sure that everything fits and is in the correct place, put the back panel on. Do not do this until you are sure that everything is in the right spot and works well. As mentioned above, the back panel is designed to have a really tight fit to keep it watertight, so it is very difficult to take off.

Turn your project over so you are now looking at the front. Hold the tongue up to the servo motor and place a magnet on the front of the piece, so it is held up between the magnets. I used two magnets on the outside of mine, to ensure that the pull was strong enough. I used this method (as opposed to gluing the tongue to the servo) because it allows for easy reattachment if the tongue comes off. I initially glued it to the servo, but someone accidentally broke the tongue off when they bumped into it. The magnets allows for any adjustments that you would want to make, and they will easily reattach (even if someone else walks into it for some reason).

Done!

You are now done! Once you plug the CPB into a power source, it will begin taking readings. Here is a clip from a video of me presenting the Ribbit Robot for my Physical Computing class (filmed by my professor, John Gallaugher) with a short demonstration included. Thanks for following along and happy making!

Downloads