Introduction: Internet Controlled Fish Food Feeder

Picture of Internet Controlled Fish Food Feeder

This is tutorial three of the series, where I take electronic devices which you normal control using an Arduino, to the internet using a Spark Core. In this instructable I'm going to show you how you can make an internet controlled Fish Food Feeder, which can be controlled via any web browser. I have tried to keep this instructable as simple as possible so that everyone can keep up.

This instructable is powered by a Spark Core and is a continuation of the previous instructable of the series. In the previous instructable I showed you how to control a servo over the internet using a web browser, now it's time to put that into use and create a project out of it. So have a look at how to connect your servo to the internet, from my previous instructable.

In the next instructable I will show you how to get started with relays and control your house lighting over the internet and build a Home Automation system.

So lets get started.

Step 1: Tools and Components

Picture of Tools and Components

The parts are pretty much the same as the previous instructable, all you need now is a round plastic case like the one in the image and an enclosure for the project (I used a Makey Makey box to do that). For those of you who are here for the first time, here is a complete list of materials and components required.

  • Spark Core
  • Bread Board
  • Servo
  • Jumper Wires
  • Li-ion Battery (optional)

No soldering skills are required for this tutorial as we will be using a breadboard, but in the future tutorials there will be a lot of soldering. And there are a lot of tutorials on YouTube that shows you how to solder. You can also use an Arduino and you can PM me for additional details on how to get started.

Note- You can also get a Photon form the Particle store for $19 all the code and the setup of this series will remain unchanged.

Step 2: Getting Started

Picture of Getting Started

Now that you have your core lets get it connected to the internet or the Spark Cloud API. First get the core out of the box and connect the spark core to the computer via the micro USB cable. Now you should get the spark core blinking blue color.

Time to set up your android or Iphone to configure your core -

  • First download and install the respective app - Android or IPhone
  • Next sign up for a free account using valid details

Time to Connect the Core to the Cloud -

Make sure your phone is connected to the WiFi you want to use (it'll show up in the SSID blank on the app), then enter your password and click CONNECT!

The core would start blinking the following colors -

  • Blinking blue: Listening for Wi-Fi credentials
  • Solid blue: Getting Wi-Fi info from app
  • Blinking green: Connecting to the Wi-Fi network
  • Blinking cyan: Connecting to the Particle Cloud
  • Blinking magenta: Updating to the newest firmware
  • Breathing cyan: Connected!

Once you got the core Breathing cyan everything went fine and it's time to proceed to the next step.

Step 3: Setup

Picture of Setup

To start off you can check out my previous instructable on how to get started on taking a servo to the internet, if you are reading this first you can try the example code form the previous instructable to check if everything runs fine before proceeding to the next step.

Here is the code that you can copy and paste in the particle IDE

Servo myservo;  // create servo object to control a servo

int pos = 0;    // variable to store the servo position

void setup()

{
  myservo.attach(A0);  // attaches the servo on the A0 pin to the servo object
  Spark.function("setpos", setPosition);
  Spark.variable("getpos", &pos, INT);
}

void loop()
{
}

int setPosition(String posValue) {
    pos = posValue.toInt();
    myservo.write(pos);
    return 0;
}

And follow the circuit on how to connect the servo once you are done flashing the code, by default the servo position should be set to zero degrees.

Then run the HTML file found in the attachments fill in the access token and device ID and open the file in a web browser make sure you have JavaScript enabled. If everything went fine you should see the current position of the servo and on increasing the angle in the web browser, the servo's angle should change by the same value and the new position should get updated.

Step 4: Circuit

Picture of Circuit

To get started, we need an enclosure for mounting the servo onto and into which goes the Spark Core and the Li-ion battery. The servo needs to be glued to the top of the enclosure or the lid of the box, I used double sided tape to make it possible.

I kept all of the electronics inside of the enclosure, I used a 3.7V Li-ion battery to power the spark core via the Vin pin. The spark core is capable of accepting up to 6V input voltage as it has an on board 3.3V regulator. I used a battery because I did not want a USB cable going into the box as it made it look ugly.

The circuit is the same as that of the previous instructable.

To the servo I glued some straws which contain the food (we need to put some in after getting it stuck to the servo), and when the servo moves to certain angle the food from the straw gets dropped into the tank. I have many tiny fishes and a straw scoop of food is enough to feed them.

Step 5: A Better Design

Picture of A Better Design

For those people who have a large number of fish or just two big fish and that little scoop of food is not enough here is a better design that you can try.

For this design you need a round container like the one in the picture, drill two holes in one of the sides through which food can drop to the tank. I used double sided tape and got it glued to the servo and when I turn the servo the food will drop into the tank.

The amount of food that falls into the tank depends on how many times the servo moves through and fro, but I was able to achieve doping a larger quantity of food into the tank. Plus, you don't need to keep refilling the straws as you can put a lot more food into the container to carry, making this the better design.

Step 6: Programming

Picture of Programming

The program which gets uploaded to the core is the same as the previous instructable, and you can copy paste it in the Particle IDE and then flash it to your core.

Servo myservo;  // create servo object to control a servo<br>int pos = 0;    // variable to store the servo position
void setup()
{
  myservo.attach(A0);  // attaches the servo on the A0 pin to the servo object
  Spark.function("setpos", setPosition);
  Spark.variable("getpos", &pos, INT);
}
void loop()
{
}
int setPosition(String posValue) {
    pos = posValue.toInt();
    myservo.write(pos);
    return 0;
}

On the web page side of stuff the code has some changes in it the new HTML file can be found in the attachments all you need is to download the file and enter your Access Token in a field where it says << access token >> and similarly the Core ID in a field where it says << Core ID >>. After you enter the fields save it and run it in your web browser and make sure it has JavaScript enabled.

You can click "Feed!!" to increase the angle by 68 degrees and drop the food into the tank and the "Reset" simply resets the angle to zero degrees.

Step 7: Whats Next

Picture of Whats Next

Well after making a fish feeder, it's time to take a level up.

In the next instructable I'm going to show you how to connect your home lighting to the internet and how to make a cool home automation system using spark core and a raspberry PI more of that soon.

If you have encountered any problem or want to suggest anything please leave a comment below and I would be glad to help you out.

Comments

About This Instructable

2,858views

32favorites

License:

More by LightBug:Getting started with IoT using the Particle CoreFish Food Feeder Using the Linkit OneControlling High voltage devices with LinkIt One
Add instructable to: