Remote Control Door - Internet Your Thing
by tcollinsworth in Circuits > Remote Control
18579 Views, 73 Favorites, 0 Comments
Remote Control Door - Internet Your Thing
We can instantly open a door or control anything we can connect. It works from any iPhone, Android, or PC. After connecting something we want to control, download the free app to a PC, open a port, and control it remotely from anywhere. It's open source so anyone can modify it to sense and control anything they like. You can try it out here. In the kickstarter video we show creating a virtual fence around our house to automagically open the garage door and let the dog out when we approach home.
For less than $50 of easy to find parts and a little ingenuity, we can let our best friend out as we approach home so he can meet us at the door. If for some reason we can't be home on time, we can open the door from anywhere. We could even program a timer to automatically let him out in case we didn't have service.
We've also created prototypes that can open the kennel door or activate other items as we approach or leave home, work, or any other location. You can find out more on the Internet Your Thing Kickstarter project.
Download a fully working server here, just unpack it and run.
Get the full source here. A complete list of all technology used is published at the end of this howto.
For less than $50 of easy to find parts and a little ingenuity, we can let our best friend out as we approach home so he can meet us at the door. If for some reason we can't be home on time, we can open the door from anywhere. We could even program a timer to automatically let him out in case we didn't have service.
We've also created prototypes that can open the kennel door or activate other items as we approach or leave home, work, or any other location. You can find out more on the Internet Your Thing Kickstarter project.
Download a fully working server here, just unpack it and run.
Get the full source here. A complete list of all technology used is published at the end of this howto.
Prepare
All the materials and tools that we used are listed below. There are also some optional items listed if you want to go wireless. The kennel we modified was a large Vari Kennel. If yours is different, you will most likely have to modify the mechanism.
Materials
Materials
- Kennel
- aluminum or steel flat stock: (local hardware store) 1/16 inch thick, 1 inch wide, 2 feet long
- bolts and nuts: eight 10-24 x 1/2 inch long or similar
- board or rod: approximately two feet long
- pulley, small
- string: approximately two feet
- weight: a small water bottle works well
- hobby servo like B1221
- small stiff wire: three inches
- arduinio or derivative microcontroller and small stand-offs for mounting
- wire: approximately 4 feet (old telephone or Ethernet cable works great)
- electrical tape
- Twist ties from toy packaging
- screwdriver
- drill
- hacksaw
- pliers
- hammer
- large wrench or vice to bend metal for servo bracket
- knife or wire strippers
- Bluetooth or WiFi controller
- jumpers
- soldering iron
Controller
Connecting the parts are quite simple. It only takes a USB cable, three wires for the servo, and power. If you want to go wireless, you can use a Bluetooth Multi-thing controller for local control or consider the Daisy WiFi via the Internet Your Thing Kickstarter project.
Servos generally require a little more power than the USB can provide, so we recommend an alternate power source. We just used an old 9 or 12 volt power adapter from something that broke long ago.
Servos generally require a little more power than the USB can provide, so we recommend an alternate power source. We just used an old 9 or 12 volt power adapter from something that broke long ago.
Configure Arduino
This is easy, trust me! You don't have to write a program, just load it.
//Start of sketch
#include <Servo.h>
Servo servo;
//pin we connected the servo to
int servoPin = 2;
//Open and closed servo positions in degrees
int closedPosition = 130;
int openPosition = 30;
void setup()
{
servo.attach(servoPin);
Serial.begin(57600);
}
//does the following loop forever
void loop() {
//if something was sent to the arduino, process it
if (Serial.available() > 0) {
processInput();
}
}
void processInput() {
int input = Serial.read();
if (input == 'o') {
servo.write(openPosition);
} else if (input == 'c') {
servo.write(closedPosition);
} else {
Serial.println("Send 'o' to open, 'c' to close");
}
}
//End of sketch
- Download the free Aruduino IDE from the Arduino site
- Plug the USB cable into the Arduino and the PC
- Click Tools : Board and select you Arduino model - most likely an Uno if you bought it recently
- Click Tools : Serial Port and select the port for your Arduino, probably the only one available
- Copy the simple Arduino sketch below and paste it into the text area
- Click the on the toolbar square with the arrow that points to the right (it's white in the picture), this is upload
- If it succeeds, you have successfully programmed the Arduino and can close the Arduino IDE
//Start of sketch
#include <Servo.h>
Servo servo;
//pin we connected the servo to
int servoPin = 2;
//Open and closed servo positions in degrees
int closedPosition = 130;
int openPosition = 30;
void setup()
{
servo.attach(servoPin);
Serial.begin(57600);
}
//does the following loop forever
void loop() {
//if something was sent to the arduino, process it
if (Serial.available() > 0) {
processInput();
}
}
void processInput() {
int input = Serial.read();
if (input == 'o') {
servo.write(openPosition);
} else if (input == 'c') {
servo.write(closedPosition);
} else {
Serial.println("Send 'o' to open, 'c' to close");
}
}
//End of sketch
Start Server
We've provided an app you can download and run on your own PC to avoid additional fees. We've also posted all the source so you can inspect and modify the app to do whatever you want. We just ask that you maintain the link to our site.
- Download the app
- Unpack it
- Run the script
- Configure your router to port forward to the app on port 9549 - you can change this if you like
- If you want security, configure SSL and add authentication
- Run ipconfig (windows) or ifconfig (linux) on the PC where you'll run the app to get the IP address
- Login to your router
- Go to the port forwading
- Add a forwarding rule that forwards traffic from port 9549 (default which you can change) to the IP address from step 1 and port 9549
- Save the config
- Check the routers status and get the public internet address - this address is what you will connect to from the outside (phones, work, etc.) It will look something like http://74.44.69.247:9549
- Your public IP address can change preventing access. There are DDNS services you can use to create a name and keep the dynamic address up to date if it changes so you can always connect - you can read more about it here.
- Your internal IP address can change preventing access if you use DHCP . It generally doesn't, however you may want to use static IP addresses so it doesn't change.
- If you have more than one router/firewall, you will need to setup port forwarding on router/firewall between the server and the public Internet. I have Vonage and a Netgear WiFi router, so I had to configure both. The procedure is exactly the same as outlined above.
Kennel Modifications
We made three minor modifications that can all be removed/reversed in the event we ever want to ship or sell the kennel.
Latch
The door latch on the Vai Kennel has springs which push two bars in opposite directions. You have to squeeze on both of them to open the door. When shipping your kennel, this keeps the door from accidentally opening if a baggage handler were to grab and lift only on the latch.
The springs are too strong for a standard servo to open. We've found that only the bottom latch, gravity, and the servo keep our kennel door closed. You may need to experiment with yours to see what works best.
Pop the cover off the latch by gently prying from the back with a flat bladed screwdriver, remove the springs, and pop the cover back on. Put the springs in a bag and tape them to the side of the kennel in case you ever want to ship your dog in his kennel.
Counter weight
To open the door we need to add a counter weight to pull the door open when it is unlatched. This was accomplished by attaching a narrow board to the side of the kennel with a pulley on the end. The length was chosen to match the open door so the pulley and the door meet. This gives ideal leverage. The water in the bottle was adjusted so the door didn't open too fast or slow. We also had to trim a couple bits of plastic the door was sticking on when it was closed.
Controller
We mounted the controller on the back where no one would see it. We drilled three small holes and attached the Arduino with matching stand-offs and 4-40 screws. The optional Bluetooth or Daisy WiFi controller was attached with self adhesive hook and loop tape. The cables were neatly routed under the kennel frame and held in place with twist ties from toy packaging which my wife conveniently saves - thank you dear.
Latch
The door latch on the Vai Kennel has springs which push two bars in opposite directions. You have to squeeze on both of them to open the door. When shipping your kennel, this keeps the door from accidentally opening if a baggage handler were to grab and lift only on the latch.
The springs are too strong for a standard servo to open. We've found that only the bottom latch, gravity, and the servo keep our kennel door closed. You may need to experiment with yours to see what works best.
Pop the cover off the latch by gently prying from the back with a flat bladed screwdriver, remove the springs, and pop the cover back on. Put the springs in a bag and tape them to the side of the kennel in case you ever want to ship your dog in his kennel.
Counter weight
To open the door we need to add a counter weight to pull the door open when it is unlatched. This was accomplished by attaching a narrow board to the side of the kennel with a pulley on the end. The length was chosen to match the open door so the pulley and the door meet. This gives ideal leverage. The water in the bottle was adjusted so the door didn't open too fast or slow. We also had to trim a couple bits of plastic the door was sticking on when it was closed.
Controller
We mounted the controller on the back where no one would see it. We drilled three small holes and attached the Arduino with matching stand-offs and 4-40 screws. The optional Bluetooth or Daisy WiFi controller was attached with self adhesive hook and loop tape. The cables were neatly routed under the kennel frame and held in place with twist ties from toy packaging which my wife conveniently saves - thank you dear.
Servo Mount
Using the the 1/16 x 1 inch aluminum or steel flat stock.
Cut the following
Tape or clamp the above pieces to some old wood and drill all holes (3/16 inches) before bending. It is easier to drill first. All the holes will line up.
The only holes that are important are the pairs on the end of the long servo mount. To mark them, just push them in along the end of the servo under the mounting holes and mark with a pen. Do this on both ends.
The other holes just need to be roughly aligned as you see them in the picture.
Bend
Kidslike love to pound on metal with hammers to form it into something.
The long servo mount needs to be bent into a "C" shape to match the servo. If you used a similar servo, then the small end bends need to both be at 1/2 inch and the other two bends need to be at 2 inches (1-1/2 inches long) leaving 2-3/4 across the bottom.
The two 3-1/2 inch risers need to be bent at 2 inches from the connection to the servo bracket.
Assemble
Kids also enjoy putting all the parts together and especially crawling inside the kennel. If the dog goes in too, all the more fun.
Connect the risers to the servo bracket and then connect the servo. It has to be done in this order so you can tighten the riser bolts before you mount the servo. Last, mount the whole assembly to the kennel door by placing the backing plate on the inside and the servo assembly on the outside. Align the servo so it is centered over the latch cover.
Cut the following
- 6-3/4 inch - servo mount
- 2 1/8 inch - backing plate
- two 3-1/2 inch - risers
Tape or clamp the above pieces to some old wood and drill all holes (3/16 inches) before bending. It is easier to drill first. All the holes will line up.
The only holes that are important are the pairs on the end of the long servo mount. To mark them, just push them in along the end of the servo under the mounting holes and mark with a pen. Do this on both ends.
The other holes just need to be roughly aligned as you see them in the picture.
Bend
Kids
The long servo mount needs to be bent into a "C" shape to match the servo. If you used a similar servo, then the small end bends need to both be at 1/2 inch and the other two bends need to be at 2 inches (1-1/2 inches long) leaving 2-3/4 across the bottom.
The two 3-1/2 inch risers need to be bent at 2 inches from the connection to the servo bracket.
Assemble
Kids also enjoy putting all the parts together and especially crawling inside the kennel. If the dog goes in too, all the more fun.
Connect the risers to the servo bracket and then connect the servo. It has to be done in this order so you can tighten the riser bolts before you mount the servo. Last, mount the whole assembly to the kennel door by placing the backing plate on the inside and the servo assembly on the outside. Align the servo so it is centered over the latch cover.
Technology
Technology
- Arduino hardware and IDE
- Twitter Bootstrap - UI framework
- jQuery - javascript library, HTML manipulation, AJAX, UI
- Java
- Jetty web server
- RxTx - serial port library
- com.sun.jersey - from Glassfish, RESTful webservice
- Apache log4j
- Apache Maven - build system
- Github - source control
- Eclipse IDE
- Ubuntu Linux - preferred development OS for productivity