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?

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.

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:
- I should be able to see the rats using the Raspberry Pi’s camera.
- The camera data should be used to create a rough correlate of the rat’s activity.
- The box should run experiments automatically.
- I should be able to buzz and feed the rats remotely.
- The web interface should give a live feed of all of the events as they happen.
- The web interface should be able to give me daily digests of the rats activity and training.
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
Michael Horne
Well, after Babbage, perhaps Faraday the Rat?
Liz Upton
“Darlington” came second in the name-our-bear compo…
Hove
You’d better get two of them then!
David
A long-tailed pair.
Tom West
That would require Faraday’s cage to be a Faraday cage, surely?
Liz Upton
Comment of the day!
James Howe
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.
Aaron
Soc-rat-es :-)
Magnus
SoC-rat-es, amirite?
Ravenous
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.
David
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!
Ravenous
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…)
Liz Upton
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!
Ben Nuttall
I have it on good authority that hamsters prefer to dance than be weighed…
Dexy
If hamsters and food treats, it’s got to be called the Hamper!
u8nc
Peev.
Then you can introduce him to visitors a s our pet —.
Ravenous
You mean Commodore Pet? :(
Roger
Surely the Twitter enabled hopper feed should be called the “Cwitter feed” (say it out loud as if you had a lisp!)?
AndrewS
Wodewick the Wat? ;-)
Liz Upton
Fwee Bawabbas!
The Pi Hut
Give it an eye-patch and it could be a PiRat(e)
nathanael
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).
nathanael
nathanael
cute rodent pic
Comments are closed