Thursday, April 24, 2014

Cellular connected GPS tracker

I wanted to make it easier to track my mileage for work, so I decided to build a GPS tracker using some off-the-shelf parts.  I used a GPS enabled Skywire EVDO modem from NimbeLink and an Arduino to capture the GPS data and send it to the cloud(Exosite) over the Skywire cellular link.  I put together a detailed, step-by-step Instructable on how to do it so others can replicate.

Here is the picture of the complete, simple setup, before putting on my car.


Here is a screen capture of the map it produced after a day of driving:
Here is a link to the live dashboard https://portals.exosite.com/views/1265154472/2460159184

Saturday, February 15, 2014

Get notified when your cookies are stolen!

I bought a new NL-SWDK-1xRTT-V development kit and wanted to do something fun and quick to test it out, so I hooked up a simple magnetic reed switch to an Arduino Leo and modified the development kit sample code to send me an SMS whenever someone opens the cookie cupboard.  The video and picture show you the pieces.  The operation is pretty straightforward.  You mount the magnetic switch near the edge of the door, and you mount a magnet on the door.  You arm the system by plugging in power.  The code takes a few seconds to initialize the modem, and then anytime the door opens in the future, I get a text message.  My sample code is provided below so others can replicate or improve!

There are a few cool things about the Skywire module:
1) its small 33mm x 29mm
2) its certified as an end-product on the Verizon network, so you can embed it into end products and skip the FCC and Carrier certification hassles found in typical product designs
3) it conforms to the XBee formfactor, so you can plug it into many existing development tools and upgrade legacy low-power RF products to communicate over the cellular network without any hardware re-design
4) the development kit is also an Arduino shield, so you can plug it right into your favorite Arduino and use the sample code to create something useful like this!
5) NimbeLink provides low cost Verizon plans ($5/mo for SMS only, $10/mo for <1MB data plans) so you can get your device activated and running on the network the same day without having to go through Verizon!
6) complete kit is only $262 on Digikey.com

Development kit on Arduino Leonardo plus Antenna and open/close sensor.






For more information, checkout the Skywire product page here.




/*
SMS Cookie alarm
This sketch is an example that sends SMS messages using the Telit CE910-DUAL modem.
Circuit:
* Arduino Leonardo
* Skywire development kit: NL-SWDK-1xRTT and NL-SW-1xRTT
created 2/15/2014
by Kurt Larson // NimbeLink.com
This example is in the public domain.
*/
#define DESTINATION_PHONE_NUMBER "15554443333"    // destination phone number of 1-555-444-3333 should be formated like: 15554443333
String SMS_MESSAGE = "Cookies are under attack! Sent via Arduino & Skywire cellular modem!";    // SMS message you want to send, limited to 160 characters
void setup()               // Initializes the pins, serial ports, modem
{
  pinMode(10, INPUT);       // Set I/O pin 10 to input for door open/close sensor
  pinMode(13, OUTPUT);      // Set LED pin to output
  digitalWrite(12, LOW);    // Set I/O pin 12 to low
  pinMode(12, OUTPUT);      // Configure I/O pin 12 as output
  digitalWrite(12, LOW);    // Drive I/O pin 12 low
  delay(1100);               // modem requires >1s pulse
  pinMode(12, INPUT);       // Return I/O pin 12 to input/hi-Z state and wait >10 seconds for modem software to boot up  
  delay(10000);             // modem documentation says wait 10 seconds
  Serial1.begin(115200);    // Initialize serial port to communicate with modem
  while (!Serial1) ;
  Serial1.println("AT+CMGF=1");  // put modem into text mode
  delay(250);                // wait for modem response
}
void loop() 
{
  if (digitalRead(10) == 1) {        // if the signal goes high, that means the open/close sensor is open, so send an alert
    digitalWrite(13, LOW);
    Serial1.print("AT+CMGS=\"+");
    Serial1.print(DESTINATION_PHONE_NUMBER);
    Serial1.print("\"\r");
    delay(250);
    Serial1.print(SMS_MESSAGE);
    Serial1.write(26);
    Serial1.write("\r");
    delay(300000);              // do not retrigger for 5 minutes
  }
 }
For more information, checkout the Skywire product page here.

Thursday, October 31, 2013

Remote Control Lawn Mower

Its hard to find people that actually WANT to mow their lawn.  I am no different. I don't enjoy it. It takes me away from fiddling with electronics!  My solution to the problem was to build a remote control lawn mower.  It took a few months from start to finish, but its been a robust tool for our family.  A video first, then the rest of this blog post documents all the major components and peels back the layers of the onion on how it works.

I started with a standard 6HP push mower.  I removed the front drive wheels and replaced them with mini-bike tires that had a built in gear tooth sprocket.  I replaced the back wheels with large caster wheels so they could spin freely in 360 degrees.  I used motors and gear boxes from National Power Chair -- the folks that sell components for motorized wheel chairs and combat robots.  The motors are large DC 12-24V motors.  




I use a Futaba remote control transmitter and receiver to send signals from me to the lawn mower. 
You can see me holding it in the video.  To drive the motors, I use a Vantec speed controller.  It takes the RC signals and converts them to PWM DC forward and reverse controls to each motor.  The two motors drive the two front wheels independently, so the driving experience is kind of like driving a tank with skid steering. 
The power system is a little complicated.  In order to have enough energy to drive the lawn mower long enough to mow the lawn, you need multiple large 12V lead acid batteries, but there is no room for them, and the weight would kill the mower's speed, so I decided to copy what they do in automobiles.  I bought the cheapest alternator I could from the local auto parts store.  One for a 1979 Ford Pinto!  I added a pulley wheel to the mower's gas engine output shaft, and used a rubber belt to drive the alternator shaft.  This allowed me to use a single, smaller battery in the system. 
I used a 12V lead acid battery designed for motorcycles, the size was a good fit right in the front where the weight helps with the traction.
It took me a few months to perfect the system, but once it was working good, and I had some practice driving, I was able to mow the lawn consistently in about 45 minutes.  I used the mower for a few years, but eventually starting paying the neighbor kids to do it for me.
Here is a video from a few years ago showing how it works.  Its pretty quick and spins around quickly on the cement where there is no grass slowing it down!

Wednesday, September 18, 2013

Laminar Flow Nozzle

A few years ago, Hackaday, my favorite website, posted a laminar water jet project, and it inspired me to create my own.  My goal is to create nighttime light shows with computer control of the water color by driving red, green, and blue lights at different intensities throughout a musical sequence.  So far, I have built up the blue and green solution, and this video is the outcome of the testing.  More details below on the construction.



The laminar nozzle is built with roughly 800 drinking straws all placed in parallel inside a 4" PVC pipe.  The water input is a 3/4" garden hose adapter, perpendicular to the flow of the output nozzle.  The construction consists of some cleaning sponges near the water inlet, followed by the 800 straws, a couple inch gap between the end of the straws, and finally the end cap.  The exit nozzle is a critical component.  The sharper the edge on the water exit nozzle, the better the quality of the laminar flow leaving the nozzle.  To create mine, I purchased a brass pipe end cap from Home Depot, drilled a hole in it, and tapered the rest of the exit material so the water would not touch it.  I then sanded using 600ish grit sand paper to create, literally, a sharp inner edge.
To get the colored light to shine down the laminar flow, I fed three fiber optic cables up the center of the PVC pipe, all the way to about one inch before the exit nozzle.  

To create the light, I used 2 separate high power LEDs.  I used one blue and one green PT-54 Phlatlight LEDs which I drove at around 5Watts.  The pictures below show how I mounted the LEDs to individual black CPU heatsinks, and held them in place with a piece of aluminum, similar to U channel, but with 2 extra strips down the center.  I cut out custom notches to keep pressure on the LEDs for good connection to the heat sinks below.  I also drilled a hole through the U channel to hold  fiber optic cable. 

The cable I used is 3.0mm PMMA cable.  If you haven't used fiber optic cable before, you need to create clean cuts and polish both ends to get a good amount of light to pass through.  I cut the cables and found some online guides for how to polish the ends.  You basically use increasing grades of sand paper to sand out any defects at the end of the cable.  I had to go to a special wood shop to get sand paper that was 3000, 5000, and 8000 grit to get the fiber optic ends square and smooth.  I wasn't sure how much the sanding would help, so I used a light intensity meter (lumens/lux) and was surprised there was about 4x improvement in number of lumens that made it through the cable after they were polished!

The interface between the LED and fiber optic cable was nothing special. I pushed the fiber directly onto the surface of the LED, and that was it.


To drive the LEDs, I needed a high power, constant current source, so I wired up a current source using an LM388, some power resistors, and heatsinks.  For the simple experiment shown in the video, I used push buttons to activate the current source for each LED.  With this simple setup, I can create 3 colors: blue, green, and green+blue.  The long term goal is to drive each LED power source with a PWM signal with duty cycle control via an MCU so I can adjust the perceived intensity of each color individually.