<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
		<id>https://wiki.ardumower.de/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ovenystas</id>
		<title>www.wiki.ardumower.de - Benutzerbeiträge [de]</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.ardumower.de/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ovenystas"/>
		<link rel="alternate" type="text/html" href="https://wiki.ardumower.de/index.php?title=Spezial:Beitr%C3%A4ge/Ovenystas"/>
		<updated>2026-10-13T16:18:57Z</updated>
		<subtitle>Benutzerbeiträge</subtitle>
		<generator>MediaWiki 1.24.1</generator>

	<entry>
		<id>https://wiki.ardumower.de/index.php?title=Arduino_code_techniques&amp;diff=2105</id>
		<title>Arduino code techniques</title>
		<link rel="alternate" type="text/html" href="https://wiki.ardumower.de/index.php?title=Arduino_code_techniques&amp;diff=2105"/>
				<updated>2015-06-04T21:00:46Z</updated>
		
		<summary type="html">&lt;p&gt;Ovenystas: /* Mean filter */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page shows example code, common code techniques etc. that can be useful for your own programming experiments with the Arduino.&lt;br /&gt;
&lt;br /&gt;
=Integration=&lt;br /&gt;
&lt;br /&gt;
To get the new position at each tick, you take the old position and add the change in position. The change in position is just the&lt;br /&gt;
speed of the robot multiplied by the time since the last tick, which you can get from the timers on the microcontroller or some other known timer. &lt;br /&gt;
&lt;br /&gt;
 position += speed * dt;  &lt;br /&gt;
 angle += gyro * dt;&lt;br /&gt;
&lt;br /&gt;
=Low pass filter=&lt;br /&gt;
*Problem: you have multiple ADC measurements (battery, ultrasonic etc.) that can quickly change. What value is the 'smooth value' (low-pass filter)? The goal of the low-pass filter is to only let through long-term changes, filtering out short-term fluctuations. &lt;br /&gt;
*Solution: This code will apply a 'low-pass' filter to your values. A 'weight' constant specifies the cut-off frequency, so how much your values are 'smoothed': if the weight is lower, the cutt-off frequency is lower (so more is filtered out), however the more slowly the system adapts to the last measurements.&lt;br /&gt;
&lt;br /&gt;
 float value = 0.0; &lt;br /&gt;
 float weight = 0.1; // how much your values are 'smoothed'&lt;br /&gt;
&lt;br /&gt;
 void loop(){   &lt;br /&gt;
   value = (1.0-weight) * value   +   weight * analogRead(A0);   // low-pass values&lt;br /&gt;
   Serial.println(value); // print value&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The time it takes to reach the full value depends on both the filter constants (0.9 and 0.1 in the example) and the sample rate of the loop (dt).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=High pass filter=&lt;br /&gt;
It allows short-duration signals to pass through while filtering out signals that are steady over time. This can be used to cancel out drift.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Time constant=&lt;br /&gt;
The time constant of a filter is the relative duration of signal it will act on. For a low-pass filter, signals much longer than the time constant pass through unaltered while signals shorter than the time constant are filtered out. The opposite is true for a high-pass filter. &lt;br /&gt;
&lt;br /&gt;
The time constant 'tau' of a digital low-pass filter,&lt;br /&gt;
&lt;br /&gt;
 y = (a)*(y) + (1-a)*(x);&lt;br /&gt;
&lt;br /&gt;
running in a loop with sample period 'dt', can be found like this:&lt;br /&gt;
&lt;br /&gt;
 tau = a * dt / (1-a)    &amp;lt;=&amp;gt;     a = tau / (tau+dt)&lt;br /&gt;
&lt;br /&gt;
So if you know the desired time constant and the sample rate, you can pick the filter coefficient 'a'.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Complementary filter=&lt;br /&gt;
&lt;br /&gt;
This just means the two parts of the filter always add to one, so that the output is an accurate, linear estimate in units that make sense. The filter presented here is not exactly complementary, but is a very good approximation when the time constant is much longer than the sample rate (a necessary condition of digital control anyway). &lt;br /&gt;
&lt;br /&gt;
 angle = (0.98)*(angle + gyro*dt) + (0.02)*(x_acc);&lt;br /&gt;
&lt;br /&gt;
If this filter were running in a loop that executes 100 times per second, the time constant for&lt;br /&gt;
both the low-pass and the high-pass filter would be:&lt;br /&gt;
&lt;br /&gt;
 tau = a*dt/(1-a) = 0.98*0.01sec/0.02 = 0.49sec&lt;br /&gt;
&lt;br /&gt;
This defines where the boundary between trusting the gyroscope and trusting the accelerometer is. For time periods shorter than half a second, the gyroscope integration takes precedence and the noisy horizontal accelerations are filtered out. For time periods longer than half a second, the accelerometer average is given more weighting than the gyroscope, which may have drifted by this point.&lt;br /&gt;
&lt;br /&gt;
=Median filter=&lt;br /&gt;
*Problem: you have multiple ADC measurements (battery, ultrasonic etc.) that can contain outliers. What value is the 'most seen value'?&lt;br /&gt;
*Solution: This code will sort and choose the center value.&lt;br /&gt;
*Example measurements: 32,7,7,1,6,8,7,9,23,7,8,9,7&lt;br /&gt;
*Sorted: 1,6,7,7,7,7,7,8,8,9,9,23,32  &lt;br /&gt;
*Returned: 7 (center value)&lt;br /&gt;
&lt;br /&gt;
 unsigned int ADCmedian(int pin, int count) {&lt;br /&gt;
   int values[count], last;&lt;br /&gt;
   uint8_t j, i = 0;&lt;br /&gt;
   values[0] = 0;&lt;br /&gt;
   while (i &amp;lt; count) {&lt;br /&gt;
     last = analogRead(pin);&lt;br /&gt;
     if (i &amp;gt; 0) {       &lt;br /&gt;
        for (j = i; j &amp;gt; 0 &amp;amp;&amp;amp; values[j - 1] &amp;lt; last; j--) // Insertion sort loop.&lt;br /&gt;
    values[j] = values[j - 1]; // Shift ping array to correct position for sort insertion.&lt;br /&gt;
     } else j = 0;              // First ping is starting point for sort.&lt;br /&gt;
     values[j] = last;              // Add last ping to array in sorted position.&lt;br /&gt;
     i++;                       // Move to next ping.    &lt;br /&gt;
     if (i &amp;lt; count) delay(1); &lt;br /&gt;
    }&lt;br /&gt;
    return (values[count/2]); // Return the median.&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=Further links=&lt;br /&gt;
&lt;br /&gt;
http://robottini.altervista.org/tag/complementary-filter&lt;/div&gt;</summary>
		<author><name>Ovenystas</name></author>	</entry>

	<entry>
		<id>https://wiki.ardumower.de/index.php?title=Hauptseite&amp;diff=1796</id>
		<title>Hauptseite</title>
		<link rel="alternate" type="text/html" href="https://wiki.ardumower.de/index.php?title=Hauptseite&amp;diff=1796"/>
				<updated>2015-04-05T21:09:20Z</updated>
		
		<summary type="html">&lt;p&gt;Ovenystas: /* Ardumower topics */ Improved links&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| border=0&lt;br /&gt;
 |&amp;lt;span style=&amp;quot;color:#cf7606; font-size:200%;&amp;quot;&amp;gt;'''Welcome to'''&amp;amp;nbsp;&amp;lt;/span&amp;gt;&amp;lt;span style=&amp;quot;color:#005288; font-size:200%;&amp;quot;&amp;gt;'''Ardumower - the DIY robot mower'''&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size:150%;&amp;quot;&amp;gt;Ardumower WIKI, the knowledge base of the Ardumower community&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Image:H7c785a1.png |100px|left|Ardumower Logo]][[Image:1000x500-ausbildung.jpg|thumb|180px|Image of the month]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Yt-brand-standard-logo-95x40.png|thumb|180px|http://www.youtube.com/user/naneona/videos]]&lt;br /&gt;
&lt;br /&gt;
You probably know Ardumower Forum, the DIY robot mower community on the Internet. Now there's the additional Ardumower knowledge site, named WIKI. Here you find information, basics, and tips about DIY robot mowers sorted by different topics. The pages should be a starter guide as well as a reference book (you may recognize the structure from the well known Wikipedia). We use the same system for it: MediaWiki.&amp;lt;p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On this WIKI, you actually can modify pages freely - you can even try out your first edits on a testpage [[test]] on this Wiki. Before you edit longer pages, you should practise on this testpage [[test]].&lt;br /&gt;
&lt;br /&gt;
Help us improving this Wiki! Simply [http://wiki.ardumower.de/index.php?title=Spezial:Anmelden/signup register] and start editing today...&lt;br /&gt;
&lt;br /&gt;
=Getting started / Introduction=&lt;br /&gt;
[[Image:Ardumower_overview.png|thumb|400px|Overview]]&lt;br /&gt;
These introduction pages should help you to get started building your own DIY robot mower:&lt;br /&gt;
*[[Getting started]] (introduction and overall steps)&lt;br /&gt;
*[[Arduino first steps]] (if you have never worked with Arduino before)&lt;br /&gt;
&lt;br /&gt;
=Ardumower topics=&lt;br /&gt;
These pages give you a reference book sorted by robot mower topics:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;color:blue; background-color:#ffffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot;&lt;br /&gt;
!Chassis assembly&lt;br /&gt;
|[[Ardumower chassis]] &lt;br /&gt;
|-&lt;br /&gt;
!Arduino code, schematics, PCB etc.&lt;br /&gt;
|[[Arduino first steps]]&lt;br /&gt;
|[[Ardumower PCB|Ardumower PCB &amp;amp; code]]&lt;br /&gt;
|[[Arduino Due]]&lt;br /&gt;
|[[Troubleshooting]]&lt;br /&gt;
|-&lt;br /&gt;
!Actuators&lt;br /&gt;
|[[Motor driver|Motor driver &amp;amp; motors]]&lt;br /&gt;
|[[Relay]]&lt;br /&gt;
|-&lt;br /&gt;
!Sensors&lt;br /&gt;
|[[Perimeter wire]]&lt;br /&gt;
|[[Ultrasonic]]&lt;br /&gt;
|[[Hall sensor]]&lt;br /&gt;
|[[Lawn sensor]]&lt;br /&gt;
|[[Odometry]]&lt;br /&gt;
|[[IMU]]&lt;br /&gt;
|[[Rain sensor]]&lt;br /&gt;
|[[Dropsensor]]&lt;br /&gt;
|-&lt;br /&gt;
!Energy&lt;br /&gt;
|[[Charging]]&lt;br /&gt;
|-&lt;br /&gt;
!Wireless&lt;br /&gt;
|[[Model R/C]]&lt;br /&gt;
|[[Bluetooth|Bluetooth &amp;amp; App]]&lt;br /&gt;
|[[GPS]]&lt;br /&gt;
|-&lt;br /&gt;
!Other modules&lt;br /&gt;
|[[Realtime clock]]&lt;br /&gt;
|-&lt;br /&gt;
!Software architecture, algorithms&lt;br /&gt;
|[http://www.grauonline.de/alexwww/ardumower/sim/mower.html Ardumower simulator]&lt;br /&gt;
|[[Ardumower software design]]&lt;br /&gt;
|[[Sensor fusion|Sensor fusion &amp;amp; SLAM]]&lt;br /&gt;
|[[PID control]]&lt;br /&gt;
|[[Kalman|Kalman (EKF)]]&lt;br /&gt;
|-&lt;br /&gt;
!Arduino programming&lt;br /&gt;
|[[Arduino crash course]]&lt;br /&gt;
|[[Arduino code techniques]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Your robot mower project / Dein Rasenroboter-Projekt=&lt;br /&gt;
Describe your own robot mower project on a new WIKI page / Beschreibe Dein eigenes Rasenroboter-Projekt auf einer neuen WIKI-Site:&lt;br /&gt;
* [[Ardumower Chassis 'mountain mod']]&lt;br /&gt;
* [[Ardumower Mini]]&lt;br /&gt;
* ...&lt;br /&gt;
* ...&lt;br /&gt;
&lt;br /&gt;
=Your Ardumower extension / Deine Ardumower Erweiterung=&lt;br /&gt;
Describe your own robot mower extension or improvement (optical, computer vision, IR landmarks, sound, navigation, wireless, or any other addition) on a new WIKI page / Beschreibe Deine eigene Erweiterung oder Verbesserung des Ardumowers:&lt;br /&gt;
* Generating sounds using a [[Sound module]]&lt;br /&gt;
* [[Ardumower future PCB]]&lt;br /&gt;
* ...&lt;br /&gt;
* ...&lt;br /&gt;
&lt;br /&gt;
=Wiki help=&lt;br /&gt;
* How to edit/add a page: [[Wiki help]]&lt;br /&gt;
* Use this page to try out any wiki code: [[test]]&lt;br /&gt;
&lt;br /&gt;
=Further links=&lt;br /&gt;
[http://www.ardumower.de/index.php/de Ardumower Home / Forum]&lt;br /&gt;
[https://www.marotronics.de/ Ardumower Shop]&lt;/div&gt;</summary>
		<author><name>Ovenystas</name></author>	</entry>

	</feed>