Tag Archives: gps

Home Automation Update

2017.

As with all things that change, much remains the same.  The past several years have seen an explosion of new products in the “Smart Home” market, yet no clear winner has emerged, resulting in a landscape that is even more fragmented and beset by compatibility issues than ever before.  Whereas 5 years ago one was faced with a choice of several protocols (Z-wave, X10, ZigBee) and control software options (HomeSeer or Vera) or expensive, bundled turn-key solutions like Control4 or Savant, the product offerings are now much more diverse.  Almost every large tech company (Google, Apple, Samsung) and many home appliance stores (Home Depot, Lowe’s) have their own brand-name devices, home automation hubs, and cloud subscription services.  Nothing as ambitious as Google Home (the platform, not the smart speaker they launched this year) has materialized, and because no one ecosystem has gained wide acceptance, the consumer is faced with the unfortunate choice of settling for the limitations of a single ecosystem that may be lacking in certain device modules or software features, or going down an ever more harrowing DIY path and dealing with compatibility issues as they try to integrate products from the above manufacturer’s offerings into a third-party control network, hoping that the underlying protocols are still compatible.

Left with the choice of investing an a single ecosystem that may – and likely will – become obsolete (and unsupported?) within less than a decade, I have decided to stick with the tried and true – HomeSeer and Z-Wave – for the foreseeable future.  While lacking some of the nice flourishes like well-designed mobile apps and effortless compatibility, the endless rule-based configuration and extensibility of HomeSeer offers true Automation where competing “consumer-friendly” products lean more towards glitzy remote-control.

In the past few years, I have added some additional functionality, mostly through software, that has improved the overall experience of my setup.  The mantra is simple: unseen, unheard.  Anticipate, react, but do not interfere or present features that add little value.  What does that look like?

Alexa

My glorified smart alarm clock.  Really.  While the other features are nice, and I do enjoy the occasional customized morning briefing, using the Echo as an alarm clock has made a notable improvement in the daily routine.  With IFTTT integration, Alexa can trigger events in HomeSeer, and trigger phrases can be customized.  I can say, “Alexa, trigger all lights out” to turn every (connected) light in the house out, or “Alexa, trigger air on” to turn on the AC.  Rather than fumbling with a crappy old alarm clock or relying on my phone, I can say “Alexa, set alarm for 5:25 AM” and it is done.  The time is maintained accurately via internet connection, and daylight savings is accounted for.  Better yet, IFTTT can respond to the alarm going off as a trigger.  This allows the lights in my bedroom, hallway, and living room to automatically come on when the alarm goes off, and (optionally) the coffee pot to turn on with a 10min delay for me to finish a shower,  Pretty cool.

Presence

One of the requirements for true home automation is the accurate tracking of presence.  The system must know who is home in order to respond appropriately.  This is actually very difficult to implement, and there are many ways of going about it, including motion sensors, Bluetooth beacons, pinging each household member’s phone while connected to the Wi-Fi network, or using GPS position reporting from an app.  The latter two options offer the additional granularity of knowing WHO is home (assuming they keep their phone with them) and the last option gives the ability to set multiple trigger zones on a map with the goal of anticipating one’s arrival home and thus responding BEFORE they arrive, allowing for heat/AC to already be on, alarms to be disabled, etc.  This is what I have implemented with one of my favorite iOS apps, Geofency.  It allows multiple “Geo-Fences” to be set up, with accurate cell and GPS based tracking of the entry and exit into and out of set geographical regions, with associated trigger actions.  In this case, like with Alexa, IFTTT is used as a bridge to connect with HomeSeer and set “Home” and “Away” status.

Security

ADT?  pfft.  With no additional hardware, and zero monthly subscription fees, I have an adequate security system by simply utilizing the existing presence features described above with alternative events to be triggered when either of the in-house motion sensors (entryway and stairway) detect motion.  Normally, these are used to turn lights on, but when no one is home, they send an alert text that there is activity in the home.  While I have experimented with cameras, there are just too many false positives (headlights flashing through a window, lightning, birds etc…).  Simple IR sensors are much more reliable at detecting humans and humans only.

HVAC

Here is where the cost savings comes in to save the day and pay for all the cool stuff described above.  Presence sensing and a connected thermostat (no, not a Nest, just a simple, dumb, Z-wave thermostat) allow for the heat and AC to be on only when home, and to dynamically react to changing outside weather conditions, bedtimes, and early/late mornings.  The cost savings, especially with air conditioning, is in the range of hundreds of dollars annually.

Conclusion

With the exception of voice control via Alexa, little has changed from the hardware standpoint.  Sure, a few more lights are attached via Z-Wave outlet, thanks to overall lower prices.  Several 4-button Aeon MiniMotes have been added for convenience of turning said lights on and off singly or in groups.  But the rest?  Mostly better software integration.  Better presence detection has enabled a much less distracting level of automation, where the house reacts to certain events reliably and appropriately, but is still able to be overridden manually without hassle.

While the lights don’t change colors and doors don’t lock and unlock themselves, I am happy with this fairly unobtrusive setup until something better comes along.

 

Category: Technology | Tags: , , ,

TK102 Clone – GPS Tracker Setup Guide

As with most Chinese knockoff and clone devices, one can expect minor variations in hardware, numerous inconsistencies in software / firmware and a complete lack of documentation.  For a device where all commands must be issued over SMS text message, figuring out how the Xexun / ZY International TK102 / TK102B / TK102-II functions without a proper manual is difficult enough, but for my “clone,” the closest to which I’ve come to identifying as a Heacent HC06A board inside a TK102 shell, in which the formatting of the commands has inexplicably been altered, the task was a miserable one.

SupportedDevs_1

Mine resembles the “Hash Clone.” Click for the key and link to the source, the developer of an android app for these trackers.


That said, at $27.97, this type of hassle is almost expected, and for a fully functioning (once understood) GPS / GSM tracker, the lack of documentation does little to spoil the deal.

The Elusive list of Commands

For this device, the commands use “#” for padding/separations, rather than a space as on the official devices and many of the, er, “more official” clones.  The commands also vary slightly.  As with the original, all passwords must be numeric only, and six digits.  The default is “123456.”  Here is what I have gotten to work:

 

Function SMS Command SMS Response Notes
Initialization #begin#123456# begin ok resets password
Change Password #123456#123456#987654# password ok
Get IMEI #imei#123456# imei:123456789000015 15 digits
Set Timezone #timezone#123456#S0400# time ok S equals negative?
Set APN #apn#123456#epc.tmobile.com#user#pwd# apn ok user and pwd are optional
Set Server IP #adminip#123456#193.193.165.166#20751# adminip ok IP and port (IP can be a url)
Remove IP #noadminip#123456# noadminip ok Limit 1 IP / Domain?
Admin Number #admin#123456#18001234567# admin ok need country prefix
Remove Number #noadmin#123456#18001234567# noadmin ok Can store 5 numbers
Admin SMS #adminsms#123456#18001234567# sms ok Can store 5 numbers?
Remove SMS #noadminsms#123456#18001234567# noadminsms ok
Check Status #check#123456# electricity:24.97% GPS:A gprs:open gsm :75 A= fix ; open=online
Google Maps link #smslink#123456# http://maps.google.com/?q=N41.000000,W87.000000
Auto Track #fix#030#004#123456# set fix ok interval (<20) # total (<255)
Auto Track-alt #fix#030s#004n#123456# set fix ok s: second, m: minute, h: hour
Stop Auto Track #nofix#123456# Cancel fix time ok!
Listen to Microphone #monitor#123456# monitor ok Call to listen to mic
Back to default mode #tracker#123456# tracker ok Switch back to normal mode

From the various sources I pieced this together from, I still couldn’t figure out the following issues:

  1. Admin phone number: Requires an international prefix (eg +1 for the US).  The example they list is for China (+86), which is formatted as 0086.  Unsure how many zeros should precede the “1” for US.  I’m also not sure a prefix is even needed unless you’re calling from out of the country.
  2. The “Auto Track” position updates don’t seem to be sent via SMS, only GPRS when a server is configured.  Not sure if that’s because I incorrectly whitelisted my number or if I never tried with GPRS disabled.
  3. I tried a bunch of free android apps; none worked with this clone; they don’t like the “#”s.  This app looks like it would work, but it is $10.  I’ll just use Tasker.
  4. The :Low Battery Alert” supposedly begins to alert at 3.7V and sends you SMS in 30m intervals thereafter. In my experience, “Low” is about 60%.
  5. Several commands I did not mention above or test, but which should work:

 

Function SMS Command SMS Response Notes
Geo-fence #stockade#123456#500#60#22. 312451#113.54376# stockade+geo-info radius#time#longitude#latitude
Disable Geo-fence #nostockade#123456#
Movement alert #move#123456# move+geo-info Must be still during setup
Disable Movement alert #nomove#123456# move ok
Overspeed alert #speed#123456#080# speed ok km/h; not less than 20km/h
Disable Overspeed alert #nospeed#123456#

For the Geo-Fencing, apparently there’s a way to either set a coordinate and diameter, or to use two coordinates, where the first defines the top left corner of the box making up the geo-fence, and the second is the coordinate of the bottom right corner.

Now, Make it Pretty…

Finally, here is how to get the GPRS / data connection set up using GPS-Trace.com

  1. Register at this website: http://gps-trace.com/
  2. Setup your GPS with the following configurations (remember to leave the GPS tracker outdoors with clear view of the sky):
    1. If you have not already set up your GPS password:
      1. Send SMS command: #begin#123456# (you should receive an SMS saying “begin ok”)
      2. Make a phone call to the SIM card you put in your GPS (you should receive info such as geographic coordinates);
    2. Send SMS command: #imei#123456# and save your IMEI for later.
    3. Send SMS command: #timezone#123456#S0300# (this is the setting for GMT -3, Brazilian time);
    4. Send SMS command: #adminip#123456#193.193.165.166#20751#
      1. This is for setting the correct IP and port to work with gps-trace
  3. On gps-trace.com, considering you’ve already registered your account, you should now add a new unit – must use “Vehicle”
    1. Look for the “new unit” icon placed on the bottom right side of the screen
    2. Fill the “unit name” field with a name of your choice
    3. Fill in the phone number in international format (“+1” prefix for US)
    4. In “device type” choose “Heacent HC06A”
    5. Fill the IMEI field with your device’s IMEI number (15 digits)
    6. Fill the “password” field with your device’s password (default is 123456)

Now both the Auto Track and individual polling options (smslink and simply calling the device) should also result in a transmission to gps-trace with your coordinates mapped and timestamped.  Theoretically, the above method could be adopted with any online service, or hosted oneself with something like GPS-Gate.

c8ab2848-6466-6241-e541-dc493b82b49d

The TK102B…or a not-so-identical clone.

Or Make it Yours

As an alternative to GPS-Trace Orange, I have actually found Traccar, and more specifically, the Traccar-Web UI modification to offer the best blend of features, simplicity and the ability to export data for use in google Earth or similar.  You can either create an account and use the free demo server each of these projects maintains, or download and host your own server, which is what I did.  This allowed me to watch the connection log as my tracker attempted to send data, make sure it was actually connected, and figure out which port it should use.  Traccar uses ports 5000-5100 based on the format of the data the GPS tracker sends, as each is formatted differently.  The HC06A / TK-102 clone, for example, sends a HEX string that converts to “#123456789000015##1#0000#AUT#01#31041001a4776d #8312.534700,W,4120.236900,N,0.00,0.00#060715#212609.000##”.  It’s sending the IMEI, lat/lon, date and time as well as some other stuff I couldn’t decipher.  If this is sent to Traccar on port 5016, it is able to correctly parse the data and display it on a map.

traccar

Traccar. The UI modification adds several additional features, including import/export.

So, to adapt the above instructions for GPS Trace Orange if you prefer to use Traccar instead, simply change the IP and Port to reflect this.  For the Traccar demo server, this would be:  #adminip#123456#104.43.219.242#5016# or alternativly the UI-Mod server is #adminip#123456#188.166.50.6 #5016# .  You can also use your own server, such as #adminip#123456#innominatethoughts.com#5016#.  Using text for your domain does indeed work, rather than needing to use the IP, which is great if you’re using a dynamic IP with DDNS.  Whichever version of Traccar use, you’ll need to create an account, add a device, and use the IMEI as the “unique identifier.”

Category: Technology | Tags: , , , ,

Lessons in Long Range FPV

There’s a saying that good judgement comes from experience and experience comes from poor judgement.  After the total loss of my first FPV plane, I realized the necessity of including several layers of redundancies both to my ability to remain in control of the aircraft as well as being able to recover it in the event of a crash outside line-of-sight.  Here is what I settled on.

Control Improvements:

1. UHF LRS (Long Range control System)

I decided on Dragonlink’s 433MHz UHF transmitter to replace my shorter-ranged 2.4GHz FrSky system.

dragonlink

As one of the two direct contributors to Icarus’ loss, replacing the control link was something that should have been done from the start.  I can’t even say I wasn’t warned – this is common advice on RCGroups for folks transitioning to FPV flying and the longer range flights it often leads to.  Alternatively, I could have gone with EzUHF, OpenLRS, or Chainink.  All of these products perform within a similar envelope, but each has its own ecosystem of accessories.  This is something to keep in mind if an integrated OSD or antenna-tracker are in your future.

2. 1.3GHz Video

I switched from omnidirectional, circular-polarized 5.8GHz video to 1.3GHz.

13ghzvideo

The lower frequency provides greater range and object penetration.  I also bumped the VTX power up from 250mW to 600mW, which while not as effective as increasing antenna gain, should still make a noticeable improvement to range.  The VRX will now be a standalone unit, rather than a module integrated into my FatShark goggles, which makes it easier to use larger antennas.

3. Directional Antenna

I actually went back to linear polarization for the time being, mostly to cut costs.  Currently, I have a DIY “Inverted-Vee” antenna on the transmitter, mounted on the tail of the Skywalker.  I use a standard 6dBi dipole antenna on the receiver, with the option to switch to a ReadyMadeRC 8dBi patch antenna that is optimized for 1280MHz.

pattern_hg908p

Using a directional antenna will more than double the video link’s range.  For flights that will remain within a 1mi radius, a directional antenna adds additional risk (flying outside the coverage pattern), but for flights that are well-planned and aim to cover a linear distance away from the launch point, they are ideal.

4. OSD with RTH

Of all the things I regret having on the Icarus, it was an autopilot.

1-28-2014 10-17-32 PM

The Cyclops Storm OSD integrates both basic autopilot (return to home) and pilot assist features (heading hold, stabilization) via a tiny AHRS (Attitude and heading reference system).  In addition, this data is passed through to an on screen display.  The Storm’s jack-of -all-trades simplicity won out over the endlessly-customizable and feature-rich, ArduPilot, which requires a separate OSD board and (to utilize its full potential) a laptop and wireless telemetry TX/RX to view and send commands to the autopilot in real-time.  Dragon’s own DOSD was also in the running, but its price exceeded both Storm and ArduPilot, while offering a feature set somewhere between the two.

5. Fixed Ground Station / FatShark 5.8GHz Relay

An added bonus to using separate video hardware from the 5.8GHz gear integrated into my goggles was that I could leave it – along with batteries, screen and DVR – on a tripod base station and relay the video to my goggles on 5.8GHz, leaving me free to walk around with no wires tethering me to anything.  In the winter months, this means that I can set everything up outside, launch the plane, and then retire to the warmth of my car to fly it. How novel.   More importantly, the RC receiver antenna will now remain in an optimal position at all times, rather than having its polarization left to the mercy of the way I held my controller.

Emergency Recovery:

1. Ground Recorder

I actually already had a DVR to record the wireless, standard-def flight footage as I view it in my goggles, but its importance should not be ignored.  Often, those last few seconds of picture can mean the difference between cluelessness and a well-defined search area.

2. GPS Tracker

It’s truly amazing what $40 can buy these days.  In this case, I am referring to the Chinese knock-off of the TK-102B cellular GPS tracker.
image

It may have the feel of a McDonald’s toy, software glitches that make some of the more advanced functions inoperable, and documentation that is better supplied by reverse-engineering, but it works.  Slap in a GSM SIM card (H20 wireless sells them for $3.33/mo with full AT&T coverage), send a cryptic command over SMS, and $0.20 later, you have the position of your plane in degrees, minutes and seconds.  I’m sure you can see how useful this is.

3. Lost Plane Finder Buzzer

Sometimes simple is best.  Even with GPS coordinates, it can be difficult to locate a crash site in dense wilderness.  I opted to solve this problem of the final 100m with a cheap HobbyKing buzzer that is activated with the plane’s failsafe.  On failsafe, the RX channel this buzzer is connected to is set to +100, which triggers the buzzer.  It serves a secondary purpose of detecting when there is even the briefest loss of control link – if the plane is anywhere nearby, it is clearly audible.  The only thing I didn’t do is give this buzzer its own battery.  This would be ideal, as in the event of a crash, the other electronics will likely continue to operate, depleting the main battery within the hour.

4. LEDs

In addition to increasing visibility, looking cool, and opening the door for night flying, the LEDs I have integrated into my Skywalker build were also included to assist with finding it in the dark.

Results:

These changes yield a vastly more reliable platform.  Rather than two separate points of failure, where either a video or a control link failure meant near-instant doom, the Skywalker has 4 layers of redundancy.  It has better RF links, an autopilot to keep it in the air when those fail (and bring it back home), a DVR, lights and a buzzer to locate it if it goes down, and the ultimate last line of defense: a GPS satellite tracking system to allow recovery when all else fails.  Further details on the Skywalker build are in the pipeline, along with – hopefully – some video to demonstrate the joys of FPV.

Category: Flying | Tags: , , , ,

Android Dash-Cam DIY

Premise

The gadgets in my car have been through a number of iterations, from TomTom running on an old Windows Mobile 6 phone, to a full-fledged, Windows 7 based CarPC complete with touchscreen, GPS and Bluetooth OBD-II data monitoring.  These were fun projects, and may be worth a future post.  Sadly, each had a number of flaws, and have since been replaced with a much simpler android setup.

droid_dvr_profile

My current electronics suite: a Droid X and a Whistler XTR-150 Laser/Radar Detector

Having no better use for my retired Motorola Droid X, I decided to re-purpose it as a dedicated Car DVR after watching one too many YouTube videos involving Russian motor vehicle accidents.  Why does a former superpower dominate this genre of video clips?  Surprisingly, Russia does not top the statistics when it comes to fatal motor vehicle accidents (the Middle East seems to dominate that field) and while they place a respectable 4th in alcohol consumption per capita, this by itself doesn’t seem to explain the need for meticulous video record-keeping of one’s daily commute to work.

Of course, the reason most of us keep records usually has something to do with taxes and the law, and it is no different here.  Apparently, the legal atmosphere on Russia’s roads is very much one of guilty-until-proven-innocent.  With widespread corruption, hit-and-runs, and the general dearth of witnesses, the Dash-Cam is a technological last hope for innocent drivers who are tired of being taken advantage of by accident-staging and bullying.

Here in Michigan, its more just for fun – although you never know when having footage on hand may prove useful.  So, how do you turn an old android smartphone into an automated, HD-video-shooting piece of awesomeness?

Set-up

1) The phone.  Generally, any android phone will do for this, though you will want to be sure the camera placement is in a suitable location so as not to be blocked by the mount.  I’d aim for something that records in at least 720p, such as the Droid X, 1st-gen Galaxy S, or HTC Rhyme/Incredible/Desire.  A MicroSD slot is also highly recommended.

2) Get a mount.  I used this one from Arkon.  It is universal, cheap, and (aside from coming lose on a hot day), dependable.  This may be a better option, depending on where your camera is located.

droid_dvr_close

3) Time to go shopping…at the Play Store.  You’ll need DailyRoads Voyager (free) and Tasker ($6.49).  Optionally, you can add (all free) Orientation ControlNo Lock, MyTracks (and its Tasker plugin), and Quick Boot to log GPS tracks and keep the screen unlocked and in landscape mode.  Rooting your device will unlock some extra functionality with Tasker, but isn’t strictly necessary for the task at hand.

4) Power.  You need a power source from your car to charge the phone.  It must only supply power when the car is on (most outlets do this).  A cheap car adapter will do, or you can get a bit more creative and splice in the wiring so as to conceal the wiring and make things look more professional.

5) Configuration.  Set up DailyRoads to automatically record (I like 5min clips) when launched.  Make sure to go through the rest of the settings and tweak them to your needs and the capabilities of your device.  Ensure the GPS data is logged in .srt format, as this will allow it to be overlayed on the video as subtitles when playing back on your PC with VLC or similar.

For Tasker, you’ll need it to launch DailyRoads (and MyTracks) when the car is powered on (charging), and kill it when power is removed, as well as switch to airplane mode to conserve battery.  Tasker can be a bit daunting the first time you open it up, but there are many guides online that walk you through its array of functions.  In addition, I have shared my profiles here, an you may import and modify them to suit your purposes.

 

That’s it!  Your Android Dash-Cam will now start and stop recording in tune with your driving, no input required.

Issues

car_lower_dash Having had this setup running for a bit over a half of a year, my biggest issue remains that of battery life.  Despite the power savings afforded by Airplane mode, I still find myself having to charge the phone manually about once per week, especially in the winter.  Ideally, I’d just run a cable to the phone that is always powered by the car’s battery – the small drain shouldn’t pose a threat to the car.  However, the issue here is that Tasker depends on the charging status to know when you’re driving. One idea is to use the GPS to measure speed, and have that trigger Tasker.  In my set-up though, the GPS is turned off with the car to save power, and even if I were to leave it on, I’m not confident that it would reliably maintain a fix for days on end.

That leaves Bluetooth and Wi-Fi as the only other input options.  I’m thinking of using a Bluetooth device  powered by the car to trigger the event when it connects to the phone.  When the car turns off, it will lose power, disconnect, and thus Tasker will know to stop the recording.  I’ll try to give both these options a fair shot in the next few weeks, and will report back if successful.

Category: Technology | Tags: , , , , , , , ,