I love our dogs more than anything. Even more than my NXTs. I can hear you all gasp and mutter “blasphemer!”. Now before you throw me on the fire, you must understand that I was a dog person before I was a robot person.
Anyway, as I was saying, as much as I love my dogs, they have a tendency to bark. When we’re home, we can (and do) tell them to shut up, sometimes combined with the (in)appropriate expletives, depending on volume and time duration of said barking spree. However, when we’re not there, we obviously can’t keep an eye and ear on them. Luck would have it that Mindsensors have a new sensor, the NXTHID. It’s a sensor that can act as a Human Interface Device (HID), like a keyboard. Using I2C commands, you can, for example, send data to a program on your computer via a USB cable as if *you* were typing it. You can also make it start a program using the “run command” by sending the “Windows Key” modifier and the letter “r” and entering the command line in the text box followed by an newline and return carriage.
That gave me an idea. How cool would it be to know how much the dogs had barked and for how long? Everyone (and their dog) is using Twitter nowadays, so why not my NXT as well? I did some Google’ing for a command line Twitter client for Windows and bumped into a very handy little script that uses wget to send a message. It’s really very simple. Put the batch file and wget program in a directory in your PATH (like C:Windows or another directory you added to the PATH variable yourself). Make sure you edit the twitter.bat file to set the username and password of your Twitter account.
I created a small program that uses a test release of the NXTHID driver I made. It will be part of the next release of the ROBOTC Driver Suite. You can download the zip file with the program and all the necessary drivers here: [LINK]. The program is quite simple. First we check if the dog is barking, this is done by checking if the sound sensor is registering a loud noise. Usually our house is pretty quiet, so if the sensor reads “100”, we can be pretty sure that it’s a bark. If we’re not already running a total bark time timer, we reset it now and start counting. Another timer to check how long it’s been since the last bark is also reset. If there hasn’t been any barking for 30 seconds and our total barking time has been less than 90 seconds (that’s 60 seconds of barking time + the 30 seconds since the last bark), we’ll ignore it. However, if the total barking time is more than 90 seconds, we’ll start up the twitter script to alert us. After the tweet is sent, the whole process starts anew.
It is important to set your NXT to not switch itself off after 10 minutes or you’ll never know how bad your dog has been. You can view my NXT’s Twitter page here: [LINK].
Very nice! Of course, now I want to know what your dogs were doing when they were barking 37 times :).
—
Brian Davis
They usually only bark when:
* they’re playing
* they hear a dog outside
* they think they hear a dog outside
* they see a fly and fail to catch it
* they see fit
Other than on those occasions, they’re pretty quiet.
I know this is an old post, and the robot logging your dogs was disabled about a year ago, but I am interested in getting an NXTHID. However, I would like access to other HID besides the keyboard. Mainly a mouse. A joystick would be nice, but I’d settle for a mouse and keyboard.
You should contact Mindsensors about that. I’d like to see those features implemented, too.
[…] Library relaying site to send them which is really, really cool! I am so going to rebuild TwitterTattle to do this. No more tethering needed! This is […]