Introduction
Over the past few weeks I have read about several projects for the iobridge: internet dog feeder, Jason’s fish cam, and the servo-beer. These got me thinking about small projects that I could use the new device for. It didn’t take very long before I came up with idea for LaserPup. One of my favorite things in the world is my dog, and one of his favorite things in the world is his laser pointer. Over the past 4 years he’s gone through several of them, and it continues to be one of his favorite toys.

This is not LaserPup
So what is LaserPup? It is not a dog with a laser beam attached to his head, as cool as that would be. In its simplest form it is an internet enabled dog toy. I have created a small device that mounts in the ceiling of my basement where my dog likes to play. It is comprised of two servos, a buzzer, and a laser pointer. The servos move the laser pointer around on the floor, alleviating the need for my arms to do it myself. Because really, there is nothing more exhausting than sitting on the couch watching TV while your dog chases the laser around the floor. The buzzer is used to notify the dog that it is time to play, and also that play time is over. This is really a bit of a social experiment, and I’m curious how long it will take before he understands what it means (if ever).
LaserPup YouTube Demo
What makes the project possible is the iobridge, as it allows me full control of the servos and the small electronic circuit over the internet. To stream the action I installed a small webcam in the room, and to combat darkness I added an X10 controlled light. Finally I designed an interface page for the iphone (using iui as a base) that controls it all, and now my new toy travels with me everywhere.
Disclaimer:
I understand that some people don’t believe that laser pointers and dogs are good mix. In some dogs it can lead to OCD, and strange behaviors. I am confident that this is not an issue with my dog, but realize the dangers and will continue to monitor him.
Hardware Design
Once I decided to actually construct this project it was time to gather supplies. Here is what I needed to complete my device:
- I/O Bridge with Servo Module
- Webcam
- 2 Servos
- Buzzer
- Laser Pointer
- Spare Electrical Components from parts bin (Transistor, Resistors, LEDs, etc.)
- X10 Module
It has been many years since college, which was the last time I put together a digital circuit. I was lucky enough to find my old EE breadboard, and a trip to Radio Shack gave me the spare components I needed to get started. After the week long wait for the everything else it was time to get building.
The first thing I did was connect up the servo module board, the two servos, and the iobridge. I powered on the iobridge and followed the directions to link it to my web account. On the iobridge website I configured the servo board, and created two widgets for variable servo motion. In all this about 15 minutes before I had web control from the iobridge site working to move my servos.
The servos moved, but I needed to fine tune them to the ranges of motion I needed. To make a complete circle on the floor I figured that the X-Axis needed to move 180 degrees, and the Y-Axis needed about 80 degrees. I had two Hitec HS-322D servo’s in my possession, and I set out on the internet to find the PWM timings. So if anyone else is interested in the values for this particular servo:
-90 Degrees -> 600 usec
-45 Degrees ->1050 usec
0 Degrees -> 1500 usec
45 Degrees -> 1950 usec
90 Degrees -> 2400 usec
If the servos are vibrating then you’ve issued a timing outside the valid range, and you can damage the servo. Once I put in the correct min/max and starting points the servos were fully operational, and had the range of motion I desired.
Now that the servos were working it was time to create a digital circuit! I would need to use two digital out lines of iobridge, one to control the laser pointer on/off and one to control the audio buzzer. Now I could have run both of those directly off of the 5V digital out line, the iobridge would have supported the necessary current. But just to play it safe, and because I had the necessary parts, I decided to turn them on/off through transistors being used as a digital switches. By wiring it this way the current to power them is drawn from the power supply, and not the digital logic that produces the DOUT signals from the iobridge.
For the first prototype I used LEDs in place of the laser pointer and buzzer. I then created iobridge widgets for the two digital out lines, each one has an on and off switch. By connecting the two DOUT lines of the iobrige to the base of the transistors I was able to turn on & off the LEDs from the iobridge website. Now I had full control over the web of all my necessary electronic pieces through widgets.
Next I took an old laser pointer device that ran off of 3 1.5V watch batteries, and removed the electronics with a dremmel. I soldered a wire across the push button switch to short it, and keep it always in the on position. Next I replaced the two LEDs on my breadboard with the laser and a small buzzer. At this point the LaserPup module was ready for assembly!
After creating a quick circuit diagram I soldered the electronics onto a small prototyping board. This was mounted with the servos in a box, and ready for installation in the ceiling. Since I didn’t want the ioBridge mounted in the ceiling (I want it available for other projects), I decided to create a simple interface board that would connect my custom modules using a standard ethernet cable. The physical construction of the device was finally complete.
Software Interface Design
The iobridge website provides javascript code to drop onto your webpage and control all of your widgets. There is also an api that allows you to interface with your controls in custom javascript, and this is what I would be using. Since the desired interface of this project is my iphone, I designed the page to fit perfectly when the phone is in the horizontal position. On the page I have the live video feed to the laser pointer room, along with three interface objects.
The second button controls a x10 light that is in the laser pointer room. If it’s too dark then you can not see the video feed, and what fun is that.
The first button turns the laser pointer on and off. When turning the laser pointer on, it will also turn the buzzer on for two 1 second pulses. When turning the laser pointer off it will move the servos back to the default position, and turn the buzzer on for one 1 second pulse. We’ll see how long it takes my dog to figure out what the buzzing means!
The circle graphic controls the position of the laser pointer in the room, but only if the laser pointer is turned on. If you click on the circle, an image map is used to feed the coordinates to javascript that then calculate the correct servo positions and set the values. Thanks to the iobridge team there, they provided me two lines of javacript that mapped x/y coordinates to servo PWM positions.
Conclusion
I would eventually like to make an updated interface that uses the iphone’s accelerometors as the control. Since the current interface is written in javascript, Safari only gives access to 3 positions from the iphone (-90,0,90). I will have to develop an iphone application, and not a web page, to finish what I envision. Please check out the demo and tell me what you think, as you can see from the video Skyler is a big fan! Leave a comment below, or email me at joe@laserpup.com
ioBridge RJ45 Breakout Board
My new iobridge is great, and I already have several project ideas. The problem I faced was how to connect multiple projects, in different locations of my house, to one central iobridge. Ethernet is the cheapest multi-wire cable I could think of, with 8 separate wires it will pass enough signals for most projects. As an example my LaserPup module requires 6 lines: 2 PWM servo signals, 2 DOUT signals, and +5/GND. That still leaves 2 to spare.
I purchased a few RJ45 jacks from digikey, and once they came in I noticed that the second row of pins is offset. This means it wouldn’t fit in the holes of a .1″ prototype board, but that was nothing a little bending of the pins to align them wouldn’t fix.
With that figured out I soldered together a simple breakout board that had one RJ45 jack, an 8 pin male header, and an 8 pin female header. This would give me the versatility to send any signal down any pin of the ethernet cable. By using two headers I can connect to the board with a bare wire or one that has a header attached. It also allows me a second point to easily connect a multimeter for testing and debugging.
Now for all of my remote iobridge modules, I will just add an RJ45 port and use a standard cat5 cable to connect them together.















No comments:
Post a Comment