Today's Hardware Friday project comes to us via Matt Cavanagh and his need to, well, chase out some rodents from under his house...
The houses in Durban, South Africa (where I live) usually have some form of gap underneath them that ranges from 30cm to big enough to crawl inside. As far as I know it is for ventilation to help with the heat. The problem is that a bunch of squeaky rodents have decided that mine is a good home, and unfortunately the gap is pretty small so I can’t fit. So I decided to make a little car that could go scout out the area and show me what was going on under there, and possibly how to stop it.
For the frame and wheels I designed models and 3D printed them.
The Bluetooth module is powered from the Netduino 3V3 and GND pins, and wired to pins 0 and 1 for data.
A very handy feature of the motor driver is that you can feed it with 9V and it will output 5V (from the 5V pin). So the battery goes into the VCC and GND, and then the Netduino is powered from the GND and 5V on the motor driver board. The LED board can also be driven directly from that 5V.
Each motor is connected to the outputs on each side.
If you haven’t followed my Netduino+WP8 Bluetooth tutorial then go here now, because the Bluetooth part won’t be explained fully here.
Before adding any Bluetooth code, add a new class to the project called MotorController.cs.
This class will basically control one motor per instance, and is just a helper to set the speed and direction.
Build that code and deploy to the Netduino, then we can move on to the Windows Phone part!
Windows Phone code
Create a standard Windows Phone 8 application. Before you forget, enable the ID_CAP_PROXIMITY capability within WMAppManifest.xml.
Next we need to create a control stick that will be used to move around and drive the car. Create a new UserControl called ThumbStick.xaml within a new folder called Controls.
The XAML below just defines a square with an X in the middle. There are events to detect when the user puts their finger down, moves it, and then lifts their finger. You might notice that instead of referring to a finger, it mentions a mouse – this is just because it is based on desktop Silverlight.
I wanted to keep the mechanics very simple so decided to not have a turning mechanism, but instead slow down a specific motor to make it turn in that direction. Although this works, there is a lot of friction because the back wheels are forced to slide out when turning. In future I would probably add a way for the wheels themselves to turn, or go with a tank-tread style.
I designed the platform around using a 9V battery – which turns out is a pretty bad idea. Compared to most other types of batteries they have a very low mAh and die really fast when driving two motors and an array of LED’s.
Matt provides all the details, code, hints and tips for creating your own rodent chaser. Now all you need to add are some lasers and... :P