Train your rat: behavioural science at home

Skinner boxes are a kind of apparatus used for conditioning and training animals in scientific studies. You’ll almost certainly have read about them or seen them on TV: an animal is rewarded with a treat for pressing a button; or trained to respond to a patter of lights or other stimuli (like shapes, music and other sounds, or drawings). This is the sort of arrangement where a sequence of behavioural primitives (light flashes green, animal pokes green button, is rewarded with a snack) can be threaded together to create really useful data for behavioural scientists. Is it harder for an old mouse to learn to solve the puzzle than a young mouse might find it? Do other environmental variables, like diet, gender or temperature affect the results?

rat eating someone's lunch

An example rat, engaging in behaviour.

They’re not just used by behavioural scientists: a Skinner box can be a useful device for training pets, especially pets with a reasonable amount of smarts, like parrots or rats. It can automate the process you may have already used with your pet, where “correct” behaviour is rewarded – walk to heel, get a doggy snack. (We also find this approach helpful here at Pi Towers. When Gordon behaves himself, we give him a biscuit.)

Skinner boxes are also pretty expensive.  So Katherine Scott, computer vision and robotics expert, electronics ninja and rat owner/trainer, has built her own, which she intends to release as an open source device when she’s finished refining it.

Open Skinner box

Prototype Open Skinner box, with ratty customer.

Katherine didn’t just want any old Skinner box, though – Open Skinner box is an Internet of Things device, and she says:

I wanted to create not just a Skinner Box but a web enabled Skinner Box, a sorta internet of things Skinner Box. So what features should it have? I came up with the following list:

  1. I should be able to see the rats using the Raspberry Pi’s camera.
  2. The camera data should be used to create a rough correlate of the rat’s activity.
  3. The box should run experiments automatically.
  4. I should be able to buzz and feed the rats remotely.
  5. The web interface should give a live feed of all of the events as they happen.
  6. The web interface should be able to give me daily digests of the rats activity and training.
Live camera output from the box

Live camera output from the box

ratstats

Rat stats

Katherine presented Open Skinner box at Pycon: you can watch a video of her presentation at her website, and find schematics, source code, sample rat-stats, thoughts on where the device is going next, and much more there too.

Here at Pi Towers, we’ve been contemplating the acquisition of an office rodent, so we can make sure that the pet projects we’re working on for the resources section here work properly. (How many hamsters does it take to trigger a home-made tinfoil switch? What’s the best design for a Twitter-enabled food hopper?) If you’ve got suggestions for names, please leave them in the comments below.

24 comments

Avatar

Well, after Babbage, perhaps Faraday the Rat?

Avatar

“Darlington” came second in the name-our-bear compo…

Avatar

You’d better get two of them then!

Avatar

A long-tailed pair.

Avatar

That would require Faraday’s cage to be a Faraday cage, surely?

Avatar

Comment of the day!

Avatar

Ooh, very interested in this. I never spent much time teaching mine tricks, but training them to come when called or at the sound of a clicker would be so much easier with a little automatic positive re-enforcement.

And just fyi, don’t keep rats alone, they’re social animals and looking after two is easer than just the one.

Avatar

Soc-rat-es :-)

Avatar

SoC-rat-es, amirite?

Avatar

An office rodent would have to be named “Byte”. (Or “Nibble” if it’s a small one.)

Or maybe “Random Access” if it’s not a maze solver.

But seriously the feeder is a good idea, another project to get kids interested.

Avatar

Is it just me, or do you all get shades of Hitchhiker’s seeing rodents in mazes? If it’s a mouse, my vote is for Deep Thought, and get 42 of them…

How many roads must a man walk down… Yes! 42!

Avatar

Is it possible to weigh hamsters, etc. automatically? I was thinking of pet related experiments – if you have only one in a cage, then a platform permanently in the cage could be used to weight it every time Hammy walks across. It should be possible to track daily weights that way.

(Trouble is accumulated rubbish on the platform. But it already measures its tare weight anyway so maybe that doesn’t matter…)

Avatar

I can imagine the cheek-stuffing business presenting a problem there too – but you’d have lots of points of data, which should smooth that out; it’d be another nice idea for a resource for kids, now I think about it!

Avatar

I have it on good authority that hamsters prefer to dance than be weighed…

Avatar

If hamsters and food treats, it’s got to be called the Hamper!

Avatar

Peev.
Then you can introduce him to visitors a s our pet —.

Avatar

You mean Commodore Pet? :(

Avatar

Surely the Twitter enabled hopper feed should be called the “Cwitter feed” (say it out loud as if you had a lisp!)?

Avatar

Wodewick the Wat? ;-)

Avatar

Fwee Bawabbas!

Avatar

Give it an eye-patch and it could be a PiRat(e)

Avatar

I had a pet rat once. I tied a mirror and a bell to a bar in its cage and in the morning it was lying on the floor, so I tied it back on. This kept happening. The rat (minty) was untying the the string with his mouth without biting through it. I think thats clever (I couldn’t do it).

Avatar

Avatar

Leave a Comment

Comments are closed