MouseAir – Using AI on the Raspberry Pi to Entertain your Cat

MouseAir

MouseAir – Using AI on the Raspberry Pi to Entertain your Cat

Cats.  Computers.  AI.  Robotics.  Mice.

This is a great introductory project for learning how to make the Raspberry Pi do physical tasks.  Easy to build  (no soldering needed) and easy to use.   But you will get exposed to some very sophisticated hardware and software technology (including AI machine learning for Cat Detection, no less).

You can buy a MouseAir kit here while they last.

This project has it all.   There have been few projects that make us laugh out loud every time we look at it, but this is one of those.  MouseAir.   This is an easy to build (no soldering!) project that will turn your Raspberry Pi into one of the funniest, smartest and cat like projects of all time.   Let’s start out by watching a MouseAir Launch in sloooow motion.

What Does MouseAir do?

MouseAir uses an advanced AI (Artificial Intelligence) machine learning algorithm to detect when a cat walks into the view of the supplied camera.   When it spots a cat, MouseAIr jumps into action.   It starts the motors spinning and then activates a servo motor to push the mouse up into the motors and then be launched down the hall for the cat (note:  not chickens) to chase.   All kidding aside, this is actually a very sophisticated kit showing aspects of AI, robotics and Python programming.

Mouse Air – The Project

MouseAir is a unique Raspberry Pi based kit that you put together.   We give you all the electronics and motors to build it.  Have a 3D Printer?  Print your own 3D parts.  All STL files are included.  If you don’t a 3D printer you can buy them from many 3D vendors or even us.  Don’t like the way the program works?  Change it.  We supply all the software open source.  Open source Python3.  Even the Artificial Intelligence.

Oh, and it requires no soldering to assemble!   This is  a good thing.

This is a kit built for your to modify and learn from.   You build it.  You test it.  You modify it.

The full MouseAir kit consists of a Raspberry PI, SDCard with the software and source code, electronics, a controller board, motors and the 3D Printed parts, gears and other doohickies.

This project is designed to educate the builder about Machine Learning AI,  dc motors, servo motors and sensors.  It is also designed to be built by beginners in the Raspberry Pi and small computer world but will require some adult supervision to complete for younger makers.

It supports the Blynk app on iPhone and Android to control MouseAir and set parameters.  If you know your way around a Raspberry Pi, everything can be set from changing the software too.   You don’t have to connect a monitor to the Raspberry Pi to do this project, but it is easier to do so.

 What Can I do to Prepare for MouseAIr?

Now this is a serious question.   You should go and buy a copy of “Python All-in-One for Dummies” by our CTO Dr. John C. Shovic.  It gives you a great introduction to learning Python, the Raspberry Pi, Robotics and even some AI.   MouseAir is mentioned on page 645.

Python All in one book

Panther, our CTO Dr. John Shovic’s long suffering cat, announces MouseAir below.

Wrong Place.  Wrong Time.  Camera in Way.

 

Since we are stretching, let’s watch MouseAir stretch out a loooonnnng flight.  Note the head of Cat Simulator 1.0 in the lower left corner.

 

STL 3D Printing Files

All the 3D printing files (including OpenSCAD source files) are located here.

Technical Stuff

The MouseAir Project is complete!  It loads toy mice and fires them off for the cat.

However ridiculous that sounds.

Dr. John wanted to make sure that we include some technical stuff and block diagrams in the Kickstarter.   So here he goes…..

The MouseAir system is built around a Raspberry Pi controlling all the devices and connected to an app based Blynk control panel and also a simple webpage via a WiFi connection. We are using a Pi Camera capture the cat events, examine the video frames looking for a cat with a machine learning AI algorithm.     Here is a video showing the AI at work on our Cat simulator (Panther the Cat would NOT cooperate).   We declare a Cat at when the AI is 90% sure.

 

Cat find video

 

The Mouse Air project has been around in various stages for several years. The goal of the project (conceived in a bar, the Fedora in Coeur d’Alene Idaho and named by Sarah, the most excellent bartender there.  And some BlueMoon Beer.) was to be able to detect a cat walking by and fire a mouse.  It worked!  The first version was physically large and complex, but fun!  I had so much response (including the response from the Cat) to that article and project from a variety of sources, that I decided to do a redesign of MouseAir incorporating what I had learned from the project. I aggressively redesigned to eliminate unneeded hardware and drive down the cost and size.

Here is the latest hardware block diagram:

And the latest software block diagram:

Here are some pictures showing the individual devices on a completed MouseAir Kit:

The MouseAir AI Machine Learning Program

The term Artificial Intelligence is being thrown around a lot these days to apply to a bunch of things that aren’t really AI.  It’s a marketing term for these folks, rather than a technical term.   The AI in MouseAir is an example of a neural network based Machine Learning program,  which really is an AI technique.

If you want an introduction about AI and neural networks that are based on the Raspberry Pi, then please check out Book 4 of Dr. Shovic’s book, “Python All-in-One for Dummies”.

We call our machine learning program Cat/NotCat because we are only interested in categorizing pictures as either being a Cat or Not being a Cat.   It is either a Cat or NotCat.  Sounds strange, but there we go!

Before you can use a new machine learning program, you have to train it.  We train the MouseAir program by using 1000’s of picture of Cats and the 5,000 – 10,000 pictures of NotCats.   The neural network we are using has over 1,500,000 variables and about 160 neurons.   This is a multi-level neural network model.   The one we are using for early training is below:

You don’t have to understand any of this to build or use the MouseAir project, but if you want to tinker with software this is a great thing to play with (like change it for dogs! ) and experiment with.   AI techniques are complicated to develop, but often they aren’t that hard to use.  Like Cat/NotCat.

Well that’s enough of the technical talk for today.  Please consider joining our Kickstarter and helping reduce obesity in the feline population today!

 

FAQ

Questions, we get questions all the time (mostly about our sanity).  So we thought we would start with Frequently Asked Questions about MouseAir.

Can you launch dog treats?  Sure, but the dog would destroy the machine getting to the treats before you launch..

Can you launch Mice with catnip?  Sure, but the cat would destroy the machine getting to the catnip mouse before you launch.

The secret is to use a mouse that is not TOO interesting to the cat until it moves.  Dogs, you should only use single use mice as they will destroy the mouse and then probably move over to destroy the machine.

How about Chickens?   No.  Never.  We listen to the our great customer friend, Lutz.  He states emphatically, “Chickens have no respect for technology.  None.”

Can I Use Live Mice?  No.  Icky.  No live mice.   Just the toy ones please.   I’m not sure how you could get a live mouse to sit and wait to be launched in any case.

Can I change the AI to recognize my two year old? Sure, but then the toddler would destroy the machine and eat the mouse.   We don’t think two year olds respect technology either.  Safer to stick with Cats.

 

History of MouseAir

MouseAir has been in development for a number of years off and on and has gone through several iterations.

Here is an early block diagram of the project.  Done in a bar.  Under the influence.  Note the high quality cat drawing in the lower left.  Good thing Dr. Shovic didn’t go to art school.

The first prototype was enormous.  It even used 12V motors and a large solenoid for a car door automatic door lock (no kidding – they are cheap) to push the mouse.

Lots of things did not work.  For example, the RFID tag detector.  Dr. John’s Cat Panther, is a chipped cat.   However, it turns out there are four different standards for chipping a cat, and the inexpensive RFID decoder we had could not read the chip.  We then built a custom RFID antenna on a Tupperware bowl and collared the cat with an RFID chip (he was NOT a fan of the collar by the way) and it kind of worked, but only if we put treats inside the Tupperware bowl and he went into the bowl.   We abandoned this line of research as not being cat friendly.  Sigh.

 

Time passed.  The cat complained.  We refined and shrank the MouseAIr project to something that could actually be built and turned into a buildable kit.

We next made the intuitive leap into Artificial Intelligence and decided to use the Pi camera combined with Machine Learning to replace the RFID detection with the famous Cat / Not Cat TensorFlow based Neural Network (want to know what this is?  Dr. Shovic’s book above is a great introduction) to detect whether the wily feline is walking by MouseAIr.   Below is an early version of the AI software successfully  identifying the robot as a NotCat.   It took a while to get there.

All of the open source code and training data is provided as part of the MouseAir kit.  You can modify, change, improve and personalize your MouseAir experiment.  This is a learning kit and designed to be nirvana for a Maker!