<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Nicholas Skinner's Blog &#187; Electronics Projects</title>
	<atom:link href="http://www.ns-tech.co.uk/blog/category/electronics/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ns-tech.co.uk/blog</link>
	<description>Freelance website and web application developer</description>
	<lastBuildDate>Tue, 14 May 2013 16:09:51 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Debugging (Hard To Replicate Issues) With Embedded Software Devices</title>
		<link>http://www.ns-tech.co.uk/blog/2011/10/debugging-hard-to-replicate-issues-with-embed-software-devices/</link>
		<comments>http://www.ns-tech.co.uk/blog/2011/10/debugging-hard-to-replicate-issues-with-embed-software-devices/#comments</comments>
		<pubDate>Thu, 20 Oct 2011 18:03:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Electronics Projects]]></category>

		<guid isPermaLink="false">http://www.ns-tech.co.uk/blog/?p=1229</guid>
		<description><![CDATA[I write software for various hardware devices. Finding bugs, and resolving them is usually relatively easy if the issue can be replicated in a test environment with development hardware and full logging equipment setup. The problem however is when: It is equipment using GSM, making use of various different phone networks, and cell towers that [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2011/10/openlog.jpg"><img class="alignright size-full wp-image-1242" src="http://www.ns-tech.co.uk/blog/wp-content/uploads/2011/10/openlog_small.jpg" alt="OpenLog" width="300" height="300" /></a>I write software for various hardware devices. Finding bugs, and resolving them is usually relatively easy if the issue can be replicated in a test environment with development hardware and full logging equipment setup. The problem however is when:</p>
<ol>
<li>It is equipment using GSM, making use of various different phone networks, and cell towers that can not be easily replicated.</li>
<li>The issue only occurs on location in the field (i.e. live customers using the device).</li>
<li>It is an intermittent issue that can not be replicated on cue, ruling out simply going to the location for an hour setting up the relevant equipment and logging the issue.</li>
<li>Devices are in locations where it not particularly convenient / safe to setup and leave expensive testing equipment / laptops etc.</li>
<li>Testing equipment needs to run a Windows only application from a hardware manufacturer that needs “babysitting&#8221; (restarting if it stops logging).</li>
</ol>
<p>I recently faced this issue. I tried a few options including blindly guessing at what the issue could be and implementing fixes for various possible issues, next tried working with the network operator (which got nowhere). Final solution I came up with was to build some custom / cheap (in comparison to the alternative) logging hardware to take the place of the hardware development board, Windows running laptop, hardware manufacturers software tool.</p>
<p>My first thoughts were that this could be done by using an <a href="http://www.arduino.cc/">Arduino</a> with an SD Card <a href="http://www.adafruit.com/products/243">data logging “shield&#8221;</a> however after some further research I discovered the <a href="http://www.sparkfun.com/products/9530">Spark Fun OpenLog</a>. The OpenLog was a perfect fit since it:</p>
<ol>
<li>Can be powered from 3.3V &#8211; 12V (could just piggy back it on the existing devices power supply).</li>
<li>Serial levels compatible with 2.8V CMOS levels of device.</li>
<li>Already setup to automatically log serial data to files on an SD Card.</li>
<li>Open source firmware that is freely available, meaning I could customise it to emulate the manufacturers software tool (eliminating the need for the extra hardware, and meaning I could deal with the reliability issues).</li>
<li><a href="https://github.com/nseidle/OpenLog/wiki/Datasheet">Development environment</a> (see section “Compile Version 2&#8243;) that is simple / relatively straight forward to obtain / setup / use (<a href="http://arduino.cc/en/Main/Software">Ardino IDE</a> &#8211; even though it is not “Arduino&#8221; branded hardware as such).</li>
<li>Supports upto 16GB microSD cards (device outputs large logs).</li>
</ol>
<p>There were a few steps involved in the process including, connecting the OpenLog to the device, building a programming cable for the OpenLog, and customising the OpenLog software to emulate the initialisation string of the Windows software tool.</p>
<p>I have never coded AVR C before however found it relatively straight forward to make the modifications I required to emulate the initialisation string of the Windows tool (primarily logging the string with Eltima Software’s <a href="http://www.eltima.com/products/serial-port-monitor/">Serial Port Monitor</a> application, saving the data to a file on the SD Card and instructing OpenLog to read it back over the serial port, then drop back into logging mode.</p>
<p>A few issues I encountered along the way were:</p>
<ol>
<li>OpenLog stops reading files if it <a href="https://github.com/nseidle/OpenLog/issues/76">encounters a NULL byte</a>, however this should be fixed in the latest release.</li>
<li>Error trying to upload new software from the Arduino IDE to OpenLog due to the DTR pin needing to be connected to OpenLog to reset it just before programming. I substituted DTR for RTS (which my FTDI cable did have broken out).</li>
<li>Device I was logging data to was outputting [CTRL]+[Z] 3 times – the OpenLog escape sequence – I therefore modified the escape sequence to be 9 times rather than just 3.</li>
</ol>
<h3>Parts List</h3>
<h4>One Off</h4>
<table class="tblwithborder" cellspacing="0">
<tbody>
<tr>
<td>TTL-232R-3V3 USB to serial FTDI cable</td>
<td><a href="http://proto-pic.co.uk/usb-to-serial-ttl-cable-ftdi-5v-vcc-3-3v-i-o/">PPDEV-09717</a></td>
</tr>
<tr>
<td>Kingston USB Card Reader (19 in 1)</td>
<td><a href="http://www.ebuyer.com/139230-kingston-usb-card-reader-19-in-1-fcr-hs219-1">139230</a></td>
</tr>
</tbody>
</table>
<h4>Per Logger</h4>
<table class="tblwithborder" cellspacing="0">
<tbody>
<tr>
<td>1GB microSD Card (or alternate 8GB)</td>
<td><a href="http://proto-pic.co.uk/flash-memory-microsd-1gb/">PPCOM-08163</a></td>
</tr>
<tr>
<td>Kingston 8gb Class 4 MicroSDHC Card</td>
<td><a href="http://www.ebuyer.com/147731-kingston-8gb-class-4-microsdhc-card-with-adapter-sdc4-8gb">147731</a></td>
</tr>
<tr>
<td>OpenLog</td>
<td><a href="http://proto-pic.co.uk/openlog/">PPDEV-09530</a></td>
</tr>
<tr>
<td>Crimp Pins</td>
<td><a href="http://proto-pic.co.uk/polarized-connectors-crimp-pins/">PPPRT-08100</a></td>
</tr>
<tr>
<td>4 pin header</td>
<td><a href="http://proto-pic.co.uk/polarized-connectors-header-4-pin/">PPPRT-08231</a></td>
</tr>
<tr>
<td>2 pin header</td>
<td><a href="http://proto-pic.co.uk/polarized-connectors-header-2-pin/">PPPRT-08233</a></td>
</tr>
<tr>
<td>4 pin housing</td>
<td><a href="http://proto-pic.co.uk/polarized-connectors-housing-4-pin/">PPPRT-08097</a></td>
</tr>
</tbody>
</table>
<h3>Build Instructions</h3>
<h4>Solder Headers</h4>
<ul>
<li>Solder a x4 way header connector onto the logger GND, VCC, TXO, RXI (i.e. miss out the first pin labelled BLK, it is not required).</li>
<li>Solder a x1 way header connector onto the logger for the GRN pin (I used a 2 way with the other pin overlapping off the end of the board as I could not easily obtain a 1 pin)</li>
<li>Solder a x4 way housing connector onto the wires from the device (match up GND/VCC/TXO/RXI to appropriate pins on the device).</li>
</ul>
<p>Note: A 5 or 6 way header soldered to all logger pins could just be used but I thought this approach best to avoid any mistakes (broken loggers) &#8211; that way there is a x4 way header to use when plugging into the printer and you are not left wondering which 4 pins should be connected.</p>
<h4>FTDI Programming Cable</h4>
<p>Modify the FTDI cable such that it has the following pinout (compatible with logger). Use a flat screw driver to release the pins from the existing socket.</p>
<table class="tblwithborder" cellspacing="0">
<tbody>
<tr>
<td>GND</td>
<td>Black</td>
</tr>
<tr>
<td>VCC</td>
<td>Red</td>
</tr>
<tr>
<td>RXD</td>
<td>Yellow</td>
</tr>
<tr>
<td>TXD</td>
<td>Orange</td>
</tr>
<tr>
<td>RTS</td>
<td>Green</td>
</tr>
<tr>
<td>CTS</td>
<td>Brown &#8211; N/C</td>
</tr>
</tbody>
</table>
<h3>Notes</h3>
<ul>
<li>Arduino needs to be <a href="https://github.com/nseidle/OpenLog/wiki/Datasheet">modified</a> with a special version of HardwareSerial.cpp to work with OpenLog.</li>
<li>If your SD Card did not come pre formatted you may need to use the FAT32 microSD optimised <a href="https://www.sdcard.org/consumers/formatter_3/">formatting tool</a> from SD Association.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.ns-tech.co.uk/blog/2011/10/debugging-hard-to-replicate-issues-with-embed-software-devices/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building A Web Accessible Heating / Hot Water Programmer (Home Automation)</title>
		<link>http://www.ns-tech.co.uk/blog/2011/06/web-accessible-heating-hot-water-programmer/</link>
		<comments>http://www.ns-tech.co.uk/blog/2011/06/web-accessible-heating-hot-water-programmer/#comments</comments>
		<pubDate>Sun, 12 Jun 2011 14:47:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Electronics Projects]]></category>

		<guid isPermaLink="false">http://www.ns-tech.co.uk/blog/?p=1091</guid>
		<description><![CDATA[I recently got round to completing a central heating / hot water automation project I had been meaning to do for a few years but previously issues over cabling, heat (i.e. possible damage to electronics), hardware choice, and various other installation issues had caused me not to do it until now. Features: Two channel (heating [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2011/06/heating_cabinet.jpg"><img src="http://www.ns-tech.co.uk/blog/wp-content/uploads/2011/06/heating_cabinet_small.jpg" alt="Heating Cabinet" width="300" height="251" class="alignright size-full wp-image-1114" /></a>I recently got round to completing a central heating / hot water automation project I had been meaning to do for a few years but previously issues over cabling, heat (i.e. possible damage to electronics), hardware choice, and various other installation issues had caused me not to do it until now.</p>
<h3>Features:</h3>
<ul>
<li>Two channel (heating and hot water) support.</li>
<li>Temporary Override (ignore schedule for 30 min &#8211; 1 day), both overriding on, but also off.</li>
<li>Permanent Override (ignore schedule).</li>
<li>Web based interface for changing schedule / override settings.</li>
<li>Schedule support for any combination of weekdays.</li>
<li>Schedule support for one off custom schedules on specific dates only.</li>
<li>Setting date/time via NTP (with automatic support for time zones, and daylight savings &#8211; built into Linux server).</li>
<li>Support for override control via <a href="http://www.voip-info.org/wiki/view/Asterisk+Cisco+79XX+XML+Services">Cisco 7960 phones</a> (already located around house / managed by <a href="http://www.asterisk.org/">Asterisk</a>).</li>
<li>Wireless from control unit to programmer (linked to network).</li>
<li>Self contained system &#8211; does not require separate PC server running 24/7.</li>
</ul>
<h3>Hardware</h3>
<p><a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2011/06/honeywell_wiring.gif"><img src="http://www.ns-tech.co.uk/blog/wp-content/uploads/2011/06/honeywell_wiring_small.gif" alt="Honeywell In Parallel Wiring" width="150" height="228" class="alignright size-full wp-image-1142" /></a>In terms of hardware the system is comprised of:</p>
<ol>
<li>A relay box containing two opto-isolated 230V 3A relays with CMOS level control.</li>
<li>A control box with Synapse RF Engine installed in Synapse Evaluation board connected to several lights/switches allowing for local control over on/off, override settings, and visual indication of on/off status (evaluation board is connected directly to relay box).</li>
<li>An <a href="http://eshop.acmesystems.it/?id=FOXG20">ACME System Fox G20 Board</a> (Atmel ARM processor, running Debian Linux), linked to another Synapse RF Engine, the controller behind the whole system, connected to wired network.</li>
</ol>
<p>I chose to install the relay box it in parallel with the existing timer clock.  During normal use the existing timer will be turned to its ‘permanent override: off&#8217; setting, this means that if the custom system were to fail it&#8217;s a simple case of powering it down, and going back to using the regular programmer.</p>
<h4>Relay Box</h4>
<p><a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2011/06/relay_box.jpg"><img src="http://www.ns-tech.co.uk/blog/wp-content/uploads/2011/06/relay_box_small.jpg" alt="Relay Box" width="200" height="150" class="alignleft size-full wp-image-1121" /></a>In terms of mounting the relay PCB in the box I chose to use to use some nuts and bolts, hot gluing the bolt to the base.  I also put some small rubber feet on the board to keep it more secure.  This allows the relay board to still be removed from the box if required at a later stage.</p>
<p>I secured cables going into the boxes with cable ties (one on the outside and one on the inside), not the most professional solution but having used various cable grips before none of which seemed particularly secure (prone to popping out again), and being time consuming to fit therefore this time I opted for a simpler solution.</p>
<h4>Control Box</h4>
<p><a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2011/06/controller_pcb_view.jpg"><img src="http://www.ns-tech.co.uk/blog/wp-content/uploads/2011/06/controller_pcb_view_small.jpg" alt="Controller PCB View" width="200" height="169" class="alignright size-full wp-image-1117" /></a>The control box had limited space this meant things fit nicely without moving but I also used some stick on cable holders to hold the PCB steady, and placed a blank PCB in the box to separate the switches from the Synapse Evaluation board preventing the possibility of shorts.</p>
<p>I used a standard labeller with stick on labels for marking controls on the box, this did not lead to as professional a finish as I would have liked however I could not immediately think of a better options without paying out for a possibly costly custom enclosure.</p>
<p>In terms of wiring in the control box, it is fairly straight forward, a TS7809 [<a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2011/06/ts7809.gif">pinouts</a>] to regulate the 12V PSU to 9V, switches connected directly from ground to GPIO pins (for pinouts see Python file), LEDs each connected to GPIOs via transistors [<a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2011/06/transistors.gif">wiring diagram</a>].</p>
<h3>Software</h3>
<h4>Fox G20</h4>
<p><a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2011/06/web_interface_screenshot.gif"><img src="http://www.ns-tech.co.uk/blog/wp-content/uploads/2011/06/web_interface_screenshot_small.gif" alt="Web Interface Screenshot" width="200" height="101" class="alignleft size-full wp-image-1145" /></a>The Fox G20 runs a PHP schedule application which sends signals to the control box LEDs / relays, and also receives button press events for override support.  It does this via a serial / wireless link (using Synapse modules) to the control box.</p>
<p>The Fox G20 was chosen since it offers (in software terms) something very similar to a regular Linux PC &#8211; support for web server, PHP, Cron jobs, RTC (with backup battery), serial ports, Ethernet, hard drive (memory card) all in a small form factor (web server, PHP, cron support were even already installed on the purchased memory card), meaning that time consuming / fiddly cross compiling etc was not required as they might with other hardware.</p>
<p>Getting the Fox G20 out of the box I was immediately very impressed with it and was able to get up and running within minutes, only thing that was not immediately clear was the <a href="http://foxg20.acmesystems.it/doku.php?id=tutorial:ssh_access&#038;s[]=netusg20">root password</a> (netusg20) but this was quickly located after a search of the <a href=" http://foxg20.acmesystems.it/doku.php">wiki</a>.</p>
<p>[Download: <a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2011/06/php_schedule_app.zip">PHP Schedule Application</a> inc. Cron service]</p>
<h4>Fox G20 &#8211; Synapse RF Engine</h4>
<p><a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2011/06/fox_g20_electronics.jpg"><img src="http://www.ns-tech.co.uk/blog/wp-content/uploads/2011/06/fox_g20_electronics_small.jpg" alt="Fox G20 Electronics" width="200" height="150" class="alignright size-full wp-image-1124" /></a>The Python script on the Synapse RF Engine simple connects the serial port to the transparent wireless connection. </p>
<p>[Download: <a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2011/06/heating_pc.py_.txt">Python Software</a>]</p>
<h4>Control Box &#8211; Synapse RF Engine</h4>
<p>The Python script on the Synapse RF Engine mounted in the control box is responsible for sending out message over wireless serial when buttons are pressed, and processing messages turning them into GPIO on/off events to control the relays/LEDs.</p>
<p>[Download: <a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2011/06/heating_controller.py_.txt">Python Software</a>]</p>
<h3>Custom Build</h3>
<p>A few of the decisions to build my own system include:</p>
<ul>
<li>Cost of commercial solution.</li>
<li>Easily extendable as required (ability to just code new features in PHP).</li>
<li>Support for control via Cisco 7960 phones (at any location in the house) &#8211; phones that support XML browser via &#8220;services&#8221; menu.</li>
<li>Implementation of all existing features of current system easing user adoption (for other members of the household).</li>
<li>Ability to make system wireless, but also separate from existing servers (independent system).
<li>Network support for NTP  / timezones / daylight savings time.</li>
<li>Key components that may be damaged by heat (unavoidable due to location) easily replaceable (e.g. just slot in new Synapse Module, purchase new power adapter).</li>
<li>Easy to make remotely accessible (just code authentication support).</li>
</ul>
<h3>Implementation Notes</h3>
<ul>
<li>PHP was not particularly designed to be used as a long running process (which is how it is necessarily used on the Fox G20 to receive data from the serial port.  For that reason I wrote a separate script called by Cron to check it is running, or if not start it back up again.  This causes a slight usability issue with the physical control box in that it may be unresponsive for up to 60 seconds (if the PHP process stops, and is pending a restart) however in practice this seems to happen only once every 5 hours, and the control box is rarely used anyway so it would be unlucky for a user to try and use it during that time.  It does not cause any issues with the schedule since any on/off events that happened when it was not running will be processed when it starts back up again.</li>
<li>I could have simplified things by having the Fox G20 board with WiFi module directly in the control box (removing the need for the Synapse modules) however did not do this due to possible issues with heat (cost of replacement), ease of access, and ease of hardware / software implementation (there does not seem to be a particularly simple/optimal way of supporting momentary push buttons in an event driven way, with the Fox G20 whereas there is with the Synapse).</li>
<li><a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2011/06/fox_g20.jpg"><img src="http://www.ns-tech.co.uk/blog/wp-content/uploads/2011/06/fox_g20_small.jpg" alt="Fox G20 Packaging" width="200" height="150" class="alignright size-full wp-image-1127" /></a>I chose to implement support for permanent overrides on the control box via momentary/non locking toggle switches.  These are not ideal as they do not offer the user any feedback on the current state directly, however it seemed like the best option due to already using up most of the GPIOs on the Synapse Engine, and increased built time, especially when they are a rarely used feature.  I chose to use non locking switches such that the permanent override setting could be changed via the web interface, but another option may have been to use locking toggle switches and remove permanent override control from the web interface.</li>
<li>The Fox G20 PSU is supplied with a Euro plug, even if ordered in the UK, I therefore purchased a <a href="http://www.pulsat.com/products/Euro-Charger-to-UK-Adaptor-%28Black%29.html">Euro to UK plug adapter</a>, but another option would have been ordering a new 5V 1A PSU.</li>
<li>Currently the system is still relying on the existing hard wired thermostat.  Synapse recently brought out a new <a href="http://www.synapse-wireless.com/index.php?mainID=8&#038;subID=24&#038;type=product&#038;prodID=24">motion/light/temperature sensor</a> which I may add in support for in the future.  The motion sensor could potentially be used to automatically turn off the system (disregarding the schedule) if no one is in the house resulting in cost savings.  To switch over I would simply set the existing thermostat to a high temperature such that it is always on, allowing the Synapse sensor to have priority.</li>
<li>I only tested the blue LEDs initially which was a mistake since after implementation I found that the green LEDs were barely visible (I did not realise the greens require greater current), this meant the addition of some extra lower value resistors on the PCB that I had not originally planned for.  Even so the green LEDs still ended up being significantly less bright than the blues however measuring current with a meter any lower resistor values (leading to a higher current) may have been out of spec possibly damaging / reducing the life of the LED.  The reduced brightness is not ideal from a user point of view however is acceptable as the box is mounted inside a darkened cabinet.</li>
</ul>
<h3>Parts List</h3>
<table cellspacing="0" class="tblwithborder">
<tr>
<td>x2</td>
<td>Momentary Toggle Switch</td>
<td><a href="http://www.maplin.co.uk/sub-miniature-toggle-switches-2341">FH03D</a></td>
</tr>
<tr>
<td>x1</td>
<td>2.1DC Socket</td>
<td><a href="http://www.maplin.co.uk/2.1mm-single-hole-fixing-dcsocket-1407">JK09K</a></td>
</tr>
<tr>
<td>x1</td>
<td>ABS Box (Control)</td>
<td><a href="http://www.maplin.co.uk/mb-plastic-boxes-1676">LH22Y</a></td>
</tr>
<tr>
<td>x2</td>
<td>Green LED Momentary Push Switch</td>
<td><a href="http://www.maplin.co.uk/illuminated-push-to-make-switch-34861">N08AR</a></td>
</tr>
<tr>
<td>x2</td>
<td>Blue LED Momentary Push Switch</td>
<td><a href="http://www.maplin.co.uk/illuminated-push-to-make-switch-34861">N09AR</a></td>
</tr>
<tr>
<td>x1</td>
<td>12V DC PSU</td>
<td><a href="http://www.maplin.co.uk/cctv-dc-12v-1000ma-power-supply-227631">N12GN</a></td>
</tr>
<tr>
<td>x1</td>
<td>9V Regulator (TS7809CZ)</td>
<td><a href="http://www.maplin.co.uk/1a-positive-fixed-regulators-7937">N37CA</a></td>
</tr>
<tr>
<td>x1</td>
<td>ABS Box (Relays)</td>
<td><a href="http://www.maplin.co.uk/multipurpose-abs-plastic-enclosures-219549">N59FK</a></td>
</tr>
<tr>
<td>x3</td>
<td>2 Core 3A Mains Cable</td>
<td><a href="http://www.maplin.co.uk/oval-2-core-3a-mains-cable-2192y-80">XR47B</a></td>
</tr>
<tr>
<td>x2</td>
<td>4 Core Alarm White</td>
<td><a href="http://www.maplin.co.uk/burglar-alarm-signal-cable-to-bs6360-bs6746-65">XR89W</a></td>
</tr>
<tr>
<td>x4</td>
<td>2N2222A Transistor</td>
<td><a href="http://www.maplin.co.uk/small-signal-npnhigh-frequency-19068">Maplin</a></td>
</tr>
<tr>
<td>x1</td>
<td>FOX Board G20 Starter Kit</td>
<td><a href="http://eshop.acmesystems.it/?id=COMBO-2">COMBO-2</a></td>
</tr>
<tr>
<td>x2</td>
<td>Synapse RF150 Module</td>
<td><a href="http://uk.futureelectronics.com/en/technologies/semiconductors/wireless-rf/rf-modules-solutions/802154-zigbee/Pages/9000494-RF150PC6.aspx">RF150PC6</a></td>
</tr>
<tr>
<td>x1</td>
<td>Synapse Evaluation Board</td>
<td><a href="http://uk.futureelectronics.com/en/technologies/semiconductors/wireless-rf/rf-modules-solutions/proprietary/Pages/6671358-SN171GG-NR.aspx">SN171GG-NR</a></td>
</tr>
<tr>
<td>x1</td>
<td>Euro to UK plug adapter</td>
<td><a href="http://www.pulsat.com/products/Euro-Charger-to-UK-Adaptor-%28Black%29.html">Pulsat</a></td>
</tr>
</table>
<h3>FOX G20 / Synapse &#8211; Pinouts</h3>
<table cellspacing="0" class="tblwithborder">
<tr>
<th>Synapse Pin</th>
<th>G20 Pin</th>
</tr>
<tr>
<td>5 (UART 0 RX)</td>
<td>J6.5 (USART 1 TX)</td>
</tr>
<tr>
<td>6 (UART 0 TX)</td>
<td>J6.4 (USART 1 RX)</td>
</tr>
<tr>
<td>21 (VCC)</td>
<td>J6.1 (3.3V)</td>
</tr>
<tr>
<td>24 (GND)</td>
<td>J6.40 (GND)</td>
</tr>
</table>
<p>Further Information: <a href="http://foxg20.acmesystems.it/doku.php?id=tutorial:serial_port">FOX G20 &#8211; serial ports</a>, <a href="http://foxg20.acmesystems.it/doku.php?id=hw:foxg20pinout&#038;s[]=3&#038;s[]=3v">FOX G20 &#8211; pinout</a></p>
<p>The FOX G20 has a 3.3V output that can be used to directly power the Synapse Module.</p>
<h3>Further Resources</h3>
<ul>
<li><a href="http://www.automatedhome.co.uk/Reviews/Central-Heating-Automation-Review.html">Dean Smith &#8211; Comfort System</a></li>
<li><a href="http://www.automatedhome.co.uk/Reviews/DIY-Heating-Interface-Review.html">Steve Jones &#8211; HomeVisionPro</a></li>
<li><a href="http://www.automatedhome.co.uk/Content/HomeVision-Central-Heating.html">Keith Doxey &#8211; HomeVisionPro</a></li>
<li><a href="http://honeycottage.mm-wave.com/hahome.htm">Honey Cottage &#8211; TOM10/xAP</a></li>
</ul>
<p><strong>Update 2011-07-06</strong>:  The Synapse &#8220;<a href="http://www.synapse-wireless.com/index.php?mainID=8&#038;subID=24&#038;type=product&#038;prodID=24">motion/light/temperature sensor</a>&#8221; is part of the &#8220;closed&#8221; <a href="http://www.snap-lighting.com/">SNAP-Lighting.com</a> system, it can not be independently controlled via Python.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ns-tech.co.uk/blog/2011/06/web-accessible-heating-hot-water-programmer/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Doorbell Control (Home Automation) Notification Hardware Unit</title>
		<link>http://www.ns-tech.co.uk/blog/2011/05/doorbell-control-home-automation-notification-hardware-unit/</link>
		<comments>http://www.ns-tech.co.uk/blog/2011/05/doorbell-control-home-automation-notification-hardware-unit/#comments</comments>
		<pubDate>Sun, 08 May 2011 15:38:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Electronics Projects]]></category>

		<guid isPermaLink="false">http://www.ns-tech.co.uk/blog/?p=1071</guid>
		<description><![CDATA[In an addition to my original Doorbell Control project, along with software based notification of events I put together a portable, battery operated unit as well. The unit operates from two AA batteries and features: 1 Red LED 2 Green LEDs 1 Buzzer 2 Push switches 2 Toggle switches Apart from the toggle power switch [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2011/05/notifier_unit_open.jpg"><img src="http://www.ns-tech.co.uk/blog/wp-content/uploads/2011/05/notifier_unit_open_small.jpg" alt="Notifier Unit Open" title="Notifier Unit Open" width="300" height="285" class="alignright size-full wp-image-1075" /></a>In an addition to my original <a href="http://www.ns-tech.co.uk/blog/2010/12/doorbell-control-home-automation-with-the-synapse-rf-engine/">Doorbell Control project</a>, along with <a href="http://www.ns-tech.co.uk/blog/2011/01/doorbell-control-home-automation-notification-software/">software based notification of events</a> I put together a portable, battery operated unit as well.</p>
<p>The <a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2011/05/notifier_unit.jpg">unit</a> operates from two AA batteries and features:</p>
<ul>
<li>1 Red LED</li>
<li>2 Green LEDs</li>
<li>1 Buzzer</li>
<li>2 Push switches</li>
<li>2 Toggle switches</li>
</ul>
<p>Apart from the toggle power switch all LEDs/switches are software controllable via GPIO pins.</p>
<p><a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2011/05/unit_parts.jpg"><img src="http://www.ns-tech.co.uk/blog/wp-content/uploads/2011/05/unit_parts_small.jpg" alt="Notifier Unit Parts" title="Notifier Unit Parts" width="180" height="194" class="alignleft size-full wp-image-1082" /></a>If the doorbell is rung, the bell sends a multicast RPC call which is picked up by the unit.  One of the green LEDs is then turned on.  Depending on the status of the (non power) toggle switch the buzzer is then turned on as well (the non power toggle switch is used to enable/disable the buzzer).  One push button is used to reset the unit (turn back off the LED/buzzer).  The red LED is used to indicate the power on/off status.  The remaining extra push switch/LED are currently not used but built in for possible future functionality.</p>
<h3>Parts List</h3>
<table cellspacing="0" class="tblwithborder">
<tr>
<td>x2</td>
<td>Green LED</td>
<td><a href="http://www.maplin.co.uk/5mm-low-current-leds-35771">UK49D</a></td>
</tr>
<tr>
<td>x1</td>
<td>Red LED</td>
<td><a href="http://www.maplin.co.uk/">CK48</a></td>
</tr>
<tr>
<td>x2</td>
<td>Push Switch</td>
<td><a href="http://www.maplin.co.uk/push-to-make-low-cost-2493">NK91Y</a></td>
</tr>
<tr>
<td>x2</td>
<td>Toggle Switch</td>
<td><a href="http://www.maplin.co.uk/sub-miniature-toggle-switches-2341">FH00A</a></td>
</tr>
<tr>
<td>x1</td>
<td>ABS Box MB1</td>
<td><a href="http://www.maplin.co.uk/mb-plastic-boxes-1676">LH20W</a></td>
</tr>
<tr>
<td>x3</td>
<td>LED Holder</td>
<td><a href="http://www.maplin.co.uk/5mm-rounded-panel-indicator-leds-and-bezels-35952">N89AX</a></td>
</tr>
<tr>
<td>x1</td>
<td>PP3 Battery Clip</td>
<td><a href="http://www.maplin.co.uk/pp3-type-battery-snap-44392">HF28F</a></td>
</tr>
<tr>
<td>x1</td>
<td>2AA Battery Box</td>
<td><a href="http://www.maplin.co.uk/aa-size-battery-holders-31427">YR60Q</a></td>
</tr>
<tr>
<td>x1</td>
<td>Buzzer</td>
<td><a href="http://www.maplin.co.uk/wire-ended-piezo-buzzer-3219">CR34M</a></td>
</tr>
<tr>
<td>x1</td>
<td>Synapse RF Engine</td>
<td><a href="http://www.synapse-wireless.com/index.php?mainID=3&#038;subID=3&#038;type=product&#038;prodID=3">RF100</a></td>
</tr>
</table>
<p>Note: The DC plug/socket shown in one of the photos was later removed due to lack of space inside the box.</p>
<p>Download: <a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2011/05/portable.py_.txt">Python Software</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ns-tech.co.uk/blog/2011/05/doorbell-control-home-automation-notification-hardware-unit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Active RFID with the Wavetrend L-RX300 and Synapse RF Engine</title>
		<link>http://www.ns-tech.co.uk/blog/2011/03/active-rfid-with-the-wavetrend-l-rx300-and-synapse-rf-engine/</link>
		<comments>http://www.ns-tech.co.uk/blog/2011/03/active-rfid-with-the-wavetrend-l-rx300-and-synapse-rf-engine/#comments</comments>
		<pubDate>Sun, 20 Mar 2011 15:33:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Electronics Projects]]></category>

		<guid isPermaLink="false">http://www.ns-tech.co.uk/blog/?p=1023</guid>
		<description><![CDATA[As part of a work project / possible home automation project requiring presence detection I recently purchased some Wavetrend RFID readers, and tags. Wavetrend has various hardware available including tags suitable for mounting on metal, plastic, personnel, and keyfobs with buttons. Tags also support RSSI such that it is possible to determine approximately how close [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2011/03/synapse_wavetrend_l-rx300.jpg"><img src="http://www.ns-tech.co.uk/blog/wp-content/uploads/2011/03/synapse_wavetrend_l-rx300_s.jpg" alt="Synapse with Wavetrend L-RX300 (small)" width="300" height="224" class="alignright size-full wp-image-1025" /></a>As part of a work project / possible home automation project requiring presence detection I recently purchased some <a href="http://www.wavetrend.net/">Wavetrend</a> <a href="http://www.wavetrend.net/readers.html">RFID readers</a>, and <a href="http://www.wavetrend.net/activtags.html">tags</a>.</p>
<p>Wavetrend has various hardware available including tags suitable for mounting on metal, plastic, personnel, and keyfobs with buttons.  Tags also support RSSI such that it is possible to determine approximately how close a tag is to a reader.</p>
<p>On the hardware interface side the <a href="http://www.wavetrend.net/downloads/RX300-0a-PI-A4.pdf">Wavetrend RX300</a> can simply be plugged into the Synapse SN171 Proto Board via a male-male <a href="http://www.expansys.com/expansys-mini-null-modem-adapter-db9-male-db9-male-121390/">null modem serial adapter</a>.</p>
<p>On the software side the serial data from the RX300 could just be transparently forwarded to a server for processing, however if you have only a small number of tags, and are looking to trigger events on other nodes without depending on an external server processing the data in the middle the better option is to parse the tag data on the Synapse Engine itself.</p>
<p>See below for sample code to parse data from a Wavetrend RX300 reader and send logEvent RPCs to Portal (event log code can be replaced by your own code to e.g. trigger events depending on the tag ID or RSSI).  Python code should also be easily adaptable for use on non Synapse hardware.</p>
<p>[Download: <a href='http://www.ns-tech.co.uk/blog/wp-content/uploads/2011/03/wavetrend_l-rx300.py_.txt'>Wavetrend L-RX300 Parser</a>]</p>
<p>Related Project: <a href="http://www.ns-tech.co.uk/blog/2010/02/active-rfid-tracking-system/">Building An Active RFID People / Asset Tracking System With Mesh Networking</a></p>
<p>Update 2011-05-20: Suppliers of WaveTrend hardware include:</p>
<ul>
<li><a href="http://www.iautomate.com/search.php?search_query=wavetrend&#038;x=0&#038;y=0">iAutomate</a></li>
<li><a href="http://www.gaorfid.com/index.php?main_page=product_info&#038;cPath=133&#038;products_id=669">GAO RFID Inc</a></li>
<li><a href="http://www.aeroscout.be/contents/en-uk/d140_Wavetrend.html">RFID Plaza</a></li>
<li><a href="http://www.upswung.com/Wavetrend/Wavetrend_readers.htm">UpSwung</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.ns-tech.co.uk/blog/2011/03/active-rfid-with-the-wavetrend-l-rx300-and-synapse-rf-engine/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Fixing The Exspect EX864 iPhone Headphone Adapter For ithlete</title>
		<link>http://www.ns-tech.co.uk/blog/2011/02/fixing-the-exspect-ex864-iphone-headphone-adapter-for-ithlete/</link>
		<comments>http://www.ns-tech.co.uk/blog/2011/02/fixing-the-exspect-ex864-iphone-headphone-adapter-for-ithlete/#comments</comments>
		<pubDate>Sat, 05 Feb 2011 18:04:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Electronics Projects]]></category>

		<guid isPermaLink="false">http://www.ns-tech.co.uk/blog/?p=1015</guid>
		<description><![CDATA[I recently purchased the Exspect EX864 iPhone Headphone Adapter which basically extends the existing 4 pin headphone socket (speaker/microphone) for your iPhone. It is useful if you have e.g. a large iPhone case such as the Otterbox Defender and are looking to connect a 3rd party device that would otherwise be blocked by the case, [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2011/02/ex864.jpg"><img src="http://www.ns-tech.co.uk/blog/wp-content/uploads/2011/02/ex864_small.jpg" alt="" title="EX864 Adapter" width="300" height="202" class="alignright size-full wp-image-1016" /></a>I recently purchased the <a href="http://www.amazon.co.uk/gp/product/B0010VD8YS/">Exspect EX864 iPhone Headphone Adapter</a> which basically extends the existing 4 pin headphone socket (speaker/microphone) for your iPhone.  It is useful if you have e.g. a large iPhone case such as the <a href="http://www.otterbox.com/iPhone-4-Defender-Series-Case/APL2-I4XXX,default,pd.html?dwvar_APL2-I4XXX_color=20&#038;start=1&#038;cgid=apple-iphone-4-cases">Otterbox Defender</a> and are looking to connect a 3rd party device that would otherwise be blocked by the case, such as the <a href="http://www.myithlete.com/">ithlete Receiver</a>.</p>
<p>After testing the device I found it worked in terms of passing through earphone audio but not in terms of passing through the microphone.  Further testing with a multimeter showed that the <a href="http://pinouts.ru/PortableDevices/iphone_headphone_pinout.shtml">4th ring (sleeve)</a> which is the microphone connection was not passed through.</p>
<p>Since the microphone is the sleeve connection (the only one easily accessible on the socket) I was able to run a wire down the side of the case from the top socket to the 4th ring on the plug, solder it in place, and finish it off with some heat proof tubing.  It seems to work fine in terms of fixing the microphone problem.</p>
<p>Note: I also purchased the <a href="http://www.amazon.co.uk/gp/product/B000Y8Z3I2/">iFrogz Fritz Headphone Adapter</a> which had the same problem as the EX864 in terms of the microphone connection not being wired through.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ns-tech.co.uk/blog/2011/02/fixing-the-exspect-ex864-iphone-headphone-adapter-for-ithlete/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Doorbell Control (Home Automation) Notification Software</title>
		<link>http://www.ns-tech.co.uk/blog/2011/01/doorbell-control-home-automation-notification-software/</link>
		<comments>http://www.ns-tech.co.uk/blog/2011/01/doorbell-control-home-automation-notification-software/#comments</comments>
		<pubDate>Sun, 23 Jan 2011 14:06:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Electronics Projects]]></category>

		<guid isPermaLink="false">http://www.ns-tech.co.uk/blog/?p=1004</guid>
		<description><![CDATA[In the second part of my original Doorbell Control project I wrote some software to handle notifications for the doorbell being pressed in C#. For the initial stage I chose to keep things simple and provide notifications (voice announcements) via the intercom feature of an existing SIP phone network running Asterisk (open source PBX software) [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2011/01/ha_software.gif"><img src="http://www.ns-tech.co.uk/blog/wp-content/uploads/2011/01/ha_software_small.gif" alt="Home Automation Software Screenshot" width="300" height="178" class="alignright size-full wp-image-1006" /></a>In the second part of my original <a href="http://www.ns-tech.co.uk/blog/2010/12/doorbell-control-home-automation-with-the-synapse-rf-engine/">Doorbell Control project</a> I wrote some software to handle notifications for the doorbell being pressed in C#.</p>
<p>For the initial stage I chose to keep things simple and provide notifications (voice announcements) via the intercom feature of an existing SIP phone network running <a href="http://www.asterisk.org/">Asterisk</a> (open source PBX software) with <a href="http://www.cisco.com/en/US/prod/collateral/voicesw/ps6788/phones/ps379/ps1855/product_data_sheet09186a0080091984.html">Cisco 7960</a> phones rather than going for a hardware approach.</p>
<p>The process is as follows:</p>
<ol>
<li>Press on doorbell changes state of Synapse node GPIO resulting in multicast RPC being sent across the Synapse network.</li>
<li>Synapse node on the server running <a href="http://www.synapse-wireless.com/index.php?mainID=3&#038;subID=3&#038;type=product&#038;prodID=9">SNAPConnect</a> picks up the multicast RPC, and triggers an XML RPC call to custom C# application.</li>
<li>C# application uses the <a href="http://www.voip-info.org/wiki/view/Asterisk+manager+API">Asterisk Manager</a> interface on the Asterisk PBX server to trigger an internal call between each phones &#8220;intercom&#8221; line (intercom / &#8220;auto answer&#8221; lines connect the caller immediately and do not have to be &#8220;picked up&#8221;), and an internal extension that just plays back a pre-recorded custom audio file (in this case the phrase &#8220;doorbell&#8221;).  Some non Cisco 7960 (non intercom supporting) analogue phones are also being notified by triggering call with a small timeout to produce a  single quick half ring.  The C# application is in addition logging events to a MySQL database.</li>
</ol>
<p>[<a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2011/01/ha_software.zip">Download</a>]</p>
<p>Note: Software is based on the example SNAPConnect RPC code provided by Synapse.  It is highly customised to my own requirements / setup.  It is the provided primarily for those with C# knowledge looking to complete similar projects.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ns-tech.co.uk/blog/2011/01/doorbell-control-home-automation-notification-software/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Doorbell Control (Home Automation) with the Synapse RF Engine</title>
		<link>http://www.ns-tech.co.uk/blog/2010/12/doorbell-control-home-automation-with-the-synapse-rf-engine/</link>
		<comments>http://www.ns-tech.co.uk/blog/2010/12/doorbell-control-home-automation-with-the-synapse-rf-engine/#comments</comments>
		<pubDate>Sun, 12 Dec 2010 18:55:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Electronics Projects]]></category>

		<guid isPermaLink="false">http://www.ns-tech.co.uk/blog/?p=933</guid>
		<description><![CDATA[We have a fairly standard hard wired, 8V AC mains adapter powered push button doorbell.  However due to some shortcomings I recently decided to upgrade it to provide additional capabilities but keeping the existing circuit as much as possible. Requirements: Sense Bell Press &#8211; Allowing for triggering of other events on press, such as additional [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/12/bell_circuit_board.jpg"><img src="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/12/bell_circuit_board_small.jpg" alt="Bell Circuit Board" width="300" height="171" class="alignright size-full wp-image-953" /></a>We have a fairly standard hard wired, 8V AC mains adapter powered push button doorbell.  However due to some shortcomings I recently decided to upgrade it to provide additional capabilities but keeping the existing circuit as much as possible.</p>
<h2>Requirements:</h2>
<ul>
<li><strong>Sense Bell Press</strong> &#8211; Allowing for triggering of other events on press, such as additional remote ringers in other parts of the house, computer popup notification and possibly cameras / camera display (e.g. via scart triggering on TV) etc in the future.</li>
<li><strong>Disable Bell Ringer</strong> &#8211; From either a remote physical switch or PC (for periods when we do not want to be disturbed by doorstep salesmen).</li>
<li><strong>Ring Bell</strong> &#8211; Allowing the bell to keep ringing for a certain minimum duration even if the button is just pressed quickly to save missing callers who do not hold in the button for an adequate duration.</li>
</ul>
<p>Additionally there was a self imposed requirement of interfacing to it in a way such that during reprogramming, or a hardware / software failure the original bell would still operate as normal.</p>
<h3>Parts List</h3>
<p>The <a href="http://www.synapse-wireless.com/index.php?mainID=2&#038;subID=30&#038;type=default">Synapse RF Engine</a> (<a href="http://www.youtube.com/user/SynapseWirelessInc#g/u">YouTube</a>) was chosen for this project, since Synapse hardware is easily scriptable via Python, and has inbuilt support for sending / receiving commands over a wireless network (with mesh networking if required) to either other remote Synapse Engines or a PC connected to a Synapse USB adapter.</p>
<table cellspacing="0" class="tblwithborder">
<tr>
<th>Qty</th>
<th>Name</th>
<th>Code</th>
</tr>
<tr>
<td>x1</td>
<td>W005 Bridge Rectifier</td>
<td><a href="http://www.maplin.co.uk/Module.aspx?ModuleNo=19088&#038;OrderCode=W005">AQ94C</a></td>
</tr>
<tr>
<td>x1</td>
<td>1000µF/25V Capacitor</td>
<td><a href="http://www.maplin.co.uk/Module.aspx?ModuleNo=44037">N68BT</a></td>
</tr>
<tr>
<td>x1</td>
<td>SFH618-2 Optocoupler</td>
<td><a href="http://www.maplin.co.uk/Module.aspx?ModuleNo=2228">CY94C</a></td>
</tr>
<tr>
<td>x2</td>
<td>1N4001S Rectifier Diode</td>
<td><a href="http://www.maplin.co.uk/Module.aspx?ModuleNo=19079&#038;OrderCode=QL73Q">QL73Q</a></td>
</tr>
<tr>
<td>x2</td>
<td>12V Relay</td>
<td><a href="http://www.maplin.co.uk/Module.aspx?ModuleNo=2512&#038;OrderCode=JM67X">JM67X</a></td>
</tr>
<tr>
<td>x2</td>
<td>HUF75337P3 MOSFET</td>
<td><a href="http://www.maplin.co.uk/Module.aspx?ModuleNo=22997">UE47B</a></td>
</tr>
<tr>
<td>x3</td>
<td>Terminal Blocks</td>
<td><a href="http://www.maplin.co.uk/Module.aspx?ModuleNo=30049&#038;OrderCode=RH76H">RH76H</a></td>
</tr>
<tr>
<td>x1</td>
<td>100 Ohm Resistor (x2)</td>
<td><a href="http://www.maplin.co.uk/Module.aspx?ModuleNo=42453">N63BH</a></td>
</tr>
<tr>
<td>x1</td>
<td>10 K Ohm Resistor (x3)</td>
<td><a href="http://www.maplin.co.uk/Module.aspx?ModuleNo=42453">N63BH</a></td>
</tr>
</table>
<p>All parts above were sourced from <a href="http://www.maplin.co.uk/">Maplin Electronics</a>.</p>
<p>I used a the SN171 Proto Board from the <a href="http://uk.futureelectronics.com/en/technologies/development-tools/rf-wireless/Pages/8306680-EK2100.aspx">Synapse EK2100 evaluation kit</a> however the proto boards can also be purchased <a href="http://uk.futureelectronics.com/en/technologies/semiconductors/wireless-rf/rf-modules-solutions/proprietary/Pages/6671358-SN171GG-NR.aspx">separately</a>.</p>
<h3>Circuit Diagram</h3>
<p><a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/12/bell_circuit_diagram.jpg"><img src="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/12/bell_circuit_diagram_small.jpg" alt="Bell Circuit Diagram" title="Bell Circuit Diagram" width="530" height="382" class="alignright size-full wp-image-946" /></a></p>
<p>[Relay Circuit: <a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/12/relay_circuit.jpg">Closeup Diagram</a>]</p>
<p><em>Note 1: Due to space limitations only the circuit for the bottom MOSFET is shown, the other however is just a duplicate of the first, also see above for closeup diagram of the relay control part of the circuit.</em></p>
<p><em>Note 2: The pin spacing of the relay PCB terminals did not match that of my stipboard therefore I chose the non standard approach of soldering wires to the terminals and zip tying the relays to the board.</em></p>
<p>In order to allow the bell to still work even if the Synapse module was removed / non operational the original bell circuit was primarily kept intact but with a normally closed relay added to disable the bell ringer, a normally open relay added in parallel to the switch, and an opto-coupler added in parallel to the bell (before the relay) to sense the button press (even if the bell ringer itself is disabled).</p>
<h3>Software</h3>
<p>Download: <a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/12/doorbell_control.py_.txt">Python Software</a></p>
<h3>Inputs / Outputs</h3>
<p>A mcastRpc of &#8220;doorbell_ring_handle&#8221; is sent when the bell press is sensed, and the following two calls are made available &#8220;doorbell_ring(duration_ms)&#8221;, &#8220;doorbell_disable_ringer(status)&#8221;.</p>
<h3>Future Projects</h3>
<p>Future projects will handle the other end of the system, i.e. the remote ringers (PC and/or hardware based), bell enable/disable switch.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ns-tech.co.uk/blog/2010/12/doorbell-control-home-automation-with-the-synapse-rf-engine/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Building An Active RFID People / Asset Tracking System With Mesh Networking</title>
		<link>http://www.ns-tech.co.uk/blog/2010/02/active-rfid-tracking-system/</link>
		<comments>http://www.ns-tech.co.uk/blog/2010/02/active-rfid-tracking-system/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 20:31:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Electronics Projects]]></category>

		<guid isPermaLink="false">http://www.ns-tech.co.uk/blog/?p=384</guid>
		<description><![CDATA[Introduction I was initially looking into off the shelf hardware, however was unable to find any readily available equipment (to the hobbyist market in low quantities) that was reasonably priced, and fit the requirements. Therefore partly as a personal project, and partly in preparation for a possible commercial product I decided to put together a [...]]]></description>
				<content:encoded><![CDATA[<h3 class="alternate">Introduction</h3>
<p><a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/01/complete_kit_2.jpg"><img src="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/01/complete_kit_2_small.jpg" alt="All Hardware Components" width="200" height="198" class="alignright" /></a>I was initially looking into off the shelf hardware, however was unable to find any readily available equipment (to the hobbyist market in low quantities) that was reasonably priced, and fit the requirements.  Therefore partly as a personal project, and partly in preparation for a possible commercial product I decided to put together a prototype <a href="http://en.wikipedia.org/wiki/Radio-frequency_identification">active RFID</a> tracking System.</p>
<p>The solution I came up with is based on 3 main hardware components, and 5 software components.  It utilises <a href="http://en.wikipedia.org/wiki/Mesh_networking">mesh networking</a> meaning that only a single reader needs to be physically connected to a PC, all other readers just require power.</p>
<h4 class="alternate">Hardware:</h4>
<ul>
<li><a href="#b-384-tag_hardware">Tags</a> &#8211; Carried around / placed on assets to be tracked.</li>
<li><a href="#b-384-reader_nodes_hardware">Reader Nodes</a> &#8211; Placed around the area where the assets need to be tracked in.</li>
<li><a href="#b-384-pc_reader_hardware">PC Reader</a> &#8211; Connected to the PC, receives data from reader nodes and sends it to the PC.</li>
</ul>
<p>The main hardware component used is the <a href="http://www.synapse-wireless.com/?mainID=3&amp;subID=3&amp;type=product&amp;prodID=3">Synapse RF Engine</a>, a 2.4 GHz transceiver module with built in support for running Python scripts, 2 UARTs, a number of GPIOs, and a 2.5uA low power mode.</p>
<h4 class="alternate">Software:</h4>
<ul>
<li><a href="#b-384-tag_software">Tags</a> &#8211; Software running on the tag to send out a &#8220;ping&#8221; at a defined interval, then put the &#8220;tag&#8221; to sleep before sending another ping.</li>
<li><a href="#b-384-reader_node_software">Reader Nodes</a> &#8211; Software running on the reader node hardware to listen for tag &#8220;pings&#8221;, and after receiving a ping, send the tag ID, reader node ID, and received signal strength to the PC Reader.</li>
<li><a href="#b-384-pc_reader_software">PC Reader</a> &#8211; Software running on the reader hardware to receive data over the air from the many reader nodes and forward it to the serial / USB interface.</li>
<li><a href="#b-384-data_forwarder">PC Serial to HTTP data forwarder</a> &#8211; Software running on the PC that listens for data from the serial / USB connected PC Reader, and forwards that data via HTTP to a server.</li>
<li><a href="#b-384-php_gui">Location tracking processing / display GUI</a> &#8211; Web based software to process the tag data into a location, and display it on a map.</li>
</ul>
<p>The software consists of Python used by the Tags, Reader Nodes, PC Reader.  C# used by the &#8220;PC Serial to HTTP data forwarder&#8221;, and PHP, HTML, JavaScript, SVG used by the &#8220;Location tracking processing / display GUI&#8221;.</p>
<p><object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/k0PF9KK9pJQ&#038;hl=en_GB&#038;fs=1&#038;rel=0&#038;hd=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/k0PF9KK9pJQ&#038;hl=en_GB&#038;fs=1&#038;rel=0&#038;hd=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object></p>
<p><em>Video showing simulation of tracking between 8 rooms, using 5 tags.  For real life demo showing a single tag moving between 3 rooms <a href="#b-384-php_gui">see below</a>.</em></p>
<h3 class="alternate">System Design</h3>
<p><a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/01/complete_kit_1.jpg"><img src="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/01/complete_kit_1_small.jpg" alt="All Hardware Components" width="200" height="152" class="alignright" /></a>The system was originally designed around the principle of <a href="http://en.wikipedia.org/wiki/Trilateration">Trilateration</a>.  Reader Nodes are placed at fixed known positions around the room / rooms containing tags that need to be located.  As long as a tag is within range of at least 3 reader nodes the tags position can be calculated by using the signal strength of the tag to each of the 3 nearest readers.  However this approach turned out not to be very feasible since past around 2 meters the <a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/02/signal_data.xlsx">signal strength started fluctuating</a> in a seemingly unpredictable way.  It may be possible to predict / error correct for the fluctuations however I opted to go for a simpler approach of just plotting tags next to the reader with the highest signal strength (the one they are nearest to).  This now means that readers need to be placed in each room (ideally centrally) where tags need to be tracked and it is only possible to determine a tag is in a room, and not its position in that room (although it is not used the original trilateration code has been left in the download).</p>
<p>Using a two part system of sending the tag data to a web server (via a locally run data forwarding application) then displaying it back to clients in the browser has a number of advantages:</p>
<ul>
<li>Main application processing / display logic can be maintained in a single central location for one or more deployments.</li>
<li>Location display / viewing GUI is cross platform (can be accessed via most modern browsers the have support for  <a href="http://en.wikipedia.org/wiki/Scalable_Vector_Graphics">SVG</a> excluding Internet Explorer).</li>
<li>No software to install on client PCs viewing the map.</li>
<li>Multiple users can logon and view the map at the same time.</li>
</ul>
<p>The use of mesh networking means that only a single device needs to be directly connected to a PC, all the others just need to be within range of any other unit that itself is either close to the PC, or close to another reader that is close to the PC.  The makes setting up the system much easier as there is no need to wire each node to the PC / the network or have a PC next to each node.  The nodes just require 3V power.</p>
<h3 class="alternate" id="b-384-tag_hardware">Tag Hardware</h3>
<h4 class="alternate">Parts List</h4>
<p><em>Per individual tag</em></p>
<table cellspacing="0" class="tblwithborder">
<tr>
<th>Qty</th>
<th>Name</th>
<th>Supplier</th>
<th>Cost (&pound; GBP)</th>
</tr>
<tr>
<td>x1</td>
<td>Pocket Card Enclosure</td>
<td><a href="http://www.teko.co.uk/enclosures/pocket-card.htm">Teko PC.4</a></td>
<td align="right">3.56</td>
</tr>
<tr>
<td>x1</td>
<td><a href="http://www.synapse-wireless.com/?mainID=3&amp;subID=3&amp;type=product&amp;prodID=3"> RF100P86 Synapse RF Engine</a></td>
<td><a href="http://uk.futureelectronics.com/en/Technologies/Product.aspx?ProductID=RF100P86SYNAPSEWIRELESSINC2270387">Future RF100P86</a></td>
<td align="right">15.09</td>
</tr>
<tr>
<td>x1</td>
<td>VBH2032-1-LF Battery Holder</td>
<td><a href="http://uk.farnell.com/renata/vbh2032-1-lf/holder-battery-vertical-for-cr/dp/1216359">Farnel 1216359</a></td>
<td align="right">0.84</td>
</tr>
<tr>
<td>x1</td>
<td>CR2032 Battery</td>
<td><a href="http://www.rapidonline.com/Electrical-Power/Batteries/Lithium/Lithium-coin-cells/74894/kw/18-0386">Rapid 18-0386</a></td>
<td align="right">0.88</td>
</tr>
<tr>
<td>x1</td>
<td>Small Stick On Feed (sold in packs of 4)</td>
<td><a href="http://www.maplin.co.uk/module.aspx?moduleno=1840">Maplin FE32K</a></td>
<td align="right">0.89</td>
</tr>
<tr>
<td>x1</td>
<td>Large Stick On Feed (sold in packs of 4)</td>
<td><a href="http://www.maplin.co.uk/module.aspx?moduleno=1840">Maplin FW38R</a></td>
<td align="right">0.89</td>
</tr>
</table>
<p>Note: I used a CR2032 battery from Rapid however both Farnel, and Future also have a selection available from various manufacturers.</p>
<h4 class="alternate">Building The Tag</h4>
<p><a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/01/tag_boxed_2.jpg"><img src="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/01/tag_boxed_2_small.jpg" alt="Tag Boxed" width="200" height="216" class="alignright" /></a></p>
<p>I choose the Teko Enclosure because of its compact, credit card size.  Unfortunately however this meant that the RF Engine would not fit vertically inside.  I could have used one of the alternate form factor modules (sold by companies such as Panasonic that also support the Synapse firmware) however having the pins broken out is actually useful for updating the tag Python software / firmware at a later date.  I therefore decided to bend over the pins, allowing one side to be plugged into the evaluation board as normal (albeit it a much looser fit) and the other to be plugged into the IDC header via an extension cable.  <a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/01/tag_nocover.jpg"><img src="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/01/tag_nocover_small.jpg" alt="Tag Without Cover" width="200" height="146" class="alignleft" /></a> I tried a number of approaches to bending over the pins, including bending them all at once using pliers, and trying to bend them against a flat surface, neither proved very fruitful.  In the end I found the best approach was individually bend each using the tip of the pliers.</p>
<p>In terms of wiring things are fairly straight forward, pin 24 on the modules goes to (-) on the battery holder, and pin 21 to (+) on the battery holder.  I soldered to the top of the module to avoid obstructing the pins meaning they can still be plugged into the evaluation board/extension cable for reprogramming.  I also used some heat shrink tubing to tidy things up.</p>
<p><a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/01/eval_board_extension_1.jpg"><img src="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/01/eval_board_extension_1_small.jpg" alt="Evaluation Board" width="200" height="350" class="alignright" /></a></p>
<p>To secure the module in the enclosure I used two small stick on feet on the module itself, and two larger stick on feet to wedge the battery holder into a corner of the enclosure.</p>
<p>Not being as adept as I could be with finding productions on Digikey&#8217;s site I took the approach of ordering two parts (<a href="http://search.digikey.com/scripts/DkSearch/dksus.dll?lang=en&amp;site=US&amp;WT.z_homepage_link=hp_go_button&amp;KeyWords=3M1324-ND&amp;x=25&amp;y=19">3M1324-ND</a>, <a href="http://search.digikey.com/scripts/DkSearch/dksus.dll?lang=en&amp;site=US&amp;WT.z_homepage_link=hp_go_button&amp;KeyWords=MMS-112-02-T-SV&amp;x=15&amp;y=21">SAM1242-12-ND</a>) really designed for PCB mounting and soldering a ribbon cable to them.  A better approach (if such parts exist) would have been to purchase connectors that can mount directly to ribbon cable (therefore requiring no soldering), and to purchase suitable sized ribbon cable to fit.</p>
<p>Note: If you are going to use the same approach I did and solder the connections then ensure the solder does not leak into the socket, otherwise it will not be possible to plug it in to the evaluation board.</p>
<h3 class="alternate" id="b-384-reader_nodes_hardware">Reader Node Hardware</h3>
<h4 class="alternate">Parts List</h4>
<p><em>Per individual reader &#8211; at least 3 reader nodes are required</em></p>
<table cellspacing="0" class="tblwithborder">
<tr>
<th>Qty</th>
<th>Name</th>
<th>Supplier</th>
<th>Cost (&pound; GBP)</th>
</tr>
<tr>
<td>x1</td>
<td>50mm x 50mm x 20mm ABS Box</td>
<td><a href="http://www.maplin.co.uk/module.aspx?moduleno=43710">Maplin N53FK</a></td>
<td align="right">1.59</td>
</tr>
<tr>
<td>x1</td>
<td><a href="http://www.synapse-wireless.com/?mainID=3&amp;subID=3&amp;type=product&amp;prodID=3">RF100P86 Synapse RF Engine</a></td>
<td><a href="http://uk.futureelectronics.com/en/Technologies/Product.aspx?ProductID=RF100P86SYNAPSEWIRELESSINC2270387">Future RF100P86</a></td>
<td align="right">15.09</td>
</tr>
<tr>
<td>x1</td>
<td>2.1mm DC Socket</td>
<td><a href="http://www.maplin.co.uk/module.aspx?moduleno=1407">Maplin JK09K</a></td>
<td align="right">1.69</td>
</tr>
<tr>
<td>x1</td>
<td>Regulated 3V DC 400mA Power Adapter</td>
<td><a href="http://www.maplin.co.uk/module.aspx?moduleno=19160">Maplin MG76H</a></td>
<td align="right">7.99</td>
</tr>
</table>
<h4 class="alternate">Building The Reader Node</h4>
<p><a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/01/reader_node_unboxed.jpg"><img src="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/01/reader_node_unboxed_small.jpg" alt="Reader Node Unboxed" width="200" height="154" class="alignleft" /></a>As with the tags in terms of wiring, the reader nodes are fairly straight forward, with pins 21 and 24 going to the appropriate connections on the DC plug.</p>
<p>As with the PC reader it would be possible to use the &#8220;SNAPstick USB Module Interface&#8221; to avoid the soldering work, and in this case a USB power supply e.g. <a href="http://www.maplin.co.uk/Module.aspx?ModuleNo=227636">plug form</a> or <a href="http://www.maplin.co.uk/Module.aspx?ModuleNo=115319">cabled form</a> would also be required.</p>
<p>Using the Maplin N53FK box I found the modules only just fitted alongside the DC Plug, I had to remove one of small plastic mounting stands in the box to make it fit.  The other small mounting stand served to secure the module in the box with one row of pins on the module fitting between it and the outer case wall. <a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/01/4_reader_nodes_no_lid.jpg"><img src="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/01/4_reader_nodes_no_lid_small.jpg" alt="4 Reader Nodes Without Lids" width="200" height="190" class="alignright" /></a>  After the module and DC plug were fitted inside the box some space remained between the top of the module and the top of the box, therefore I used a single packing peanut to secure things.  Something like hot glue could also be used however the packing peanut means the modules can quickly and easily be removed and put back into the box, e.g. for reprogramming (however generally it would be possible to reprogram them over the air).</p>
<p>Note: If you are looking for additional range the Synapse RF100PC6 (including a transmit amplifier) or RF100PD6 (including a transmit amplifier and allowing connector of an external antenna) may be more suitable for the both the PC reader, and reader nodes.</p>
<h3 class="alternate" id="b-384-pc_reader_hardware">PC Reader Hardware</h3>
<h4 class="alternate">Parts List</h4>
<table cellspacing="0" class="tblwithborder">
<tr>
<th>Qty</th>
<th>Name</th>
<th>Supplier</th>
<th>Cost (&pound; GBP)</th>
</tr>
<tr>
<td>x1</td>
<td>50mm x 50mm x 20mm ABS Box</td>
<td><a href="http://www.maplin.co.uk/module.aspx?moduleno=43710">Maplin N53FK</a></td>
<td align="right">1.59</td>
</tr>
<tr>
<td>x1</td>
<td><a href="http://www.synapse-wireless.com/?mainID=3&amp;subID=3&amp;type=product&amp;prodID=3">RF100P86 Synapse RF Engine</a></td>
<td><a href="http://uk.futureelectronics.com/en/Technologies/Product.aspx?ProductID=RF100P86SYNAPSEWIRELESSINC2270387">Future RF100P86</a></td>
<td align="right">15.09</td>
</tr>
<tr>
<td>x1</td>
<td><a href="http://www.ftdichip.com/Products/EvaluationKits/TTL-232R-3V3.htm">TTL-232R-3V3 USB to Serial (3.3v level) Cable</a></td>
<td><a href="http://www.skpang.co.uk/catalog/product_info.php?products_id=317">SK Pang</a></td>
<td align="right">18.98</td>
</tr>
<tr>
<td>x2</td>
<td><a href="http://www.farnell.com/datasheets/10177.pdf">LP2950ACZ-3.0 Voltage Regulator</a></td>
<td><a href="http://uk.farnell.com/national-semiconductor/lp2950acz-3-0-nopb/ldo-reg/dp/1685546">Farnel 1685546</a></td>
<td align="right">0.64 ea</td>
</tr>
<tr>
<td>x1</td>
<td>6 Way 2.54mm Molex Header</td>
<td><a href="http://www.rapidonline.com/Cables-Connectors/Connectors-Multipole/PCB-Interconnect/2.54mm-Straight-header/66415/kw/PCB+Header">Rapid 22-0846</a></td>
<td align="right">0.48</td>
</tr>
<tr>
<td>x1</td>
<td>Cable Tie</td>
<td></td>
<td align="right"></td>
</tr>
</table>
<h4 class="alternate">Building The Reader</h4>
<p><a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/01/pc_reader_top_off.jpg"><img src="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/01/pc_reader_top_off_small.jpg" alt="PC Reader No Lid" width="200" height="187" class="alignright" /></a></p>
<p>To simplify the process of linking the 3V Synapse module to the PC (i.e. avoid using a <a href="http://en.wikipedia.org/wiki/MAX232">MAX232</a> and the extra PCB / wiring that would involve) I used a 3V FTDI USB to serial cable.  The USB end plugs straight into the PC and provides a virtual serial port, the other end connects to the UART pins on the Synapse module.  In terms of power, to avoid the need for an external power supply I used an LP2950ACZ-3.0 Voltage Regulator to convert the 5V power provided by the USB port / FTDI cable to the 3V needed by the module.  The LP2950ACZ-3.0 however is only rated for 100mA therefore I used two in parallel to provide 200mA (the Synapse RF Engine datasheet quotes a transmit current of 110mA and a receive current of 65mA).</p>
<p><a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/01/pc_reader.jpg"><img src="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/01/pc_reader_small.jpg" alt="PC Reader Unit" width="200" height="121" class="alignright" /></a></p>
<p>To save some of the work involved in building the readers a <a href="http://uk.futureelectronics.com/en/Technologies/Product.aspx?ProductID=SN132HONRSYNAPSEWIRELESSINC6904726">SNAPstick USB Module Interface</a> (as included in the evaluation kit), and a <a href="http://uk.futureelectronics.com/en/Technologies/Product.aspx?ProductID=RF100P86SYNAPSEWIRELESSINC2270387">RF100P86</a> could be used instead however it would still require a suitable enclosure, and USB extension cable bringing the cost to ~50 GBP per reader.</p>
<p>[View: <a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/01/pc_reader_module.jpg">Module Wiring</a> | <a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/01/pc_reader_connections.jpg">Connector Wiring</a> | <a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/01/pc_reader_wires.jpg">Connector &amp; Module</a>]</p>
<h3 class="alternate" id="b-384-tag_software">Tag Software</h3>
<p>The Python tag software is fairly straight forward, it performs 5 main functions:</p>
<ol>
<li>Set transmit power level for the tags.</li>
<li>Initialise GPIOs to optimise current consumption in sleep mode.</li>
<li>Turn off relaying of messages for other devices in the mesh network (it will only be powered up for a small amount of time every specified interval therefore this would not be very useful, also it may use up extra current).</li>
<li>Send out a ping (via multicast RPC) to any reader nodes in range with the tag id, and a TTL of 1.</li>
<li>Go to sleep for e.g. 10 seconds.</li>
</ol>
<p><a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/01/tag_unboxed.jpg"><img src="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/01/tag_unboxed_small.jpg" alt="Tag Unboxed" width="200" height="157" class="alignleft" /></a></p>
<p>Specifying a TTL of 1 on the multicast RPC call causes only readers that are directly in range of the tag to receive the ping, otherwise by default any nodes not in direct range of the tag would be forwarded the call from readers that were.  This would mean it would not be possible to work out which reader actually communicated with the tag directly and which communicated 2nd hand.</p>
<p>The software is loaded onto the tag via the Synapse &#8220;<a href="http://forums.synapse-wireless.com/showthread.php?t=9">Portal</a>&#8221; application available for Windows, Mac, and Linux, also included with the evaluation kit.</p>
<p>When programming the tag you should plug it into the evaluation board rather than run it on battery and program it over the air because leaving the module on the workbench un-programmed, even for just a few minutes will quickly drain the small battery (15mA when idle according to the datasheet) and 40mA / 110mA when receiving / transmitting. </p>
<p>[Download: <a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/02/tracking_tag.py_.txt">Python Source</a>]</p>
<h3 class="alternate" id="b-384-reader_node_software">Reader Node Software</h3>
<p>The reader node Python software is responsible for receiving a multicast ping from the tag, and then forwarding it back to the module connected to the PC, along with the signal strength of the tag that sent the ping, and the id of the reader itself.  Thanks to the <a href="http://www.synapse-wireless.com/documents/products/SYNAPSE_SNAP.pdf">SNAP (Synapse Network Appliance) protocol</a> the intricacies usually involved with using a mesh network are all abstracted away from the programmer meaning it can be done in only 2 lines of code (excluding comments, variables).</p>
<p>[Download: <a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/02/tracking_reader_node.py_.txt">Python Source</a>]</p>
<h3 class="alternate" id="b-384-pc_reader_software">PC Reader Software</h3>
<p>The PC Reader Python software handles receiving data from the reader nodes (which themselves receive data from tags).  It initialises the serial port, connects UART  1 (itself connected to the FTDI cable, which appears as a virtual serial port on the PC side) to STDIN/STDOUT (i.e. meaning that any Python &#8220;print&#8221; statements cause that data to be sent over the UART to the PC), and then initialises it to 9600 baud.  The software prints the tag ping data to the serial port (after decoding the hex values to plain text).</p>
<p>Example: 003c02,001a06,57<br />
(i.e. [tag id],[reader id],[signal strength]</p>
<p>If the tag that sent the ping is in range of e.g. 4 reader nodes at that time, 4 lines will be received with the same tag id, but different reader ids, and varying signal strengths depending on which reader nodes the tag is closer to.</p>
<p>Note: There is not a command / function to send data to the UART, Python access to it is available only by e.g. cross connecting the UART with STDIN/STDOUT.</p>
<p>[Download: <a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/02/tracking_pc.py_.txt">Python Source</a>]</p>
<h3 class="alternate" id="b-384-data_forwarder">PC Serial To HTTP Data Forwarder</h3>
<p><a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/01/data_forwarder.jpg"><img src="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/01/data_forwarder_small.jpg" alt="Data Forwarder Application Screenshot" width="200" height="166" class="alignright" /></a></p>
<p>The data forwarding application listens for data on the virtual serial port created by the FTDI adapter, and sends it to a HTTP server via HTTP Post.  The local &#8220;COM Port&#8221; (e.g. COM 6) and remote servers HTTP address (http://www.example.com/locationtrack/?p=clientapi&amp;password=track111) running the server software should be specified.  If no HTTP server API address is specified tag data will be logged to the screen only (useful for debugging / testing).</p>
<p>It does not simply pass data straight through to the web API however does some initial processing, firstly in order to minimise HTTP requests (improve performance), and secondly in order to group tag pings together based on a 1 second time limit (something that would be otherwise unnecessarily complex to do on the web application side).  It is assumed a tag is in the same location when any reader reports seeing that particular tag within a 1 second window from when the tag was first seen by any reader.</p>
<p><a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/01/data_forwarder_code.gif"><img src="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/01/data_forwarder_code_small.gif" alt="Data Forwarder Code Screenshot" width="200" height="141" class="alignleft" /></a>The application includes an &#8220;Auto Connect&#8221; checkbox which will cause it to automatically open the connection to the serial port when the software is loaded.</p>
<p>Note: One of the selling points of using the Synapse module (Python / high level language / RPC) based solution is the ease of use of it, everything is very much simplified for the programmer over other options such as perhaps using a <a href="http://www.nordicsemi.com/index.cfm?obj=product&amp;act=display&amp;pro=93">Nordik nRF24LU1</a>, and controlling it over I2C with an <a href="http://www.sparkfun.com/commerce/product_info.php?products_id=9034">AVR</a> in &#8220;C&#8221;.  However this does bring with it additional licensing costs if you use over 6 modules on a network at a time using Portal.  Therefore I coded a custom client side data forwarding application, rather than loading a Python script into Portal to do this and using RPC calls which would have been a simpler solution.  In terms of deployments using the C# application also simplifies things avoiding the need for Portal to be installed / configured, the C# application just requires setting the COM port and URL.</p>
<p>The .net framework is required to run this application, it is available from <a href="http://www.update.microsoft.com/">Microsoft Update</a> or as a download from <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=0856EACB-4362-4B0D-8EDD-AAB15C5E04F5&amp;displaylang=en">microsoft.com</a>.</p>
<p><a href="http://www.microsoft.com/express/vcsharp/">C# Express Edition</a> is available for free from Microsoft for viewing / editing the source code.</p>
<p>[Download: <a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/02/serial_http_data_forwarder_code.zip">C# Source</a> | <a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/02/serial_http_data_forwarder.exe">Application Executable</a>]</p>
<h3 class="alternate" id="b-384-php_gui">Location Tracking Processing / Display GUI</h3>
<p><a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/02/display_gui.jpg"><img src="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/02/display_gui_small.jpg" alt="Display GUI (Tracking Map)" width="200" height="129" class="alignright size-full wp-image-551" /></a>Coded in PHP this part of the code is responsible for accepting data from the HTTP Data Forwarder, converting the signal data into a location on a map, saving the data to a MySQL database and displaying it to one of more users viewing the map.  The frontend is coded in JavaScript and <a href="http://en.wikipedia.org/wiki/Scalable_Vector_Graphics">SVG</a> (using the <a href="http://keith-wood.name/svg.html">jQuery SVG plugin</a>).  AJAX is used to poll the server for tags that have moved and JavaScript / SVG is used to dynamically animate them to their new positions on screen.</p>
<p>When the map is first loaded the tags will animate from their last 2 positions coming to rest at the current live location.  JavaScript code has been written to ensure that tags are not placed on top of each other but rather clustered around the closest reader.</p>
<p>Support is provided on GUI for adding maps (one or more), readers, tags, and users (who can login) to the system.</p>
<p>[Download: <a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/02/location_track_code.zip">PHP Source</a>]</p>
<p>[View: <a href="http://www.ns-tech.co.uk/demo/location-track/?demo=1">Demo</a>]</p>
<p><object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/KvFXblEACYI&#038;hl=en_GB&#038;fs=1&#038;rel=0&#038;hd=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/KvFXblEACYI&#038;hl=en_GB&#038;fs=1&#038;rel=0&#038;hd=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object></p>
<p><em>Video showing a single tag moving around the map plan diagram corresponding to its real world location in one of 3 rooms.  The tag ping interval was set to 3 seconds.</em></p>
<p><object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/6dpKDKL7CQM&#038;hl=en_GB&#038;fs=1&#038;rel=0&#038;hd=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/6dpKDKL7CQM&#038;hl=en_GB&#038;fs=1&#038;rel=0&#038;hd=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object></p>
<p><em>Video showing failed attempt to use trilateration to determine the unknown position of tag using the known position of 3 readers, and signal strengths to them.</em></p>
<h3 class="alternate">General Notes</h3>
<p>I would suggest purchasing the <a href="http://www.synapse-wireless.com/?mainID=3&amp;subID=8&amp;type=product&amp;prodID=8">Synapse Starter Kit</a> (<a href=" http://uk.futureelectronics.com/en/technologies/development-tools/rf-wireless/Pages/8306680-EK2100.aspx">Future Electronics</a>), since although modules are programmable over the air, a serial connection is required in some situations such as deleting running scripts that are in an infinite loop, or have disabled the RF interface used by the &#8220;Portal&#8221; software for uploading new software. </p>
<p>Synapse Wireless software, and documentation is available from the <a href="http://forums.synapse-wireless.com/showthread.php?t=9">Synapse forum</a>.</p>
<h3 class="alternate">Download All</h3>
<p>Includes all project files as linked individually above (Tag Python, Reader Node Python, PC Reader Python, C# Data Forwarder Source, Data Forwarder Binary, PHP Processing / Display application).</p>
<p>[Download: <a href="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/02/tracking_all_code.zip">All Code</a>]</p>
<h3 class="alternate">Issues</h3>
<ul>
<li>With the non trilateration approach of placing tags nearest to the highest signal strength reader, readers need to be carefully situated, particularly if they are in different sized rooms adjacent to each other in order to avoid false readings.</li>
<li>If building the readers again I would use a different type of DC socket, as the one chosen was fairly loose when used with the 3V adapter plugs.</li>
<li>I was expecting to achieve a longer battery life, as it stands battery life is around 1 week for a 10 second ping interval, and around 2 days for a 3 second interval on the CR2032.  In terms of increasing battery life the main options would be decreasing the ping rate (therefore increasing the sleep time), or going for a different battery however this would likely require a larger form factor enclosure.</li>
</ul>
<h3 class="alternate">OpenBeacon Suitability</h3>
<p><img src="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/01/openbeacon_tag.jpg" alt="OpenBeacon Tag" width="200" height="158" class="alignright size-full wp-image-483" /></p>
<p>At first glance <a href="http://www.openbeacon.org/">OpenBeacon</a> hardware (as used at conferences such as the <a href="http://events.ccc.de/congress/2007/">CCC&#8217;s 24C3</a>) would appear to be an ideal choice, their website even mentions it is &#8220;meant to be used as a reference platform by hardware and software developers&#8221;, however the more I looked into it the more it did not seem suitable for my particular requirements:</p>
<ul>
<li>Form factor of <a href="https://shop.openpcd.de/product_info.php?products_id=44&amp;osCsid=0115sl3deeu7oded5fn6jv7j21">20 EUR white tags</a> is not particularly ideal (open circuit board / battery).</li>
<li><a href="https://shop.openpcd.de/product_info.php?products_id=46&amp;osCsid=0115sl3deeu7oded5fn6jv7j21">Keyring tags</a> are available however they cost 25 EUR each + 5 EUR for <a href="https://shop.openpcd.de/product_info.php?products_id=43&amp;osCsid=0115sl3deeu7oded5fn6jv7j21">the case</a>, i.e. 30 EUR in total per tag.</li>
<li><a href="https://shop.openpcd.de/product_info.php?products_id=42&amp;osCsid=0115sl3deeu7oded5fn6jv7j21">USB readers</a> are available for 85 EUR however require a PC by each reader, not particularly suitable for even a small deployment with e.g. 4 or 5 readers.</li>
<li><a href="https://shop.openpcd.de/product_info.php?products_id=45&amp;osCsid=0115sl3deeu7oded5fn6jv7j21">Ethernet readers</a> are available but at a cost of 340 EUR&#8217;s they are somewhat expensive and still require a network cable to each, not ideal.</li>
<li>Readers are not able to provide received signal strength but rather rely on the tags broadcasting at a set (limited) number of power levels meaning a position can not be calculated as accurately as it may otherwise.</li>
</ul>
<p>Update: <a href="http://www.ns-tech.co.uk/blog/2010/02/active-rfid-tracking-system/#comment-411">Reader Tip</a> on setting up &#8220;Reader Nodes&#8221;.</p>
<h3 class="alternate">Other Projects</h3>
<p><a href="http://www.ns-tech.co.uk/products/parallel-track/"><img src="http://www.ns-tech.co.uk/blog/wp-content/uploads/2010/01/paralleltrack.jpg" alt="Parallel Track Screenshot" width="200" height="116" class="alignright" /></a></p>
<p>If you are interested in this project you may find these others also of interest: <a href="http://www.ns-tech.co.uk/products/parallel-track/">Parallel Track</a>, a free (for personal non commercial use) server side vehicle tracking application coded in PHP designed to be used with Python supporting <a href="http://www.telit.com/en/products.php">Telit hardware modules</a> running the embedded <a href="http://www.tmodsoft.com/software/vehicle-tracking/">TModSoft software</a> (firmware).  <a href="http://www.ns-tech.co.uk/products/track-any-mobile/">Track Any Mobile</a>, a web application for mobile phone tracking using the MSC (MSISDN) available using an SS7 API provider.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ns-tech.co.uk/blog/2010/02/active-rfid-tracking-system/feed/</wfw:commentRss>
		<slash:comments>107</slash:comments>
		</item>
	</channel>
</rss>
