<?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>Abdulrahman Alotaiba&#039;s Blog &#187; mobile</title>
	<atom:link href="http://blog.mawqey.com/tag/mobile/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mawqey.com</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Mon, 06 Feb 2012 11:16:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Experimenting with Android and Arduino</title>
		<link>http://blog.mawqey.com/2011/01/24/experimenting-with-android-and-arduino/</link>
		<comments>http://blog.mawqey.com/2011/01/24/experimenting-with-android-and-arduino/#comments</comments>
		<pubDate>Mon, 24 Jan 2011 16:37:18 +0000</pubDate>
		<dc:creator>Abdulrahman Alotaiba</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[mobile]]></category>

		<guid isPermaLink="false">http://blog.mawqey.com/?p=42</guid>
		<description><![CDATA[This is an experiment showing how an Nexus S mobile phone, controlling LED Graph Bar based on the orientation using the accelerometer sensor. <a href="http://blog.mawqey.com/2011/01/24/experimenting-with-android-and-arduino/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Ever since I got into the world of mobile development, I always wanted to do more than just writing apps. I always wanted to interact with the physical world with my mobile. So lately, I have discovered an awesome open source electronics i/o board called <a href="http://www.arduino.cc/">Arduino</a>. I ordered one from <a href="http://www.sparkfun.com/">Sparkfun</a>, and it took around 20 days to get to me, it would&#8217;ve gotten to me a little earlier, if the carrier company didn&#8217;t think it was an explosive unit.</p>
<p><iframe title="YouTube video player" class="youtube-player" type="text/html" width="480" height="390" src="http://www.youtube.com/embed/3CaI088SiIQ" frameborder="0" allowFullScreen></iframe></p>
<p><span id="more-42"></span><br />
As I got my Arduino, I had to dust out my electronics knowledge that I got back when I was at college. Arduino really makes it easy, even for the non electronics geek, to get into electronics really quickly.</p>
<h3 id="My_First_Real_Arduino_Experiment">My First Real Arduino Experiment</h3>
<p>After a quick refresh into the world of electronics, I wanted to do a little experiment that would allow me to interface my newly bought Nexus S phone with Arduino. Since I didn&#8217;t connect my bluesmirf bluetooth module yet, I had to interface with Arduino using <a href="http://en.wikipedia.org/wiki/Serial_communication">serial connection</a>. There&#8217;s one problem though, I didn&#8217;t want to connect a &#8220;<strong>mobile device</strong>&#8221; with wires to a board.</p>
<p>The solution was simple:</p>
<ol>
<li>Connect the Arduino board to a host computer</li>
<li>Run a TCP server on the host computer, that waits for commands from a client</li>
<li>The TCP server translates those commands, and sends them to the Arduino&#8217;s serial port</li>
</ol>
<h3 id="Circuit_Design">Circuit Design</h3>
<p>The components setup is easy, you would control the 10 LED graph bar, as individual LEDs with current limiting resistors. Looking at the <a href="http://www.sparkfun.com/datasheets/Components/LED/YSLB-102510R3-10.pdf">datasheet</a> for the LED graph bar, it says that I would need 20mA of current to operate the LEDs. Unfortunately, I don&#8217;t have lower resistors than my 330Ω, so I used 10 330Ω resistors to provide around 15mA to each LED, which was enough.</p>
<h3 id="LED_Graph_Bar_Arduino_Sketch">LED Graph Bar Arduino Sketch</h3>
<p>Arduino comes with a powerful language called the <a href="http://arduino.cc/en/Reference/HomePage">Arduino programming language</a>, which is based on C/C++. So I had no problem understanding the language quickly, and start interacting with the board.</p>
<p><script src="https://gist.github.com/793461.js"> </script></p>
<p>I connected the LEDs to ports 2 to 11 on the Arduino board, and sat them to output either HIGH (5v) to light on, or LOW (0v) to light off. Also in the setup function, I initiate the serial communication with baud rate = 9600.</p>
<p>As the loop function starts, I wait for serial bytes to arrive, as the bytes arrive, they arrive in ASCII encoded stream. I had to do a little conversion from ASCII to integer, and if the integer is between 0 and 9, I light the LEDs that correspond to that number plus 1, So if I receive 3, I would light 4 LEDs. I count from 0, because I wanted to keep my communication under 1 byte, plus that&#8217;s how machines count.</p>
<h3 id="TCP_To_Serial_Communication_Server">TCP To Serial Communication Server</h3>
<p>To let the Nexus S communicate wirelessly with Arduino, I had to write something that would allow me to send serial commands from the mobile phone to Arduino. So I wrote a simple TCP server in Python. The Python server would receive the desired commands over WiFi, and translates those commands to Arduino using the serial port. I wouldn&#8217;t have used this server, if I connected the bluetooth module, since I can send those commands directly from Android phone to Arduino.</p>
<p><script src="https://gist.github.com/793446.js"> </script></p>
<p>The TCP server is simple, I use the awesome library <a href="http://pyserial.sourceforge.net/">pySerial</a> to open the serial port on my Arduino, with the same baud rate as defined on the sketch. If the connection has been established, I loop indefinitely waiting for commands, which in our case would be digits from 0 to 9. As I receive the digits, I convert them to ASCII, and send them to Arduino. If the letter &#8216;Q&#8217; was received, the communication ends.</p>
<h3 id="The_Android_App">The Android App</h3>
<p>The TCP server waits for commands to be sent from any device that it connects to, I had the server running on port 50000 of the same machine that is connected to the Arduino. and all I had to do is send the numbers of LEDs that I want to light. Using the accelerometer sensor on the Nexus S, it was really easy. I just had to filter out the jitter, as the accelerometer sensor is very sensitive, so I could send normal integers over the air to light how many LEDs I want.</p>
<p>The full <a href="https://github.com/alotaiba/Android-Arduino-Test-App">source code of the app</a> is available under GNU GPLv3 license on my github repository, please feel free to use it.</p>
<h3 id="Resources">Resources</h3>
<ul>
<li><a href="http://www.arduino.cc/">Arduino website</a></li>
<li><a href="http://www.sparkfun.com/">Sparkfun</a></li>
<li><a href="http://www.arduino.cc/playground/Projects/ArduinoUsers">Arduino Playground</a></li>
<li><a href="http://principialabs.com/arduino-python-4-axis-servo-control/">Arduino-Python 4-Axis Servo Control</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.mawqey.com/2011/01/24/experimenting-with-android-and-arduino/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>A New Era in My Life</title>
		<link>http://blog.mawqey.com/2010/07/14/a-new-era-in-my-life/</link>
		<comments>http://blog.mawqey.com/2010/07/14/a-new-era-in-my-life/#comments</comments>
		<pubDate>Wed, 14 Jul 2010 01:59:23 +0000</pubDate>
		<dc:creator>Abdulrahman Alotaiba</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[markdown]]></category>
		<category><![CDATA[mawqey]]></category>
		<category><![CDATA[mobile]]></category>

		<guid isPermaLink="false">http://blog.mawqey.com/?p=5</guid>
		<description><![CDATA[A new era has started in my life, and today marks this era. I have been quiet for the past few months, and that is due to the transition that I&#8217;ve began taking early this year. If you don&#8217;t know &#8230; <a href="http://blog.mawqey.com/2010/07/14/a-new-era-in-my-life/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A new era has started in my life, and today marks this era. I have been quiet for the past few months, and that is due to the transition that I&#8217;ve began taking early this year.</p>
<p>If you don&#8217;t know me that well, I have been an active web developer, who develops and writes mainly in Arabic, on a blog called <a href="http://www.almashroo.com/">Almashroo</a>.</p>
<p>Web development has been my passion for the past 10 years, and I couldn&#8217;t imagine a day, where I don&#8217;t write a JavaScript line here, and PHP line there, complementing them with some (X)HTML and CSS.</p>
<p><span id="more-5"></span></p>
<h3 id="Entering_The_Mobile_World">Entering The Mobile World</h3>
<p>Today, I&#8217;m moving on to a more interesting and challenging area of development, that is, mobile software development. I&#8217;ve spent the past few months developing an open source cross platform mobile app, as a first project, to officially get into this small, and yet challenging world.</p>
<p>I can&#8217;t wait to tell you all about, as I&#8217;m currently preparing the official web site that hosts it, stay tuned for more information that will come shortly.</p>
<h3 id="What_About_the_Web_Development">What About the Web Development?</h3>
<p>Well, I&#8217;m first and foremost a web developer, who still enjoys it. However, I think the knowledge that I&#8217;m getting currently from the mobile, will in fact benefit me greatly as web developer.</p>
<p>Will I return to the web development soon? The short answer, probably yes, but it will take a me a while to get back.</p>
<p>I have redesigned and developed my web site from the grounds up, using the new, and exciting features of HTML5 and CSS3. I used <a href="http://codeigniter.com/">CodeIgniter</a> as a framework, for the main site, along with <a href="http://daringfireball.net/projects/markdown/">Markdown</a> to control the conent, and <a href="http://wordpress.org/">WordPress</a> for this blog. For the people who knew my website before, I have converted it to English, so I can communicate my thoughts to the rest of world.</p>
<p>I have also collected some of my open source projects, and put them on <a href="http://github.com/alotaiba">Github</a>, so you can see and fork them as you like.</p>
<h3 id="What_is_this_Mobile_App_I_am_Working_On">What is this Mobile App I am Working On?</h3>
<p>As I said previously, it&#8217;s an open source cross platform mobile app, that will benefit my country&#8217;s users a lot, this app will be supported on multiple platforms, iPhone, BlackBerry, Android, and any mobile that can run Java ME apps.</p>
<p>A blog post announcing it will be posted right here soon, and when I say soon, I mean in the next few days. So stay tuned.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mawqey.com/2010/07/14/a-new-era-in-my-life/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

