Cats and lasers and (Raspberry) Pi, OH MY!

栏目: IT技术 · 发布时间: 4年前

内容简介:Keeping a modern cat entertained requires something more high-tech than a ball of yarn. The MagPi’s Phil King wonders if this is a purr-fect project…WARNING! LASER EYE! Don’t look into a laser beam, and don’t point a laser beam at a somebody’s head. For mo

Keeping a modern cat entertained requires something more high-tech than a ball of yarn. The MagPi’s Phil King wonders if this is a purr-fect project…

WARNING! LASER EYE! Don’t look into a laser beam, and don’t point a laser beam at a somebody’s head. For more on things you SHOULDN’T do with a laser, visit magpi.cc/lasersafety .

Cats and lasers and (Raspberry) Pi, OH MY!

Xander the cat is a much-loved family pet, but as his owners live in a flat, he can get a little bored staying indoors when they’re out at work. Seeking a way to keep his cat entertained, Enzo Calogero came up with an ingenious Raspberry Pi–powered project. “We noticed that he loves to chase a laser light, so we decided to create a device to make laser games for him,” explains Enzo.

The result is the Tri-Lasers for Felines device which, when the cat’s presence is detected by a PIR motion sensor, beams a laser dot around the room for Xander to chase between randomly generated points. Judging by the video on the project’s Hackster tutorial page , he seems to love it.

trilaser

This video is about trilaser

Pan and tilt

The laser’s main movement trajectory is handled by mounting it on a Pan-Tilt HAT, which has vertical and horizontal servo motors. “A pair of coordinates (x, y) is generated randomly,” explains Enzo. “The laser point moves from the current point to a new coordinate, following the segment that connects the two points, at a speed defined by a status variable. Once the new coordinates are reached, we loop back to point one.”

Cats and lasers and (Raspberry) Pi, OH MY!

To add extra interest for Xander, its movement is randomised further by switching between three laser diodes to perform micro random movements very quickly. “Switching the active laser among the three allows extremely rapid movements of the laser dot, to create an extra variability of the light trajectories which seems more enjoyable for the cat,” says Enzo.

While the laser point is visible in daylight, it shows up better when there’s less light: “Xander prefers it when the room is completely dark.”

The device’s three laser diodes are set into a 3D-printed triangular holder that sits atop the Pan-Tilt HAT’s acrylic mount — which would normally be used to hold a Camera Module. Enzo also designed and 3D-printed a case for the PIR sensor.

Cat-a-log

In addition to handling laser movement, the Python script saves a log of Xander’s activity: “We check it now and then out for curiosity,” says Enzo. “When Xander was a kitten, he was playing with it very often. Now he is a bit older and much more prone to sleep rather than play, we switch it on when we are out in the evening to keep him busy during our prolonged absence.”

One issue that came up is that, being naturally curious animals, cats are prone to investigate any new objects. “We try to put it as high and unreachable as possible, but cats are extremely skilled,” says Enzo. “So, he was able to reach the device few times. And the best way to save the device from cat attacks is to make it as still as possible, so the cat loses interest.”

Cats and lasers and (Raspberry) Pi, OH MY!

Therefore a tilt sensor was added to the device, to cause it to shut down if triggered by an inquisitive Xander, thus reducing the risk of damage.

This isn’t the only feline-focused project from Enzo, who has also built an IoT food scale to monitor when and how much Xander eats, sending the data to a Google Cloud online dashboard. He’s now working on a wheeled robot to track the cat with a camera and perform a few interactions — we wonder what Xander will make of that.

More from The MagPi

The MagPi magazine is available from newsagents in the UK, Barnes & Noble in the US, the Raspberry Pi Store here in Cambridge, and online in the Raspberry Pi Press store .

This month’s issue comes with a free stand for your Raspberry Pi 4. Yay!

Cats and lasers and (Raspberry) Pi, OH MY!

A note from Alex regarding cats and lasers

Some cats don’t like lasers. They find it far too upsetting when they can’t catch what it is they’re chasing. If your cat starts to pant while chasing lasers, don’t assume it’s just exhausted. Panting can be a sign of stress in cats, and stressed is something your cat shouldn’t be. Exercise caution when playing with your cat and laser toys, and consult a vet if you’re unsure whether their behaviour is normal.

Signed,

The owner of a cat who doesn’t like laser toys

Cats and lasers and (Raspberry) Pi, OH MY!


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

The Web Designer's Idea Book, Vol. 2

The Web Designer's Idea Book, Vol. 2

Patrick McNeil / How / 2010-9-19 / USD 30.00

Web Design Inspiration at a Glance Volume 2 of The Web Designer's Idea Book includes more than 650 new websites arranged thematically, so you can easily find inspiration for your work. Auth......一起来看看 《The Web Designer's Idea Book, Vol. 2》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

MD5 加密
MD5 加密

MD5 加密工具

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具