Feature

Doggy Door Tech

Sophie Parker

Issue 11, May 2018

What does a maker do when their pup is struggling? They hit the bench to create some innovative tech to assist their four-legged friend.

Sophie’s dog Tilly wasn’t a fan of pushing her way through a doggy door to get outside. After propping it open for a while, Sophie realised there had to be a better way, especially on those cold nights! And so, the DIY automatic doggy door was born! We caught up with Sophie to learn more.

Your automatic dog door is a great invention - and a great solution. How did you first tackle this problem?

Prior to going for an electronic solution, we tried holding the door open with string. That of course worked, but it made the house terribly draughty in winter. So after a month of goosebumpy ankles, I decided I had to do better. It was a simple problem, but the solution needed to work well, without breaking down, so my dog would be able to use it all by herself, whenever she needed.

That’s a good point about reliability. Having poor Tilly stuck in the rain because of some failed code probably wouldn’t be ideal! Did it take some trial and error to get the servo mounting and positioning correct?

I was lucky enough that the plastic of the door was easily cut into, to make a slot for mounting the servo body. The lever mechanism, however, did take some work. I extended the servo arm with some pieces of scrap fibreglass prototype board, then used some 2mm steel wire. This is attached to the fibreglass arm at one end, and to a small loop of sheet aluminium at the other. To establish the most effective point on the door for the fulcrum to be mounted, I simply gaffer-taped the aluminium loop into place. This allowed me to move it a few times to find the best balance between the holding torque of the servo, and the door being as wide open as possible. As it happens, the gaffer tape was so effective I decided to leave that as the mounting mechanism, rather than drilling into or gluing to the door.

Ah gaffer tape - friend to engineers, makers, and just about everyone! If it works it works! You told us that Tilly’s fluffy fur didn’t work too well with ultrasonic sensors, and you had to shift to infrared sensors. Did you need to recode for the infrared sensors, or are they treated the same way by the Arduino?

When I made the change to Sharp infrared sensors, I did have to change the code somewhat. The basic logic was the same, but the way the sensors compute “distance” is quite different.

Ultrasonic sensors, in particular the generic HR-S04 kind, send a small pulse when you bring their input pin high for a few milliseconds. Some time later, they pull their output pin high for a short while. The time between the Arduino pulling the pin high, and the high input, is the same time it took for the round trip of the sound pulse! After that, you can just use the speed of sound in air to calculate distance from the time, and halve it (because it’s a round trip). There are also libraries that do this for you.

The electronics mounted to the frame.
The electronics mounted to the frame.

The IR sensors, on the other hand, provide a simple analogue output of the proportion of reflected light. This means they’re less accurate at specific distances, but that wasn’t an issue for me. Their benefit was that the infrared light was still detectable after reflecting off fur, unlike ultrasonic pulses.

That’s definitely a creative solution - a case of the right tool for the right job, it seems! We often reach for ultrasonics due to their abundance, but IR definitely seems to be the right choice here. Do you have any problem with bugs (e.g., large moths) opening the door or triggering the outside relays during the summer months? Or are the IR sensors only looking for large objects?

I haven’t had any such problems so far. Firstly, there’s no visible light outside the door to attract insects (and they aren’t attracted to infrared). Also, I included logic averaging several sensor readings before deciding whether it is over the threshold to open. This prevents things like insects and passing feet from setting off the door. Tilly, however, need only wait in front of it for half a second or so, and it will open. I add this kind of logic to most sensor-based projects — it cuts out a lot of noise from any number of sources, and it’s rare to require more than a few values per second.

That’s a great point, and a good code workaround too! Tilly would have learned the process quickly too. Have you considered adding any security (RFID or similar) as an additional gatekeeper?

I have! My first idea was to use RFID. Unfortunately regular 13MHz tags have a much too small range for reading (a few centimetres). The possibility of using her microchip, which is a low frequency passive RFID, is still on the back-burner as a possibility, but it hasn’t been necessary yet. Perhaps when the possums get smart enough to let themselves in, I’ll look to add it!

Those pesky possums! Hopefully you never have to deal with them! Anything else you’d like us to know about this project, or are there any planned upgrades?

Gaffer tape was adequate and avoided drilling the plastic.
Gaffer tape was adequate and avoided drilling the plastic.
A makeshift weather shield protects the outdoor infrared sensor.
A makeshift weather shield protects the outdoor infrared sensor.
Veroboard ultimately replaced the breadboard, increasing reliability.
Veroboard ultimately replaced the breadboard, increasing reliability.

I would like to do the microchip update someday, but other than that, I think it’s about finished.

Using her embedded microchip is definitely a great idea, if it’s practical to do so. Range may be the killer there, but maybe you can integrate a reader into a back scratcher to encourage her to come close enough? Or maybe not! If you had your time again with the knowledge gained during this build, what would you do differently?

I wouldn’t have left it using a solderless prototyping breadboard for as long as I did. I spent some time trying to work out intermittent issues with the servo being too weak. It turned out to be due to the breadboard having thin jumper wires. I migrated the project to soldered stripboard, and the issues were solved. I also would have thought harder about the properties and limitations of sound-based sensing first.

Yes a prototyping board is great for the workbench, but can quickly fail in practice. Glad you isolated the issues. What awesome new project are you working on now?

I work in theatre lighting, and I’m designing a miniature wireless transmitter to trigger lighting and sound cues, via a base station, with NRF24L01+ wireless modules. The aim is for the transmitters to be small enough to fit within a costume, wig or prop, and last for days on a AAA battery or coin cells. I’ve decided to branch out into STM32 development for the project, which is a big, complicated world compared to the Arduino ecosystem! It’s also stretching my skills at PCB design to make the device as tiny as possible.

Tilly

That’s awesome! No doubt the actors will love the creative additions, and create some added flare to your future productions! Thanks for taking us through Tilly’s Doggy Door.

Sophie Parker

Sophie Parker

Theatre Lighting Technician / Designer & Freelance Embedded Electronics Developer.