<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.2.1" -->
<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/"
	>

<channel>
	<title>Grau goes Color</title>
	<link>http://grauonline.de/wordpress</link>
	<description>A blog on projects with robotic, computer vision and more</description>
	<pubDate>Sat, 21 Aug 2010 17:57:38 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.1</generator>
	<language>en</language>
			<item>
		<title>Pascal is dead - long lives FreePascal!</title>
		<link>http://grauonline.de/wordpress/?p=48</link>
		<comments>http://grauonline.de/wordpress/?p=48#comments</comments>
		<pubDate>Sat, 21 Aug 2010 14:49:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Programming languages]]></category>

		<guid isPermaLink="false">http://grauonline.de/wordpress/?p=48</guid>
		<description><![CDATA[



You develop software for the consumer market in a professional manner? But you cannot afford a team of 30 developers? Your code changes quickly? And at the end you need to deliver your products to your customers, not just prototypes, right?



Don&#8217;t take me wrong, we have been using several programming languages over the years (including [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://grauonline.de/wordpress/wp-content/uploads/lazarus.png" title="lazarus"><img src="http://grauonline.de/wordpress/wp-content/uploads/lazarus.thumbnail.png" alt="lazarus" /></a></p>
<blockquote>
<blockquote></blockquote>
</blockquote>
<p>You develop software for the consumer market in a professional manner? But you cannot afford a team of 30 developers? Your code changes quickly? And at the end you need to deliver your products to your customers, not just prototypes, right?</p>
<blockquote>
<blockquote></blockquote>
</blockquote>
<p>Don&#8217;t take me wrong, we have been using several programming languages over the years (including C++, Java, Python) and still use them all over the time. I rather think the general idea is that e.g. C++ is not always the right choice - Here&#8217;s what you get if you use FreePascal/Lazarus:</p>
<ul>
<li>FreePascal is *not* just Pascal - you get a 100% programming <strong>OO-language</strong> with objects, classes, generics, interfaces, type-saftety and a <strong>clean </strong>and <strong>easy syntax</strong> like Java or C# - everything in a compiler.<br />
You might ask: Does it have the same quality like gcc or VC++? We think: YES.</li>
<li>FreePascal is <strong>multi-platform</strong> - after you wrote your application for Windows, it will run without modifications on the Mac - natively.</li>
<li>FreePascal is <strong>extendable</strong> - you can easily add shared libraries written in C or any other language.</li>
<li>Lazarus is *not* just another IDE - you get a multi-platform <strong>integrated source code editor</strong> including syntax checking, code completion, refactoring tools, and with an integrated <strong>WYSIWYG user interface editor </strong>for managing your application&#8217;s user interface:  menus, windows, text labels, edit fields, buttons, etc. - including &#8216;layout manager&#8217; - everything with full preview and without recompiling your code!</li>
<li>Lazarus LCL (component library) is a <strong>multi-platform</strong>, <strong>Unicode</strong>-capable GUI library - after you designed your user interface on Window, it will run without any modifications on the Mac.<br />
You might ask: Does this LCL have the quality of something like wxWidgets or QT?  We think: YES.</li>
<li>The &#8216;<strong>edit-compile-run</strong>&#8216; cycle is *<strong>fast</strong>* - you don&#8217;t have to wait for the executables, they are just there after hitting the compilation button.</li>
<li>Needless to say: it is <strong>Open Source</strong> - If you find a bug, it&#8217;s often easy to fix it yourself. Plus, the source of your issue is just a click away (CTRL+mouse click shows the IDE/GUI library code of the clicked method).<br />
It comes with a <strong>modified GPL license</strong> which means you are fully allowed to<strong> build and ship your commerical applications </strong>with it, and of course without having to ship your own source code.</li>
</ul>
<p>Enough to  say - try it out yourself:</p>
<ol>
<li>Download the Lazarus package (already includes the compiler) <a href="http://www.freepascal.org" title="http://www.freepascal.org"><br />
</a><a href="http://www.lazarus.freepascal.org/" title="http://www.lazarus.freepascal.org/">http://www.lazarus.freepascal.org/<br />
</a><a href="http://www.freepascal.org" title="http://www.freepascal.org">http://www.freepascal.org/</a></li>
<li><a href="http://www.freepascal.org/docs-html/ref/ref.html" title="http://www.freepascal.org/docs-html/ref/ref.html">Start learning the language</a> (like you would do with C#, Objective-C, Smalltalk or something else)</li>
<li><a href="http://www.youtube.com/results?search_query=lazarus+freepascal&amp;aq=f" title="http://www.youtube.com/results?search_query=lazarus+freepascal&amp;aq=f">Watch the YouTube tutorial videos</a></li>
<li><a href="http://www.grauonline.de/slides/lazarus.html" title="http://www.grauonline.de/slides/lazarus.html">Read our FreePascal/Lazarus success story :-)&#8230;</a></li>
</ol>
<p>Do you need someone else to develop the application for you using FreePascal? <a href="http://grauonline.de/cmsimple2_6/en/?Services:Free_Pascal_Programming_Services" title="http://grauonline.de/cmsimple2_6/en/?Services:Free_Pascal_Programming_Services">Then don&#8217;t hesitate to ask us!</a></p>
]]></content:encoded>
			<wfw:commentRss>http://grauonline.de/wordpress/?feed=rss2&amp;p=48</wfw:commentRss>
		</item>
		<item>
		<title>GDB/FreePascal - How a debugger can trigger on variable corruption</title>
		<link>http://grauonline.de/wordpress/?p=47</link>
		<comments>http://grauonline.de/wordpress/?p=47#comments</comments>
		<pubDate>Fri, 16 Jul 2010 08:45:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Programming languages]]></category>

		<guid isPermaLink="false">http://grauonline.de/wordpress/?p=47</guid>
		<description><![CDATA[Problem: Some variable is overwritten in your program and you need to find the location where this will happen.
Example: As you can see from the program output, the variable &#8216;otherdata&#8217; has been corrupted by the variable &#8216;data. Imagine, between the corruption and using again the variable &#8216;otherdata&#8217; million of code lines could be executed!

program project1;
type [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem: </strong>Some variable is overwritten in your program and you need to find the location where this will happen.</p>
<p><strong>Example: </strong>As you can see from the program output, the variable &#8216;otherdata&#8217; has been corrupted by the variable &#8216;data. Imagine, between the corruption and using again the variable &#8216;otherdata&#8217; million of code lines could be executed!</p>
<pre>
program project1;
type p64 = ^int64;

procedure testme;
var
  otherdata: integer;
  data: integer;
begin
  writeln('data=',hexStr(data, 8));
  writeln('otherdata=',hexStr(otherdata, 8));
  writeln;

  p64(@data)^:=$00AABBBBCCCCDDDD;  // overwrites otherdata
  writeln('dummy');
  writeln('dummy');
  writeln('data=',hexStr(data, 8));
  writeln('otherdata=',hexStr(otherdata, 8));
end;

begin
  testme();
end.

C:Projectsfrtestdebugger&gt;project1.exe

data=7FFDB000
otherdata=0042C294
dummy
dummy
data=CCCCDDDD
otherdata=00AABBBB</pre>
<p><strong><br />
Solution: </strong>GDB has the ability to &#8216;<strong>watch</strong>&#8216; for variable changes and trigger them! In this example, it will stop execution at the line that corrupts the OTHERDATA variable.</p>
<p><em>C:\Projects\fr\test\debugger&gt;gdb project1.exe</em></p>
<p>GNU gdb 6.8<br />
Copyright (C) 2008 Free Software Foundation, Inc.<br />
License GPLv3+: GNU GPL version 3 or later &lt;http://gnu.org/licenses/gpl.html&gt;<br />
This is free software: you are free to change and redistribute it.<br />
There is NO WARRANTY, to the extent permitted by law.  Type &#8220;show copying&#8221;<br />
and &#8220;show warranty&#8221; for details.<br />
This GDB was configured as &#8220;i686-pc-mingw32&#8243;&#8230;<br />
(gdb)</p>
<p><em>(gdb) <strong>break TESTME</strong></em><br />
Breakpoint 1 at 0&#215;4014ff: file project1.lpr, line 23.</p>
<p>Breakpoint 1, TESTME () at project1.lpr:23<br />
23        writeln(&#8217;data=&#8217;,hexStr(data, 8));</p>
<p><em>(gdb) <strong>watch OTHERDATA</strong></em><br />
Hardware watchpoint 2: OTHERDATA</p>
<p><em>(gdb) <strong>continue</strong></em><br />
Continuing.<br />
data=7FFDC000<br />
otherdata=0042C294</p>
<p><strong>Hardware watchpoint 2: OTHERDATA</strong></p>
<p><strong>Old value = 4375188<br />
New value = 11189179<br />
</strong>TESTME () at project1.lpr:27<br />
27        writeln(&#8217;dummy&#8217;);</p>
<p>Hopefully this feature will get into Lazarus soon <img src='http://grauonline.de/wordpress/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://grauonline.de/wordpress/?feed=rss2&amp;p=47</wfw:commentRss>
		</item>
		<item>
		<title>8051 Quickstart using STC MCU</title>
		<link>http://grauonline.de/wordpress/?p=44</link>
		<comments>http://grauonline.de/wordpress/?p=44#comments</comments>
		<pubDate>Fri, 09 Jul 2010 12:04:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Microcontrollers]]></category>

		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://grauonline.de/wordpress/?p=44</guid>
		<description><![CDATA[This article describes the first steps how you start programming a 8051 compatible MCU (aka C51), in this case the STC12C5412AD using a USB-to-TTL adaptor.

Why 8051/C51 ?


very popular (you can find plenty of code examples)
simple to program (simple register maps etc.)
cheap
Todays 8051 compatible MCUs have most needed integrated (flash memory, EEPROM, ADC, UART, PWM, &#8230;)
almost [...]]]></description>
			<content:encoded><![CDATA[<p>This article describes the first steps how you start programming a 8051 compatible MCU (aka C51), in this case the STC12C5412AD using a USB-to-TTL adaptor.</p>
<p><a href="http://grauonline.de/wordpress/wp-content/uploads/stc_usb.jpg" title="stc_usb.jpg"><img src="http://grauonline.de/wordpress/wp-content/uploads/stc_usb.jpg" alt="stc_usb.jpg" /></a></p>
<p><strong>Why 8051/C51 ?<br />
</strong></p>
<ul>
<li>very popular (you can find plenty of code examples)</li>
<li>simple to program (simple register maps etc.)</li>
<li>cheap</li>
<li>Todays 8051 compatible MCUs have most needed integrated (flash memory, EEPROM, ADC, UART, PWM, &#8230;)</li>
<li>almost nothing has changed since its beginning (same registers - the 1980&#8217;s code you find still works)</li>
</ul>
<p><strong><br />
Why STC MCU?</strong></p>
<ul>
<li>cheap</li>
<li>easy to flash: no external programmer is required - TX/RX line is used to flash the MCU</li>
</ul>
<p><strong>What you need:</strong></p>
<ul>
<li><a href="http://www.mcu-memory.com/" title="http://www.mcu-memory.com/">STC MCU </a>(STC12C5412AD, STC12C5620AD, &#8230;) - here we using the LQFP-32 pins version (right chip in the picture above)</li>
<li>USB-to-TTL (5V) adaptor like in the picture above (these can be found easily via eBay) - my adaptor uses the popular CP2102 USB-to-UART bridge</li>
<li>Wire, adaptor board, &#8230;</li>
<li>a PC</li>
</ul>
<p><strong>Steps:</strong></p>
<ol>
<li>Connect the STC MCU to the USB-to-TTL adaptor:<br />
USB-adaptor <strong>TX</strong> &lt;&#8212;&gt; MCU <strong>RX</strong><br />
USB-adaptor <strong>RX</strong> &lt;&#8212;&gt; MCU <strong>TX</strong><br />
USB-adaptor <strong>+5V </strong>&lt;&#8212;&gt;  MCU <strong>VCC</strong><br />
USB-adaptor <strong>GND</strong> &lt;&#8212;&gt; MCU <strong>GND</strong><br />
That&#8217;s too easy isn&#8217;t it? <img src='http://grauonline.de/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </li>
<li><a href="http://www.mcu-memory.com/datasheet/stc/stc-isp-v4.80/stc-isp-v4.80-not-setup.EXE" title="Download STC ISP software v4.80 (Chinese)">Download STC ISP software v4.80 (Chinese user interface) </a>- I needed v4.80 for my MCU, newer MCUs need newer ISP versions!</li>
<li><a href="https://www.keil.com/demo/eval/c51.htm" title="Download Keil uVison IDE and compiler (evaluation)">Download Keil uVision IDE and Compiler (evaluation)<br />
</a></li>
<li>Install uVision, create a new project &#8220;Atmel AT89S52&#8243;, no startup file. Under Project options, set OSC frequency, and check &#8220;hex file&#8221; output.</li>
<li>In uVision, create a new file (test1.c), and add it to the project.  Write your first MCU program in this file.</li>
<li>Add the corresponding STC MCU header file to your project and include it (e.g. STC12C5410AD.H or STC12C5620AD.H). They contain the port and memory definitions for your type of MCU. You can find them in the download below.</li>
<li>Compile to .hex file</li>
<li>Upload .hex file using the ISP software.  <strong>Important: </strong>the STC MCU automatically starts reading and flashing the program via RX line when a certain sequence is sent at start up - therefore, you first need to start the &#8216;Download&#8217; in the ISP software, and <strong>_after_</strong> that turn on the MCU !  Also, both the ISP software and MCU will automatically handshake a good baud rate  (e.g. if the internal 6 Mhz OSC is used, the ISP software will probe a &#8216;good&#8217; baud rate, so that the MCU will start downloading).</li>
</ol>
<p><strong>Downloads:</strong></p>
<p><a href="http://grauonline.de/wordpress/wp-content/uploads/stc_demo.zip" title="stc_demo.zip">stc_demo.zip </a><br />
(shows how to initialize the UART, ADC and successively sends the value of ADC0 via UART to the PC)</p>
]]></content:encoded>
			<wfw:commentRss>http://grauonline.de/wordpress/?feed=rss2&amp;p=44</wfw:commentRss>
		</item>
		<item>
		<title>mySmartUSB goes Bluetooth</title>
		<link>http://grauonline.de/wordpress/?p=40</link>
		<comments>http://grauonline.de/wordpress/?p=40#comments</comments>
		<pubDate>Sat, 12 Jun 2010 07:48:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Microcontrollers]]></category>

		<category><![CDATA[Robotic]]></category>

		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://grauonline.de/wordpress/?p=40</guid>
		<description><![CDATA[Dieser Artikel beschreibt, wie man ein Bluetooth-Modul mit einem ISP-Programmer (hier: das &#8216;mySmartUSB-Modul&#8217; der Firma Laser &#38; Co. Solutions GmbH) verbindet und auf diese Weise Mikrocontroller via Bluetooth mit dem PC programmieren und zusätzlich Daten mit dem Mikrocontroller und dem PC austauschen kann. Diese Möglichkeit, beides kabellos zu bewerkstelligen (Mikrocontrollerprogrammierung  -und RS232-Datentransfer) , dürfte relativ [...]]]></description>
			<content:encoded><![CDATA[<p>Dieser Artikel beschreibt, wie man ein Bluetooth-Modul mit einem ISP-Programmer (hier: das &#8216;mySmartUSB-Modul&#8217; der Firma <a href="http://shop.myavr.de" title="Laser &amp; Co. Solutions GmbH">Laser &amp; Co. Solutions GmbH</a>) verbindet und auf diese Weise Mikrocontroller via Bluetooth mit dem PC programmieren und zusätzlich Daten mit dem Mikrocontroller und dem PC austauschen kann. Diese Möglichkeit, beides kabellos zu bewerkstelligen (Mikrocontrollerprogrammierung  -und RS232-Datentransfer) , dürfte relativ einzigartig sein!</p>
<p><strong>Ausgangslage</strong></p>
<p>Manchmal wäre es &#8216;Nice-to-have&#8217;, manchmal geht es aber auch nicht anders:  man möchte das Kabel zwischen Mikrocontroller und PC loswerden. In unserem Fall sollte ein mobiler Roboter per Funk vom PC programmiert und später dessen Sensordaten im Betrieb an diesen PC übertragen werden.</p>
<p>Warum überhaupt Bluetooth?</p>
<ul>
<li>es gibt kostengünstige USB-Bluetooth-Dongles für den PC (wenige Euro)  (PC-seitig braucht man also nichts entwickeln!)</li>
<li>Bluetooth simuliert eine serielle Schnittstelle (COM-Port) am PC - man kann also alle bisherigen Tools und  Programme weiterverwenden  (PC-seitig bleibt also alles beim Alten!)</li>
<li>die Reichweite ist akzeptabel (100-150 m , Bluetooth class1)</li>
<li>es gibt kostengünstige (ca. 15 €) Bluetooth-Module mit 3.3V TTL UART-Schnittstelle (4 Pins werden davon benutzt:  3.3V VCC,  GND,  TX und RX)</li>
</ul>
<p>Warum mySmartUSB als ISP-Mikrocontroller-Programmer?</p>
<ul>
<li>er unterstützt die gängigsten Programmierprotokolle (AVR910/AVR911)</li>
<li>einziger ISP-Programmer (meines Wissen), der auch als UART-Bridge fungieren kann und diese ist dazu auch noch per UART-Kommando schaltbar(!) (mehr dazu unten) - den USB-zu-UART Konverter (CP2102) brauchen wir hier jedoch nicht</li>
</ul>
<p><strong>Verwendete Komponenten</strong></p>
<ol>
<li>myAVR mySmartUSB (v2.10) zur µC-Programmierung/UART Datentransfer mit diesem</li>
<li>myAVR Board mit ATmega168</li>
<li>Bluetooth-Modul BTM220</li>
<li>3.3V Spannunsgregler (LF33CV), 2 Elkos, 4 Widerstände, 1 LED, 1 IC (74HCT14N) für den Bluetooth-Adapter</li>
</ol>
<p><strong> Schritt 1 :  Bluetooth-Adapter für mySmartUSB bauen<br />
</strong></p>
<p>Für diesen Zweck wird hier das Rayson Bluetooth-Modul &#8216;BTM220A&#8217; verwendet, welches eine UART-Schnittstelle verwendet. Da dieses Modul jedoch mit 3.3V Spannungsversorgung arbeitet, wird ein 3.3V Spannungsregler sowie ein 3.3V zu 5V TTL Pegel-Wandler (für RX/TX) eingesetzt. Die genaue Adapter-Schaltung kann z.B. dem<a href="http://www.blog.1000und1led.de/?p=103" title="Blog von Martin Hänsler"> Blog von Martin Hänsler </a>entnommen werden. Zur Pegel-Wandlung der TX- bzw. RX-Leitungen wird dort ein invertierendes Schmitt-Trigger IC verwendet, ein Spannungsteiler sorgt bei der RX-Leitung für den 3.3V Level.</p>
<p>Nach einer nachmittaglichen Bastelarbeit könnte das vollständige Bluetooth-Modul dann z.B. so aussehen <img src='http://grauonline.de/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><a href="http://grauonline.de/wordpress/wp-content/uploads/bluetooth.jpg" title="bluetooth.jpg"><img src="http://grauonline.de/wordpress/wp-content/uploads/bluetooth.thumbnail.jpg" alt="bluetooth.jpg" /></a></p>
<p>Ergebnis: Bluetooth-Modul mit 5V TTL UART (mit vier Anschlußpins: 5V VCC, GND, TX und RX)</p>
<p><strong>Schritt 2 :  TX und RX am mySmartUSB suchen<br />
</strong><br />
Im nächsten Schritt soll mit diesem Bluetooth-Modul ein ATmega168 auf einem myAVR Board programmiert werden können (natürlich über Bluetooth). Zusätzlich soll aber auch das ATmega UART-Modul mit dem PC über Bluetooth angebunden werden, so dass man kabellos Daten mit dem Mikrocontroller austauschen kann. Für beide Zwecke bietet sich die &#8216;<a href="http://shop.myavr.de/" title="mySmartUSB-Tochterplatine">mySmartUSB-Tocherplatine</a>&#8216; des myAVR-Boards geradezu an, da es über einfache UART-Kommandos zwischen Programmier- und Datenmodus umschalten kann.</p>
<p>Ein Problem muss allerdings noch gelöst werden: der Programmer verfügt offensichtlich nur über einen USB-Anschluß als Programmierschnittstelle, die TX/RX-Leitungen zum Programmer hin müssen also ausfindig gemacht werden -vom CP2102-USB-zu-seriell Konverter Baustein ausgehend findet man RX an Pin14 und TX an Pin15 der mySmartUSB-Steckpfosten</p>
<p>(Anmerk.:  in der mySmartUSB Dokumentation findet man andere TX und RX Pins für die UART-Bridge - diese können aber nicht zum programmieren sondern nur für den Datenaustausch verwendet werden).<br />
<a href="http://grauonline.de/wordpress/wp-content/uploads/mysmartusb.jpg" title="mysmartusb.jpg"><img src="http://grauonline.de/wordpress/wp-content/uploads/mysmartusb.thumbnail.jpg" alt="mysmartusb.jpg" /><br />
</a></p>
<p>Die benötigte 5V Spannungsversorgung für den Spannungsregler des Bluetooth-Moduls muss man sich ggf. über das myAVR-Board holen - ohne USB-Anschluß scheint der Programmer nur etwa 4V über das myAVR-Board zu bekommen.</p>
<p><strong>Schritt 3 :  mySmartUSB und Bluetooth-Adapter verbinden<br />
</strong><br />
Dann kommt der spannende Augenblick beide Module miteinander zu verbinden <img src='http://grauonline.de/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
Wichtig: RX vom Bluetooth-Modul geht auf TX vom mySmartUSB  (was der eine sendet, muss der andere empfangen)</p>
<p><a href="http://grauonline.de/wordpress/wp-content/uploads/mysmartusb_bluetooth.jpg" title="mysmartusb_bluetooth.jpg"><img src="http://grauonline.de/wordpress/wp-content/uploads/mysmartusb_bluetooth.thumbnail.jpg" alt="mysmartusb_bluetooth.jpg" /></a></p>
<p>Und siehe da!  Ein erstes Austesten mit den bisherigen myAVR-Tools und Programmen zeigt : alle Funktionen laufen wie erwartet!</p>
<p>Im nächsten Schritt werde ich wohl die mögliche Reichweite dieses Bluetooth-Moduls austesten - 100 Meter im Freien sollten damit machbar sein <img src='http://grauonline.de/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Fazit:  &#8230;ich bin mir sicher:  so ein fertig aufgebautes Bluetooth-Modul wäre garantiert eine ideale Ergänzung des myAVR-Sortiments   <img src='http://grauonline.de/wordpress/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://grauonline.de/wordpress/?feed=rss2&amp;p=40</wfw:commentRss>
		</item>
		<item>
		<title>Kameraposititionssteuerung via Internet</title>
		<link>http://grauonline.de/wordpress/?p=37</link>
		<comments>http://grauonline.de/wordpress/?p=37#comments</comments>
		<pubDate>Fri, 25 Dec 2009 20:09:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Microcontrollers]]></category>

		<category><![CDATA[Internet]]></category>

		<category><![CDATA[Robotic]]></category>

		<category><![CDATA[Computer Vision]]></category>

		<guid isPermaLink="false">http://grauonline.de/wordpress/?p=37</guid>
		<description><![CDATA[Endlich mal wieder ein kleines Projekt, welches viele Dinge der Informatik miteinander verbindet: Servos, Mikrocontroller, USB-Kamera, Mikrocontroller &#60;-&#62; PC-Kommunikation, HTTP-Server, Javascript, AJAX, Python &#8230;

Aber jetzt erstmal im Detail:
Wie der Titel schon andeutet, geht es darum, eine USB-Webcam, welche auf zwei Servos montiert wurde via einem Web-Interface fernzusteuern - und natürlich das Bild der Kamera zu [...]]]></description>
			<content:encoded><![CDATA[<p>Endlich mal wieder ein kleines Projekt, welches viele Dinge der Informatik miteinander verbindet: Servos, Mikrocontroller, USB-Kamera, Mikrocontroller &lt;-&gt; PC-Kommunikation, HTTP-Server, Javascript, AJAX, Python &#8230;</p>
<p><a href="http://grauonline.de/wordpress/wp-content/uploads/spy.jpg" title="wwwspy"><img src="http://grauonline.de/wordpress/wp-content/uploads/spy.jpg" alt="wwwspy" /></a></p>
<p>Aber jetzt erstmal im Detail:</p>
<p>Wie der Titel schon andeutet, geht es darum, eine USB-Webcam, welche auf zwei Servos montiert wurde via einem Web-Interface fernzusteuern - und natürlich das Bild der Kamera zu übertragen.</p>
<p>Das Projekt ist ähnlich dem Projekt von <a href="http://www.infolexikon.de/blog/webcam-servos-parallel-port-ajax/" title="Markus Meissner">Tobias Weis </a>- allerdings wird hier Windows und als Skriptsprache Python (statt Linux und PHP) verwendet.</p>
<p><strong>Funktionsweise</strong></p>
<p>Die Servos werden über Pulsweitenmodulation (<a href="http://de.wikipedia.org/wiki/Pulsweitenmodulation" title="PWM">PWM</a>) vom Mikrocontroller angesteuert, der Mikrocontroller erhält die Steuerbefehle via RS232-Schnittstelle (RS232 through USB).  Ein auf dem PC laufender und in Python geschriebener Web-Server liest regelmäßig Bilder von der USB-Kamera, nimmt Befehle vom Web-Client entgegen (Kamera nach rech/links/oben/unten) und schickt diese Befehle dann an den Mikrocontroller.</p>
<p><strong>Benötigte Hardware</strong></p>
<ul>
<li>Mikrocontroller Atmel ATMEGA8L (ich verwende das myAVR Board MK2 USB von <a href="http://shop.myavr.de/Systemboards.htm?sp=artlist_kat.sp.php&amp;katID=14" title="myAVR">myAVR</a>) - dieses Board enthält den Mikrocontroller sowie einen Programmer zum Übertragen der Software in den Mikrocontroller via USB.</li>
<li>2 handelsübliche <a href="http://www.rn-wissen.de/index.php/Servos" title="Servos">Servos</a> (werden im Modellbau eingesetzt und gibt es teilweise recht günstig bei eBay - ansonsten beim Modellbauer, Conrad, &#8230;)</li>
<li>USB-Webcam (gibt&#8217;s überall)</li>
<li>Ein Netzteil (5V, ca. 1A) zur Energieversorgung der Servos</li>
</ul>
<p><strong>Benötigte Software</strong></p>
<ul>
<li> <a href="http://www.atmel.com/dyn/Products/tools_card.asp?tool_id=2725" title="Atmel AVR Studio">Atmel AVR Studio 4 </a>(kann man bei Atmel herunterladen) - zum Kompilieren/Übertragen der Mikrocontrollersoftware</li>
<li><a href="http://www.python.org/download/releases/2.6/" title="Python 2.6">Python 2.6</a> - Skriptspraceh zum Ausführen des Web-Servers, Kamera-Zugriff, Mikrocontroller-Kommunikation etc.</li>
<li><a href="http://sourceforge.net/projects/pywin32/" title="Python Windows Extensions">Python Windows Extensions </a>- wird für von der Universal Serial Port Python Library benötigt</li>
<li><a href="http://www.pythonware.com/products/pil/index.htm" title="Python Imaging Library">Python Imaging Library (PIL) </a>- wird für die Python VideoCapture Library benötigt</li>
</ul>
<p><strong>Schritt 1: Servos montieren und mit Mikrocontroller verbinden<br />
</strong></p>
<p>Den ersten Servo auf ein Brett fixieren, den zweiten Servo auf den ersten montieren und die Kamera auf den zweiten Servo befestigen. Dann die Steuerleitungen der Servos mit den Atmel Pins PB1 (OC1A) und PB2 (OC1B) verbinden. Zuletzt die +5V und Masse-Leitung der Servos mit dem externen Netzteil verbinden und die Masse-Leitung des externen Netzteils mit der Masse des Atmels verbinden (siehe auch das <a href="http://static.evigo.net/infolexikon/.media/images/2008/09/18/ubercam.png" title="Schaltbild von Markus Meissner">Schaltbild von Tobias</a>).</p>
<p><strong>Schritt 2: Mikrocontroller programmieren </strong></p>
<p>Als nächstes wird der Atmel-Mikrocontroller programmiert. Zunächst sicherstellen dass die Fuse Bits des Atmels so eingestellt sind, dass dieser mit dem externen 3.6864 Mhz Quartz arbeitet (wichtig für die RS232 Kommunikation), z.B. mit dem Tool <a href="http://www.esnips.com/web/AtmelAVR" title="AVROSPII">AVROSPII</a>. Dann die Mikrocontroller-Software (avr/test2.c bzw. Projektdatei avr/test2.aps) in den Atmel mit AVR Studio übertragen (Build-&gt;Build und danach Tool-AVR Prog). Falls das myAVR-Board nicht gefunden wird, überprüfen ob COM1 oder COM2 für den USB-Treiber (-&gt;Gerätemanager) verwendet wird.</p>
<p>Nach erfolgereicher Übertragung der Mikrocontroller-Software kann man die Servos mit der Batch-Datei (avr/term.bat) austesten, welche ein RS232-Terminal startet. Durch Drücken der Tasten 1, 2, 3 oder 4 kann man die Servos steuern (rechts/links/oben/unten).</p>
<p><strong>Schritt 3: Web-Server starten</strong></p>
<p>Die WebCam mit dem PC verbinden. Dann den Web-Server starten (im Verzeichnis control ausführen:  python start.py). Nach ein paar Sekunden läuft der Web-Server dann auf Port 8080. Im Web-Browser gibt man also &#8220;http://localhost:8080&#8243; als URL ein und mit ein bisschen Glück sieht man das Web-Interface der Steuerungssoftware.</p>
<p><a href="http://grauonline.de/wordpress/wp-content/uploads/wwwspy.zip" title="wwwspy_download">Download der Software</a></p>
]]></content:encoded>
			<wfw:commentRss>http://grauonline.de/wordpress/?feed=rss2&amp;p=37</wfw:commentRss>
		</item>
		<item>
		<title>Do-It-Yourself Elektrofahrrad</title>
		<link>http://grauonline.de/wordpress/?p=30</link>
		<comments>http://grauonline.de/wordpress/?p=30#comments</comments>
		<pubDate>Tue, 16 Jun 2009 11:02:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://grauonline.de/wordpress/?p=30</guid>
		<description><![CDATA[Man nehme:

ein 28&#8243; Damen-Fahrrad
einen Nine-Continent Vorderradnabenmotor 250 W, 36V
Motor-Steuerelektronik
Pedal-Sensor
und Bremsschalter  (alles zusammen 180 EUR als Bausatz)
3 x 12 V, 7Ah Blei-Gel-Akkus (60 EUR)

&#8230;und heraus kommt ein Elektro-Bike  



Das Gesamtgewicht (Fahrrad, Elektromotor und Akkus) liegt für diese Variante bei ca. 30 kg.Zum Fahren (max. 25 km/h, max. 250 W, im Pedelec-Betrieb, d.h. Einschalten des Motors [...]]]></description>
			<content:encoded><![CDATA[<p>Man nehme:</p>
<ul>
<li>ein 28&#8243; Damen-Fahrrad</li>
<li>einen <a href="http://www.pedelecforum.de/wiki/doku.php?id=e-motor:ninecontinent" title="Nine-Continent Vorderradnabenmotor">Nine-Continent Vorderradnabenmotor</a> 250 W, 36V</li>
<li>Motor-Steuerelektronik</li>
<li>Pedal-Sensor</li>
<li>und Bremsschalter  (alles zusammen 180 EUR als Bausatz)</li>
<li>3 x 12 V, 7Ah Blei-Gel-Akkus (60 EUR)</li>
</ul>
<p><br class="webkit-block-placeholder" />&#8230;und heraus kommt ein Elektro-Bike <img src='http://grauonline.de/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://grauonline.de/wordpress/wp-content/uploads/nc1.jpg" title="nc1"><img src="http://grauonline.de/wordpress/wp-content/uploads/nc1.thumbnail.jpg" alt="nc1" /></a></p>
<p><a href="http://grauonline.de/wordpress/wp-content/uploads/nc2.jpg" title="nc2"><img src="http://grauonline.de/wordpress/wp-content/uploads/nc2.thumbnail.jpg" alt="nc2" /></a></p>
<p><a href="http://grauonline.de/wordpress/wp-content/uploads/nc1.jpg" title="nc1"><img src="http://grauonline.de/wordpress/wp-content/uploads/nc1.thumbnail.jpg" alt="nc1" /></a></p>
<p>Das Gesamtgewicht (Fahrrad, Elektromotor und Akkus) liegt für diese Variante bei ca. 30 kg.Zum Fahren (max. 25 km/h, max. 250 W, im Pedelec-Betrieb, d.h. Einschalten des Motors durch Treten) braucht man <strong>keine</strong> Versicherung.</p>
<p>Die erreichbare Höchstgeschwindigkeit liegt bei 25 km/h (mit aktivierter Begrenzung), und bis zu 40 km/h (ohne Begrenzung).</p>
<p>Endlich machen Gebirgsfahrten (hier 19% Steigung an der steilsten Stelle) mit dem Drahtesel Spaß <img src='http://grauonline.de/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Reichweite: 17. Juni 2009 - Heute wurde die erste &#8220;Langstrecke&#8221; mit dem E-Bike (mit dem vollen 7Ah Akku) gemacht, 13.6 km lang (incl. kleineren &#8216;Bergen&#8217;) - mit Unterstützung in den Pedalen hat der Akku gerade so gereicht <img src='http://grauonline.de/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> - beim letzten Anstieg setzte die Steuerung ab und zu aus - ein Zeichen dafür, dass der Akku langsam schlapp macht und geladen werden muss.  Fazit: Für noch längere Strecken sollte ein 10Ah Akku oder besser verwendet werden.</p>
]]></content:encoded>
			<wfw:commentRss>http://grauonline.de/wordpress/?feed=rss2&amp;p=30</wfw:commentRss>
		</item>
		<item>
		<title>Energie verbrauchen sie alle</title>
		<link>http://grauonline.de/wordpress/?p=29</link>
		<comments>http://grauonline.de/wordpress/?p=29#comments</comments>
		<pubDate>Wed, 10 Jun 2009 08:25:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://grauonline.de/wordpress/?p=29</guid>
		<description><![CDATA[Moderne Computer, Fax-Geräte, TVs verbrauchen immer weniger Energie, stimmt&#8217;s? Zumindest möchte uns das die Industrie weismachen. Irgendwie möchte man das für seine eigenen Elektrogeräte auch nachvollziehen können - also in den Baumarkt marschieren, Energiemeßgerät (4 EUR) kaufen und das Meßgerät zwischen Verbraucher und Elektrogerät schalten und schon kann die Messung losgehen:


Elektrogerät
Strom (Ampere)
Leistung (Watt)


Apple MacBook
0,1
25


Apple MacBook [...]]]></description>
			<content:encoded><![CDATA[<p>Moderne Computer, Fax-Geräte, TVs verbrauchen immer weniger Energie, stimmt&#8217;s? Zumindest möchte uns das die Industrie weismachen. Irgendwie möchte man das für seine eigenen Elektrogeräte auch nachvollziehen können - also in den Baumarkt marschieren, Energiemeßgerät (4 EUR) kaufen und das Meßgerät zwischen Verbraucher und Elektrogerät schalten und schon kann die Messung losgehen:</p>
<table border="1" cellpadding="0" cellspacing="0">
<tr>
<th>Elektrogerät</th>
<th>Strom (Ampere)</th>
<th>Leistung (Watt)</th>
</tr>
<tr>
<td>Apple MacBook</td>
<td>0,1</td>
<td>25</td>
</tr>
<tr>
<td>Apple MacBook im Standby</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>Acer Aspire 1650 Notebook</td>
<td>0,19</td>
<td>48</td>
</tr>
<tr>
<td>Acer Aspire 1650 Notebook im Standby</td>
<td>0,03</td>
<td>7</td>
</tr>
<tr>
<td>Desktop PC</td>
<td>0,7</td>
<td>160</td>
</tr>
<tr>
<td>Desktop PC im Standby</td>
<td>0,11</td>
<td>23</td>
</tr>
<tr>
<td>Oki 2520 MFP Multifunktionsfax</td>
<td>0,19</td>
<td>44</td>
</tr>
<tr>
<td>Oki 2520 MFP Multifunktionsfax im Standby</td>
<td>0,17</td>
<td>39</td>
</tr>
<tr>
<td>Xmas Beleuchtung</td>
<td>0,06</td>
<td>7</td>
</tr>
<tr>
<td>TV Set im Standby</td>
<td>0,12</td>
<td>27</td>
</tr>
<tr>
<td>Router</td>
<td></td>
<td>44</td>
</tr>
<tr>
<td>Altes Fax aus den 1980er Jahren</td>
<td>0,3</td>
<td>65</td>
</tr>
<tr>
<td>Altes Fax aus den 1980er Jahren im Standby</td>
<td></td>
<td>18</td>
</tr>
</table>
<p>Wie ich finde, ist das ein interessantes Ergebnis: Der Desktop PC im Standby verbraucht beinahe genauso viel Energie wie ein MacBook im Vollbetrieb - ein altes Fax von 1980 verbraucht im Standby weniger als die Hälfte eines modernen Fax-Gerätes im Standby - und ein Fernseher verbraucht im Standby mehr als ein MacBook im Vollbetrieb&#8230; Moderne Geräte sind (bis auf wenige Ausnahmen) im Standby erstaunlich energiehungrig.</p>
<p><strong>Mein Vorschlag</strong>: ein weltweites Siegel für den Konsumenten für jedes Elektrogerät mit Angabe des Energieverbrauchs (Watt Vollbetrieb/Standby), nicht zuletzt damit wir unser weltweites CO2 Ziel erreichen?</p>
]]></content:encoded>
			<wfw:commentRss>http://grauonline.de/wordpress/?feed=rss2&amp;p=29</wfw:commentRss>
		</item>
		<item>
		<title>Obstacle avoidance in flight via optical flow</title>
		<link>http://grauonline.de/wordpress/?p=28</link>
		<comments>http://grauonline.de/wordpress/?p=28#comments</comments>
		<pubDate>Wed, 06 May 2009 08:30:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Virtual Reality]]></category>

		<category><![CDATA[Robotic]]></category>

		<category><![CDATA[Computer Vision]]></category>

		<guid isPermaLink="false">http://grauonline.de/wordpress/?p=28</guid>
		<description><![CDATA[This video shows our prototyped flight simulation and controller software that

simulates the flight dynamics of an RC aircraft and
automatically controls that aircraft so that it avoids obstacles (ground/mountains etc.), only by analysing the optical flow in front of the aircraft. For the optical flow sensor, an optical mouse CCD (20&#215;20 pixels) with a lense is [...]]]></description>
			<content:encoded><![CDATA[<p><span style="font-family: Arial; font-size: 12px; line-height: normal" class="Apple-style-span">This video shows our prototyped flight simulation and controller software that</span>
<ol>
<li><span class="Apple-style-span" style="font-family: Arial; font-size: 12px; line-height: normal">simulates the flight dynamics of an RC aircraft and</span></li>
<li><span style="font-family: Arial; font-size: 12px; line-height: normal" class="Apple-style-span">automatically controls that aircraft so that it avoids obstacles (ground/mountains etc.), only by analysing the optical flow in front of the aircraft. For the optical flow sensor, an optical mouse CCD (20&#215;20 pixels) with a lense is simulated.</span>  </li>
</ol>
<p><object height="344" width="425">
<param value="http://www.youtube.com/v/8YaWPm2Yb3w&amp;hl=de&amp;fs=1" name="movie"></param>
<param value="true" name="allowFullScreen"></param>
<param value="always" name="allowscriptaccess"></param><embed src="http://www.youtube.com/v/8YaWPm2Yb3w&amp;hl=de&amp;fs=1" height="344" width="425" allowfullscreen="true" allowscriptaccess="always" type="application/x-shockwave-flash"></embed></object></p>
<p><span style="font-family: Arial; font-size: 12px; line-height: normal" class="Apple-style-span">Also <a href="http://grauonline.de/wordpress/?p=17" title="click here">click here </a>to see how the same technique is used in 2D to navigate a robot, only by optical flow.</span> </p>
]]></content:encoded>
			<wfw:commentRss>http://grauonline.de/wordpress/?feed=rss2&amp;p=28</wfw:commentRss>
		</item>
		<item>
		<title>Teddies im 21. Jahrhundert</title>
		<link>http://grauonline.de/wordpress/?p=27</link>
		<comments>http://grauonline.de/wordpress/?p=27#comments</comments>
		<pubDate>Sat, 24 Jan 2009 17:45:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://grauonline.de/wordpress/?p=27</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p><a href="http://grauonline.de/wordpress/wp-content/uploads/bear3.jpg" title="Teddy"><img src="http://grauonline.de/wordpress/wp-content/uploads/bear3.jpg" alt="Teddy" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://grauonline.de/wordpress/?feed=rss2&amp;p=27</wfw:commentRss>
		</item>
		<item>
		<title>Optical flow based robot obstacle avoidance with Matlab</title>
		<link>http://grauonline.de/wordpress/?p=17</link>
		<comments>http://grauonline.de/wordpress/?p=17#comments</comments>
		<pubDate>Sat, 17 Jan 2009 18:59:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Virtual Reality]]></category>

		<category><![CDATA[Robotic]]></category>

		<category><![CDATA[Computer Vision]]></category>

		<guid isPermaLink="false">http://grauonline.de/wordpress/?p=17</guid>
		<description><![CDATA[This is the result of a project where a virtual robot avoids obstacles in a virtual environment without knowing the environment - the robot navigates autonomously, only by analysing it&#8217;s virtual camera view.
In detail, this example project shows:
1. How to create a virtual environment for a virtual robot and display the robot&#8217;s camera view
2. Capture the robot&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>This is the result of a project where a virtual robot avoids obstacles in a virtual environment without knowing the environment - the robot navigates autonomously, only by analysing it&#8217;s virtual camera view.</p>
<p>In detail, this example project shows:</p>
<p>1. How to create a virtual environment for a virtual robot and display the robot&#8217;s camera view<br />
2. Capture the robot&#8217;s camera view for analysing<br />
3. Compute the optical flow field of the camera view<br />
4. Estimate Focus of expansion (FOE) and Time-to-contact (TTC)<br />
5. Detect obstacles and make a balance decision (turn robot right/turn left)</p>
<p>Matlab&#8217;s Virtual Reality toolbox makes it possible to not only visualize a virtual world, but also capture it into an image from a specified position, orientation and rotation. The virtual world was created in VRML with a plain text editor and it can be viewed in your internet browser if you have installed a VRML viewer (you can install one <a href="http://www.parallelgraphics.com/products/cortona/" title="here">here</a>).</p>
<p><a href="http://grauonline.de/wordpress/wp-content/uploads/ofnav_world.jpg" title="Virtual world for the robot"><img src="http://grauonline.de/wordpress/wp-content/uploads/ofnav_world.jpg" alt="Virtual world for the robot" /></a></p>
<p>(Click <a href="http://grauonline.de/alexwww/ofnav/obstacles.wrl" title="VRML scene for robot">here</a> to view the VRML file with your VRML viewer) .</p>
<p>For calculating the optical view field of two successive camera images, I used a C optimized version of Horn and Schunk&#8217;s optical flow algorithm - <a href="http://people.csail.mit.edu/bkph/papers/Optical_Flow_OPT.pdf" title="See here for details">see here for details</a>).</p>
<p>Based on this optical flow field, the flow magnitudes of right and left half of each image is calculated. If the sum of the flow magnitudes of the view reaches a certain threshold, it is assumed there is an obstacle in front of the robot. Then the computed flow magnitude of right and left half image is used to formulate a balance strategy: if the right flow is larger than the left flow, the robot turns left - otherwise it turns right.</p>
<p><a href="http://grauonline.de/wordpress/wp-content/uploads/ofnav_gui1.png" title="Virtual robot GUI"></a></p>
<p><a href="http://grauonline.de/wordpress/wp-content/uploads/ofnav_gui.png" title="Virtual robot GUI"></a></p>
<p> <a href="http://grauonline.de/wordpress/wp-content/uploads/ofnav_gui2.png" title="Virtual robot GUI"><img src="http://grauonline.de/wordpress/wp-content/uploads/ofnav_gui2.thumbnail.png" alt="Virtual robot GUI" /></a></p>
<p>Robot&#8217;s camera view at the same time:</p>
<p><a href="http://grauonline.de/wordpress/wp-content/uploads/ofnav_camera1.png" title="Virtual robot camera view"><img src="http://grauonline.de/wordpress/wp-content/uploads/ofnav_camera1.thumbnail.png" alt="Virtual robot camera view" /></a></p>
<p><a href="http://grauonline.de/wordpress/wp-content/uploads/ofnav_camera.png" title="Virtual robot camera view"></a></p>
<p><object width="425" height="344">
<param name="movie" value="http://www.youtube.com/v/vgwYAbrlnTg&#038;hl=de&#038;fs=1"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/vgwYAbrlnTg&#038;hl=de&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
<p><a href="http://grauonline.de/alexwww/ofnav/ofnav.avi" title="Click here to see a recorded video of a virtual robot session.">Click here to see a video recording of a robot session. </a></p>
<p><a href="http://grauonline.de/alexwww/ofnav/ofnav_src.zip" title="Click here to download Matlab code.">Click here to download Matlab code.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://grauonline.de/wordpress/?feed=rss2&amp;p=17</wfw:commentRss>
<enclosure url="http://grauonline.de/alexwww/ofnav/ofnav.avi" length="11429888" type="video/x-msvideo" />
		</item>
	</channel>
</rss>
