<?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>Tinkerlog &#187; Arduino</title>
	<atom:link href="http://tinkerlog.com/category/arduino/feed/" rel="self" type="application/rss+xml" />
	<link>http://tinkerlog.com</link>
	<description>Alex' blog</description>
	<lastBuildDate>Fri, 03 Sep 2010 18:39:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Mega328 Header Kit</title>
		<link>http://tinkerlog.com/2010/03/11/mega328-header-kit/</link>
		<comments>http://tinkerlog.com/2010/03/11/mega328-header-kit/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 14:51:40 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[avr]]></category>

		<guid isPermaLink="false">http://tinkerlog.com/?p=1059</guid>
		<description><![CDATA[
It took a while since I first posted about the new ATmega header board but finally, here it is.
The board is great for prototyping on a solderless breadboard. It is compatible with the common 28-pin AVR controllers like ATmega48, ATmega88, ATmega168 and ATmega328. On plus it is Arduino compatible.
Some of the features:

Space efficient, occupies only [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://tinkerlog.com/wordpress/wp-content/uploads/2010/02/l_IMGP0033.JPG"><img src="http://tinkerlog.com/wordpress/wp-content/uploads/2010/02/s_IMGP0033.JPG" alt="Blinky Mega328 Header Board" title="Blinky Mega328 Header Board" width="480" height="301" class="alignnone size-full wp-image-1032" /></a></p>
<p>It took a while since I first <a href="http://tinkerlog.com/2009/05/23/atmega-breadboard-header/">posted</a> about the new ATmega header board but finally, here it is.</p>
<p>The board is great for prototyping on a solderless breadboard. It is compatible with the common 28-pin AVR controllers like ATmega48, ATmega88, ATmega168 and ATmega328. On plus it is Arduino compatible.</p>
<p>Some of the features:</p>
<ul>
<li>Space efficient, occupies only on more row than the controller itself</li>
<li>Has no voltage regulator on board, so you choose, at which voltage you want to run it</li>
<li>It has SMD resistors and LEDs (size 1206) to make it a great starting point to learn how to hand solder SMD</li>
<li>Has a sticker to tell which pin is what. <a target="_blank" href="http://todbot.com/blog/2009/05/23/arduino-chip-sticker-label/">Thanks Tod!</a></li>
<li>Blinks blue!</li>
</ul>
<p>Check out the detailed <a href="http://tinkerlog.com/howto/mega328-header/">howto page</a> and grab a <a href="http://store.tinkerlog.com/store/index.php?main_page=product_info&#038;cPath=3&#038;products_id=11">kit at the shop</a>, if you like.</p>
]]></content:encoded>
			<wfw:commentRss>http://tinkerlog.com/2010/03/11/mega328-header-kit/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Remote Accelerometer</title>
		<link>http://tinkerlog.com/2010/02/07/remote-accelerometer/</link>
		<comments>http://tinkerlog.com/2010/02/07/remote-accelerometer/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 15:44:21 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[ADXL335]]></category>
		<category><![CDATA[RFM12B]]></category>

		<guid isPermaLink="false">http://tinkerlog.com/?p=915</guid>
		<description><![CDATA[
What is a remote accelerometer? It&#8217;s a tiny device that has a three axis accelerometer and transmit the acceleration values to a remote host. And what is it good for? There are various uses for it. One is you attach the sensor to someone and let him jump around. On your remote machine you can [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://tinkerlog.com/wordpress/wp-content/uploads/2010/02/l_DSC_0080.JPG"><img src="http://tinkerlog.com/wordpress/wp-content/uploads/2010/02/s_DSC_0080.JPG" alt="ADXL335 + ATmega328 + RFM12B" title="ADXL335 + ATmega328 + RFM12B" width="480" height="300" class="alignnone size-full wp-image-925" /></a></p>
<p>What is a remote accelerometer? It&#8217;s a tiny device that has a three axis accelerometer and transmit the acceleration values to a remote host. And what is it good for? There are various uses for it. One is you attach the sensor to someone and let him jump around. On your remote machine you can use the data to produce sound or modify music. Think of it as a simplified Wiimote.</p>
<p><span id="more-915"></span></p>
<p>Last year Jan of <a href="http://electronicperformers.org/">electronicperformers.org</a> came to me with the idea to make the jumping of people on a trampoline audible. We thought about it and it seemed to be easy. I tinkered with some <a target="_blank" href="http://www.digi.com/products/wireless/point-multipoint/xbee-series1-module.jsp">XBees</a> and <a target="_blank" href="http://www.analog.com/en/sensors/inertial-sensors/adxl335/products/product.html">ADXL</a> acceleration sensors. They worked quite ok, but we had some trouble with the transmission, which sometimes just stopped for a couple of seconds. Maybe some kind of resetting, I really don&#8217;t know. Here is a video of the installation.</p>
<p><object style="height: 344px; width: 425px"><param name="movie" value="http://www.youtube.com/v/jP24ht-JSfw"><param name="allowFullScreen" value="true"><param name="allowScriptAccess" value="always"><embed src="http://www.youtube.com/v/jP24ht-JSfw" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="425" height="344"></object></p>
<p>After that I thought, nice, but can&#8217;t we get it smaller and cheaper? So I sat down and designed a tiny custom PCB.</p>
<h3>Features</h3>
<p><a href="http://tinkerlog.com/wordpress/wp-content/uploads/2010/02/l_adxl_rfm12.png"><img src="http://tinkerlog.com/wordpress/wp-content/uploads/2010/02/s_adxl_rfm12.png" alt="ADXL335 + ATmega328 + RFM12B (Schematic)" title="ADXL335 + ATmega328 + RFM12B (Schematic)" width="480" height="330" class="alignnone size-full wp-image-937" /></a></p>
<p>I had already two <a target="_blank" href="http://news.jeelabs.org/docs/jn3.html">JeeNodes</a> laying around. These boards are using a RFM12B transceiver board to communicate with each other. So I decided to use the RFM12B as XBee replacement. They are really cheap, around 3 to 4 Euros.<br />
The device should be Arduino compatible. Mostly because of the ease of development and available libraries.</p>
<ul>
<li><a target="_blank" href="http://www.atmel.com/dyn/products/product_card.asp?PN=ATmega328P">ATmega328P</a>, Arduino compatible microcontroller, running at 8 MHz</li>
<li><a target="_blank" href="http://www.analog.com/en/sensors/inertial-sensors/adxl335/products/product.html">ADXL335</a>, 3 axis accelerometer, +/- 3g</li>
<li><a target="_blank" href="http://www.hoperf.com/rf_fsk/rf_transceiver.htm">RFM12B</a> radio transceiver, 868 MHz, range of up to 100 meters</li>
<li><a target="_blank" href="http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&#038;name=MCP1702T-3302E/CBCT-ND">MCP1702</a> linear, low-drop voltage regulator for 3.3 V, 250 mA</li>
<li>powered by a 3.7 V lipo cell, 100-300 mA</li>
<li>6 pin ISP header for programming the bootloader</li>
<li>6 pin serial header to attach an FTDI-cable</li>
<li>voltage sensor to tell when the battery goes low</li>
</ul>
<h3>Assembly</h3>
<p><a href="http://tinkerlog.com/wordpress/wp-content/uploads/2010/02/l_DSC_0067.JPG"><img src="http://tinkerlog.com/wordpress/wp-content/uploads/2010/02/s_DSC_0067.JPG" alt="ADXL335 + ATmega328 + RFM12B" title="ADXL335 + ATmega328 + RFM12B" width="480" height="301" class="alignnone size-full wp-image-928" /></a></p>
<p>This is my second try on SMD. Resistors and capacitors are sized 0805. The controller is TQFP and the ADXL335 is LFCSP. LFCSP has not even pins you can hand solder. A very tiny package. As I had no stencil to place the solder paste (because I still have no laser cutter) I had to place the paste by hand. Pressing hard on the syringe and trying to work precisely at the same time is not that easy. After placing a tiny bubble of paste on every pad and gently placing all components, I heated up my hot-air rework station. Soldering with the hot-air station was easy. Not all components are well aligned, maybe because I used not enough solder paste. Often mis-aligned parts slide into place as soon as the paste gets liquid.<br />
Next were the headers, battery connector and the RFM12B module. These were soldered traditionally with an iron.   </p>
<p>Here is a picture of the back with the RFM12B module. The red wire is the antenna.</p>
<p><a href="http://tinkerlog.com/wordpress/wp-content/uploads/2010/02/l_DSC_0070.JPG"><img src="http://tinkerlog.com/wordpress/wp-content/uploads/2010/02/s_DSC_0070.JPG" alt="ADXL335 + ATmega328 + RFM12B (backside)" title="ADXL335 + ATmega328 + RFM12B (backside)" width="480" height="300" class="alignnone size-full wp-image-927" /></a></p>
<h3>Software</h3>
<p>After having the thing assembled it&#8217;s time to test it out. First is to program the Arduino bootloader. For that you need an ISP programmer. I used the <a target="_blank" href="http://www.adafruit.com/index.php?main_page=product_info&#038;products_id=46">USBtinyISP</a> from adafruit. Simply select the target (Arduino Pro Mini @ 8 MHz w/ ATmega328), programmer and the port in the Arduino IDE and select &#8220;burn bootloader&#8221;. Worked on the first try.<br />
Next is a blink sketch to check if the serial connection and the LED works. It turns out that I used too little solder paste on the controller. After resoldering that pin the LED worked.<br />
Next sketch was to check if the ADXL works correctly, which it did. All three axis seem to work great.<br />
After that I had to get the transceiver working. I took the RFM12 lib from <a target="_blank" href="http://news.jeelabs.org/code/">Jee Labs</a>. You have to download the Ports lib as well to get it running. First I uploaded the RF12demo sketch, which allows to setup the RFM12 module and store the configuration in EEPROM. The module was recognized and configured with no problem at all.</p>
<p>Time to develop the actual firmware. Here is the sketch for the sensor.</p>
<pre name="code" class="c">
// RF12B ADXL sensor
// config D i4 g212 @ 868 MHz

#include "Ports.h"
#include "RF12.h"

int xPin = 0;
int yPin = 1;
int zPin = 2;
int ledPin = 5;
byte buf[6];

void setup() {
  rf12_config();
  pinMode(ledPin, OUTPUT);
}

int x, y, z;
unsigned long time;
byte ledOn;

void loop() {
  rf12_recvDone();
  if (rf12_canSend()) {
    x = analogRead(xPin);
    y = analogRead(yPin);
    z = analogRead(zPin);
    buf[0] = x >> 8;
    buf[1] = x;
    buf[2] = y >> 8;
    buf[3] = y;
    buf[4] = z >> 8;
    buf[5] = z;
    rf12_sendStart(0, buf, 6);
  }
  if (time < millis()) {
    time = millis() + 200;
    if (ledOn) {
      digitalWrite(ledPin, HIGH);
    }
    else {
      digitalWrite(ledPin, LOW);
    }
    ledOn = !ledOn;
  }
}
</pre>
<p>It's really easy. You have to call the rfm12_recvDone() to make sure the driver is still working. You have to call it, even if you are not trying to receive anything. If rfm12_canSend() returns true, we can transmit our data. We read the 3 axis acceleration and pack it into a byte array. This byte array is then transmitted. No more, no less. No acknowledge, nothing. </p>
<p>The receiver part looks almost the same, it receives the data and prints it on the serial port. From here on, you can do almost anything: Processing, Pure Data, Python, what ever fits best. You only have to be able to read a serial port.</p>
<h3>Demo</h3>
<p><object width="490" height="276"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=9270103&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=9270103&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="490" height="276"></embed></object></p>
<p>For the demo I used Processing to draw a graph of every acceleration value. The red one is a bit hard to see in the video. Then I used Python with <a target="_blank" href="http://www.pyglet.org/">pyglet</a> to play short wave sounds.</p>
<h3>Outlook</h3>
<p><a href="http://tinkerlog.com/wordpress/wp-content/uploads/2010/02/l_DSC_0077.JPG"><img src="http://tinkerlog.com/wordpress/wp-content/uploads/2010/02/s_DSC_0077.JPG" alt="3 generations of remote accelerometers" title="3 generations of remote accelerometers" width="480" height="299" class="alignnone size-full wp-image-930" /></a></p>
<p>The picture above shows three generations of this device. On the left is the first implementation, using an XBee and an ADXL335, both on breakout boards, wired on a prototyping board. In the middle is the first custom PCB. As you can see, there are two air wires. That happens, when you get distracted while designing a PCB. On the right is the current version.</p>
<p>For the next design I would include an ON/OFF switch so you don't have to pull off the battery all the time. And maybe add a small tactile button to make more Wii-like projects possible.</p>
<h3>Downloads and Links</h3>
<ul>
<li>Eagle files and Arduino sketches, <a href='http://tinkerlog.com/wordpress/wp-content/uploads/2010/02/remote_accell.zip'>remote_accell.zip</a></li>
<li><a target="_blank" href="http://news.jeelabs.org/code/">RFM12 lib</a> at Jee Labs, great stuff!</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://tinkerlog.com/2010/02/07/remote-accelerometer/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>Palo Altona &#8211; Tinker drinkup in Hamburg</title>
		<link>http://tinkerlog.com/2010/01/15/palo-altona-tinker-drinkup-in-hamburg/</link>
		<comments>http://tinkerlog.com/2010/01/15/palo-altona-tinker-drinkup-in-hamburg/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 10:16:30 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[palo altona]]></category>

		<guid isPermaLink="false">http://tinkerlog.com/?p=905</guid>
		<description><![CDATA[
If you&#8217;ve missed Marcus post, here is another on the same topic.
Nearly every other Thursday Marcus and I are hanging out together for having a beer and chatting about all things geek, especially electronics, CNC, 3D-printing, micrcontroller and Arduino. But there&#8217;s no limit, everyone interested in tinkering and making is welcome. It takes place at [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://tinkerlog.com/wordpress/wp-content/uploads/2010/01/tinker-drinkup.jpg" alt="tinker-drinkup" title="Tinker drinkup - Michael and me - with blinking stuff on the table" width="500" height="281" class="alignnone size-full wp-image-906" /></p>
<p>If you&#8217;ve missed <a target="_blank" href="http://interactive-matter.org/2010/01/palo-altona-%e2%80%93-hamburg-tinker-drinkup/">Marcus post</a>, here is another on the same topic.</p>
<p>Nearly every other Thursday Marcus and I are hanging out together for having a beer and chatting about all things geek, especially electronics, CNC, 3D-printing, micrcontroller and Arduino. But there&#8217;s no limit, everyone interested in tinkering and making is welcome. It takes place at <a target="_blank" href="http://www.qype.co.uk/place/5426-Saal-II-Hamburg">Saal II</a> in Schanze. Try us, we&#8217;re kind <img src='http://tinkerlog.com/wordpress/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>You can take a look at <a target="_blank" href="http://twitter.com/interactmatter">Marcus&#8217;</a> or <a target="_blank" href="http://twitter.com/9600baud">mine</a> twitterfeed to checkout when the next <a target="_blank" href="http://twitter.com/#search?q=%23palo_altona">#palo_altona</a> will be.</p>
<p>We already had guests sometimes but yesterday&#8217;s drinkup was great as we had <strong>two</strong> new guests. Feels as if there is something moving in Hamburg. Yeah!</p>
<p><b>Update 2010/02/16:</b> Palo Altona is now scheduled biweekly. Every Thursday was a bit stressing for everybody.</p>
<p><b>Update 2010/03/20:</b> Palo Altona has now a <a href="http://paloaltona.posterous.com/">Posterous page</a> for news and schedule.</p>
]]></content:encoded>
			<wfw:commentRss>http://tinkerlog.com/2010/01/15/palo-altona-tinker-drinkup-in-hamburg/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A retro twitter wall (twypper)</title>
		<link>http://tinkerlog.com/2009/11/20/a-retro-twitter-wall-twypper/</link>
		<comments>http://tinkerlog.com/2009/11/20/a-retro-twitter-wall-twypper/#comments</comments>
		<pubDate>Fri, 20 Nov 2009 18:12:57 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://tinkerlog.com/?p=822</guid>
		<description><![CDATA[
A couple of weeks ago Jan came to me and asked me if I could build a special kind of twitter wall. At our company CoreMedia we do an Open Space every 3 months or so. This time we had a Hacking Day as well, so we needed something special. After throwing some ideas around, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://tinkerlog.com/wordpress/wp-content/uploads/2009/11/l_DSC_0420.JPG"><img src="http://tinkerlog.com/wordpress/wp-content/uploads/2009/11/s_DSC_0420.JPG" alt="Arduino with typewriter" title="Arduino with typewriter" width="480" height="343" class="alignnone size-full wp-image-844" /></a></p>
<p>A couple of weeks ago <a target="_blank" href="http://twitter.com/jtietjen">Jan</a> came to me and asked me if I could build a special kind of twitter wall. At our company <a target="_blank" href="http://www.coremedia.com">CoreMedia</a> we do an <a target="_blank" href="http://en.wikipedia.org/wiki/Open_Space_Technology">Open Space</a> every 3 months or so. This time we had a <a target="_blank" href="https://blog.coremedia.com/cm/post/3077033/RE_SocializeCoreMedia_OpenSpace_am_13_November_2009.html#4634397">Hacking Day</a> as well, so we needed something special. After throwing some ideas around, we came up with a twitter client that should print out tweets with an electric typewriter. A short google showed, that that has been done already (of course!). See it at <a target="_blank" href="http://oomlout.co.uk/?p=79">oomlout</a>.</p>
<p>But that couldn&#8217;t stop us. Jan scanned ebay for a nice electric typewriter and found a Commodore SQ 1000. It was in really good condition, probably rarely used. It worked as advertised.</p>
<p><span id="more-822"></span></p>
<h3>Take it apart</h3>
<p><a href="http://tinkerlog.com/wordpress/wp-content/uploads/2009/11/l_DSC_0320.JPG"><img class="alignnone size-full wp-image-828" title="Take it apart" src="http://tinkerlog.com/wordpress/wp-content/uploads/2009/11/s_DSC_0320.JPG" alt="Take it apart" width="480" height="322" /></a></p>
<p>First step is to take it apart. That reveals a small PCB and the connections of the keyboard. Later I realized that I hadn&#8217;t to open up the keyboard itself, because there is nothing of interest in there. It is a simple keyboard matrix.</p>
<p><a href="http://tinkerlog.com/wordpress/wp-content/uploads/2009/11/l_DSC_0319.JPG"><img src="http://tinkerlog.com/wordpress/wp-content/uploads/2009/11/s_DSC_0319.JPG" alt="SQ 1000 Mainboard" title="Commodore SQ 1000 Mainboard" width="480" height="344" class="alignnone size-full wp-image-830" /></a></p>
<p>The big chip on the right is a SEC microcontroller. The smaller chips should be there for driving the barrel etc. but I haven&#8217;t investigated that. The green foil in the middle is the connection to the keyboard. Actually there are two connections, each with 8 lines, one for the rows, one for the columns to form a matrix.</p>
<p><a href="http://tinkerlog.com/wordpress/wp-content/uploads/2009/11/l_DSC_0325.JPG"><img src="http://tinkerlog.com/wordpress/wp-content/uploads/2009/11/s_DSC_0325.JPG" alt="Solder some hook wires" title="Solder some hook wires" width="480" height="343" class="alignnone size-full wp-image-829" /></a></p>
<p>I decided, that the easiest way to simulate key presses was by shorting the switch of the desired key. I soldered two 8 line cables to the solder joints on the bottom side of the PCB. Actually there were 12 lines on one of the connectors, but 4 of these lines are used to drive LEDs for caps lock and power. </p>
<h3>How does it work</h3>
<p><a href="http://tinkerlog.com/wordpress/wp-content/uploads/2009/11/l_DSC_0328.JPG"><img src="http://tinkerlog.com/wordpress/wp-content/uploads/2009/11/s_DSC_0328.JPG" alt="Analyze the keyboard" title="Analyze the keyboard" width="480" height="322" class="alignnone size-full wp-image-827" /></a></p>
<p>Putting everything back in to place I tried to understand, how the keyboard matrix works. Very helpful was <a target="_blank" href="http://www.avr-asm-tutorial.net/avr_en/keypad/keyboard.html">this tutorial</a>, that connects a keypad to an AVR. </p>
<p>All 16 lines are directly connected to the controller, no external pull-up or pull-down resistors. As already said, the 16 lines are arranged to form a 8 by 8 matrix, giving 64 possible key codes. 8 lines are supplying 5V (called out) and the other 8 lines are low (called in).  The controller then cycles through all out lines, pulling it down, one at a time. Then it checks if one of the in lines is pulled to low to identify the pressed key.<br />
To simulate the key press I have to wait for low on a specific out line and then pull one of the in lines low. I used my oscilloscope to see what&#8217;s really going on. It turns out that the controller scans for key strokes with 87 Hz. Every line is low for about 150 us. I used the Arduino to record the sequence and calculate how wide the low phase is. When I would find a low on line 1 of the out line, I could use it as trigger and compute when the other lines would be pulled down. That way I would only use a single wire (and Arduino input) to detect the out line.<br />
To set a specific in line to low I am using a 74HC595, a shift register with tristate output. The tristate is nice, because if it is disabled, the keyboard is fully functional as if the Arduino is not connected at all.</p>
<p><a href="http://tinkerlog.com/wordpress/wp-content/uploads/2009/11/l_DSC_0421.JPG"><img src="http://tinkerlog.com/wordpress/wp-content/uploads/2009/11/s_DSC_0421.JPG" alt="Arduino interfaced with Commodore SQ1000" title="Arduino interfaced with Commodore SQ1000" width="480" height="344" class="alignnone size-full wp-image-838" /></a></p>
<p>Here is everything connected on a breadboard. On the left is a standard Arduino with an Ethernet Shield.</p>
<p><a href="http://tinkerlog.com/wordpress/wp-content/uploads/2009/11/l_DSC_0423.JPG"><img src="http://tinkerlog.com/wordpress/wp-content/uploads/2009/11/s_DSC_0423.JPG" alt="Arduino, Ethernetshield and a shift register 74HC595" title="Arduino, Ethernetshield and a shift register 74HC595" width="480" height="343" class="alignnone size-full wp-image-836" /></a></p>
<p>On the right is the shift register. In the middle is a pull up resistor connected to line 1 of the out lines. That is used to be able to &#8220;see&#8221;, when the line goes down.</p>
<h3>Reading twitter</h3>
<p>The software part to connect to twitter is straight forward. I used the <a target="_blank" href="http://apiwiki.twitter.com/Twitter-Search-API-Method%3A-search">twitter search API</a> to pull tweets that contained the word #cos09, which was the hashtag used at the CoreMedia Open Space. The query is executed every 60 seconds and the query string looks like this:<br />
<code></p>
<p>http://search.twitter.com/search.json?q=cos09&#038;since_id=0</p>
<p></code><br />
Parsing the json formatted response is a bit ugly, mostly because memory is very limited on the ATmega168. After fetching and parsing a complete response, the max_id is stored and used for the next query. That way only new tweets are printed. </p>
<h3>Demo</h3>
<p><object width="490" height="276"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=7645230&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=7645230&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="490" height="276"></embed></object></p>
<p>So far everything worked well, except the hash sign (#), the @ and &#8230; umlauts (*sigh*). The hash sign is not available because it only accessible by pressing the code key simultaneously, which is not possible with the current setup. The @ is not available at all, I simulate it by the sequence O-backspace-a. Umlauts are missing because &#8230; I&#8217;m lazy. </p>
<h3>Final twitter wall setup</h3>
<p><a href="http://tinkerlog.com/wordpress/wp-content/uploads/2009/11/l_DSC_0013.JPG"><img src="http://tinkerlog.com/wordpress/wp-content/uploads/2009/11/s_DSC_0013.JPG" alt="Final setup at CoreMedia Open Space" title="Final setup with camera and projector" width="480" height="343" class="alignnone size-full wp-image-837" /></a></p>
<p>This is the setup as twitter wall. On the right is a video camera, recording incoming tweets and displaying them via a projector on the wall. The notebook is only bridging WiFi to Ethernet.</p>
<p>After all, the retro twitter wall was fairly successful. People stood around with a smile, tweeting with their iPhone, waiting for an intense &#8220;rattatatat rattatat &#8230;&#8221;.</p>
<p><object style="height: 344px; width: 425px"><param name="movie" value="http://www.youtube.com/v/CV9_25N21eM"><param name="allowFullScreen" value="true"><param name="allowScriptAccess" value="always"><embed src="http://www.youtube.com/v/CV9_25N21eM" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="425" height="344"></object></p>
<p>Here is another action shot, taken by <a href="http://www.jormason.com/wordpress/?p=409">Jörn</a>.</p>
<h3>Links and Downloads</h3>
<ul>
<li>Source: <a href='http://tinkerlog.com/wordpress/wp-content/uploads/2009/11/twypper.zip'>twypper.zip</a></li>
<li><a href="http://oomlout.co.uk/?p=79">Twitter Monitoring Typewriter at oomlout</a></li>
<li><a target="_blank" href="http://www.avr-asm-tutorial.net/avr_en/keypad/keyboard.html">Connecting a keypad to an AVR</a></li>
<li><a target="_blank" href="http://www.dribin.org/dave/keyboard/one_html/">Keyboard Matrix Help</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://tinkerlog.com/2009/11/20/a-retro-twitter-wall-twypper/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Arduino introduction in c&#8217;t</title>
		<link>http://tinkerlog.com/2009/07/21/arduino-introduction-in-ct/</link>
		<comments>http://tinkerlog.com/2009/07/21/arduino-introduction-in-ct/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 22:55:50 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Arduino]]></category>

		<guid isPermaLink="false">http://tinkerlog.com/?p=773</guid>
		<description><![CDATA[
Here is my very first article. It is published in c&#8217;t, one of the best known computer magazines in Germany. wOOt!
It shows some basic Arduino examples and how to build a Wiimote-like controller. The controller consists of an 3-axis accelerometer, a push button and an Arduino nano on a breadboard. This combination is used to [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://tinkerlog.com/wordpress/wp-content/uploads/2009/07/dsc_0037.jpg" alt="" title="c&#039;t Arduino article " width="480" height="322" class="alignnone size-full wp-image-774" /></p>
<p>Here is my very first article. It is published in <a target="_blank" href="http://www.heise.de/ct/inhalt/2009/16/164/">c&#8217;t</a>, one of the best known computer magazines in Germany. wOOt!</p>
<p>It shows some basic <a target="_blank" href="http://arduino.cc">Arduino</a> examples and how to build a Wiimote-like controller. The controller consists of an 3-axis accelerometer, a push button and an Arduino nano on a breadboard. This combination is used to control a Lunar Lander type of game, programmed in <a target="_blank" href="http://processing.org/">Processing</a>.</p>
<ul>
<li>c&#8217;t article <a target="_blank" href="http://www.heise.de/ct/Mikrocontroller-Programmierung-mit-Arduino--/artikel/142053">Shake, rattle &#8216;n&#8217; roll, as full text</a></li>
<li><a target="_blank" href="http://www.heise.de/ct/projekte/machmit/processing/wiki">wiki</a> with more images, links and downloads</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://tinkerlog.com/2009/07/21/arduino-introduction-in-ct/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Microcontroller cheat sheet</title>
		<link>http://tinkerlog.com/2009/06/18/microcontroller-cheat-sheet/</link>
		<comments>http://tinkerlog.com/2009/06/18/microcontroller-cheat-sheet/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 10:54:35 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[avr]]></category>

		<guid isPermaLink="false">http://tinkerlog.com/?p=752</guid>
		<description><![CDATA[
Often, when I am tinkering with a controller on a breadboard, I have to open up the according datasheet, only to look up the pinout. So I designed a simple page with all of of the pinouts that I use most. It has:

8-pin AVRs, ATtiny25/ATtiny45/ATtiny85
20-pin AVR, ATtiny2313
28-pin AVRs, ATmega48/ATmega88/ATmega168/ATmega328
Arduino to ATmega mapping
ISP header, 6-pin and [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://tinkerlog.com/wordpress/wp-content/uploads/2009/06/micro-cheat-sheet.png" alt="" title="Microcontroller cheat sheet" width="470" height="578" class="alignnone size-full wp-image-755" /></p>
<p>Often, when I am tinkering with a controller on a breadboard, I have to open up the according datasheet, only to look up the pinout. So I designed a simple page with all of of the pinouts that I use most. It has:</p>
<ul>
<li>8-pin AVRs, ATtiny25/ATtiny45/ATtiny85</li>
<li>20-pin AVR, ATtiny2313</li>
<li>28-pin AVRs, ATmega48/ATmega88/ATmega168/ATmega328</li>
<li>Arduino to ATmega mapping</li>
<li>ISP header, 6-pin and 10-pin</li>
<li>FTDI-cable</li>
</ul>
<p>Maybe it&#8217;s helpful for others as well. You can download it as:</p>
<ul>
<li><a href='http://tinkerlog.com/wordpress/wp-content/uploads/2009/06/micro-cheat-sheet.pdf'>micro-cheat-sheet.pdf</a></li>
<li><a href='http://tinkerlog.com/wordpress/wp-content/uploads/2009/06/micro-cheat-sheet.svg'>micro-cheat-sheet.svg</a></li>
</ul>
<p>If you like it, you will also like the Tod&#8217;s cool <a target="_blank" href="http://todbot.com/blog/2009/05/23/arduino-chip-sticker-label/">Arduino chip sticker</a>.</p>
<h3>Update 2010/01/24</h3>
<p>The new version includes the pinout of the Bus Pirate. Thanks Philipp for the update.</p>
]]></content:encoded>
			<wfw:commentRss>http://tinkerlog.com/2009/06/18/microcontroller-cheat-sheet/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Mini Braitenberg vehicle</title>
		<link>http://tinkerlog.com/2009/06/07/mini-braitenberg-vehicle/</link>
		<comments>http://tinkerlog.com/2009/06/07/mini-braitenberg-vehicle/#comments</comments>
		<pubDate>Sun, 07 Jun 2009 12:40:28 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[braitenberg]]></category>
		<category><![CDATA[robot]]></category>

		<guid isPermaLink="false">http://tinkerlog.com/?p=737</guid>
		<description><![CDATA[
Here is the second incarnation of a Braitenberg vehicle. This one is almost half of the size of the previous one and it is programmed to &#8220;love&#8221;. That means it sticks to the light source and does not try to overrun it, as the &#8220;aggressive&#8221; first one.


If it is dark, then the two motors run [...]]]></description>
			<content:encoded><![CDATA[<p><object width="490" height="282"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=5029632&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=5029632&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="490" height="282"></embed></object></p>
<p>Here is the second incarnation of a <a target="_blank" href="http://en.wikipedia.org/wiki/Braitenberg_vehicle">Braitenberg</a> vehicle. This one is almost half of the size of the <a target="_blank" href="http://tinkerlog.com/2009/04/18/arduino-powered-braitenberg-vehicle/">previous one</a> and it is programmed to &#8220;love&#8221;. That means it sticks to the light source and does not try to overrun it, as the &#8220;aggressive&#8221; first one.</p>
<p><span id="more-737"></span></p>
<p><a href="http://tinkerlog.com/wordpress/wp-content/uploads/2009/06/l_dsc_0019.jpg"><img src="http://tinkerlog.com/wordpress/wp-content/uploads/2009/06/s_dsc_0019.jpg" alt="" title="Mini Braitenberg" width="480" height="343" class="alignnone size-full wp-image-742" /></a></p>
<p>If it is dark, then the two motors run at full speed. If a sensor detects light, it slows down the motor on the same side. So, if the right sensor detects more light than the left sensor, the right motor turns slower than the left one. That makes the vehicle turn right to the light source. If it is bright enough, both sensors will stop both motors. </p>
<h3>Parts</h3>
<p><a href="http://tinkerlog.com/wordpress/wp-content/uploads/2009/06/l_dsc_0027.jpg"><img src="http://tinkerlog.com/wordpress/wp-content/uploads/2009/06/s_dsc_0027.jpg" alt="" title="Two mini servos and a lipo cell" width="480" height="344" class="alignnone size-full wp-image-743" /></a></p>
<ul>
<li><a target="_blank" href="http://www.sparkfun.com/commerce/product_info.php?products_id=9220">Arduino Mini Pro</a> from Sparkfun</li>
<li><a target="_blank" href="http://www.sparkfun.com/commerce/product_info.php?products_id=7916">Mini breadboard</a> with 170 tie points from Sparkfun</li>
<li>2 mini servos, <a target="_blank" href="http://www.hobbycity.com/hobbycity/store/uh_viewItem.asp?idProduct=663&#038;Product_Name=HXT500_5g_/_.8kg_/_10sec_Micro_Servo">HXT500</a> from Hobbycity</li>
<li>2 <a target="_blank" href="http://www.solarbotics.com/products/gm10w/">GM10 wheels</a> from Solarbotics</li>
<li><a taget="_blank" href="http://www.sparkfun.com/commerce/product_info.php?products_id=341">3.7V LiPo cell with 800 mAh</a> from Sparkfun</li>
<li>2 Light Dependant Resistors (LDR)</li>
<li>2 10 k resitors</li>
<li>2 3 pin headers</li>
</ul>
<p>I picked the Arduino Mini Pro because of it&#8217;s size and because it runs at 3.3V, a good match with the 3.7V lipo cell. The lipo cell has about the same size as the mini breadboard. The two servos are hacked for continuous rotation and tied together, bottom to bottom with a piece of wire. Although most servos are rated for 5V, they work great with 3.7V. Maybe they run a bit slower.</p>
<h3>Code</h3>
<pre name="code" class="c">
/*
 * Simple braitenberg vehicle
 */
#include "Servo.h"

Servo leftServo;
Servo rightServo;
int leftValue = 0;
int rightValue = 0;

void setup() {
  Serial.begin(9600);
  leftServo.attach(10);
  rightServo.attach(9);
} 

void loop() {
  // sensor values between 50..900
  leftValue = (880 - analogRead(1)) / 25;
  rightValue = (900 - analogRead(0)) / 30;
  leftServo.write(101 + rightValue);
  rightServo.write(101 - leftValue);
  delay(10);
}
</pre>
<p>The values are determined by experiments. Yours may vary.</p>
<p><a href="http://tinkerlog.com/wordpress/wp-content/uploads/2009/06/l_dsc_0031.jpg"><img src="http://tinkerlog.com/wordpress/wp-content/uploads/2009/06/s_dsc_0031.jpg" alt="" title="Mini Braitenberg with his older brother" width="480" height="343" class="alignnone size-full wp-image-741" /></a></p>
<p>Here is the mini next to his older brother. The space on the mini breadboard is really limited, but it just works out. Still no soldering required, if you don&#8217;t count the servo hacking.</p>
<p>What&#8217;s next? Hm, pager motors?</p>
<h3>Links</h3>
<ul>
<li><a href="http://tinkerlog.com/2009/04/18/arduino-powered-braitenberg-vehicle/">Arduino powered Braitenberg vehicle</a></li>
<li><a target="_blank" href="http://en.wikipedia.org/wiki/Valentino_Braitenberg">Valentino Braitenberg</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://tinkerlog.com/2009/06/07/mini-braitenberg-vehicle/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>ATmega breadboard header</title>
		<link>http://tinkerlog.com/2009/05/23/atmega-breadboard-header/</link>
		<comments>http://tinkerlog.com/2009/05/23/atmega-breadboard-header/#comments</comments>
		<pubDate>Sat, 23 May 2009 14:59:24 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[avr]]></category>

		<guid isPermaLink="false">http://tinkerlog.com/?p=724</guid>
		<description><![CDATA[
This is another breadboard compatible header board, that I am working on. This one is for all 28-pin AVR devices, ATmega48, ATmega88, ATmega168 and the latest ATmega328. Component count is low and there is no voltage regulator on board. That makes it easy to power it from various sources.
As a bonus, this board is a [...]]]></description>
			<content:encoded><![CDATA[<p><object width="490" height="282"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=4796132&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=4796132&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="490" height="282"></embed></object></p>
<p>This is <a href="http://tinkerlog.com/2009/01/18/attiny-breadboard-headers/">another</a> breadboard compatible header board, that I am working on. This one is for all 28-pin AVR devices, ATmega48, ATmega88, ATmega168 and the latest ATmega328. Component count is low and there is no voltage regulator on board. That makes it easy to power it from various sources.</p>
<p>As a bonus, this board is a hybrid of through hole and SMT components. It has two SMD LEDs under the hood. Great to learn how to solder surface mounted devices.</p>
<p><span id="more-724"></span></p>
<p><a href="http://tinkerlog.com/wordpress/wp-content/uploads/2009/05/l_dsc_00211.jpg"><img src="http://tinkerlog.com/wordpress/wp-content/uploads/2009/05/s_dsc_00211.jpg" alt="" title="mega168 header board" width="480" height="344" class="alignnone size-full wp-image-731" /></a></p>
<p>It has also an FTDI-connector and runs with a 16 MHz resonator, which makes it Arduino compatible. The jumper is used to select between different power sources.</p>
<p><a href="http://tinkerlog.com/wordpress/wp-content/uploads/2009/05/l_imgp0004.jpg"><img src="http://tinkerlog.com/wordpress/wp-content/uploads/2009/05/s_imgp0004.jpg" alt="" title="SMD LEDs and resistors, noob soldering" width="480" height="343" class="alignnone size-full wp-image-727" /></a></p>
<p>Yikes, SMD soldering. This is my first attempt at hand soldering 1206 <a href="http://en.wikipedia.org/wiki/Surface-mount_technology" target="_blank">SMT</a> components. 1206 is only 3.2 mm Ã— 1.6 mm! But these are about the largest SMT components available. Most commonly used are way smaller, 0805, 0603 or 0402. My soldering still looks ugly, but with a bit of practice I think I can do much better.</p>
<p>The space on the board is a bit limitted, so there is no room to mark all pins. That&#8217;s why I have a little cheat sheet around, while wiring things up.</p>
]]></content:encoded>
			<wfw:commentRss>http://tinkerlog.com/2009/05/23/atmega-breadboard-header/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Interfacing Arduino with a Telit GM862</title>
		<link>http://tinkerlog.com/2009/05/15/interfacing-arduino-with-a-telit-gm862/</link>
		<comments>http://tinkerlog.com/2009/05/15/interfacing-arduino-with-a-telit-gm862/#comments</comments>
		<pubDate>Fri, 15 May 2009 17:59:52 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[gps]]></category>
		<category><![CDATA[gsm]]></category>
		<category><![CDATA[GM862-GPS]]></category>

		<guid isPermaLink="false">http://tinkerlog.com/?p=704</guid>
		<description><![CDATA[
The Arduino can talk over a wide range of networks. Ethernet, Bluetooth, Wifi, XBEE and GPRS to name the most known. I had a Telit GM862-GPS module laying around, unused for some time already. It has GPRS and GPS capabilities, both accessible with AT commands. So I decided to port some of my code to [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://tinkerlog.com/wordpress/wp-content/uploads/2009/05/s_dsc_0005.jpg" alt="" title="Telit GM862-GPS" width="480" height="343" class="alignnone size-full wp-image-705" /></p>
<p>The Arduino can talk over a wide range of networks. Ethernet, Bluetooth, Wifi, XBEE and GPRS to name the most known. I had a <a target="_blank" href="http://www.telit.com/en/products/gsm-gprs.php?p_id=12&#038;p_ac=show&#038;p=7">Telit GM862-GPS</a> module laying <a href="http://tinkerlog.com/2007/07/13/interfacing-an-avr-controller-to-a-gps-mobile-phone/">around</a>, unused for some time already. It has GPRS and GPS capabilities, both accessible with AT commands. So I decided to port some of my code to the Arduino.</p>
<p><span id="more-704"></span></p>
<h3>Schematic</h3>
<p><a href="http://tinkerlog.com/wordpress/wp-content/uploads/2009/05/l_gm862.png"><img src="http://tinkerlog.com/wordpress/wp-content/uploads/2009/05/s_gm862.png" alt="" title="Schematic GM862 with Arduino Mega" width="490" height="240" class="alignnone size-full wp-image-706" /></a></p>
<p>Connecting the Arduino Mega to the GM862 is rather easy. Only four connections are needed.</p>
<ul>
<li>Tx3 &#8211; Tx</li>
<li>Rx3 &#8211; Rx</li>
<li>Pin 22 &#8211; On/Off</li>
<li>GND &#8211; GND</li>
</ul>
<p>The GM862 is accessed with a breadboard fiendly breakout board from <a target="_blank" href="http://www.sparkfun.com/commerce/product_info.php?products_id=277">Sparkfun</a>.</p>
<p>The logic pins of the GM862 accept only CMOS 2.8 Volt. For that reason, a voltage divider is needed for the Tx line. Both, Rx and Tx are pulled up to the PWR_CTL line of the module because these pins don&#8217;t have an internal pull up resistor.<br />
The on/off line is connected to ground with a transistor.</p>
<p>The bad thing for this setup is the power supply. The module is powered by a LiPo cell (3.7 V with 2000 mAh). The Arduino Mega is powered by the USB port. If I want to make this portable, I have to use two batteries.  Or find a better solution. Maybe powering the Arduino with a step-up converter. </p>
<h3>Software</h3>
<p>First I wanted to use an Arduino Pro mini, that runs on 3.3 V. That would save me from having two different power supplies for the Arduino and the GM862. I tried to connect the Rx/Tx lines to two digital pins and use the <a target="_blank" href="http://arduiniana.org/">NewSoftSerial</a> library. This library enables a second serial port on the Arduino besides the hardware serial port. Unfortunately it wasn&#8217;t reliable enough. Sending to the module seems to work well, receiving sometimes did not. I tried it with different baud rates and different Arduinos, 8 MHz and 16 MHz, but that didn&#8217;t help. Maybe I did something wrong, but I couldn&#8217;t figure it out.<br />
So I switched to my brand new Arduino Mega. I just connected Rx/Tx to one of the hardware serial ports and it worked immediatly.</p>
<p>The following features are implemented:</p>
<ul>
<li>Starting and stopping the module</li>
<li>Initialization</li>
<li>Sending of SMS</li>
<li>Requesting GPS position and parsing the result</li>
<li>Opening a socket, writing and reading (used to talk HTTP) over GPRS</li>
</ul>
<p>The software is an really early stage. I focussed most on functionality and less on performance or compact code.  The following todos are still open:</p>
<ul>
<li>Make debugging output configurable</li>
<li>Use of PROGMEM to reduce RAM usage</li>
<li>More compact structure for AT commands</li>
<li>Parse more responses of AT commands. Some are simply issued, without looking at the response</li>
</ul>
<p>Nevertheless, here is a small snippet, that shows features that are already working. To get it working, you have to replace XXXX with your PIN. For GPRS you have to dig into the module code and adapt the GPRS settings.</p>
<pre name="code" class="c">
/*
 * GM862-GPS testing sketch
 * used with Arduino Mega
 * http://tinkerlog.com
 */

#include "GM862.h"

int onPin = 22;                      // pin to toggle the modem's on/off
char PIN[5] = "XXXX";                // replace this with your PIN
Position position;                   // stores the GPS position
GM862 modem(&#038;Serial3, onPin, PIN);   // modem is connected to Serial3
char cmd;                            // command read from terminal

void setup() {
  delay(10000);
  Serial.begin(19200);
  Serial.println("GM862 monitor");
  modem.switchOn();                   // switch the modem on
  delay(4000);                        // wait for the modem to boot
  modem.init();                       // initialize the GM862
  modem.version();                    // request modem version info
  while (!modem.isRegistered()) {
    delay(1000);
    modem.checkNetwork();             // check the network availability
  }
  Serial.println("---------------------");
  Serial.println("ready");
}

void requestHTTP() {
  char buf[100];
  byte i = 0;
  modem.initGPRS();                   // setup of GPRS context
  modem.enableGPRS();                 // switch GPRS on
  modem.openHTTP("search.twitter.com");    // open a socket
  Serial.println("sending request ...");
  modem.send("GET /search.atom?q=gm862 HTTP/1.1\r\n"); // search twitter for gm862
  modem.send("HOST: search.twitter.com port\r\n");     // write on the socket
  modem.send("\r\n");
  Serial.println("receiving ...");
  while (i++ < 10) {                  // try to read for 10s
    modem.receive(buf);               // read from the socket, timeout 1s
    if (strlen(buf) > 0) {            // we received something
      Serial.print("buf:"); Serial.println(buf);
      i--;                            // reset the timeout
    }
  }
  Serial.println("done");
  modem.disableGPRS();                // switch GPRS off
}

void loop() {
  if (Serial.available()) {
    cmd = Serial.read();
    switch (cmd) {
    case 'o':
      modem.switchOff();              // switch the modem off
      break;
    case 's':                         // send a SMS. Replace with your number
      modem.sendSMS("6245", "your@email.com hello from arduino");
      break;
    case 'w':
      modem.warmStartGPS();           // issue a GPS warmstart
      break;
    case 'p':
      position = modem.requestGPS();  // request a GPS position
      if (position.fix == 0) {        // GPS position is not fixed
        Serial.println("no fix");
      }
      else {                          // print lat, lon, alt
        Serial.print("GPS position: ");
        Serial.print(position.lat_deg);  Serial.print(".");
        Serial.print(position.lat_min);  Serial.print(", ");
        Serial.print(position.lon_deg);  Serial.print(".");
        Serial.print(position.lon_min);  Serial.print(", ");
        Serial.println(position.alt);
      }
      break;
    case 'h':
      requestHTTP();                  // do a sample HTTP request
      break;
    default:
      Serial.println("command not recognized");
    }
  }
}
</pre>
<h3>Log</h3>
<p>Here is a log, that I recorded within the Arduino IDE. You can see, how</p>
<ul>
<li>the modem gets switched on</li>
<li>the modem gets initialized</li>
<li>the version info is requested</li>
<li>it waits until the network is reachable</li>
<li>a GPS position is requested</li>
<li>a SMS gets send</li>
<li>how a HTTP GET is issued over GPRS, it searches for gm862 on twitter</li>
</ul>
<pre>
GM862 monitor
switching on
done
initializing modem ...
AT
->ok
AT+IPR=19200
->ok
AT+CMEE=2
->ok
AT+CPIN=XXXX
->ok
done
version info ...
AT+GMI
->buf: AT+GMI
Telit
OK
AT+GMM
->buf: AT+GMM
GM862-GPS
OK
AT+GMR
->buf: AT+GMR
07.02.403
OK
AT+CSQ
->buf: AT+CSQ
+CSQ: 0,0
OK
done

checking network ...
AT+CREG?
->buf: AT+CREG?
+CREG: 0,2
OK
done

checking network ...
AT+CREG?
->buf: AT+CREG?
+CREG: 0,2
OK
done

checking network ...
AT+CREG?
->buf: AT+CREG?
+CREG: 0,1
OK
done

---------------------
ready

requesting GPS position ...
AT$GPSACP
->buf: AT$GPSACP
$GPSACP: 110621.999,5333.9477N,00954.8735E,1.4,66.3,3,22.21,0.10,0.05,150509,08
OK
3
GPS position: 53.565794, 9.914568, 66

sending SMS ...
AT+CMGF=1
->ok
AT+CMGS="6245"
->not ok: AT+CMGS="6245"
>
your@email.com hello from arduino
done

initializing GPRS ...
AT+CGDCONT=1,"IP","internet","0.0.0.0",0,0
->buf:
+CMGS:  35
OK
AT+CGDCONT=1,"IP","internet","0.0.0.0",0,0
OK
AT#USERID=""
->buf: AT#USERID=""
OK
AT#PASSW=""
->buf: AT#PASSW=""
OK
done

switching GPRS on ...
AT#GPRS=1
->buf: AT#GPRS=1
+IP: 10.37.146.251
OK
done

opening socket ...
AT#SKTD=0,80,"search.twitter.com",0,0
->buf: AT#SKTD=0,80,"search.twitter.com",0,0
buf:
buf:
CONNECT
sending request ...
receiving ...
buf:HTTP/1.1 200 OK
Date: Fri, 15 May 2009 11:07:19 GMT
Server: hi
Status: 200 OK
Cache-Control: ma
buf:x-age=20, must-revalidate, max-age=1800
Content-Type: application/atom+xml; charset=utf-8
X-Serve
buf:d-By: searchweb005.twitter.com
Expires: Fri, 15 May 2009 11:37:18 GMT
Content-Length: 4757
Vary:
buf: Accept-Encoding
X-Varnish: 218274860
Age: 0
Via: 1.1 varnish
X-Cache-Svr: searchweb005.twitter
buf:.com
X-Cache: MISS
Connection: close

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
[...]
    &lt;/author&gt;
  &lt;/entry&gt;
&lt;/feed&gt;

NO CARRIER
done

switching GPRS off ...
AT#GPRS=0
->buf: AT#GPRS=0
OK
done
</pre>
<h3>Outlook</h3>
<p>Besides some software todos on the list, two things are still bugging me. One is the need of an Arduino Mega because of the hardware serial port. I will try the new version of NewSoftSerial, as soon as it is released. The other thing is the need of two power sources. But that could be solved with the Arduino Mini pro, when the software serial issue is fixed.</p>
<p>Everything else worked well. Now I only need a problem that could be solved with this <img src='http://tinkerlog.com/wordpress/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  .</p>
<h3>Links and Downloads</h3>
<ul>
<li>Source code: <a href='http://tinkerlog.com/wordpress/wp-content/uploads/2009/05/arduino-gm862.zip'>arduino-gm862.zip</a></li>
<li><a href="http://tinkerlog.com/2007/07/13/interfacing-an-avr-controller-to-a-gps-mobile-phone/">Interfacing an AVR controller to a GPS Mobile Phone</a></li>
<li><a target="_blank" href="http://www.sparkfun.com/commerce/product_info.php?products_id=277">GM862 breakout board</a> from Sparkfun</li>
<li><a target="_blank" href="http://www.telit.co.it/modulef.asp?famId=7&#038;famName=GM862%20Modem%20Family">GM862 specs</a> at Telit.</li>
<li><a target="_blank" href="http://www.roundsolutions.de">roundsolutions</a>, distributor for GM862 modules.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://tinkerlog.com/2009/05/15/interfacing-arduino-with-a-telit-gm862/feed/</wfw:commentRss>
		<slash:comments>65</slash:comments>
		</item>
		<item>
		<title>Arduino powered Braitenberg vehicle</title>
		<link>http://tinkerlog.com/2009/04/18/arduino-powered-braitenberg-vehicle/</link>
		<comments>http://tinkerlog.com/2009/04/18/arduino-powered-braitenberg-vehicle/#comments</comments>
		<pubDate>Sat, 18 Apr 2009 16:38:04 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[sensor]]></category>
		<category><![CDATA[braitenberg]]></category>
		<category><![CDATA[robot]]></category>

		<guid isPermaLink="false">http://tinkerlog.com/?p=613</guid>
		<description><![CDATA[
Jonathan asked me, if I would like to do a project with him on Braitenberg vehicles. After some research and reading the first couple of chapters in Vehicles: Experiments in Synthetic Psychology, I was hooked in. Here is the first version of a Braitenberg vehicle, powered with two RC-Servos and an Arduino as its brain.
Best [...]]]></description>
			<content:encoded><![CDATA[<p><object width="441" height="254"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=4212409&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=4212409&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="441" height="254"></embed></object></p>
<p><a href="http://www.optokopter.com">Jonathan</a> asked me, if I would like to do a project with him on Braitenberg vehicles. After some research and reading the first couple of chapters in <a href="http://www.amazon.com/Vehicles-Experiments-Psychology-Valentino-Braitenberg/dp/0262521121">Vehicles: Experiments in Synthetic Psychology</a>, I was hooked in. Here is the first version of a Braitenberg vehicle, powered with two RC-Servos and an Arduino as its brain.</p>
<p>Best of all, it needs no soldering, drilling or hot glue. And if you&#8217;ve played already with Arduinos, there is a good chance, that you have already most of the needed parts at home..</p>
<p><span id="more-613"></span></p>
<h3>Braitenberg vehicles</h3>
<p><img class="alignnone size-full wp-image-615" title="Braitenberg vehicle, turning towards the light source" src="http://tinkerlog.com/wordpress/wp-content/uploads/2009/04/braitenberg.png" alt="" width="450" height="398" /></p>
<p><a href="http://en.wikipedia.org/wiki/Valentino_Braitenberg">Valentino Braitenberg</a> developed a model of simple vehicles with sensors and actuators (motors) and interconnections between them. While the vehicles are extremely simple, the emerging behaviour is not. It is often interpreted as love, aggression or caution.</p>
<p>The easiest one is a light seeking vehicle. That&#8217;s like &#8220;hello world&#8221; in robotics. The sensors are affecting directly the motors. The right sensor affects the left motor and the left sensor affects the right motor. That means, if light shines on the right sensor, the left wheel turns. And if the light shines brighter on the right sensor, the left motor will turn faster than the left one and so the vehicle will turn towards the light source.</p>
<p>These kind of simple robots can be build with analog techniques alone, they don&#8217;t need a microcontroller. Think of two sensors feeding into two amplifiers that control the motors. The big advantage a controller brings in, is the possibility to rewire the connections between inputs and outputs in software. Even more complex functions for the interconnections can be reprogrammed easily.</p>
<h3>Needed parts</h3>
<p><a href="http://tinkerlog.com/wordpress/wp-content/uploads/2009/04/b_dsc_0006a.jpg"><img class="alignnone size-full wp-image-637" title="Parts for a Braitenberg vehicle" src="http://tinkerlog.com/wordpress/wp-content/uploads/2009/04/s_dsc_0006a.jpg" alt="" width="480" height="344" /></a></p>
<ul>
<li>Arduino board</li>
<li>small breadboard or prototyping Arduino shield</li>
<li>2 RC-servos, can be cheap</li>
<li>2 wheels, <a href="http://www.solarbotics.com/products/gmpw/">Solarbotics</a></li>
<li>2 light sensors, LDR (Light Dependent Resistor), e.g. <a href="http://www.solarbotics.com/products/cds/">CdS from Solarbotics</a>, and 2 resistors</li>
<li>2 3-pin headers</li>
<li>battery holder and 4 rechargeable batteries</li>
<li>some rubber bands</li>
<li>some wires</li>
<li>paper clip</li>
</ul>
<p>I am using a <a href="http://www.ladyada.net/make/boarduino/">Boarduino</a> here, that snaps nicely into the small breadboard. The two wheels are used for convenience. You could use any other type of wheels and attach them to the servos.</p>
<p>The two resistors have to match the LDRs to form a good voltage divider. Otherwise you get only a small range of values out of your sensors. Mine work great with a 10 k resistor.</p>
<p>The servos are hacked. Hacking servos means modifying them for continuous motion. A standard servo moves its tiny arm around from -90 to +90 degrees. But we want them to act as simple motors. There are quite a number of resources out there on how to hack a servo. One of the latest and very good documented one is from Tod. Check out his post about <a href="http://todbot.com/blog/2009/04/11/tiny-servos-as-continuous-rotation-gearmotors/">&#8220;Tiny Servos as Continuous Rotation Gearmotors&#8221;</a>.</p>
<h3>Tools</h3>
<p>Nothing. Ha, no soldering iron, no drilling and no hot glue! Ok, you need a PC and an USB-cable.</p>
<h3>Assembling</h3>
<p><a href="http://tinkerlog.com/wordpress/wp-content/uploads/2009/04/b_dsc_0005a.jpg"><img class="alignnone size-full wp-image-633" title="Breadboard with Boarduino and servos" src="http://tinkerlog.com/wordpress/wp-content/uploads/2009/04/s_dsc_0005a.jpg" alt="" width="480" height="343" /></a></p>
<p>Attach the two servos to the breadboard by using 3-pin headers. Connect the red cable to VCC and the brown one to GND. The orange cable is used to send the control pulses to the servo motor. It is connected to Arduino pin 10 (left) and 9 (right).</p>
<p><a href="http://tinkerlog.com/wordpress/wp-content/uploads/2009/04/b_dsc_0013.jpg"><img class="alignnone size-full wp-image-641" style="margin: 5px;" title="left side" src="http://tinkerlog.com/wordpress/wp-content/uploads/2009/04/t_dsc_0013.jpg" alt="" width="220" height="148" /></a><a href="http://tinkerlog.com/wordpress/wp-content/uploads/2009/04/b_dsc_0015.jpg"><img class="alignnone size-full wp-image-642" style="margin: 5px;" title="right side" src="http://tinkerlog.com/wordpress/wp-content/uploads/2009/04/t_dsc_0015.jpg" alt="" width="220" height="148" /></a></p>
<p>The LDR and the resistor are forming a voltage divider. Connect the LDR to VCC and to a free socket on the breadboard. Now connect the resistor to GND and a free socket of the same row as the LDR. Next connect a wire from this row to the analog input pins of the Arduino (left to analog 0 and right to analog 1).</p>
<p><a href="http://tinkerlog.com/wordpress/wp-content/uploads/2009/04/b_dsc_0008.jpg"><img class="alignnone size-full wp-image-625" title="Rubber band to hold everything in place" src="http://tinkerlog.com/wordpress/wp-content/uploads/2009/04/s_dsc_0008.jpg" alt="" width="480" height="344" /></a></p>
<p>Now take the two servos, put them together and wrap a rubber band around them and the breadboard. Then attach the battery holder to the breadboard and fix it with another rubber band.</p>
<p><a href="http://tinkerlog.com/wordpress/wp-content/uploads/2009/04/b_dsc_0020.jpg"><img class="alignnone size-full wp-image-632" title="Tail" src="http://tinkerlog.com/wordpress/wp-content/uploads/2009/04/s_dsc_0020.jpg" alt="" width="480" height="343" /></a></p>
<p>Use the paperclip or some other kind of wire to form a small hook. The hook should snap into place and holding the breadboard and the battery holder together. And it has a little notch that is used instead of a third wheel.</p>
<p><a href="http://tinkerlog.com/wordpress/wp-content/uploads/2009/04/b_dsc_0003.jpg"><img class="alignnone size-full wp-image-636" title="Waiting for a brain" src="http://tinkerlog.com/wordpress/wp-content/uploads/2009/04/s_dsc_0003.jpg" alt="" width="480" height="343" /></a></p>
<p>Now this tiny guy is complete.</p>
<h3>Arduino Code</h3>
<pre name="code" class="c">
/*
 * Simple braitenberg vehicle
 * http://tinkerlog.com
 */

#include "Servo.h"

Servo leftServo;
Servo rightServo;
int leftValue = 0;
int rightValue = 0;

void setup() {
  leftServo.attach(10);
  rightServo.attach(9);
} 

void loop() {
  // sensor values between 50..900
  leftValue = (analogRead(0) - 50) / 50;
  rightValue = (analogRead(1) - 50) / 50;
  leftServo.write(89 + rightValue);
  rightServo.write(89 - leftValue);
  delay(10);
}</pre>
<p>Yes, that&#8217;s all it needs. Only 25 lines of code. Including comments.</p>
<p>The analog values of the sensors are in a range between 50 and 900. So we take 50 as 0 and scale the value down.</p>
<p>The value you send to the servo is the degree it should turn to. From 0 to 180 degrees. At 90 degrees it is centered. For me, 89 is the value at which the left and the right servo stands still. If we add a value, the servo motors spins forward, if we subtract a value, it spins backward. The function for the right servo subtracts the values because it is attached on the opposite side.</p>
<p>You might have to write some simple sketches to evaluate the right values of the sensors and servo motors.</p>
<p>If you plug the USB cable into your PC, it may suck too much power because of the servo motors. You  can power it with your external battery pack. Check your Arduino board, most have a jumper for external power supply. Or you unplug the servos for programming.</p>
<h3>Play</h3>
<p><a href="http://tinkerlog.com/wordpress/wp-content/uploads/2009/04/b_dsc_0005.jpg"><img class="alignnone size-full wp-image-630" title="Ready to roll" src="http://tinkerlog.com/wordpress/wp-content/uploads/2009/04/s_dsc_0005.jpg" alt="" width="480" height="360" /></a></p>
<p>Now switch him on and see if he finds some light sources. It works better, if the rest of the room is dark with only a single light source. I managed to tempt him with a flash light or a lighter. If he seems not to turn as much as he should, try to bend the light sensors more sideways.</p>
<p>This small bot is a bit shaky because of the rubber bands. But he is forgiving. And as he moves around underneath your table, you almost instantly think of him as something that has its own will. Even if you know, that it has only two sensors and two motors.</p>
<h3>Links</h3>
<ul>
<li>Wikipedia: <a href="http://en.wikipedia.org/wiki/Valentino_Braitenberg">Valentino Braitenberg</a></li>
<li>Amazon: <a href="http://www.amazon.com/Vehicles-Experiments-Psychology-Valentino-Braitenberg/dp/0262521121">Vehicles: Experiments in Synthetic Psychology</a></li>
<li>Video of Jonathan&#8217;s <a href="http://www.vimeo.com/2755217">vehicles</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://tinkerlog.com/2009/04/18/arduino-powered-braitenberg-vehicle/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
	</channel>
</rss>
