Building an Automatic Fish Feeder

Hey there! I hope you have some fun Thanksgiving plans that include lots of gorging yourself and relaxing. Today’s song is an old favorite of mine.

I’ve been looking for a project for my Tessel2 microcontroller for a few months now. It’s cool because it allows you to program hardware using Javascript, which is my favorite.

 

With the coming holidays, I’ll be traveling for a few days. Since I’m the proud father of a Betta fish named Rhaegar, I wanted to make sure he stayed alive and happy, so I decided to make him an automatic fish feeder.

 

First, I printed out the model from Thingiverse.

IMG_0448
Top-down view of the final print with the servo attached

 

It’s a pretty simple idea: a tank that gravity-feeds food to an auger. The auger spins with the help of the attached continuous-rotation servo, which is controlled by the Tessel.

 

IMG_0447
3/4 view of the finished piece

Then, I wrote the code. I wanted to make sure the fish was fed every twelve hours, and that I was alerted when he was fed. I used Twilio as my text messaging service, which was super easy.

 

index.js


var tessel = require('tessel');
var servolib = require('servo-pca9685');
var servo = servolib.use(tessel.port['A']);
var twilio = require('twilio');

var servo1 = 1; // We have a servo plugged in at position 1
var TWELVE_HOURS = 60 * 60 * 1000 * 12; /* ms */

servo.on('ready', function () {
	var client = new twilio.RestClient('AC60444a3748dee195b9250b351b25f0f6', 'API_SECRET_GOES_HERE');

	var timeSinceLastFeed = 0;
  
  	var dispenseFood = function(){

  		if(((new Date) - timeSinceLastFeed) > TWELVE_HOURS) {
		//if(((new Date) - timeSinceLastFeed) > 1500) { //for testing at a faster pace
                        client.messages.create({
		            body: 'Fish is about to be fed!',
		            to: 'MY_PHONE_NUMBER',  // Text this number
		            from: '+18455354398' // From a valid Twilio number
		            }, function(err, message) {
		        });
	  		servo.move(servo1, .7); //moves clockwise at full speed
	  		setTimeout(function(){servo.move(servo1, 0.4)}, 75); //moves clockwise at slow speed
	  		
	  		timeSinceLastFeed = new Date();
	  	
	  		return true;
	  	}
	  	else {
	  		console.log('It has been less than twelve hours since the last feeding; can\'t feed yet!');
	  		return false;
	  	}
  	};
  	
  	dispenseFood(); //run once on start
  	setInterval(dispenseFood, 60 * 60 * 1000); //check every hour, just in case
  	//setInterval(dispenseFood, 2000); for testing
});

Then, I did lots of testing. I needed to make sure the amount of food was consistent in each feeding, which was exceedingly difficult. I decreased the time between feedings and tried both worms and pellets to see which was the easiest to produce consistent results, and ended up with a mixture of both.

View post on imgur.com

IMG_0456
Testing the amount of time to spin the auger for optimum food release

 

Next, I pushed the code out to the Tessel to connect to our WiFi and run the program automatically on boot, which was as simple as


t2 push index.js

 

Then, I secured it to the top of the fishtank with some tape (hey, it’s a prototype. Don’t judge me.)

Affixed temporarily to the top of the tank
Affixed temporarily to the top of the tank

We’re still in the testing phase, so hopefully I don’t over/underfeed him. Bettas are pretty hearty fish, though, so I’m not too worried.

 

Thanks for reading! I hope you’re having a fantastic day. See you next time!

Creating a Wooden 3D Print from a 2D Drawing

Hey there! I hope you’re having a great day. Today, we’re going to take a pencil drawing and convert it into a real, solid, wooden, 3D-printed thing.

Song of the Day!

 

Pencil Drawing to Vector Graphic

I started with this excellent drawing of a platypus by DeviantArt user blueroseval13.

Once I had the drawing I wanted to print, I brought it into Photoshop. I went into the Select menu and chose Color Range, which allowed me to select parts of the drawing based on their color. I brought the Fuzziness up to 200 (the maximum) to select every edge of the drawing.

select-color-range

 

Result after pasting into a new file and cleaning it up
Result after pasting into a new file and cleaning it up

 

I saved this new, cleaned-up drawing, and found an excellent site that converts images to the SVG (Scalable Vector Graphics) format that can be used by our 3D modeling software.

Edit: Reddit user Sonrisa3D says:

MatterControl image converter works well also. Another tool in the toolbox.

Thanks, Sonrisa3D!

Vector Graphic to 3D Model

After converting it to SVG, we can bring it into TinkerCad (a very simple 3D modeling webapp). After opening a new file in TinkerCad, we can select Import and choose our newly-created SVG, and it’ll look something like this:

3d-platypus

 

3D Model to Real, Actual Thing

Now, we can click Design -> Download for 3D Printing and bring it into our slicer software that tells the printer what to print. Then, I scaled it to fit on my printer and hit print!

3D printing works by building up really small layers over a long period of time. Since this model was pretty boring to watch, here’s one of my more interesting prints, a model of the city of Winterfell from Game of Thrones:

 

…And Finally!

Testing the print with various settings.
Testing the print with various settings.

As you can see above, I ran the print job a few times with different settings and materials to finally get the results I wanted. I started with some PETG I had laying around, and then switched to Wood once I knew it would print. I could have probably switched later and saved myself some money, but I didn’t realize how many times it would take to get the look I wanted. I didn’t think about making the walls more pronounced until a bit later, as you can see.

Let’s see how it looks on the computer to which I’m mounting it!

IMG_0223

The print in its temporary home. I'm planning to mount LED lights behind it for a sweet glow, but this will do for now.
The print in its temporary home. I’m planning to mount LED lights behind it for a sweet glow, but this will do for now.

FAQs

Which 3D printer are you using? 

Printrbot Simple Metal with Heated Bed. It’s a great starter printer, and I’m using it to print parts for my next 3D printer. 3D Printers printing 3D printers. Meta.

What materials can you print with?

Wood, BambooIron, Rubber, Hard Plastic, Softer-but-still-firm plastic, and more!

How much did these prints cost?

Total, maybe $7-8 USD.

How long did this take?

I went from drawing to having my first print in-hand in less than 3 hours. To my final print, maybe another 4 hours.

Why do you 3D print things? It would be faster to just buy them.

In some cases, sure, it might be easier to buy a toothbrush holder or coasters, or whatever you might need. But the cool part for me is being able to take an idea and transform it into a real, tangible thing – with just a little time and some fiddling on the computer. Plus, I spend a lot less money on things that are just little pieces of plastic, and can customize them or swap them out really easily whenever I want to suit my decorating desires or when they break.

Every household thing I print is one less that has to be shipped around the world in a wasteful box or cocooned in a plastic shell for safety. The plastic I print with is made from corn waste and other renewable resources. Essentially, it’s the self-sufficient, sustainable, and creative nature of this hobby that fascinates me so much.

 

Full disclosure: I get a small amount of commission if you buy anything through these links. It helps pay for my web hosting.

Thanks for reading! If you want to print this for yourself, here it is! If you have any questions, feel free to leave a comment.

 

Cheers!

Chocolate. Caviar.

Finished Chocolate Caviar
Dessert that pretends it’s dinner.

I cut dates in half and removed the pits. Then, I filled up the date halves with Nutella.

Date halves filled with Nutella.

I crushed up some walnuts with my bare hands and coated them in raw, organic cacao and honey, along with some hazelnut oil. These are our ‘caviar’ eggs. They get sprinkled all over the date-Nutella shells.

Our chocolate caviar.

 

 

 

Some ‘caviar’ spooned onto the date halves

Then, I heated some organic goji berries with water and more hazelnut oil and arranged it all on a pretty plate.

Rehydrated Goji berries

And it was good.

The pictures don’t really do it justice. I need a macro lens.

 

They came out even better than I dared to dream. The Goji berries balance out the intense chocolate sweetness and serve to cleanse the palette between tastes.

 

Please, give me free stuff, Ferrero (Makers of Nutella).