<?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>iot &#8211; Sufi Nawaz</title>
	<atom:link href="https://sufi.io/tag/iot/feed/" rel="self" type="application/rss+xml" />
	<link>https://sufi.io</link>
	<description>I build stuff</description>
	<lastBuildDate>Fri, 05 Jul 2019 18:43:59 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://sufi.io/wp-content/uploads/2019/03/cropped-sn-logo2-32x32.png</url>
	<title>iot &#8211; Sufi Nawaz</title>
	<link>https://sufi.io</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Tickery &#8211; A Time Tracking Device using Raspberry Pi and Harvest</title>
		<link>https://sufi.io/tickery/</link>
					<comments>https://sufi.io/tickery/#respond</comments>
		
		<dc:creator><![CDATA[Sufi]]></dc:creator>
		<pubDate>Thu, 04 Jul 2019 17:35:11 +0000</pubDate>
				<category><![CDATA[Apps]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[Hardware Hacks]]></category>
		<category><![CDATA[Hobbies]]></category>
		<category><![CDATA[IoT]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[hackathon 2019]]></category>
		<category><![CDATA[hardware hack]]></category>
		<category><![CDATA[harvest]]></category>
		<category><![CDATA[iot]]></category>
		<category><![CDATA[qi]]></category>
		<category><![CDATA[raspberry pi]]></category>
		<category><![CDATA[sense hat]]></category>
		<category><![CDATA[tickery]]></category>
		<category><![CDATA[time tracker]]></category>
		<category><![CDATA[wireless]]></category>
		<guid isPermaLink="false">https://sufi.io/?p=1330</guid>

					<description><![CDATA[For hackathon this year at EAI Technologies, I created an IoT device that allows me to track time through physical interaction and automatically start/stop timer based on my proximity to the device. This blog post details my experience of making such a device.]]></description>
										<content:encoded><![CDATA[
<p>For <strong>hackathon</strong> at our company each year, I work on things that differ in classification from the day to day work that I do. These hackathons typically start on a Friday and end on the following Monday giving us about 4 days to work on each project (with the caveat that we still have to prioritize client work). We are free to work on our own ideas just so long they are feasible in scope and can be targeted to be completed over the weekend.</p>



<ul class="wp-block-gallery columns-2 is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex"><li class="blocks-gallery-item"><figure><a href="https://sufi.io/wp-content/uploads/2019/07/DSC_2866-1024x683.jpg"><img decoding="async" fetchpriority="high" width="1024" height="683" src="https://sufi.io/wp-content/uploads/2019/07/DSC_2866-1024x683.jpg" alt="" data-id="1361" data-link="https://sufi.io/?attachment_id=1361" class="wp-image-1361" srcset="https://sufi.io/wp-content/uploads/2019/07/DSC_2866.jpg 1024w, https://sufi.io/wp-content/uploads/2019/07/DSC_2866-300x200.jpg 300w, https://sufi.io/wp-content/uploads/2019/07/DSC_2866-768x512.jpg 768w" sizes="(max-width: 1024px) 100vw, 1024px" /></a><figcaption>Participants of EAI Hackathon 2019</figcaption></figure></li><li class="blocks-gallery-item"><figure><a href="https://sufi.io/wp-content/uploads/2019/07/DSC_2647-1024x683.jpg"><img decoding="async" width="1024" height="683" src="https://sufi.io/wp-content/uploads/2019/07/DSC_2647-1024x683.jpg" alt="" data-id="1362" data-link="https://sufi.io/?attachment_id=1362" class="wp-image-1362" srcset="https://sufi.io/wp-content/uploads/2019/07/DSC_2647.jpg 1024w, https://sufi.io/wp-content/uploads/2019/07/DSC_2647-300x200.jpg 300w, https://sufi.io/wp-content/uploads/2019/07/DSC_2647-768x512.jpg 768w" sizes="(max-width: 1024px) 100vw, 1024px" /></a><figcaption>Participants of EAI Hackathon 2019</figcaption></figure></li></ul>



<p>Two years ago, I&#8217;d worked on implementing a <strong>Physical Kanban</strong> board with a coworker that allowed users to maintain a physical board for kanban sprints and once an image is taken of the board and uploaded, our application would run <strong>image recognition</strong> (using <strong>Google Vision API</strong>) on the image and translate all the tasks written in post-it notes to tickets in <a href="https://trello.com">Trello</a> board on their respective board columns. These tickets could be worked on after the fact to have more details and a later instance of the image capture would retain all additional information or delete the ticket if the ticket is closed or removed from the physical board.</p>



<p>While the Physical Kanban project and the other projects I&#8217;d worked on during hackathons thus far were exclusively software applications, this year, I&#8217;d decided to go for a project that involved making my own hardware and the software to make it all work.</p>



<p>But I did not want to build something for the sake of just building. I actually had a real problem at hand and with the ideas of some close friends, found the right solution to my problem.</p>



<h2 class="wp-block-heading">The Problem</h2>



<p>At <a href="https://eaiti.com">EAI Technologies</a>, we keep track of our time through <a href="https://getharvest.com">Harvest</a> application and in the best of days and circumstances, it is a hard task for me to keep track of time with it. This is where a physical device to start and stop a timer, that would be integrated with Harvest API, would be so much easier for me to visually keep track of time spent in different projects. So as far as that problem goes, Tickery would be the perfect device to solve the problem.</p>



<h2 class="wp-block-heading">The Solution</h2>



<p>As with Physical Kanban project, human beings are more attentive to physical interaction than keeping up with software applications. So while the intangible world of software keeps us connected, it could easily be lost on us to keep up with mundane tasks such as time keeping. Enter <strong>Tickery</strong>. The goal of this device is to start and stop timer for various projects (<em>mutually exclusively</em>) as you see fit. This could be beneficial for developers such as myself or for project managers or even product people to keep track of their project hours for future analytics or just simply maintaining timesheets (if applicable to them).</p>



<h2 class="wp-block-heading">Tickery (Final Product)</h2>



<div class="wp-block-image"><figure class="alignright is-resized"><a href="https://sufi.io/wp-content/uploads/2019/07/9Z7A1446-2.jpg" target="_blank" rel="noreferrer noopener"><img decoding="async" src="https://sufi.io/wp-content/uploads/2019/07/9Z7A1446-2-1024x683.jpg" alt="Time Tracking Cube" class="wp-image-1333" width="428" height="284" srcset="https://sufi.io/wp-content/uploads/2019/07/9Z7A1446-2-1024x683.jpg 1024w, https://sufi.io/wp-content/uploads/2019/07/9Z7A1446-2-300x200.jpg 300w, https://sufi.io/wp-content/uploads/2019/07/9Z7A1446-2-768x512.jpg 768w" sizes="(max-width: 428px) 100vw, 428px" /></a></figure></div>



<p>The general plan for the device was to be a <strong>polyhedron</strong> shape where <strong>flipping</strong> on each side would <strong>trigger</strong> a timer to start. There would be neutral position which would trigger all timers to stop. I also wanted a display on the top that, when flipped to one of the sides, would display the name of the project/task that it started tracking. The orientation of the display needed to based on which side it was flipped on and the <strong>color of the screen </strong>should reflect the color each side is marked with. I wanted a case that would fit all the hardware &#8211; and went against my usual tendency to make something out of wood. I opted for transparency (literally) such that it would showcase the inner parts of the device &#8211; and the Container Store had just the thing staring back at me from one of the shelve racks &#8211; an acrylic Baseball display cube. With a little bit of drilling, this became the perfect case for the job.</p>



<figure class="wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<div class='tt_post_video'><iframe loading="lazy" title="Tickery - A Time Tracking Device" width="960" height="540" src="https://www.youtube.com/embed/MU3aZJgSDLY?feature=oembed" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div>
</div><figcaption>Tickery in action</figcaption></figure>



<h2 class="wp-block-heading">Hardware</h2>



<p>For this project, I&#8217;d decided to go with a <a rel="noreferrer noopener" aria-label="Raspberry Pi Zero W (opens in a new tab)" href="https://www.raspberrypi.org/products/raspberry-pi-zero-w/" target="_blank">Raspberry Pi Zero W</a> that has builtin <strong>Wifi</strong> and <strong>Bluetooth</strong> support and a <a rel="noreferrer noopener" aria-label="Raspberry Pi Sense Hat (opens in a new tab)" href="https://www.raspberrypi.org/products/sense-hat/" target="_blank">Raspberry Pi Sense HAT</a> that comes with bunch of sensors, <strong>joystick</strong>, and an <strong>8&#215;8 LED Matrix display</strong>. Sense hat has extensive libraries and jam packed hardware features that I could take advantage of and even expand functionalities on in the future if I wanted to (like triggering e-emergency alerts for fire emergency, and so on). I&#8217;m using the joystick (although not made accessible from outside the case) to show which project the timer is active for and to do a safe shutdown of the pi if needed so that I don&#8217;t end up corrupting the SD card with having to pull the plug on the pi every time I need to turn off the device (or having to SSH in to the box and turning it off that way first). </p>



<h3 class="wp-block-heading">Powering the device</h3>



<p>To power the Pi and the Sense Hat, I used a 1200mAh 3.7v Lipo battery. The pi and the Sense Hat actually needs 5v input, so I used a voltage regulator that takes in 3.7v and delivers a constant 5V output and also does a clean shutdown of the Pi if the voltage falls below a certain threshold. This is where the Pimoroni Zero Lipo circuit shim came in to play. The only thing I do not like about the Zero Lipo, however is that you actually need a separate circuit to charge the Lipo battery. For that purpose, I used Adafruit&#8217;s Micro USB Lipo battery charger, a small device that is capable of accepting 5V input and charge the 3.7v Lipo battery while delivering the same 3.7v out for consumption at the same time as charging the battery.</p>



<div class="wp-block-image"><figure class="alignright"><a href="https://sufi.io/wp-content/uploads/2019/07/tickery-qi-charging.gif" target="_blank" rel="noreferrer noopener"><img decoding="async" loading="lazy" width="320" height="250" src="https://sufi.io/wp-content/uploads/2019/07/tickery-qi-charging.gif" alt="Qi Wireless Charging" class="wp-image-1357" /></a><figcaption>Qi Wireless Charging</figcaption></figure></div>



<p>So along with the capability to charge the Pi over micro USB, I also wanted to power the device wirelessly using a Qi charger. This was made possible with Adafruit&#8217;s <strong>Wireless Qi Receiver</strong> which I am pretty excited about. The Qi receiver delivers 5V output at 500mA and paired with the Lipo Zero, battery and charger, the Pi is capable of running on its own completely wireless for a long time.</p>



<h3 class="wp-block-heading">Components Used</h3>



<ul class="hide-bullets"><li>         <span class="material-icons">computer</span> Raspberry Pi Zero W ($5)     </li><li>         <span class="material-icons">battery_charging_full</span> Adafruit Wireless Qi Receiver ($15)     </li><li>         <span class="material-icons">battery_charging_full </span> Pimoroni Zero Lipo ($12)     </li><li>         <span class="material-icons">sd_card</span> 4GB SD Card ($3)     </li><li>         <span class="material-icons">screen_rotation</span> Raspberry Pi Sense Hat ($30)     </li><li>         <span class="material-icons">battery_charging_full</span> 1200mAh 3.7v Lipo Battery ($10)     </li><li>         <span class="material-icons">crop_square</span> Baseball Display Cube ($4)     </li><li>         <span class="material-icons">battery_charging_full</span> Adafruit Micro USB Lipo Charger ($7)     </li></ul>



<h3 class="wp-block-heading">Features</h3>



<ul class="hide-bullets"><li><i class="material-icons">             wifi         </i> WiFi</li><li><i class="material-icons">             bluetooth         </i> Bluetooth</li><li><i class="material-icons">             battery_charging_full         </i> Wireless Qi Charging</li><li><i class="material-icons">             screen_rotation         </i> 9 DOF IMU Sensor</li><li><i class="material-icons">             battery_full         </i> 7h Battery life</li><li><i class="material-icons">             tv         </i> 8&#215;8 LED Display</li></ul>



<h2 class="wp-block-heading">Software</h2>



<p>At the heart of the device is a python script that I run that pulls in the project mappings for each side of the tickery device that constantly monitors the Sense HAT&#8217;s <strong>IMU sensors</strong> to sense the orientation of the device. This <strong>python script </strong>can be found at my GitHub <a href="https://github.com/sufinawaz">here</a>. </p>



<p>As for the Restful services to keep track of the project mapping for each side  of the Tickery device, I&#8217;d  created a simple <strong>Spring Boot </strong>based application that uses <strong>elasticsearch</strong> as the data storage. I&#8217;ve used a <strong>docker container</strong> to run the elasticsearch instance, but you could easily use a hosted service or even a local instance if you so desire. You can follow my <strong>tutorial</strong> on a similar project from here <a href="https://sufi.io/spring-boot-app/">Spring Boot Starter App with Elasticsearch</a>. </p>



<p>The UI I built was a very basic <strong>Angular app</strong> that allowed me to map each of the four sides to one of the project assignments I have in Harvest. Details on using <strong>Harvest API</strong> can be found <a href="https://help.getharvest.com/api-v2/">here</a>. For this, I needed a personal access token from Harvest, which could be created <a href="https://id.getharvest.com/developers">here</a>.</p>



<h2 class="wp-block-heading">Additional Features</h2>



<p>One of the features that I was able to implement last minute was a <strong>proximity based start/stop trigger</strong> for currently active timer. For this feature I have the bluetooth address of my phone being searched for over bluetooth while at least one timer is active. If this feature is turned on, then the active timer would be stopped if, let&#8217;s say, I walk out to grab lunch and would resume the active timer if I&#8217;m back to my desk. This reduces the complexity of having to worry about leaving behind the device when I&#8217;m going leaving for home or just the work premises in general. This feature can be turned off as one wishes, but for me, this is a perfect feature that I see forgetful self leveraging quite heavily :). If I&#8217;m working from home and I leave the device on an <strong>active</strong> side, I can simply turn off the feature through the web portal.</p>



<h2 class="wp-block-heading">Future Features</h2>



<p>The Sense Hat has a bunch of sensors that I did not take advantage of for the hackathon project, but it is totally feasible to take advantage of the <strong>temperature and humidity sensor</strong> to<strong> trigger fire alarm</strong> if temperature sensor picks up an alarmingly high temperature calling. This could conceivably be done using SingleWire API or Ring API for instance. I haven&#8217;t done much research on this area but something I look forward to doing in the future.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sufi.io/tickery/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
