<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://wiki.robbo.world/wiki/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://wiki.robbo.world/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Elena+Vostrikova</id>
		<title>scratchduino - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.robbo.world/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Elena+Vostrikova"/>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Special:Contributions/Elena_Vostrikova"/>
		<updated>2026-09-08T18:17:22Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.19.20+dfsg-0+deb7u3</generator>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-27T15:46:26Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
[https://yadi.sk/d/GbsoeO923YVCda тест датчиков]&lt;br /&gt;
&lt;br /&gt;
[https://yadi.sk/d/H8jsL67k3YVDX9 тест датчиков. Файл INO]&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1.&amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE of &amp;lt;br&amp;gt;two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt;and goes forward during 0.1 second. &amp;lt;br&amp;gt;If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt;The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;[[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [https://yadi.sk/d/h7YJVH2a3YRS5d Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, the robot misses the turns in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2.&amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the line sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half power (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;'''»''' The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch handles the timing data with worse quality than Arduino IDE, therefore we have reduced the number of the ranges to 5 and simplified the action of motors.&amp;lt;br&amp;gt; The motors are rotating forward all the time, with varying power.&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, the robot misses the turn in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||It is important to modify the sketch coded for USB, because at a high speed, the intermediate values of the sensor cannot be handled. &amp;lt;br&amp;gt;We join all the intermediate values. &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, coded for a 5V power supply (USB). &amp;lt;br&amp;gt;Replace the robot's turning time of 0.1 seconds by 0.01 seconds. And increase the time of going ahead up to 0.2 seconds. &amp;lt;br&amp;gt;It is necessary because at a high speed, the robot rushes too fast along the path section where the values of the sensors are changing.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3.&amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor &amp;lt;br&amp;gt;is positioned above the white area and above the black line. &amp;lt;br&amp;gt;The trajectory the robot follows is a  line with long straight sections, and the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (track record!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Description of travelling along the black line with TWO sensors==&lt;br /&gt;
&amp;lt;center&amp;gt;It is impossible to travel along a complicated track with crossings, forks, &amp;quot;zebras&amp;quot;, and inverted sections using only one sensor. &amp;lt;br&amp;gt;When two sensors are used, special algorithms are needed to automate the robot's motion.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4.&amp;lt;/font&amp;gt; Relay controller.''' This algorithm is intended to keep the robot in the position &amp;quot;Both sensors of the robot are above the white area&amp;quot;, &amp;lt;br&amp;gt;that is, to the left and to the right from the black line. If both sensors are above the black line, the robot stops.&amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||When powered by USB, the robot stops at the turn, because both sensors get above the black line. [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
|| When extra powered from the battery, the robot misses the sharp turns, because at a speed, the sensors cannot be above the black line both at the same time. [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0] Arduino IDE Video]. If the battery charge is low, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - relay controller + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5.&amp;lt;/font&amp;gt; Proportional controller.''' Proportional controller is a device whose controlling action over an object depends on the object's deflection from a certain state. &amp;lt;br&amp;gt;Such deflection is called '''error''' and we denote it with a letter E. In our case, the error is the difference between the readings of two line sensors: E = S1 – S2. &amp;lt;br&amp;gt;To obtain the value of controlling action '''U''', we multiply the E value by a chosen factor '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. &amp;lt;br&amp;gt;Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&amp;lt;br&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds&lt;br /&gt;
||&lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| '''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6.&amp;lt;/font&amp;gt; Proportional-plus-differential controller.''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7.&amp;lt;/font&amp;gt; Proportional-integral-differential controller.'''&amp;lt;br&amp;gt; &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-27T15:40:26Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
[https://yadi.sk/d/GbsoeO923YVCda тест датчиков]&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1.&amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE of &amp;lt;br&amp;gt;two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt;and goes forward during 0.1 second. &amp;lt;br&amp;gt;If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt;The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;[[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [https://yadi.sk/d/h7YJVH2a3YRS5d Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, the robot misses the turns in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2.&amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the line sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half power (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;'''»''' The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch handles the timing data with worse quality than Arduino IDE, therefore we have reduced the number of the ranges to 5 and simplified the action of motors.&amp;lt;br&amp;gt; The motors are rotating forward all the time, with varying power.&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, the robot misses the turn in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||It is important to modify the sketch coded for USB, because at a high speed, the intermediate values of the sensor cannot be handled. &amp;lt;br&amp;gt;We join all the intermediate values. &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, coded for a 5V power supply (USB). &amp;lt;br&amp;gt;Replace the robot's turning time of 0.1 seconds by 0.01 seconds. And increase the time of going ahead up to 0.2 seconds. &amp;lt;br&amp;gt;It is necessary because at a high speed, the robot rushes too fast along the path section where the values of the sensors are changing.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3.&amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor &amp;lt;br&amp;gt;is positioned above the white area and above the black line. &amp;lt;br&amp;gt;The trajectory the robot follows is a  line with long straight sections, and the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (track record!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Description of travelling along the black line with TWO sensors==&lt;br /&gt;
&amp;lt;center&amp;gt;It is impossible to travel along a complicated track with crossings, forks, &amp;quot;zebras&amp;quot;, and inverted sections using only one sensor. &amp;lt;br&amp;gt;When two sensors are used, special algorithms are needed to automate the robot's motion.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4.&amp;lt;/font&amp;gt; Relay controller.''' This algorithm is intended to keep the robot in the position &amp;quot;Both sensors of the robot are above the white area&amp;quot;, &amp;lt;br&amp;gt;that is, to the left and to the right from the black line. If both sensors are above the black line, the robot stops.&amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||When powered by USB, the robot stops at the turn, because both sensors get above the black line. [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
|| When extra powered from the battery, the robot misses the sharp turns, because at a speed, the sensors cannot be above the black line both at the same time. [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0] Arduino IDE Video]. If the battery charge is low, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - relay controller + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5.&amp;lt;/font&amp;gt; Proportional controller.''' Proportional controller is a device whose controlling action over an object depends on the object's deflection from a certain state. &amp;lt;br&amp;gt;Such deflection is called '''error''' and we denote it with a letter E. In our case, the error is the difference between the readings of two line sensors: E = S1 – S2. &amp;lt;br&amp;gt;To obtain the value of controlling action '''U''', we multiply the E value by a chosen factor '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. &amp;lt;br&amp;gt;Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&amp;lt;br&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds&lt;br /&gt;
||&lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| '''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6.&amp;lt;/font&amp;gt; Proportional-plus-differential controller.''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7.&amp;lt;/font&amp;gt; Proportional-integral-differential controller.'''&amp;lt;br&amp;gt; &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-26T11:36:25Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: /* Description of the ROBBO Scratch project */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1.&amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE of &amp;lt;br&amp;gt;two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt;and goes forward during 0.1 second. &amp;lt;br&amp;gt;If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt;The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;[[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [https://yadi.sk/d/h7YJVH2a3YRS5d Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, the robot misses the turns in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2.&amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the line sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half power (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;'''»''' The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch handles the timing data with worse quality than Arduino IDE, therefore we have reduced the number of the ranges to 5 and simplified the action of motors.&amp;lt;br&amp;gt; The motors are rotating forward all the time, with varying power.&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, the robot misses the turn in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||It is important to modify the sketch coded for USB, because at a high speed, the intermediate values of the sensor cannot be handled. &amp;lt;br&amp;gt;We join all the intermediate values. &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, coded for a 5V power supply (USB). &amp;lt;br&amp;gt;Replace the robot's turning time of 0.1 seconds by 0.01 seconds. And increase the time of going ahead up to 0.2 seconds. &amp;lt;br&amp;gt;It is necessary because at a high speed, the robot rushes too fast along the path section where the values of the sensors are changing.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3.&amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor &amp;lt;br&amp;gt;is positioned above the white area and above the black line. &amp;lt;br&amp;gt;The trajectory the robot follows is a  line with long straight sections, and the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (track record!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Description of travelling along the black line with TWO sensors==&lt;br /&gt;
&amp;lt;center&amp;gt;It is impossible to travel along a complicated track with crossings, forks, &amp;quot;zebras&amp;quot;, and inverted sections using only one sensor. &amp;lt;br&amp;gt;When two sensors are used, special algorithms are needed to automate the robot's motion.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4.&amp;lt;/font&amp;gt; Relay controller.''' This algorithm is intended to keep the robot in the position &amp;quot;Both sensors of the robot are above the white area&amp;quot;, &amp;lt;br&amp;gt;that is, to the left and to the right from the black line. If both sensors are above the black line, the robot stops.&amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||When powered by USB, the robot stops at the turn, because both sensors get above the black line. [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
|| When extra powered from the battery, the robot misses the sharp turns, because at a speed, the sensors cannot be above the black line both at the same time. [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0] Arduino IDE Video]. If the battery charge is low, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - relay controller + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5.&amp;lt;/font&amp;gt; Proportional controller.''' Proportional controller is a device whose controlling action over an object depends on the object's deflection from a certain state. &amp;lt;br&amp;gt;Such deflection is called '''error''' and we denote it with a letter E. In our case, the error is the difference between the readings of two line sensors: E = S1 – S2. &amp;lt;br&amp;gt;To obtain the value of controlling action '''U''', we multiply the E value by a chosen factor '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. &amp;lt;br&amp;gt;Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&amp;lt;br&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds&lt;br /&gt;
||&lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| '''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6.&amp;lt;/font&amp;gt; Proportional-plus-differential controller.''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7.&amp;lt;/font&amp;gt; Proportional-integral-differential controller.'''&amp;lt;br&amp;gt; &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T13:49:10Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1.&amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE of &amp;lt;br&amp;gt;two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt;and goes forward during 0.1 second. &amp;lt;br&amp;gt;If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt;The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;[[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, the robot misses the turns in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2.&amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the line sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half power (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;'''»''' The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch handles the timing data with worse quality than Arduino IDE, therefore we have reduced the number of the ranges to 5 and simplified the action of motors.&amp;lt;br&amp;gt; The motors are rotating forward all the time, with varying power.&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, the robot misses the turn in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||It is important to modify the sketch coded for USB, because at a high speed, the intermediate values of the sensor cannot be handled. &amp;lt;br&amp;gt;We join all the intermediate values. &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, coded for a 5V power supply (USB). &amp;lt;br&amp;gt;Replace the robot's turning time of 0.1 seconds by 0.01 seconds. And increase the time of going ahead up to 0.2 seconds. &amp;lt;br&amp;gt;It is necessary because at a high speed, the robot rushes too fast along the path section where the values of the sensors are changing.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3.&amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor &amp;lt;br&amp;gt;is positioned above the white area and above the black line. &amp;lt;br&amp;gt;The trajectory the robot follows is a  line with long straight sections, and the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (track record!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Description of travelling along the black line with TWO sensors==&lt;br /&gt;
&amp;lt;center&amp;gt;It is impossible to travel along a complicated track with crossings, forks, &amp;quot;zebras&amp;quot;, and inverted sections using only one sensor. &amp;lt;br&amp;gt;When two sensors are used, special algorithms are needed to automate the robot's motion.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4.&amp;lt;/font&amp;gt; Relay controller.''' This algorithm is intended to keep the robot in the position &amp;quot;Both sensors of the robot are above the white area&amp;quot;, &amp;lt;br&amp;gt;that is, to the left and to the right from the black line. If both sensors are above the black line, the robot stops.&amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||When powered by USB, the robot stops at the turn, because both sensors get above the black line. [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
|| When extra powered from the battery, the robot misses the sharp turns, because at a speed, the sensors cannot be above the black line both at the same time. [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0] Arduino IDE Video]. If the battery charge is low, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - relay controller + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5.&amp;lt;/font&amp;gt; Proportional controller.''' Proportional controller is a device whose controlling action over an object depends on the object's deflection from a certain state. &amp;lt;br&amp;gt;Such deflection is called '''error''' and we denote it with a letter E. In our case, the error is the difference between the readings of two line sensors: E = S1 – S2. &amp;lt;br&amp;gt;To obtain the value of controlling action '''U''', we multiply the E value by a chosen factor '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. &amp;lt;br&amp;gt;Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&amp;lt;br&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds&lt;br /&gt;
||&lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| '''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6.&amp;lt;/font&amp;gt; Proportional-plus-differential controller.''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7.&amp;lt;/font&amp;gt; Proportional-integral-differential controller.'''&amp;lt;br&amp;gt; &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T13:46:49Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1.&amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE of &amp;lt;br&amp;gt;two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt;and goes forward during 0.1 second. &amp;lt;br&amp;gt;If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt;The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;[[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, the robot misses the turns in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2.&amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the line sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half power (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;'''»''' The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch handles the timing data with worse quality than Arduino IDE, therefore we have reduced the number of the ranges to 5 and simplified the action of motors.&amp;lt;br&amp;gt; The motors are rotating forward all the time, with varying power.&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, the robot misses the turn in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||It is important to modify the sketch coded for USB, because at a high speed, the intermediate values of the sensor cannot be handled. &amp;lt;br&amp;gt;We join all the intermediate values. &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, coded for a 5V power supply (USB). &amp;lt;br&amp;gt;Replace the robot's turning time of 0.1 seconds by 0.01 seconds. And increase the time of going ahead up to 0.2 seconds. &amp;lt;br&amp;gt;It is necessary because at a high speed, the robot rushes too fast along the path section where the values of the sensors are changing.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3.&amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor &amp;lt;br&amp;gt;is positioned above the white area and above the black line. &amp;lt;br&amp;gt;The trajectory the robot follows is a  line with long straight sections, and the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (track record!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Description of travelling along the black line with TWO sensors==&lt;br /&gt;
&amp;lt;center&amp;gt;It is impossible to travel along a complicated track with crossings, forks, &amp;quot;zebras&amp;quot;, and inverted sections using only one sensor. &amp;lt;br&amp;gt;When two sensors are used, special algorithms are needed to automate the robot's motion.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4.&amp;lt;/font&amp;gt; Relay controller.''' This algorithm is intended to keep the robot in the position &amp;quot;Both sensors of the robot are above the white area&amp;quot;, &amp;lt;br&amp;gt;that is, to the left and to the right from the black line. If both sensors are above the black line, the robot stops.&amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||When powered by USB, the robot stops at the turn, because both sensors get above the black line. [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
|| When extra powered from the battery, the robot misses the sharp turns, because at a speed, the sensors cannot be above the black line both at the same time. [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0] Arduino IDE Video]. If the battery charge is low, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - relay controller + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5.&amp;lt;/font&amp;gt; Proportional controller.''' Proportional controller is a device whose controlling action over an object depends on the object's deflection from a certain state. &amp;lt;br&amp;gt;Such deflection is called '''error''' and we denote it with a letter E. In our case, the error is the difference between the readings of two line sensors: E = S1 – S2. &amp;lt;br&amp;gt;To obtain the value of controlling action '''U''', we multiply the E value by a chosen factor '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. &amp;lt;br&amp;gt;Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&amp;lt;br&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds&lt;br /&gt;
||&lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| '''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6.&amp;lt;/font&amp;gt; Proportional-plus-differential controller.''' &amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7.&amp;lt;/font&amp;gt; Proportional-integral-differential controller.'''&amp;lt;br&amp;gt; &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T13:39:47Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1.&amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE of &amp;lt;br&amp;gt;two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt;and goes forward during 0.1 second. &amp;lt;br&amp;gt;If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt;The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;[[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, the robot misses the turns in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2.&amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the line sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half power (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;'''»''' The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch handles the timing data with worse quality than Arduino IDE, therefore we have reduced the number of the ranges to 5 and simplified the action of motors.&amp;lt;br&amp;gt; The motors are rotating forward all the time, with varying power.&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, the robot misses the turn in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||It is important to modify the sketch coded for USB, because at a high speed, the intermediate values of the sensor cannot be handled. &amp;lt;br&amp;gt;We join all the intermediate values. &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, coded for a 5V power supply (USB). &amp;lt;br&amp;gt;Replace the robot's turning time of 0.1 seconds by 0.01 seconds. And increase the time of going ahead up to 0.2 seconds. &amp;lt;br&amp;gt;It is necessary because at a high speed, the robot rushes too fast along the path section where the values of the sensors are changing.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3.&amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor &amp;lt;br&amp;gt;is positioned above the white area and above the black line. &amp;lt;br&amp;gt;The trajectory the robot follows is a  line with long straight sections, and the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (track record!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Description of travelling along the black line with TWO sensors==&lt;br /&gt;
&amp;lt;center&amp;gt;It is impossible to travel along a complicated track with crossings, forks, &amp;quot;zebras&amp;quot;, and inverted sections using only one sensor. &amp;lt;br&amp;gt;When two sensors are used, special algorithms are needed to automate the robot's motion.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4.&amp;lt;/font&amp;gt; Relay controller.''' This algorithm is intended to keep the robot in the position &amp;quot;Both sensors of the robot are above the white area&amp;quot;, &amp;lt;br&amp;gt;that is, to the left and to the right from the black line. If both sensors are above the black line, the robot stops.&amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||When powered by USB, the robot stops at the turn, because both sensors get above the black line. [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
|| When extra powered from the battery, the robot misses the sharp turns, because at a speed, the sensors cannot be above the black line both at the same time. [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0] Arduino IDE Video]. If the battery charge is low, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - relay controller + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5.&amp;lt;/font&amp;gt; Proportional controller.''' Proportional controller is a device whose controlling action over an object depends on the object's deflection from a certain state. &amp;lt;br&amp;gt;Such deflection is called '''error''' and we denote it with a letter E. In our case, the error is the difference between the readings of two line sensors: E = S1 – S2. &amp;lt;br&amp;gt;To obtain the value of controlling action '''U''', we multiply the E value by a chosen factor '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. &amp;lt;br&amp;gt;Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&amp;lt;br&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds&lt;br /&gt;
||&lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| '''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6.&amp;lt;/font&amp;gt; Proportional-plus-differential controller.''' &amp;lt;br&amp;gt; &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7.&amp;lt;/font&amp;gt; Proportional-integral-differential controller.'''&amp;lt;br&amp;gt; &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T13:36:12Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1.&amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE of &amp;lt;br&amp;gt;two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt;and goes forward during 0.1 second. &amp;lt;br&amp;gt;If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt;The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;[[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, the robot misses the turns in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2.&amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the line sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half power (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;'''»''' The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch handles the timing data with worse quality than Arduino IDE, therefore we have reduced the number of the ranges to 5 and simplified the action of motors.&amp;lt;br&amp;gt; The motors are rotating forward all the time, with varying power.&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, the robot misses the turn in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||It is important to modify the sketch coded for USB, because at a high speed, the intermediate values of the sensor cannot be handled. &amp;lt;br&amp;gt;We join all the intermediate values. &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, coded for a 5V power supply (USB). &amp;lt;br&amp;gt;Replace the robot's turning time of 0.1 seconds by 0.01 seconds. And increase the time of going ahead up to 0.2 seconds. &amp;lt;br&amp;gt;It is necessary because at a high speed, the robot rushes too fast along the path section where the values of the sensors are changing.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3.&amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor &amp;lt;br&amp;gt;is positioned above the white area and above the black line. &amp;lt;br&amp;gt;The trajectory the robot follows is a  line with long straight sections, and the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (track record!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Description of travelling along the black line with TWO sensors==&lt;br /&gt;
&amp;lt;center&amp;gt;It is impossible to travel along a complicated track with crossings, forks, &amp;quot;zebras&amp;quot;, and inverted sections using only one sensor. &amp;lt;br&amp;gt;When two sensors are used, special algorithms are needed to automate the robot's motion.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4.&amp;lt;/font&amp;gt; Relay controller.''' This algorithm is intended to keep the robot in the position &amp;quot;Both sensors of the robot are above the white area&amp;quot;, &amp;lt;br&amp;gt;that is, to the left and to the right from the black line. If both sensors are above the black line, the robot stops.&amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||When powered by USB, the robot stops at the turn, because both sensors get above the black line. [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
|| When extra powered from the battery, the robot misses the sharp turns, because at a speed, the sensors cannot be above the black line both at the same time. [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0] Arduino IDE Video]. If the battery charge is low, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - relay controller + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5.&amp;lt;/font&amp;gt; Proportional controller.''' Proportional controller is a device whose controlling action over an object depends on the object's deflection from a certain state. &amp;lt;br&amp;gt;Such deflection is called '''error''' and we denote it with a letter E. In our case, the error is the difference between the readings of two line sensors: E = S1 – S2. &amp;lt;br&amp;gt;To obtain the value of controlling action '''U''', we multiply the E value by a chosen factor '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. &amp;lt;br&amp;gt;Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&amp;lt;br&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
|||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| '''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6.&amp;lt;/font&amp;gt; Proportional-plus-differential controller.''' &amp;lt;br&amp;gt; &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7.&amp;lt;/font&amp;gt; Proportional-integral-differential controller.'''&amp;lt;br&amp;gt; &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T13:32:47Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1.&amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE of &amp;lt;br&amp;gt;two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt;and goes forward during 0.1 second. &amp;lt;br&amp;gt;If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt;The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;[[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, the robot misses the turns in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2.&amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the line sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half power (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;'''»''' The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch handles the timing data with worse quality than Arduino IDE, therefore we have reduced the number of the ranges to 5 and simplified the action of motors.&amp;lt;br&amp;gt; The motors are rotating forward all the time, with varying power.&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, the robot misses the turn in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||It is important to modify the sketch coded for USB, because at a high speed, the intermediate values of the sensor cannot be handled. &amp;lt;br&amp;gt;We join all the intermediate values. &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, coded for a 5V power supply (USB). &amp;lt;br&amp;gt;Replace the robot's turning time of 0.1 seconds by 0.01 seconds. And increase the time of going ahead up to 0.2 seconds. &amp;lt;br&amp;gt;It is necessary because at a high speed, the robot rushes too fast along the path section where the values of the sensors are changing.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3.&amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor &amp;lt;br&amp;gt;is positioned above the white area and above the black line. &amp;lt;br&amp;gt;The trajectory the robot follows is a  line with long straight sections, and the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (track record!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Description of travelling along the black line with TWO sensors==&lt;br /&gt;
&amp;lt;center&amp;gt;It is impossible to travel along a complicated track with crossings, forks, &amp;quot;zebras&amp;quot;, and inverted sections using only one sensor. &amp;lt;br&amp;gt;When two sensors are used, special algorithms are needed to automate the robot's motion.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4.&amp;lt;/font&amp;gt; Relay controller.''' This algorithm is intended to keep the robot in the position &amp;quot;Both sensors of the robot are above the white area&amp;quot;, &amp;lt;br&amp;gt;that is, to the left and to the right from the black line. If both sensors are above the black line, the robot stops.&amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||When powered by USB, the robot stops at the turn, because both sensors get above the black line. [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
|| When extra powered from the battery, the robot misses the sharp turns, because at a speed, the sensors cannot be above the black line both at the same time. [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0] Arduino IDE Video]. If the battery charge is low, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - relay controller + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5.&amp;lt;/font&amp;gt; Proportional controller.''' Proportional controller is a device whose controlling action over an object depends on the object's deflection from a certain state. &amp;lt;br&amp;gt;Such deflection is called '''error''' and we denote it with a letter E. In our case, the error is the difference between the readings of two line sensors: E = S1 – S2. &amp;lt;br&amp;gt;To obtain the value of controlling action '''U''', we multiply the E value by a chosen factor '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. &amp;lt;br&amp;gt;Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
|||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| '''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6.&amp;lt;/font&amp;gt; Proportional-plus-differential controller.''' &amp;lt;br&amp;gt; &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7.&amp;lt;/font&amp;gt; Proportional-integral-differential controller.'''&amp;lt;br&amp;gt; &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T13:30:49Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1.&amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE of &amp;lt;br&amp;gt;two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt;and goes forward during 0.1 second. &amp;lt;br&amp;gt;If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt;The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;[[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, the robot misses the turns in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2.&amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the line sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half power (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;'''»''' The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch handles the timing data with worse quality than Arduino IDE, therefore we have reduced the number of the ranges to 5 and simplified the action of motors.&amp;lt;br&amp;gt; The motors are rotating forward all the time, with varying power.&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, the robot misses the turn in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||It is important to modify the sketch coded for USB, because at a high speed, the intermediate values of the sensor cannot be handled. &amp;lt;br&amp;gt;We join all the intermediate values. &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, coded for a 5V power supply (USB). &amp;lt;br&amp;gt;Replace the robot's turning time of 0.1 seconds by 0.01 seconds. And increase the time of going ahead up to 0.2 seconds. &amp;lt;br&amp;gt;It is necessary because at a high speed, the robot rushes too fast along the path section where the values of the sensors are changing.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3.&amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor &amp;lt;br&amp;gt;is positioned above the white area and above the black line. &amp;lt;br&amp;gt;The trajectory the robot follows is a  line with long straight sections, and the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (track record!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Description of travelling along the black line with TWO sensors==&lt;br /&gt;
&amp;lt;center&amp;gt;It is impossible to travel along a complicated track with crossings, forks, &amp;quot;zebras&amp;quot;, and inverted sections using only one sensor. &amp;lt;br&amp;gt;When two sensors are used, special algorithms are needed to automate the robot's motion.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4.&amp;lt;/font&amp;gt; Relay controller.''' This algorithm is intended to keep the robot in the position &amp;quot;Both sensors of the robot are above the white area&amp;quot;, &amp;lt;br&amp;gt;that is, to the left and to the right from the black line. If both sensors are above the black line, the robot stops.&amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||When powered by USB, the robot stops at the turn, because both sensors get above the black line. [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
|| When extra powered from the battery, the robot misses the sharp turns, because at a speed, the sensors cannot be above the black line both at the same time. [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0] Arduino IDE Video]. If the battery charge is low, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - relay controller + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5.&amp;lt;/font&amp;gt; Proportional controller.''' Proportional controller is a device whose controlling action over an object depends on the object's deflection from a certain state. &amp;lt;br&amp;gt;Such deflection is called '''error''' and we denote it with a letter E. In our case, the error is the difference between the readings of two line sensors: E = S1 – S2. &amp;lt;br&amp;gt;To obtain the value of controlling action '''U''', we multiply the E value by a chosen factor '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. &amp;lt;br&amp;gt;Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
|||USB&lt;br /&gt;
||||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| '''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6.&amp;lt;/font&amp;gt; Proportional-plus-differential controller.''' &amp;lt;br&amp;gt; &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7.&amp;lt;/font&amp;gt; Proportional-integral-differential controller.'''&amp;lt;br&amp;gt; &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T13:28:39Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1.&amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE of &amp;lt;br&amp;gt;two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt;and goes forward during 0.1 second. &amp;lt;br&amp;gt;If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt;The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;[[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, the robot misses the turns in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2.&amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the line sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half power (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;'''»''' The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch handles the timing data with worse quality than Arduino IDE, therefore we have reduced the number of the ranges to 5 and simplified the action of motors.&amp;lt;br&amp;gt; The motors are rotating forward all the time, with varying power.&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, the robot misses the turn in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||It is important to modify the sketch coded for USB, because at a high speed, the intermediate values of the sensor cannot be handled. &amp;lt;br&amp;gt;We join all the intermediate values. &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, coded for a 5V power supply (USB). &amp;lt;br&amp;gt;Replace the robot's turning time of 0.1 seconds by 0.01 seconds. And increase the time of going ahead up to 0.2 seconds. &amp;lt;br&amp;gt;It is necessary because at a high speed, the robot rushes too fast along the path section where the values of the sensors are changing.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3.&amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor &amp;lt;br&amp;gt;is positioned above the white area and above the black line. &amp;lt;br&amp;gt;The trajectory the robot follows is a  line with long straight sections, and the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (track record!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Description of travelling along the black line with TWO sensors==&lt;br /&gt;
&amp;lt;center&amp;gt;It is impossible to travel along a complicated track with crossings, forks, &amp;quot;zebras&amp;quot;, and inverted sections using only one sensor. &amp;lt;br&amp;gt;When two sensors are used, special algorithms are needed to automate the robot's motion.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4.&amp;lt;/font&amp;gt; Relay controller.''' This algorithm is intended to keep the robot in the position &amp;quot;Both sensors of the robot are above the white area&amp;quot;, &amp;lt;br&amp;gt;that is, to the left and to the right from the black line. If both sensors are above the black line, the robot stops.&amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||When powered by USB, the robot stops at the turn, because both sensors get above the black line. [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
|| When extra powered from the battery, the robot misses the sharp turns, because at a speed, the sensors cannot be above the black line both at the same time. [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0] Arduino IDE Video]. If the battery charge is low, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - relay controller + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5.&amp;lt;/font&amp;gt; Proportional controller.''' Proportional controller is a device whose controlling action over an object depends on the object's deflection from a certain state. &amp;lt;br&amp;gt;Such deflection is called '''error''' and we denote it with a letter E. In our case, the error is the difference between the readings of two line sensors: E = S1 – S2. &amp;lt;br&amp;gt;To obtain the value of controlling action '''U''', we multiply the E value by a chosen factor '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. &amp;lt;br&amp;gt;Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| '''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6.&amp;lt;/font&amp;gt; Proportional-plus-differential controller.''' &amp;lt;br&amp;gt; &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7.&amp;lt;/font&amp;gt; Proportional-integral-differential controller.'''&amp;lt;br&amp;gt; &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T13:27:05Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1.&amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE of &amp;lt;br&amp;gt;two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt;and goes forward during 0.1 second. &amp;lt;br&amp;gt;If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt;The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;[[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, the robot misses the turns in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2.&amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the line sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half power (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;'''»''' The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch handles the timing data with worse quality than Arduino IDE, therefore we have reduced the number of the ranges to 5 and simplified the action of motors.&amp;lt;br&amp;gt; The motors are rotating forward all the time, with varying power.&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, the robot misses the turn in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||It is important to modify the sketch coded for USB, because at a high speed, the intermediate values of the sensor cannot be handled. &amp;lt;br&amp;gt;We join all the intermediate values. &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, coded for a 5V power supply (USB). &amp;lt;br&amp;gt;Replace the robot's turning time of 0.1 seconds by 0.01 seconds. And increase the time of going ahead up to 0.2 seconds. &amp;lt;br&amp;gt;It is necessary because at a high speed, the robot rushes too fast along the path section where the values of the sensors are changing.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3.&amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor &amp;lt;br&amp;gt;is positioned above the white area and above the black line. &amp;lt;br&amp;gt;The trajectory the robot follows is a  line with long straight sections, and the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (track record!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Description of travelling along the black line with TWO sensors==&lt;br /&gt;
&amp;lt;center&amp;gt;It is impossible to travel along a complicated track with crossings, forks, &amp;quot;zebras&amp;quot;, and inverted sections using only one sensor. &amp;lt;br&amp;gt;When two sensors are used, special algorithms are needed to automate the robot's motion.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4.&amp;lt;/font&amp;gt; Relay controller.''' This algorithm is intended to keep the robot in the position &amp;quot;Both sensors of the robot are above the white area&amp;quot;, &amp;lt;br&amp;gt;that is, to the left and to the right from the black line. If both sensors are above the black line, the robot stops.&amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||When powered by USB, the robot stops at the turn, because both sensors get above the black line. [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
|| When extra powered from the battery, the robot misses the sharp turns, because at a speed, the sensors cannot be above the black line both at the same time. [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0] Arduino IDE Video]. If the battery charge is low, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - relay controller + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5.&amp;lt;/font&amp;gt; Proportional controller.''' Proportional controller is a device whose controlling action over an object depends on the object's deflection from a certain state. &amp;lt;br&amp;gt;Such deflection is called '''error''' and we denote it with a letter E. In our case, the error is the difference between the readings of two line sensors: E = S1 – S2. &amp;lt;br&amp;gt;To obtain the value of controlling action '''U''', we multiply the E value by a chosen factor '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. &amp;lt;br&amp;gt;Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6.&amp;lt;/font&amp;gt; Proportional-plus-differential controller.''' &amp;lt;br&amp;gt; &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7.&amp;lt;/font&amp;gt; Proportional-integral-differential controller.'''&amp;lt;br&amp;gt; &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T13:25:56Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1.&amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE of &amp;lt;br&amp;gt;two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt;and goes forward during 0.1 second. &amp;lt;br&amp;gt;If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt;The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;[[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, the robot misses the turns in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2.&amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the line sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half power (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;'''»''' The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch handles the timing data with worse quality than Arduino IDE, therefore we have reduced the number of the ranges to 5 and simplified the action of motors.&amp;lt;br&amp;gt; The motors are rotating forward all the time, with varying power.&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, the robot misses the turn in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||It is important to modify the sketch coded for USB, because at a high speed, the intermediate values of the sensor cannot be handled. &amp;lt;br&amp;gt;We join all the intermediate values. &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, coded for a 5V power supply (USB). &amp;lt;br&amp;gt;Replace the robot's turning time of 0.1 seconds by 0.01 seconds. And increase the time of going ahead up to 0.2 seconds. &amp;lt;br&amp;gt;It is necessary because at a high speed, the robot rushes too fast along the path section where the values of the sensors are changing.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3.&amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor &amp;lt;br&amp;gt;is positioned above the white area and above the black line. &amp;lt;br&amp;gt;The trajectory the robot follows is a  line with long straight sections, and the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (track record!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Description of travelling along the black line with TWO sensors==&lt;br /&gt;
&amp;lt;center&amp;gt;It is impossible to travel along a complicated track with crossings, forks, &amp;quot;zebras&amp;quot;, and inverted sections using only one sensor. &amp;lt;br&amp;gt;When two sensors are used, special algorithms are needed to automate the robot's motion.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4.&amp;lt;/font&amp;gt; Relay controller.''' This algorithm is intended to keep the robot in the position &amp;quot;Both sensors of the robot are above the white area&amp;quot;, &amp;lt;br&amp;gt;that is, to the left and to the right from the black line. If both sensors are above the black line, the robot stops.&amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||When powered by USB, the robot stops at the turn, because both sensors get above the black line. [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
|| When extra powered from the battery, the robot misses the sharp turns, because at a speed, the sensors cannot be above the black line both at the same time. [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0] Arduino IDE Video]. If the battery charge is low, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - relay controller + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5.&amp;lt;/font&amp;gt; Proportional controller.''' Proportional controller is a device whose controlling action over an object depends on the object's deflection from a certain state. &amp;lt;br&amp;gt;Such deflection is called '''error''' and we denote it with a letter E. In our case, the error is the difference between the readings of two line sensors: E = S1 – S2. &amp;lt;br&amp;gt;To obtain the value of controlling action '''U''', we multiply the E value by a chosen factor '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. &amp;lt;br&amp;gt;Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6.&amp;lt;/font&amp;gt; Proportional-plus-differential controller.''' &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7.&amp;lt;/font&amp;gt; Proportional-integral-differential controller.'''&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T13:22:36Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1.&amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE of &amp;lt;br&amp;gt;two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;[[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, the robot misses the turns in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2.&amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the line sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half power (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;'''»''' The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch handles the timing data with worse quality than Arduino IDE, therefore we have reduced the number of the ranges to 5 and simplified the action of motors.&amp;lt;br&amp;gt; The motors are rotating forward all the time, with varying power.&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, the robot misses the turn in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||It is important to modify the sketch coded for USB, because at a high speed, the intermediate values of the sensor cannot be handled. &amp;lt;br&amp;gt;We join all the intermediate values. &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, coded for a 5V power supply (USB). &amp;lt;br&amp;gt;Replace the robot's turning time of 0.1 seconds by 0.01 seconds. And increase the time of going ahead up to 0.2 seconds. &amp;lt;br&amp;gt;It is necessary because at a high speed, the robot rushes too fast along the path section where the values of the sensors are changing.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3.&amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor &amp;lt;br&amp;gt;is positioned above the white area and above the black line. &amp;lt;br&amp;gt;The trajectory the robot follows is a  line with long straight sections, and the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (track record!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Description of travelling along the black line with TWO sensors==&lt;br /&gt;
&amp;lt;center&amp;gt;It is impossible to travel along a complicated track with crossings, forks, &amp;quot;zebras&amp;quot;, and inverted sections using only one sensor. &amp;lt;br&amp;gt;When two sensors are used, special algorithms are needed to automate the robot's motion.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4.&amp;lt;/font&amp;gt; Relay controller.''' This algorithm is intended to keep the robot in the position &amp;quot;Both sensors of the robot are above the white area&amp;quot;, &amp;lt;br&amp;gt;that is, to the left and to the right from the black line. If both sensors are above the black line, the robot stops.&amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||When powered by USB, the robot stops at the turn, because both sensors get above the black line. [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
|| When extra powered from the battery, the robot misses the sharp turns, because at a speed, the sensors cannot be above the black line both at the same time. [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0] Arduino IDE Video]. If the battery charge is low, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - relay controller + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5.&amp;lt;/font&amp;gt; Proportional controller.''' Proportional controller is a device whose controlling action over an object depends on the object's deflection from a certain state. &amp;lt;br&amp;gt;Such deflection is called '''error''' and we denote it with a letter E. In our case, the error is the difference between the readings of two line sensors: E = S1 – S2. &amp;lt;br&amp;gt;To obtain the value of controlling action '''U''', we multiply the E value by a chosen factor '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. &amp;lt;br&amp;gt;Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6.&amp;lt;/font&amp;gt; Proportional-plus-differential controller.''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7.&amp;lt;/font&amp;gt; Proportional-integral-differential controller.'''&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T13:20:50Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1.&amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE of &amp;lt;br&amp;gt;two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;[[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, the robot misses the turns in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2.&amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the line sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half power (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;'''»''' The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch handles the timing data with worse quality than Arduino IDE, therefore we have reduced the number of the ranges to 5 and simplified the action of motors.&amp;lt;br&amp;gt; The motors are rotating forward all the time, with varying power.&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, the robot misses the turn in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||It is important to modify the sketch coded for USB, because at a high speed, the intermediate values of the sensor cannot be handled. &amp;lt;br&amp;gt;We join all the intermediate values. &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, coded for a 5V power supply (USB). &amp;lt;br&amp;gt;Replace the robot's turning time of 0.1 seconds by 0.01 seconds. And increase the time of going ahead up to 0.2 seconds. &amp;lt;br&amp;gt;It is necessary because at a high speed, the robot rushes too fast along the path section where the values of the sensors are changing.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3.&amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor &amp;lt;br&amp;gt;is positioned above the white area and above the black line. &amp;lt;br&amp;gt;The trajectory the robot follows is a  line with long straight sections, and the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (track record!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Description of travelling along the black line with TWO sensors==&lt;br /&gt;
&amp;lt;center&amp;gt;It is impossible to travel along a complicated track with crossings, forks, &amp;quot;zebras&amp;quot;, and inverted sections using only one sensor. &amp;lt;br&amp;gt;When two sensors are used, special algorithms are needed to automate the robot's motion.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4.&amp;lt;/font&amp;gt; Relay controller.''' This algorithm is intended to keep the robot in the position &amp;quot;Both sensors of the robot are above the white area&amp;quot;, &amp;lt;br&amp;gt;that is, to the left and to the right from the black line. If both sensors are above the black line, the robot stops.&amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||When powered by USB, the robot stops at the turn, because both sensors get above the black line. [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
|| When extra powered from the battery, the robot misses the sharp turns, because at a speed, the sensors cannot be above the black line both at the same time. [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0] Arduino IDE Video]. If the battery charge is low, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - relay controller + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5.&amp;lt;/font&amp;gt; Proportional controller.''' Proportional controller is a device whose controlling action over an object depends on the object's deflection from a certain state. &amp;lt;br&amp;gt;Such deflection is called '''error''' and we denote it with a letter E. In our case, the error is the difference between the readings of two line sensors: E = S1 – S2. &amp;lt;br&amp;gt;To obtain the value of controlling action '''U''', we multiply this value by a chosen factor '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. &amp;lt;br&amp;gt;Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6.&amp;lt;/font&amp;gt; Proportional-plus-differential controller.''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7.&amp;lt;/font&amp;gt; Proportional-integral-differential controller.'''&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T13:14:35Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1.&amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE of &amp;lt;br&amp;gt;two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;[[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, the robot misses the turns in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2.&amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the line sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half power (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;'''»''' The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch handles the timing data with worse quality than Arduino IDE, therefore we have reduced the number of the ranges to 5 and simplified the action of motors.&amp;lt;br&amp;gt; The motors are rotating forward all the time, with varying power.&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, the robot misses the turn in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||It is important to modify the sketch coded for USB, because at a high speed, the intermediate values of the sensor cannot be handled. &amp;lt;br&amp;gt;We join all the intermediate values. &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, coded for a 5V power supply (USB). &amp;lt;br&amp;gt;Replace the robot's turning time of 0.1 seconds by 0.01 seconds. And increase the time of going ahead up to 0.2 seconds. &amp;lt;br&amp;gt;It is necessary because at a high speed, the robot rushes too fast along the path section where the values of the sensors are changing.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3.&amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor &amp;lt;br&amp;gt;is positioned above the white area and above the black line. &amp;lt;br&amp;gt;The trajectory the robot follows is a  line with long straight sections, and the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (track record!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Description of travelling along the black line with TWO sensors==&lt;br /&gt;
&amp;lt;center&amp;gt;It is impossible to travel along a complicated track with crossings, forks, &amp;quot;zebras&amp;quot;, and inverted sections using only one sensor. &amp;lt;br&amp;gt;When two sensors are used, special algorithms are needed to automate the robot's motion.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4.&amp;lt;/font&amp;gt; Relay controller.''' This algorithm is intended to keep the robot in the position &amp;quot;Both sensors of the robot are above the white area&amp;quot;, &amp;lt;br&amp;gt;that is, to the left and to the right from the black line. If both sensors are above the black line, the robot stops.&amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||When powered by USB, the robot stops at the turn, because both sensors get above the black line. [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
|| When extra powered from the battery, the robot misses the sharp turns, because at a speed, the sensors cannot be above the black line both at the same time. [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0] Arduino IDE Video]. If the battery charge is low, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - relay controller + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5.&amp;lt;/font&amp;gt; Proportional controller.''' Proportional controller is a device whose controlling action over an object depends on the object's deflection from a certain state. &amp;lt;br&amp;gt;Such deflection is called '''error''' and we denote it with a letter E. In our case, the error is the difference between the readings of two line sensors: E = S1 – S2. &amp;lt;br&amp;gt;To obtain the value of controlling action '''U''', we multiply this value by a chosen factor '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. &amp;lt;br&amp;gt;Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6.&amp;lt;/font&amp;gt; Proportional-plus-derivative controller''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7.&amp;lt;/font&amp;gt; ПИД-controller'''&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T13:12:46Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1.&amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE of &amp;lt;br&amp;gt;two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;[[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, the robot misses the turns in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2.&amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the line sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half power (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;'''»''' The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch handles the timing data with worse quality than Arduino IDE, therefore we have reduced the number of the ranges to 5 and simplified the action of motors.&amp;lt;br&amp;gt; The motors are rotating forward all the time, with varying power.&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, the robot misses the turn in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||It is important to modify the sketch coded for USB, because at a high speed, the intermediate values of the sensor cannot be handled. &amp;lt;br&amp;gt;We join all the intermediate values. &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, coded for a 5V power supply (USB). &amp;lt;br&amp;gt;Replace the robot's turning time of 0.1 seconds by 0.01 seconds. And increase the time of going ahead up to 0.2 seconds. &amp;lt;br&amp;gt;It is necessary because at a high speed, the robot rushes too fast along the path section where the values of the sensors are changing.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3.&amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor &amp;lt;br&amp;gt;is positioned above the white area and above the black line. &amp;lt;br&amp;gt;The trajectory the robot follows is a  line with long straight sections, and the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (track record!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Description of travelling along the black line with TWO sensors==&lt;br /&gt;
&amp;lt;center&amp;gt;It is impossible to travel along a complicated track with crossings, forks, &amp;quot;zebras&amp;quot;, and inverted sections using only one sensor. &amp;lt;br&amp;gt;When two sensors are used, special algorithms are needed to automate the robot's motion.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4.&amp;lt;/font&amp;gt; Relay controller.''' This algorithm is intended to keep the robot in the position &amp;quot;Both sensors of the robot are above the white area&amp;quot;, &amp;lt;br&amp;gt;that is, to the left and to the right from the black line. If both sensors are above the black line, the robot stops.&amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||When powered by USB, the robot stops at the turn, because both sensors get above the black line. [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
|| When extra powered from the battery, the robot misses the sharp turns, because at a speed, the sensors cannot be above the black line both at the same time. [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0] Arduino IDE Video]. If the battery charge is low, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - relay controller + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5.&amp;lt;/font&amp;gt; Proportional controller.''' Proportional controller is a device whose controlling action over an object depends on the object's deflection from a certain state. &amp;lt;br&amp;gt;Such deflection is called '''error''' and we denote it with a letter E. In our case, the error is the difference between the readings of two line sensors: E = S1 – S2. &amp;lt;br&amp;gt;To obtain the value of controlling action '''U''', we multiply this value by a chosen factor '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. &amp;lt;br&amp;gt;Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6.&amp;lt;/font&amp;gt; Proportional-plus-derivative controller''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7.&amp;lt;/font&amp;gt; ПИД-controller'''&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T13:07:34Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1.&amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE of &amp;lt;br&amp;gt;two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;[[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, the robot misses the turns in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2.&amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the line sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half power (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;'''»''' The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch handles the timing data with worse quality than Arduino IDE, therefore we have reduced the number of the ranges to 5 and simplified the action of motors.&amp;lt;br&amp;gt; The motors are rotating forward all the time, with varying power.&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, the robot misses the turn in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||It is important to modify the sketch coded for USB, because at a high speed, the intermediate values of the sensor cannot be handled. &amp;lt;br&amp;gt;We join all the intermediate values. &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, coded for a 5V power supply (USB). &amp;lt;br&amp;gt;Replace the robot's turning time of 0.1 seconds by 0.01 seconds. And increase the time of going ahead up to 0.2 seconds. &amp;lt;br&amp;gt;It is necessary because at a high speed, the robot rushes too fast along the path section where the values of the sensors are changing.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3.&amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor &amp;lt;br&amp;gt;is positioned above the white area and above the black line. &amp;lt;br&amp;gt;The trajectory the robot follows is a  line with long straight sections, and the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (track record!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Description of travelling along the black line with TWO sensors==&lt;br /&gt;
&amp;lt;center&amp;gt;It is impossible to travel along a complicated track with crossings, forks, &amp;quot;zebras&amp;quot;, and inverted sections using only one sensor. &amp;lt;br&amp;gt;When two sensors are used, special algorithms are needed to automate the robot's motion.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4.&amp;lt;/font&amp;gt; Relay controller.''' This algorithm is intended to keep the robot in the position &amp;quot;Both sensors of the robot are above the white area&amp;quot;, &amp;lt;br&amp;gt;that is, to the left and to the right from the black line. If both sensors are above the black line, the robot stops.&amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||When powered by USB, the robot stops at the turn, because both sensors get above the black line. [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
|| When extra powered from the battery, the robot misses the sharp turns, because at a speed, the sensors cannot be above the black line both at the same time. [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0] Arduino IDE Video]. If the battery charge is low, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - relay controller + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5.&amp;lt;/font&amp;gt; Proportional controller.''' Proportional controller is a device whose controlling action over an object depends on the object's deflection from a certain state. &amp;lt;br&amp;gt;Such deflection is called '''error''' and we denote it with a letter E. In our case, the error is the difference between the readings of two line sensors: E = S1 – S2. &amp;lt;br&amp;gt;To obtain the value of controlling action '''U''', we multiply this value by a chosen factor '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. &amp;lt;br&amp;gt;Thus, the robot will control its position '''itself''' — that is, for turning or taxying to the required direction.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6.&amp;lt;/font&amp;gt; Пропорционально-дифференциальный controller''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7.&amp;lt;/font&amp;gt; ПИД-controller'''&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T13:05:23Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1.&amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE of &amp;lt;br&amp;gt;two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;[[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, the robot misses the turns in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2.&amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the line sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half power (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;'''»''' The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch handles the timing data with worse quality than Arduino IDE, therefore we have reduced the number of the ranges to 5 and simplified the action of motors.&amp;lt;br&amp;gt; The motors are rotating forward all the time, with varying power.&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, the robot misses the turn in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||It is important to modify the sketch coded for USB, because at a high speed, the intermediate values of the sensor cannot be handled. &amp;lt;br&amp;gt;We join all the intermediate values. &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, coded for a 5V power supply (USB). &amp;lt;br&amp;gt;Replace the robot's turning time of 0.1 seconds by 0.01 seconds. And increase the time of going ahead up to 0.2 seconds. &amp;lt;br&amp;gt;It is necessary because at a high speed, the robot rushes too fast along the path section where the values of the sensors are changing.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3.&amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor &amp;lt;br&amp;gt;is positioned above the white area and above the black line. &amp;lt;br&amp;gt;The trajectory the robot follows is a  line with long straight sections, and the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (track record!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Description of travelling along the black line with TWO sensors==&lt;br /&gt;
&amp;lt;center&amp;gt;It is impossible to travel along a complicated track with crossings, forks, &amp;quot;zebras&amp;quot;, and inverted sections using only one sensor. &amp;lt;br&amp;gt;When two sensors are used, special algorithms are needed to automate the robot's motion.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4.&amp;lt;/font&amp;gt; Relay controller.''' This algorithm is intended to keep the robot in the position &amp;quot;Both sensors of the robot are above the white area&amp;quot;, &amp;lt;br&amp;gt;that is, to the left and to the right from the black line. If both sensors are above the black line, the robot stops.&amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||When powered by USB, the robot stops at the turn, because both sensors get above the black line. [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
|| When extra powered from the battery, the robot misses the sharp turns, because at a speed, the sensors cannot be above the black line both at the same time. [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0] Arduino IDE Video]. If the battery charge is low, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - relay controller + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5.&amp;lt;/font&amp;gt; Proportional controller.''' Proportional controller is a device whose controlling action over an object depends on the object's deflection from a certain state. Such deflection is called '''error''' и обозначим буквой E. In this case, the error is the difference between the readings of two line sensors:&lt;br /&gt;
E = S1 – S2. To obtain the value of controlling action '''U''', we multiply this value by a chosen factor '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. &amp;lt;br&amp;gt;Thus, the robot will control its position '''itself''' — that is, for turning or taxying to the required direction.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6.&amp;lt;/font&amp;gt; Пропорционально-дифференциальный controller''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7.&amp;lt;/font&amp;gt; ПИД-controller'''&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T13:02:34Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1.&amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE of &amp;lt;br&amp;gt;two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;[[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, the robot misses the turns in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2.&amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the line sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half power (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;'''»''' The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch handles the timing data with worse quality than Arduino IDE, therefore we have reduced the number of the ranges to 5 and simplified the action of motors.&amp;lt;br&amp;gt; The motors are rotating forward all the time, with varying power.&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, the robot misses the turn in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||It is important to modify the sketch coded for USB, because at a high speed, the intermediate values of the sensor cannot be handled. &amp;lt;br&amp;gt;We join all the intermediate values. &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, coded for a 5V power supply (USB). &amp;lt;br&amp;gt;Replace the robot's turning time of 0.1 seconds by 0.01 seconds. And increase the time of going ahead up to 0.2 seconds. &amp;lt;br&amp;gt;It is necessary because at a high speed, the robot rushes too fast along the path section where the values of the sensors are changing.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3.&amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor &amp;lt;br&amp;gt;is positioned above the white area and above the black line. &amp;lt;br&amp;gt;The trajectory the robot follows is a  line with long straight sections, and the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (track record!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Description of travelling along the black line with TWO sensors==&lt;br /&gt;
&amp;lt;center&amp;gt;It is impossible to travel along a complicated track with crossings, forks, &amp;quot;zebras&amp;quot;, and inverted sections using only one sensor. &amp;lt;br&amp;gt;When two sensors are used, special algorithms are needed to automate the robot's motion.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4.&amp;lt;/font&amp;gt; Relay controller.''' This algorithm is intended to keep the robot in the position &amp;quot;Both sensors of the robot are above the white line&amp;quot;, &amp;lt;br&amp;gt;that is, to the left and to the right from the black line. If both sensors are above the black line, the robot stops.&amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||When powered by USB, the robot stops at the turn, because both sensors get above the black line. [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4V&lt;br /&gt;
|| When extra powered from the battery, the robot misses the sharp turns, because at a speed, the sensors cannot be above the black line both at the same time. [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0] Arduino IDE Video]. If the battery charge is low, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - relay controller + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5.&amp;lt;/font&amp;gt; Proportional controller.''' Proportional controller is a device whose controlling action over an object depends on the object's deflection from a certain state. Such deflection is called '''error''' и обозначим буквой E. In this case, the error is the difference between the readings of two line sensors:&lt;br /&gt;
E = S1 – S2. To obtain the value of controlling action '''U''', we multiply this value by a chosen factor '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. Thus, the robot will control its position '''itself''' — that is, for turning or taxying to the required direction.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6.&amp;lt;/font&amp;gt; Пропорционально-дифференциальный controller''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7.&amp;lt;/font&amp;gt; ПИД-controller'''&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T12:52:22Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1.&amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE of &amp;lt;br&amp;gt;two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;[[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, the robot misses the turns in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2.&amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the line sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half power (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;'''»''' The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch handles the timing data with worse quality than Arduino IDE, therefore we have reduced the number of the ranges to 5 and simplified the action of motors.&amp;lt;br&amp;gt; The motors are rotating forward all the time, with varying power.&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, the robot misses the turn in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||It is important to modify the sketch coded for USB, because at a high speed, the intermediate values of the sensor cannot be handled. &amp;lt;br&amp;gt;We join all the intermediate values. &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, coded for a 5V power supply (USB). &amp;lt;br&amp;gt;Replace the robot's turning time of 0.1 seconds by 0.01 seconds. And increase the time of going ahead up to 0.2 seconds. &amp;lt;br&amp;gt;It is necessary because at a high speed, the robot rushes too fast along the path section where the values of the sensors are changing.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3.&amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor &amp;lt;br&amp;gt;is positioned above the white area and above the black line. &amp;lt;br&amp;gt;The trajectory the robot follows is a  line with long straight sections, and the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (track record!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Description of travelling along the black line with TWO sensors==&lt;br /&gt;
&amp;lt;center&amp;gt;It is impossible to travel along a complicated track with crossings, forks, &amp;quot;zebras&amp;quot;, and inverted sections using only one sensor. &amp;lt;br&amp;gt;When two sensors are used, special algorithms are needed to automate the robot's motion.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4.&amp;lt;/font&amp;gt; Relay controller.''' This algorithm is intended to keep the robot in the position &amp;quot;Both sensors of the robot are above the white line&amp;quot;, &amp;lt;br&amp;gt;that is, to the left and to the right from the black line. If both sensors are above the black line, the robot stops.&amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||When powered by USB, the robot stops at the turn, because both sensors get above the black line. [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
|| When extra powered from the battery, the robot misses the sharp turns, because at a speed, the sensors cannot be above the black line both at the same time. [[https://youtu.be/9rBbZvaQ1FE] ROBBO Scratch Video] &amp;lt;br&amp;gt;[[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2] Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[[https://youtu.be/Dv97KMJkuF0] Arduino IDE Video]]. If the battery is run down, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - relay controller + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5.&amp;lt;/font&amp;gt; Proportional controller.''' Proportional controller is a device whose controlling action depends on the его отклонению от заданного состояния. Принцип действия П-controller основывается на том, что мы находим значение отклонения от заданного состояния, которое назовем '''error''' и обозначим буквой E. Ошибка – это разница между показаниями датчиков линии:&lt;br /&gt;
E = S1 – S2. To obtain the value of controlling action '''U''', we multiply this value by a chosen ratio '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino] Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6.&amp;lt;/font&amp;gt; Пропорционально-дифференциальный controller''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7.&amp;lt;/font&amp;gt; ПИД-controller'''&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||[ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T12:47:53Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1.&amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE of &amp;lt;br&amp;gt;two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;[[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, the robot misses the turns in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2.&amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the line sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half power (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;'''»''' The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch handles the timing data with worse quality than Arduino IDE, therefore we have reduced the number of the ranges to 5 and simplified the action of motors.&amp;lt;br&amp;gt; The motors are rotating forward all the time, with varying power.&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, the robot misses the turn in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||It is important to modify the sketch coded for USB, because at a high speed, the intermediate values of the sensor cannot be handled. &amp;lt;br&amp;gt;We join all the intermediate values. &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, coded for a 5V power supply (USB). &amp;lt;br&amp;gt;Replace the robot's turning time of 0.1 seconds by 0.01 seconds. And increase the time of going ahead up to 0.2 seconds. &amp;lt;br&amp;gt;It is necessary because at a high speed, the robot rushes too fast along the path section where the values of the sensors are changing.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3.&amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor &amp;lt;br&amp;gt;is positioned above the white area and above the black line. &amp;lt;br&amp;gt;The trajectory the robot follows is a  line with long straight sections, and the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (track record!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Description of travelling along the black line with TWO sensors==&lt;br /&gt;
&amp;lt;center&amp;gt;It is impossible to travel along a complicated track with crossings, forks, &amp;quot;zebras&amp;quot;, and inverted sections using only one sensor. &amp;lt;br&amp;gt;When two sensors are used, special algorithms are needed to automate the robot's motion.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4.&amp;lt;/font&amp;gt; Relay controller.''' This algorithm is intended to keep the robot in the position &amp;quot;Both sensors of the robot are above the white line&amp;quot;, &amp;lt;br&amp;gt;that is, to the left and to the right from the black line. If both sensors are above the black line, the robot stops.&amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||When powered by USB, the robot stops at the turn, because both sensors get above the black line. [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
|| When extra powered from the battery, the robot misses the sharp turns, because at a speed, the sensors cannot be above the black line both at the same time. [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0 Arduino IDE Video]. If the battery is run down, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - relay controller + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5.&amp;lt;/font&amp;gt; Proportional controller.''' Proportional controller is a device whose controlling action depends on the его отклонению от заданного состояния. Принцип действия П-controller основывается на том, что мы находим значение отклонения от заданного состояния, которое назовем '''error''' и обозначим буквой E. Ошибка – это разница между показаниями датчиков линии:&lt;br /&gt;
E = S1 – S2. To obtain the value of controlling action '''U''', we multiply this value by a chosen ratio '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino] Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||[[Media:ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch]]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[[Media:Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch]]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6.&amp;lt;/font&amp;gt; Пропорционально-дифференциальный controller''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7.&amp;lt;/font&amp;gt; ПИД-controller'''&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T12:45:14Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1.&amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE of &amp;lt;br&amp;gt;two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;[[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, the robot misses the turns in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2.&amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the line sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half power (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;'''»''' The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch handles the timing data with worse quality than Arduino IDE, therefore we have reduced the number of the ranges to 5 and simplified the action of motors.&amp;lt;br&amp;gt; The motors are rotating forward all the time, with varying power.&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, the robot misses the turn in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||It is important to modify the sketch coded for USB, because at a high speed, the intermediate values of the sensor cannot be handled. &amp;lt;br&amp;gt;We join all the intermediate values. &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, coded for a 5V power supply (USB). &amp;lt;br&amp;gt;Replace the robot's turning time of 0.1 seconds by 0.01 seconds. And increase the time of going ahead up to 0.2 seconds. &amp;lt;br&amp;gt;It is necessary because at a high speed, the robot rushes too fast along the path section where the values of the sensors are changing.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3.&amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor &amp;lt;br&amp;gt;is positioned above the white area and above the black line. &amp;lt;br&amp;gt;The trajectory the robot follows is a  line with long straight sections, and the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (track record!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Description of travelling along the black line with TWO sensors==&lt;br /&gt;
&amp;lt;center&amp;gt;It is impossible to travel along a complicated track with crossings, forks, &amp;quot;zebras&amp;quot;, and inverted sections using only one sensor. &amp;lt;br&amp;gt;When two sensors are used, special algorithms are needed to automate the robot's motion.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4.&amp;lt;/font&amp;gt; Relay controller.''' This algorithm is intended to keep the robot in the position &amp;quot;Both sensors of the robot are above the white line&amp;quot;, &amp;lt;br&amp;gt;that is, to the left and to the right from the black line. If both sensors are above the black line, the robot stops.&amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||When powered by USB, the robot stops at the turn, because both sensors get above the black line. [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
|| When extra powered from the battery, the robot misses the sharp turns, because at a speed, the sensors cannot be above the black line both at the same time. [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0 Arduino IDE Video]. If the battery is run down, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - relay controller + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5.&amp;lt;/font&amp;gt; Proportional controller.''' Proportional controller is a device whose controlling action depends on the его отклонению от заданного состояния. Принцип действия П-controller основывается на том, что мы находим значение отклонения от заданного состояния, которое назовем '''error''' и обозначим буквой E. Ошибка – это разница между показаниями датчиков линии:&lt;br /&gt;
E = S1 – S2. To obtain the value of controlling action '''U''', we multiply this value by a chosen ratio '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[[[Media:http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino]] Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6.&amp;lt;/font&amp;gt; Пропорционально-дифференциальный controller''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Al 7.&amp;lt;/font&amp;gt; ПИД-&amp;lt;/font&amp;gt;con troller'''&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T12:38:29Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1.&amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE of &amp;lt;br&amp;gt;two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;[[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, the robot misses the turns in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2.&amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the line sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half power (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;'''»''' The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch handles the timing data with worse quality than Arduino IDE, therefore we have reduced the number of the ranges to 5 and simplified the action of motors.&amp;lt;br&amp;gt; The motors are rotating forward all the time, with varying power.&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, the robot misses the turn in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||It is important to modify the sketch coded for USB, because at a high speed, the intermediate values of the sensor cannot be handled. &amp;lt;br&amp;gt;We join all the intermediate values. &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, coded for a 5V power supply (USB). &amp;lt;br&amp;gt;Replace the robot's turning time of 0.1 seconds by 0.01 seconds. And increase the time of going ahead up to 0.2 seconds. &amp;lt;br&amp;gt;It is necessary because at a high speed, the robot rushes too fast along the path section where the values of the sensors are changing.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3.&amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor &amp;lt;br&amp;gt;is positioned above the white area and above the black line. &amp;lt;br&amp;gt;The trajectory the robot follows is a  line with long straight sections, and the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (track record!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Description of travelling along the black line with TWO sensors==&lt;br /&gt;
&amp;lt;center&amp;gt;It is impossible to travel along a complicated track with crossings, forks, &amp;quot;zebras&amp;quot;, and inverted sections using only one sensor. &amp;lt;br&amp;gt;When two sensors are used, special algorithms are needed to automate the robot's motion.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4.&amp;lt;/font&amp;gt; Relay controller.''' This algorithm is intended to keep the robot in the position &amp;quot;Both sensors of the robot are above the white line&amp;quot;, &amp;lt;br&amp;gt;that is, to the left and to the right from the black line. If both sensors are above the black line, the robot stops.&amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||When powered by USB, the robot stops at the turn, because both sensors get above the black line. [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
|| When extra powered from the battery, the robot misses the sharp turns, because at a speed, the sensors cannot be above the black line both at the same time. [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0 Arduino IDE Video]. If the battery is run down, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - relay controller + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5.&amp;lt;/font&amp;gt; Proportional controller.''' Proportional controller is a device whose controlling action depends on the его отклонению от заданного состояния. Принцип действия П-controller основывается на том, что мы находим значение отклонения от заданного состояния, которое назовем '''error''' и обозначим буквой E. Ошибка – это разница между показаниями датчиков линии:&lt;br /&gt;
E = S1 – S2. To obtain the value of controlling action '''U''', we multiply this value by a chosen ratio '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6&amp;lt;/font&amp;gt; Пропорционально-дифференциальный controller''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7 ПИД-controller&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T12:36:56Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1.&amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE of &amp;lt;br&amp;gt;two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;[[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, the robot misses the turns in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2.&amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the line sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half power (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;'''»''' The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch handles the timing data with worse quality than Arduino IDE, therefore we have reduced the number of the ranges to 5 and simplified the action of motors.&amp;lt;br&amp;gt; The motors are rotating forward all the time, with varying power.&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, the robot misses the turn in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||It is important to modify the sketch coded for USB, because at a high speed, the intermediate values of the sensor cannot be handled. &amp;lt;br&amp;gt;We join all the intermediate values. &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, coded for a 5V power supply (USB). &amp;lt;br&amp;gt;Replace the robot's turning time of 0.1 seconds by 0.01 seconds. And increase the time of going ahead up to 0.2 seconds. &amp;lt;br&amp;gt;It is necessary because at a high speed, the robot rushes too fast along the path section where the values of the sensors are changing.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3.&amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor &amp;lt;br&amp;gt;is positioned above the white area and above the black line. &amp;lt;br&amp;gt;The trajectory the robot follows is a  line with long straight sections, and the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (track record!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Description of travelling along the black line with TWO sensors==&lt;br /&gt;
&amp;lt;center&amp;gt;It is impossible to travel along a complicated track with crossings, forks, &amp;quot;zebras&amp;quot;, and inverted sections using only one sensor. &amp;lt;br&amp;gt;When two sensors are used, special algorithms are needed to automate the robot's motion.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4.&amp;lt;/font&amp;gt; Relay controller.''' This algorithm is intended to keep the robot in the position &amp;quot;Both sensors of the robot are above the white line&amp;quot;, that is, to the left and to the right from the black line. If both sensors are above the black line, the robot stops.&amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||When powered by USB, the robot stops at the turn, because both sensors get above the black line. [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
|| When extra powered from the battery, the robot misses the sharp turns, because at a speed, the sensors cannot be above the black line both at the same time. [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0 Arduino IDE Video]. If the battery is run down, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - relay controller + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5.&amp;lt;/font&amp;gt; Proportional controller.''' Proportional controller is a device whose controlling action depends on the его отклонению от заданного состояния. Принцип действия П-controller основывается на том, что мы находим значение отклонения от заданного состояния, которое назовем '''error''' и обозначим буквой E. Ошибка – это разница между показаниями датчиков линии:&lt;br /&gt;
E = S1 – S2. To obtain the value of controlling action '''U''', we multiply this value by a chosen ratio '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6&amp;lt;/font&amp;gt; Пропорционально-дифференциальный controller''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7 ПИД-controller&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T12:32:16Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1.&amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE of &amp;lt;br&amp;gt;two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;[[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, the robot misses the turns in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2.&amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the line sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half power (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;'''»''' The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch handles the timing data with worse quality than Arduino IDE, therefore we have reduced the number of the ranges to 5 and simplified the action of motors.&amp;lt;br&amp;gt; The motors are rotating forward all the time, with varying power.&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, the robot misses the turn in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||It is important to modify the sketch coded for USB, because at a high speed, the intermediate values of the sensor cannot be handled. &amp;lt;br&amp;gt;We join all the intermediate values. &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, coded for a 5V power supply (USB). &amp;lt;br&amp;gt;Replace the robot's turning time of 0.1 seconds by 0.01 seconds. And increase the time of going ahead up to 0.2 seconds. &amp;lt;br&amp;gt;It is necessary because at a high speed, the robot rushes too fast along the path section where the values of the sensors are changing.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3.&amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor &amp;lt;br&amp;gt;is positioned above the white area and above the black line. &amp;lt;br&amp;gt;The trajectory the robot follows is a  line with long straight sections, and the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (track record!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Description of travelling along the black line with TWO sensors==&lt;br /&gt;
It is impossible to travel along a complicated track with crossings, forks, &amp;quot;zebras&amp;quot;, and inverted sections using only one sensor. When two sensors are used, special algorithms are needed to automate the robot's motion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4.&amp;lt;/font&amp;gt; Relay controller.''' Задача этого алгоритма to keep the robot in the position &amp;quot;Both sensors of the robot are above the white line&amp;quot;, that is, to the left and to the right from the black line. If both sensors are above the black line, the robot stops.&amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||When powered by USB, the robot stops at the turn, because both sensors get above the black line. [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
|| When extra powered from the battery, the robot misses the sharp turns, because at a speed, the sensors cannot be above the black line both at the same time. [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0 Arduino IDE Video]. If the battery is run down, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - relay controller + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5.&amp;lt;/font&amp;gt; Proportional controller.''' Proportional controller is a device whose controlling action depends on the его отклонению от заданного состояния. Принцип действия П-controller основывается на том, что мы находим значение отклонения от заданного состояния, которое назовем '''error''' и обозначим буквой E. Ошибка – это разница между показаниями датчиков линии:&lt;br /&gt;
E = S1 – S2. To obtain the value of controlling action '''U''', we multiply this value by a chosen ratio '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6&amp;lt;/font&amp;gt; Пропорционально-дифференциальный controller''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7 ПИД-controller&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T12:30:37Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1.&amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE of &amp;lt;br&amp;gt;two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;[[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, the robot misses the turns in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2.&amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the line sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half power (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;'''»''' The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch handles the timing data worse than Arduino IDE, therefore&amp;lt;br&amp;gt; we have reduced the number of the ranges to 5 &amp;lt;br&amp;gt; and simplified the action of motors.&amp;lt;br&amp;gt; The motors are rotating forward all the time, with varying power.&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, the robot misses the turn in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||It is important to modify the sketch coded for USB, because at a high speed, the intermediate values of the sensor cannot be handled. &amp;lt;br&amp;gt;We join all the intermediate values. &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, coded for a 5V power supply (USB). &amp;lt;br&amp;gt;Replace the robot's turning time of 0.1 seconds by 0.01 seconds. And increase the time of going ahead up to 0.2 seconds. &amp;lt;br&amp;gt;It is necessary because at a high speed, the robot rushes too fast along the path section where the values of the sensors are changing.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3.&amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor &amp;lt;br&amp;gt;is positioned above the white area and above the black line. &amp;lt;br&amp;gt;The trajectory the robot follows is a  line with long straight sections, and the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (track record!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Description of travelling along the black line with TWO sensors==&lt;br /&gt;
It is impossible to travel along a complicated track with crossings, forks, &amp;quot;zebras&amp;quot;, and inverted sections using only one sensor. When two sensors are used, special algorithms are needed to automate the robot's motion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4.&amp;lt;/font&amp;gt; Relay controller.''' Задача этого алгоритма to keep the robot in the position &amp;quot;Both sensors of the robot are above the white line&amp;quot;, that is, to the left and to the right from the black line. If both sensors are above the black line, the robot stops.&amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||When powered by USB, the robot stops at the turn, because both sensors get above the black line. [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
|| When extra powered from the battery, the robot misses the sharp turns, because at a speed, the sensors cannot be above the black line both at the same time. [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0 Arduino IDE Video]. If the battery is run down, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - relay controller + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5.&amp;lt;/font&amp;gt; Proportional controller.''' Proportional controller is a device whose controlling action depends on the его отклонению от заданного состояния. Принцип действия П-controller основывается на том, что мы находим значение отклонения от заданного состояния, которое назовем '''error''' и обозначим буквой E. Ошибка – это разница между показаниями датчиков линии:&lt;br /&gt;
E = S1 – S2. To obtain the value of controlling action '''U''', we multiply this value by a chosen ratio '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6&amp;lt;/font&amp;gt; Пропорционально-дифференциальный controller''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7 ПИД-controller&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T12:29:24Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1.&amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE of &amp;lt;br&amp;gt;two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;[[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, the robot misses the turns in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2.&amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half power (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;'''»''' The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch handles the timing data worse than Arduino IDE, therefore&amp;lt;br&amp;gt; we have reduced the number of the ranges to 5 &amp;lt;br&amp;gt; and simplified the action of motors.&amp;lt;br&amp;gt; The motors are rotating forward all the time, with varying power.&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, the robot misses the turn in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||It is important to modify the sketch coded for USB, because at a high speed, the intermediate values of the sensor cannot be handled. &amp;lt;br&amp;gt;We join all the intermediate values. &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, coded for a 5V power supply (USB). &amp;lt;br&amp;gt;Replace the robot's turning time of 0.1 seconds by 0.01 seconds. And increase the time of going ahead up to 0.2 seconds. &amp;lt;br&amp;gt;It is necessary because at a high speed, the robot rushes too fast along the path section where the values of the sensors are changing.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3.&amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor &amp;lt;br&amp;gt;is positioned above the white area and above the black line. &amp;lt;br&amp;gt;The trajectory the robot follows is a  line with long straight sections, and the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (track record!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Description of travelling along the black line with TWO sensors==&lt;br /&gt;
It is impossible to travel along a complicated track with crossings, forks, &amp;quot;zebras&amp;quot;, and inverted sections using only one sensor. When two sensors are used, special algorithms are needed to automate the robot's motion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4.&amp;lt;/font&amp;gt; Relay controller.''' Задача этого алгоритма to keep the robot in the position &amp;quot;Both sensors of the robot are above the white line&amp;quot;, that is, to the left and to the right from the black line. If both sensors are above the black line, the robot stops.&amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||When powered by USB, the robot stops at the turn, because both sensors get above the black line. [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
|| When extra powered from the battery, the robot misses the sharp turns, because at a speed, the sensors cannot be above the black line both at the same time. [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0 Arduino IDE Video]. If the battery is run down, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - relay controller + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5.&amp;lt;/font&amp;gt; Proportional controller.''' Proportional controller is a device whose controlling action depends on the его отклонению от заданного состояния. Принцип действия П-controller основывается на том, что мы находим значение отклонения от заданного состояния, которое назовем '''error''' и обозначим буквой E. Ошибка – это разница между показаниями датчиков линии:&lt;br /&gt;
E = S1 – S2. To obtain the value of controlling action '''U''', we multiply this value by a chosen ratio '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6&amp;lt;/font&amp;gt; Пропорционально-дифференциальный controller''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7 ПИД-controller&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T12:18:44Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1. &amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE of &amp;lt;br&amp;gt;two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;[[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, the robot misses the turns in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2 &amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half power (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;'''»''' The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch handles the timing data worse than Arduino IDE, therefore&amp;lt;br&amp;gt; we have reduced the number of the ranges to 5 &amp;lt;br&amp;gt; and simplified the action of motors.&amp;lt;br&amp;gt; The motors are rotating forward all the time, with varying power.&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, the robot misses the turn in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||It is important to modify the sketch coded for USB, because at a high speed, the intermediate values of the sensor cannot be handled. &amp;lt;br&amp;gt;We join all the intermediate values &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, coded for a 5V power supply (USB). &amp;lt;br&amp;gt;Replace the time of 0.1 seconds when robot turning by 0.01 seconds. А время движения прямо увеличить до  200 milliseconds. &amp;lt;br&amp;gt; It is necessary because at a high speed, the robot rushes too fast along the path section where the values of the sensors are changing.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3 &amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor &amp;lt;br&amp;gt;is positioned above the white area and above the black line. &amp;lt;br&amp;gt; The trajectory the robot follows is a  line with long straight sections, and the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (track record!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Description of travelling along the black line with TWO sensors==&lt;br /&gt;
It is impossible to travel along a complicated track with crossings, forks, &amp;quot;zebras&amp;quot;, and inverted sections using only one sensor. When two sensors are connected, special algorithms are needed to automate the robot's motion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4 &amp;lt;/font&amp;gt; Relay controller.''' Задача этого алгоритма to keep the robot in the position &amp;quot;Both sensors of the robot are above the white line&amp;quot;, that is, to the left and to the right from the black line. If both sensors are above the black line, the robot stops.&amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||When powered by USB, the robot stops at the turn, because both sensors get above the black line. [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
|| When extra powered &amp;lt;br&amp;gt;from the battery, the robot &amp;lt;br&amp;gt;cuts the sharp turning off, &amp;lt;br&amp;gt;because at a speed, &amp;lt;br&amp;gt;the sensors cannot be &amp;lt;br&amp;gt;above the black line both at the same time [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0 Arduino IDE Video]. If the battery is run down, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - простой релейный регулятор + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5&amp;lt;/font&amp;gt; Proportional controller/''' Proportional controller is a device that оказывающее управляющее воздействие на объект ''пропорционально'' его отклонению от заданного состояния. Принцип действия П-регулятора основывается на том, что мы находим значение отклонения от заданного состояния, которое назовем '''error''' и обозначим буквой E. Ошибка – это разница между показаниями датчиков линии:&lt;br /&gt;
E = S1 – S2. To obtain the value of controlling action '''U''', we multiply this value by a chosen ratio '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6&amp;lt;/font&amp;gt; Пропорционально-дифференциальный регулятор''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7 ПИД-регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T11:48:11Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1. &amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;[[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, the robot misses the turns in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2 &amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;'''»''' The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch хуже, чем Arduino IDE &amp;lt;br&amp;gt; обрабатывает время движения, поэтому &amp;lt;br&amp;gt; количество диапазонов мы сократили до 5 &amp;lt;br&amp;gt; и упростили движение моторов.&amp;lt;br&amp;gt;  Они все время двигаются вперед с&amp;lt;br&amp;gt; разной мощностью&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, the robot misses the turn in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||It is important to modify the sketch coded for USB, because at a high speed, the in-between values of the sensor cannot be handled. &amp;lt;br&amp;gt;Объединяем все промежуточные значения &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, coded for a 5V power supply (USB). &amp;lt;br&amp;gt;Заменить время движения робота в поворотах со 100 до &amp;lt;br&amp;gt;10 milliseconds. А время движения прямо увеличить до  200 milliseconds. &amp;lt;br&amp;gt; It is necessary because at a high speed, the robot rushes too fast along the path section where the values of the sensors are changing.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3 &amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor &amp;lt;br&amp;gt;is positioned above the white area and above the black line. &amp;lt;br&amp;gt; The trajectory the robot follows is a  line with long straight sections, and the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (track record!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Описание проезда по чёрной линии с ДВУМЯ датчиками==&lt;br /&gt;
Сложную трассу с перекрестками, ответвлениями, &amp;quot;зебрами&amp;quot; и инверсными участками с одним датчиком проехать невозможно. При подключении двух датчиков требуется использовани специальных алгоритмов, которые автоматизируют движение робота.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4. - Релейный регулятор  &amp;lt;/font&amp;gt;''' Задача этого алгоритма - удерживать робота в положении &amp;quot;Оба датчика робота находятся над белой линией&amp;quot;, т.е. слева и справа от чёрной линии. Если оба датчика попадают на черную линию, the robot останавливается   &amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||При питании от USB робот &amp;lt;br&amp;gt;останавливается на повороте, &amp;lt;br&amp;gt;т.к. оба датчика оказываются&amp;lt;br&amp;gt; на черной линии [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
|| When extra powered &amp;lt;br&amp;gt;from the battery, the robot &amp;lt;br&amp;gt;cuts the sharp turning off, &amp;lt;br&amp;gt;because at a speed, &amp;lt;br&amp;gt;the sensors cannot be &amp;lt;br&amp;gt;above the black line both at the same time [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0 Arduino IDE Video]. If the battery is run down, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - простой релейный регулятор + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5 Пропорциональный регулятор &amp;lt;/font&amp;gt;''' Пропорциональный̆ регулятор is a device that оказывающее управляющее воздействие на объект ''пропорционально'' его отклонению от заданного состояния. Принцип действия П-регулятора основывается на том, что мы находим значение отклонения от заданного состояния, которое назовем '''error''' и обозначим буквой E. Ошибка – это разница между показаниями датчиков линии:&lt;br /&gt;
E = S1 – S2. To obtain the value of controlling action '''U''', we multiply this value by a chosen ratio '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6 Пропорционально-дифференциальный регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7 ПИД-регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T11:47:11Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1. &amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;[[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, &amp;lt;br&amp;gt; two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, the robot misses the turns in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2 &amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;'''»''' The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch хуже, чем Arduino IDE &amp;lt;br&amp;gt; обрабатывает время движения, поэтому &amp;lt;br&amp;gt; количество диапазонов мы сократили до 5 &amp;lt;br&amp;gt; и упростили движение моторов.&amp;lt;br&amp;gt;  Они все время двигаются вперед с&amp;lt;br&amp;gt; разной мощностью&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, the robot misses the turn in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||It is important to modify the sketch coded for USB, because at a high speed, the in-between values of the sensor cannot be handled. &amp;lt;br&amp;gt;Объединяем все промежуточные значения &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, coded for a 5V power supply (USB). &amp;lt;br&amp;gt;Заменить время движения робота в поворотах со 100 до &amp;lt;br&amp;gt;10 milliseconds. А время движения прямо увеличить до  200 milliseconds. &amp;lt;br&amp;gt; It is necessary because at a high speed, the robot rushes too fast along the path section where the values of the sensors are changing.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3 &amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor &amp;lt;br&amp;gt;is positioned above the white area and above the black line. &amp;lt;br&amp;gt; The trajectory the robot follows is a  line with long straight sections, and the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (track record!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Описание проезда по чёрной линии с ДВУМЯ датчиками==&lt;br /&gt;
Сложную трассу с перекрестками, ответвлениями, &amp;quot;зебрами&amp;quot; и инверсными участками с одним датчиком проехать невозможно. При подключении двух датчиков требуется использовани специальных алгоритмов, которые автоматизируют движение робота.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4. - Релейный регулятор  &amp;lt;/font&amp;gt;''' Задача этого алгоритма - удерживать робота в положении &amp;quot;Оба датчика робота находятся над белой линией&amp;quot;, т.е. слева и справа от чёрной линии. Если оба датчика попадают на черную линию, the robot останавливается   &amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||При питании от USB робот &amp;lt;br&amp;gt;останавливается на повороте, &amp;lt;br&amp;gt;т.к. оба датчика оказываются&amp;lt;br&amp;gt; на черной линии [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
|| When extra powered &amp;lt;br&amp;gt;from the battery, the robot &amp;lt;br&amp;gt;cuts the sharp turning off, &amp;lt;br&amp;gt;because at a speed, &amp;lt;br&amp;gt;the sensors cannot be &amp;lt;br&amp;gt;above the black line both at the same time [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0 Arduino IDE Video]. If the battery is run down, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - простой релейный регулятор + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5 Пропорциональный регулятор &amp;lt;/font&amp;gt;''' Пропорциональный̆ регулятор is a device that оказывающее управляющее воздействие на объект ''пропорционально'' его отклонению от заданного состояния. Принцип действия П-регулятора основывается на том, что мы находим значение отклонения от заданного состояния, которое назовем '''error''' и обозначим буквой E. Ошибка – это разница между показаниями датчиков линии:&lt;br /&gt;
E = S1 – S2. To obtain the value of controlling action '''U''', we multiply this value by a chosen ratio '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6 Пропорционально-дифференциальный регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7 ПИД-регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T11:46:34Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1. &amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;  [[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, &amp;lt;br&amp;gt; two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, the robot misses the turns in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2 &amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;'''»''' The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch хуже, чем Arduino IDE &amp;lt;br&amp;gt; обрабатывает время движения, поэтому &amp;lt;br&amp;gt; количество диапазонов мы сократили до 5 &amp;lt;br&amp;gt; и упростили движение моторов.&amp;lt;br&amp;gt;  Они все время двигаются вперед с&amp;lt;br&amp;gt; разной мощностью&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, the robot misses the turn in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||It is important to modify the sketch coded for USB, because at a high speed, the in-between values of the sensor cannot be handled. &amp;lt;br&amp;gt;Объединяем все промежуточные значения &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, coded for a 5V power supply (USB). &amp;lt;br&amp;gt;Заменить время движения робота в поворотах со 100 до &amp;lt;br&amp;gt;10 milliseconds. А время движения прямо увеличить до  200 milliseconds. &amp;lt;br&amp;gt; It is necessary because at a high speed, the robot rushes too fast along the path section where the values of the sensors are changing.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3 &amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor &amp;lt;br&amp;gt;is positioned above the white area and above the black line. &amp;lt;br&amp;gt; The trajectory the robot follows is a  line with long straight sections, and the robot can travel all along without slowing down.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (track record!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Описание проезда по чёрной линии с ДВУМЯ датчиками==&lt;br /&gt;
Сложную трассу с перекрестками, ответвлениями, &amp;quot;зебрами&amp;quot; и инверсными участками с одним датчиком проехать невозможно. При подключении двух датчиков требуется использовани специальных алгоритмов, которые автоматизируют движение робота.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4. - Релейный регулятор  &amp;lt;/font&amp;gt;''' Задача этого алгоритма - удерживать робота в положении &amp;quot;Оба датчика робота находятся над белой линией&amp;quot;, т.е. слева и справа от чёрной линии. Если оба датчика попадают на черную линию, the robot останавливается   &amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||При питании от USB робот &amp;lt;br&amp;gt;останавливается на повороте, &amp;lt;br&amp;gt;т.к. оба датчика оказываются&amp;lt;br&amp;gt; на черной линии [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
|| When extra powered &amp;lt;br&amp;gt;from the battery, the robot &amp;lt;br&amp;gt;cuts the sharp turning off, &amp;lt;br&amp;gt;because at a speed, &amp;lt;br&amp;gt;the sensors cannot be &amp;lt;br&amp;gt;above the black line both at the same time [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0 Arduino IDE Video]. If the battery is run down, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - простой релейный регулятор + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5 Пропорциональный регулятор &amp;lt;/font&amp;gt;''' Пропорциональный̆ регулятор is a device that оказывающее управляющее воздействие на объект ''пропорционально'' его отклонению от заданного состояния. Принцип действия П-регулятора основывается на том, что мы находим значение отклонения от заданного состояния, которое назовем '''error''' и обозначим буквой E. Ошибка – это разница между показаниями датчиков линии:&lt;br /&gt;
E = S1 – S2. To obtain the value of controlling action '''U''', we multiply this value by a chosen ratio '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6 Пропорционально-дифференциальный регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7 ПИД-регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T11:44:04Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1. &amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;  [[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, &amp;lt;br&amp;gt; two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, the robot misses the turns in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2 &amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;'''»''' The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down. &amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch хуже, чем Arduino IDE &amp;lt;br&amp;gt; обрабатывает время движения, поэтому &amp;lt;br&amp;gt; количество диапазонов мы сократили до 5 &amp;lt;br&amp;gt; и упростили движение моторов.&amp;lt;br&amp;gt;  Они все время двигаются вперед с&amp;lt;br&amp;gt; разной мощностью&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, the robot misses the turn in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||It is important to modify the sketch coded for USB, &amp;lt;br&amp;gt;because at a high speed, the in-between values of the sensor cannot be handled. &amp;lt;br&amp;gt;Объединяем все промежуточные значения &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, coded for a 5V power supply (USB). &amp;lt;br&amp;gt;Заменить время движения робота в поворотах со 100 до &amp;lt;br&amp;gt;10 milliseconds. А время движения прямо&amp;lt;br&amp;gt; увеличить до  200 milliseconds. &amp;lt;br&amp;gt; It is necessary because &amp;lt;br&amp;gt; at a high speed, the robot rushes too fast &amp;lt;br&amp;gt;along the path section where the values of the sensors are changing.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3 &amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor &amp;lt;br&amp;gt;is positioned above the white area and above the black line. &amp;lt;br&amp;gt; The trajectory the robot follows is a  line with long straight sections, and the robot can travel all along without slowing down. &amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (track record!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Описание проезда по чёрной линии с ДВУМЯ датчиками==&lt;br /&gt;
Сложную трассу с перекрестками, ответвлениями, &amp;quot;зебрами&amp;quot; и инверсными участками с одним датчиком проехать невозможно. При подключении двух датчиков требуется использовани специальных алгоритмов, которые автоматизируют движение робота.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4. - Релейный регулятор  &amp;lt;/font&amp;gt;''' Задача этого алгоритма - удерживать робота в положении &amp;quot;Оба датчика робота находятся над белой линией&amp;quot;, т.е. слева и справа от чёрной линии. Если оба датчика попадают на черную линию, the robot останавливается   &amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||При питании от USB робот &amp;lt;br&amp;gt;останавливается на повороте, &amp;lt;br&amp;gt;т.к. оба датчика оказываются&amp;lt;br&amp;gt; на черной линии [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
|| When extra powered &amp;lt;br&amp;gt;from the battery, the robot &amp;lt;br&amp;gt;cuts the sharp turning off, &amp;lt;br&amp;gt;because at a speed, &amp;lt;br&amp;gt;the sensors cannot be &amp;lt;br&amp;gt;above the black line both at the same time [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0 Arduino IDE Video]. If the battery is run down, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - простой релейный регулятор + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5 Пропорциональный регулятор &amp;lt;/font&amp;gt;''' Пропорциональный̆ регулятор is a device that оказывающее управляющее воздействие на объект ''пропорционально'' его отклонению от заданного состояния. Принцип действия П-регулятора основывается на том, что мы находим значение отклонения от заданного состояния, которое назовем '''error''' и обозначим буквой E. Ошибка – это разница между показаниями датчиков линии:&lt;br /&gt;
E = S1 – S2. To obtain the value of controlling action '''U''', we multiply this value by a chosen ratio '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6 Пропорционально-дифференциальный регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7 ПИД-регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T11:39:04Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1. &amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;  [[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, &amp;lt;br&amp;gt; two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, the robot misses the turns in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2 &amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;'''»''' The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down. &amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch хуже, чем Arduino IDE &amp;lt;br&amp;gt; обрабатывает время движения, поэтому &amp;lt;br&amp;gt; количество диапазонов мы сократили до 5 &amp;lt;br&amp;gt; и упростили движение моторов.&amp;lt;br&amp;gt;  Они все время двигаются вперед с&amp;lt;br&amp;gt; разной мощностью&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, the robot misses the turn in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||It is important to modify the sketch coded for USB, &amp;lt;br&amp;gt;because at a high speed, the in-between values of the sensor &amp;lt;br&amp;gt;cannot be handled. Объединяем все&amp;lt;br&amp;gt; промежуточные значения &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, coded for a 5V power supply (USB). &amp;lt;br&amp;gt;Заменить время движения робота в поворотах со 100 до &amp;lt;br&amp;gt;10 milliseconds. А время движения прямо&amp;lt;br&amp;gt; увеличить до  200 milliseconds. &amp;lt;br&amp;gt; It is necessary because &amp;lt;br&amp;gt; at a high speed, the robot rushes too fast &amp;lt;br&amp;gt;along the path section where the values of the sensors are changing.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3 &amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor &amp;lt;br&amp;gt;is positioned above the white area and above the black line. &amp;lt;br&amp;gt; The trajectory the robot follows is a  line with long straight sections, and the robot can travel all along without slowing down. &amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (track record!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Описание проезда по чёрной линии с ДВУМЯ датчиками==&lt;br /&gt;
Сложную трассу с перекрестками, ответвлениями, &amp;quot;зебрами&amp;quot; и инверсными участками с одним датчиком проехать невозможно. При подключении двух датчиков требуется использовани специальных алгоритмов, которые автоматизируют движение робота.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4. - Релейный регулятор  &amp;lt;/font&amp;gt;''' Задача этого алгоритма - удерживать робота в положении &amp;quot;Оба датчика робота находятся над белой линией&amp;quot;, т.е. слева и справа от чёрной линии. Если оба датчика попадают на черную линию, the robot останавливается   &amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||При питании от USB робот &amp;lt;br&amp;gt;останавливается на повороте, &amp;lt;br&amp;gt;т.к. оба датчика оказываются&amp;lt;br&amp;gt; на черной линии [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
|| When extra powered &amp;lt;br&amp;gt;from the battery, the robot &amp;lt;br&amp;gt;cuts the sharp turning off, &amp;lt;br&amp;gt;because at a speed, &amp;lt;br&amp;gt;the sensors cannot be &amp;lt;br&amp;gt;above the black line both at the same time [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0 Arduino IDE Video]. If the battery is run down, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - простой релейный регулятор + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5 Пропорциональный регулятор &amp;lt;/font&amp;gt;''' Пропорциональный̆ регулятор is a device that оказывающее управляющее воздействие на объект ''пропорционально'' его отклонению от заданного состояния. Принцип действия П-регулятора основывается на том, что мы находим значение отклонения от заданного состояния, которое назовем '''error''' и обозначим буквой E. Ошибка – это разница между показаниями датчиков линии:&lt;br /&gt;
E = S1 – S2. To obtain the value of controlling action '''U''', we multiply this value by a chosen ratio '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6 Пропорционально-дифференциальный регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7 ПИД-регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T11:14:52Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1. &amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;  [[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, &amp;lt;br&amp;gt; two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, the robot misses the turns in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2 &amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;» The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down. &amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch хуже, чем Arduino IDE &amp;lt;br&amp;gt; обрабатывает время движения, поэтому &amp;lt;br&amp;gt; количество диапазонов мы сократили до 5 &amp;lt;br&amp;gt; и упростили движение моторов.&amp;lt;br&amp;gt;  Они все время двигаются вперед с&amp;lt;br&amp;gt; разной мощностью&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, the robot misses the turn in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||It is important to modify the sketch coded for USB, &amp;lt;br&amp;gt;because at a high speed, the in-between values of the sensor &amp;lt;br&amp;gt;cannot be handled. Объединяем все&amp;lt;br&amp;gt; промежуточные значения &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, coded for a 5V power supply (USB). &amp;lt;br&amp;gt;Заменить время движения робота в поворотах со 100 до &amp;lt;br&amp;gt;10 milliseconds. А время движения прямо&amp;lt;br&amp;gt; увеличить до  200 milliseconds. &amp;lt;br&amp;gt; It is necessary because &amp;lt;br&amp;gt; at a high speed, the robot rushes too fast &amp;lt;br&amp;gt;along the path section where the values of the sensors are changing.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3 &amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor &amp;lt;br&amp;gt;is positioned above the white area and above the black line. &amp;lt;br&amp;gt; The trajectory the robot follows is a  line with long straight sections, and the robot can travel all along without slowing down. &amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (track record!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Описание проезда по чёрной линии с ДВУМЯ датчиками==&lt;br /&gt;
Сложную трассу с перекрестками, ответвлениями, &amp;quot;зебрами&amp;quot; и инверсными участками с одним датчиком проехать невозможно. При подключении двух датчиков требуется использовани специальных алгоритмов, которые автоматизируют движение робота.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4. - Релейный регулятор  &amp;lt;/font&amp;gt;''' Задача этого алгоритма - удерживать робота в положении &amp;quot;Оба датчика робота находятся над белой линией&amp;quot;, т.е. слева и справа от чёрной линии. Если оба датчика попадают на черную линию, the robot останавливается   &amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||При питании от USB робот &amp;lt;br&amp;gt;останавливается на повороте, &amp;lt;br&amp;gt;т.к. оба датчика оказываются&amp;lt;br&amp;gt; на черной линии [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
|| When extra powered &amp;lt;br&amp;gt;from the battery, the robot &amp;lt;br&amp;gt;cuts the sharp turning off, &amp;lt;br&amp;gt;because at a speed, &amp;lt;br&amp;gt;the sensors cannot be &amp;lt;br&amp;gt;above the black line both at the same time [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0 Arduino IDE Video]. If the battery is run down, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - простой релейный регулятор + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5 Пропорциональный регулятор &amp;lt;/font&amp;gt;''' Пропорциональный̆ регулятор is a device that оказывающее управляющее воздействие на объект ''пропорционально'' его отклонению от заданного состояния. Принцип действия П-регулятора основывается на том, что мы находим значение отклонения от заданного состояния, которое назовем '''error''' и обозначим буквой E. Ошибка – это разница между показаниями датчиков линии:&lt;br /&gt;
E = S1 – S2. To obtain the value of controlling action '''U''', we multiply this value by a chosen ratio '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6 Пропорционально-дифференциальный регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7 ПИД-регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T11:10:50Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1. &amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;  [[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, &amp;lt;br&amp;gt; two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, &amp;lt;br&amp;gt;the robot cuts off the corners &amp;lt;br&amp;gt;in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2 &amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;» The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down. &amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch хуже, чем Arduino IDE &amp;lt;br&amp;gt; обрабатывает время движения, поэтому &amp;lt;br&amp;gt; количество диапазонов мы сократили до 5 &amp;lt;br&amp;gt; и упростили движение моторов.&amp;lt;br&amp;gt;  Они все время двигаются вперед с&amp;lt;br&amp;gt; разной мощностью&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, the robot misses the turn in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||It is important to modify the sketch coded for USB, &amp;lt;br&amp;gt;because at a high speed, the in-between values of the sensor &amp;lt;br&amp;gt;cannot be handled. Объединяем все&amp;lt;br&amp;gt; промежуточные значения &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, coded for a 5V power supply (USB). &amp;lt;br&amp;gt;Заменить время движения робота в поворотах со 100 до &amp;lt;br&amp;gt;10 milliseconds. А время движения прямо&amp;lt;br&amp;gt; увеличить до  200 milliseconds. &amp;lt;br&amp;gt; It is necessary because &amp;lt;br&amp;gt; at a high speed, the robot rushes too fast &amp;lt;br&amp;gt;along the path section, where the values of the sensors are changing&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3 &amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor &amp;lt;br&amp;gt;is positioned above the white area and above the black line. &amp;lt;br&amp;gt; The trajectory the robot follows is a  line with long straight sections, and the robot can travel all along without slowing down. &amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (рекорд трассы!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Описание проезда по чёрной линии с ДВУМЯ датчиками==&lt;br /&gt;
Сложную трассу с перекрестками, ответвлениями, &amp;quot;зебрами&amp;quot; и инверсными участками с одним датчиком проехать невозможно. При подключении двух датчиков требуется использовани специальных алгоритмов, которые автоматизируют движение робота.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4. - Релейный регулятор  &amp;lt;/font&amp;gt;''' Задача этого алгоритма - удерживать робота в положении &amp;quot;Оба датчика робота находятся над белой линией&amp;quot;, т.е. слева и справа от чёрной линии. Если оба датчика попадают на черную линию, the robot останавливается   &amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||При питании от USB робот &amp;lt;br&amp;gt;останавливается на повороте, &amp;lt;br&amp;gt;т.к. оба датчика оказываются&amp;lt;br&amp;gt; на черной линии [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
|| When extra powered &amp;lt;br&amp;gt;from the battery, the robot &amp;lt;br&amp;gt;cuts the sharp turning off, &amp;lt;br&amp;gt;because at a speed, &amp;lt;br&amp;gt;the sensors cannot be &amp;lt;br&amp;gt;above the black line both at the same time [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0 Arduino IDE Video]. If the battery is run down, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - простой релейный регулятор + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5 Пропорциональный регулятор &amp;lt;/font&amp;gt;''' Пропорциональный̆ регулятор is a device that оказывающее управляющее воздействие на объект ''пропорционально'' его отклонению от заданного состояния. Принцип действия П-регулятора основывается на том, что мы находим значение отклонения от заданного состояния, которое назовем '''error''' и обозначим буквой E. Ошибка – это разница между показаниями датчиков линии:&lt;br /&gt;
E = S1 – S2. To obtain the value of controlling action '''U''', we multiply this value by a chosen ratio '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6 Пропорционально-дифференциальный регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7 ПИД-регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T11:08:51Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1. &amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;  [[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, &amp;lt;br&amp;gt; two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, &amp;lt;br&amp;gt;the robot cuts off the corners &amp;lt;br&amp;gt;in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2 &amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;» The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down. &amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch хуже, чем Arduino IDE &amp;lt;br&amp;gt; обрабатывает время движения, поэтому &amp;lt;br&amp;gt; количество диапазонов мы сократили до 5 &amp;lt;br&amp;gt; и упростили движение моторов.&amp;lt;br&amp;gt;  Они все время двигаются вперед с&amp;lt;br&amp;gt; разной мощностью&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, &amp;lt;br&amp;gt;the robot проскакивает поворот &amp;lt;br&amp;gt; in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||It is important to modify the sketch coded for USB, &amp;lt;br&amp;gt;because at a high speed, the in-between values of the sensor &amp;lt;br&amp;gt;cannot be handled. Объединяем все&amp;lt;br&amp;gt; промежуточные значения &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, coded for a 5V power supply (USB). &amp;lt;br&amp;gt;Заменить время движения робота в поворотах со 100 до &amp;lt;br&amp;gt;10 milliseconds. А время движения прямо&amp;lt;br&amp;gt; увеличить до  200 milliseconds. &amp;lt;br&amp;gt; It is necessary because &amp;lt;br&amp;gt; at a high speed, the robot rushes too fast &amp;lt;br&amp;gt;along the path section, where the values of the sensors are changing&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3 &amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor &amp;lt;br&amp;gt;is positioned above the white area and above the black line. &amp;lt;br&amp;gt; The trajectory the robot follows is a  line with long straight sections, and the robot can travel without slowing down all along. &amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (рекорд трассы!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Описание проезда по чёрной линии с ДВУМЯ датчиками==&lt;br /&gt;
Сложную трассу с перекрестками, ответвлениями, &amp;quot;зебрами&amp;quot; и инверсными участками с одним датчиком проехать невозможно. При подключении двух датчиков требуется использовани специальных алгоритмов, которые автоматизируют движение робота.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4. - Релейный регулятор  &amp;lt;/font&amp;gt;''' Задача этого алгоритма - удерживать робота в положении &amp;quot;Оба датчика робота находятся над белой линией&amp;quot;, т.е. слева и справа от чёрной линии. Если оба датчика попадают на черную линию, the robot останавливается   &amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||При питании от USB робот &amp;lt;br&amp;gt;останавливается на повороте, &amp;lt;br&amp;gt;т.к. оба датчика оказываются&amp;lt;br&amp;gt; на черной линии [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
|| When extra powered &amp;lt;br&amp;gt;from the battery, the robot &amp;lt;br&amp;gt;cuts the sharp turning off, &amp;lt;br&amp;gt;because at a speed, &amp;lt;br&amp;gt;the sensors cannot be &amp;lt;br&amp;gt;above the black line both at the same time [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0 Arduino IDE Video]. If the battery is run down, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - простой релейный регулятор + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5 Пропорциональный регулятор &amp;lt;/font&amp;gt;''' Пропорциональный̆ регулятор is a device that оказывающее управляющее воздействие на объект ''пропорционально'' его отклонению от заданного состояния. Принцип действия П-регулятора основывается на том, что мы находим значение отклонения от заданного состояния, которое назовем '''error''' и обозначим буквой E. Ошибка – это разница между показаниями датчиков линии:&lt;br /&gt;
E = S1 – S2. To obtain the value of controlling action '''U''', we multiply this value by a chosen ratio '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6 Пропорционально-дифференциальный регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7 ПИД-регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T11:06:37Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1. &amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;  [[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, &amp;lt;br&amp;gt; two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, &amp;lt;br&amp;gt;the robot cuts off the corners &amp;lt;br&amp;gt;in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2 &amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;» The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down. &amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch хуже, чем Arduino IDE &amp;lt;br&amp;gt; обрабатывает время движения, поэтому &amp;lt;br&amp;gt; количество диапазонов мы сократили до 5 &amp;lt;br&amp;gt; и упростили движение моторов.&amp;lt;br&amp;gt;  Они все время двигаются вперед с&amp;lt;br&amp;gt; разной мощностью&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, &amp;lt;br&amp;gt;the robot проскакивает поворот &amp;lt;br&amp;gt; in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||It is important to modify the sketch coded for USB, &amp;lt;br&amp;gt;because at a high speed, the in-between values of the sensor &amp;lt;br&amp;gt;cannot be handled. Объединяем все&amp;lt;br&amp;gt; промежуточные значения &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, coded for a 5V power supply (USB). &amp;lt;br&amp;gt;Заменить время движения робота в поворотах со 100 до &amp;lt;br&amp;gt;10 milliseconds. А время движения прямо&amp;lt;br&amp;gt; увеличить до  200 milliseconds. &amp;lt;br&amp;gt; It is necessary because &amp;lt;br&amp;gt; at a high speed, the robot rushes too fast &amp;lt;br&amp;gt;along the path section, where the values of the sensors are changing&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3 &amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt; The trajectory the robot follows is a  line with long straight sections, and the robot can travel without slowing down all along. &amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (рекорд трассы!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Описание проезда по чёрной линии с ДВУМЯ датчиками==&lt;br /&gt;
Сложную трассу с перекрестками, ответвлениями, &amp;quot;зебрами&amp;quot; и инверсными участками с одним датчиком проехать невозможно. При подключении двух датчиков требуется использовани специальных алгоритмов, которые автоматизируют движение робота.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4. - Релейный регулятор  &amp;lt;/font&amp;gt;''' Задача этого алгоритма - удерживать робота в положении &amp;quot;Оба датчика робота находятся над белой линией&amp;quot;, т.е. слева и справа от чёрной линии. Если оба датчика попадают на черную линию, the robot останавливается   &amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||При питании от USB робот &amp;lt;br&amp;gt;останавливается на повороте, &amp;lt;br&amp;gt;т.к. оба датчика оказываются&amp;lt;br&amp;gt; на черной линии [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
|| When extra powered &amp;lt;br&amp;gt;from the battery, the robot &amp;lt;br&amp;gt;cuts the sharp turning off, &amp;lt;br&amp;gt;because at a speed, &amp;lt;br&amp;gt;the sensors cannot be &amp;lt;br&amp;gt;above the black line both at the same time [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0 Arduino IDE Video]. If the battery is run down, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - простой релейный регулятор + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5 Пропорциональный регулятор &amp;lt;/font&amp;gt;''' Пропорциональный̆ регулятор is a device that оказывающее управляющее воздействие на объект ''пропорционально'' его отклонению от заданного состояния. Принцип действия П-регулятора основывается на том, что мы находим значение отклонения от заданного состояния, которое назовем '''error''' и обозначим буквой E. Ошибка – это разница между показаниями датчиков линии:&lt;br /&gt;
E = S1 – S2. To obtain the value of controlling action '''U''', we multiply this value by a chosen ratio '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6 Пропорционально-дифференциальный регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7 ПИД-регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T11:05:10Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1. &amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;  [[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, &amp;lt;br&amp;gt; two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, &amp;lt;br&amp;gt;the robot cuts off the corners &amp;lt;br&amp;gt;in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2 &amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;» The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel all along without slowing down. &amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch хуже, чем Arduino IDE &amp;lt;br&amp;gt; обрабатывает время движения, поэтому &amp;lt;br&amp;gt; количество диапазонов мы сократили до 5 &amp;lt;br&amp;gt; и упростили движение моторов.&amp;lt;br&amp;gt;  Они все время двигаются вперед с&amp;lt;br&amp;gt; разной мощностью&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, &amp;lt;br&amp;gt;the robot проскакивает поворот &amp;lt;br&amp;gt; in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||It is important to modify the sketch &amp;lt;br&amp;gt;coded for USB, because at a high speed, &amp;lt;br&amp;gt; the in-between values of the sensor &amp;lt;br&amp;gt;cannot be handled. Объединяем все&amp;lt;br&amp;gt; промежуточные значения &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, &amp;lt;br&amp;gt; coded for a 5V power supply (USB). Заменить &amp;lt;br&amp;gt;время движения робота в поворотах со 100 до &amp;lt;br&amp;gt;10 milliseconds. А время движения прямо&amp;lt;br&amp;gt; увеличить до  200 milliseconds. &amp;lt;br&amp;gt; It is necessary because &amp;lt;br&amp;gt; at a high speed, the robot rushes too fast &amp;lt;br&amp;gt;along the path section, where the values of the sensors are changing&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3 &amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt; The trajectory the robot follows is a  line with long straight sections, and the robot can travel without slowing down all along. &amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (рекорд трассы!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Описание проезда по чёрной линии с ДВУМЯ датчиками==&lt;br /&gt;
Сложную трассу с перекрестками, ответвлениями, &amp;quot;зебрами&amp;quot; и инверсными участками с одним датчиком проехать невозможно. При подключении двух датчиков требуется использовани специальных алгоритмов, которые автоматизируют движение робота.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4. - Релейный регулятор  &amp;lt;/font&amp;gt;''' Задача этого алгоритма - удерживать робота в положении &amp;quot;Оба датчика робота находятся над белой линией&amp;quot;, т.е. слева и справа от чёрной линии. Если оба датчика попадают на черную линию, the robot останавливается   &amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||При питании от USB робот &amp;lt;br&amp;gt;останавливается на повороте, &amp;lt;br&amp;gt;т.к. оба датчика оказываются&amp;lt;br&amp;gt; на черной линии [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
|| When extra powered &amp;lt;br&amp;gt;from the battery, the robot &amp;lt;br&amp;gt;cuts the sharp turning off, &amp;lt;br&amp;gt;because at a speed, &amp;lt;br&amp;gt;the sensors cannot be &amp;lt;br&amp;gt;above the black line both at the same time [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0 Arduino IDE Video]. If the battery is run down, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - простой релейный регулятор + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5 Пропорциональный регулятор &amp;lt;/font&amp;gt;''' Пропорциональный̆ регулятор is a device that оказывающее управляющее воздействие на объект ''пропорционально'' его отклонению от заданного состояния. Принцип действия П-регулятора основывается на том, что мы находим значение отклонения от заданного состояния, которое назовем '''error''' и обозначим буквой E. Ошибка – это разница между показаниями датчиков линии:&lt;br /&gt;
E = S1 – S2. To obtain the value of controlling action '''U''', we multiply this value by a chosen ratio '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6 Пропорционально-дифференциальный регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7 ПИД-регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T11:01:56Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1. &amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;  [[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, &amp;lt;br&amp;gt; two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, &amp;lt;br&amp;gt;the robot cuts off the corners &amp;lt;br&amp;gt;in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2 &amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is off. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;» The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options, respectively. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel without slowing down all along. &amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch хуже, чем Arduino IDE &amp;lt;br&amp;gt; обрабатывает время движения, поэтому &amp;lt;br&amp;gt; количество диапазонов мы сократили до 5 &amp;lt;br&amp;gt; и упростили движение моторов.&amp;lt;br&amp;gt;  Они все время двигаются вперед с&amp;lt;br&amp;gt; разной мощностью&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, &amp;lt;br&amp;gt;the robot проскакивает поворот &amp;lt;br&amp;gt; in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||It is important to modify the sketch &amp;lt;br&amp;gt;coded for USB, because at a high speed, &amp;lt;br&amp;gt; the in-between values of the sensor &amp;lt;br&amp;gt;cannot be handled. Объединяем все&amp;lt;br&amp;gt; промежуточные значения &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, &amp;lt;br&amp;gt; coded for a 5V power supply (USB). Заменить &amp;lt;br&amp;gt;время движения робота в поворотах со 100 до &amp;lt;br&amp;gt;10 milliseconds. А время движения прямо&amp;lt;br&amp;gt; увеличить до  200 milliseconds. &amp;lt;br&amp;gt; It is necessary because &amp;lt;br&amp;gt; at a high speed, the robot rushes too fast &amp;lt;br&amp;gt;along the path section, where the values of the sensors are changing&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3 &amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt; The trajectory the robot follows is a  line with long straight sections, and the robot can travel without slowing down all along. &amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (рекорд трассы!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Описание проезда по чёрной линии с ДВУМЯ датчиками==&lt;br /&gt;
Сложную трассу с перекрестками, ответвлениями, &amp;quot;зебрами&amp;quot; и инверсными участками с одним датчиком проехать невозможно. При подключении двух датчиков требуется использовани специальных алгоритмов, которые автоматизируют движение робота.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4. - Релейный регулятор  &amp;lt;/font&amp;gt;''' Задача этого алгоритма - удерживать робота в положении &amp;quot;Оба датчика робота находятся над белой линией&amp;quot;, т.е. слева и справа от чёрной линии. Если оба датчика попадают на черную линию, the robot останавливается   &amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||При питании от USB робот &amp;lt;br&amp;gt;останавливается на повороте, &amp;lt;br&amp;gt;т.к. оба датчика оказываются&amp;lt;br&amp;gt; на черной линии [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
|| When extra powered &amp;lt;br&amp;gt;from the battery, the robot &amp;lt;br&amp;gt;cuts the sharp turning off, &amp;lt;br&amp;gt;because at a speed, &amp;lt;br&amp;gt;the sensors cannot be &amp;lt;br&amp;gt;above the black line both at the same time [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0 Arduino IDE Video]. If the battery is run down, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - простой релейный регулятор + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5 Пропорциональный регулятор &amp;lt;/font&amp;gt;''' Пропорциональный̆ регулятор is a device that оказывающее управляющее воздействие на объект ''пропорционально'' его отклонению от заданного состояния. Принцип действия П-регулятора основывается на том, что мы находим значение отклонения от заданного состояния, которое назовем '''error''' и обозначим буквой E. Ошибка – это разница между показаниями датчиков линии:&lt;br /&gt;
E = S1 – S2. To obtain the value of controlling action '''U''', we multiply this value by a chosen ratio '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6 Пропорционально-дифференциальный регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7 ПИД-регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T10:56:02Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1. &amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;  [[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, &amp;lt;br&amp;gt; two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, &amp;lt;br&amp;gt;the robot cuts off the corners &amp;lt;br&amp;gt;in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2 &amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The readings of the sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is стоит. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;» The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel without slowing down all along. &amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch хуже, чем ArduiniIDE &amp;lt;br&amp;gt; обрабатывает время движения, поэтому &amp;lt;br&amp;gt; количество диапазонов мы сократили до 5 &amp;lt;br&amp;gt; и упростили движение моторов.&amp;lt;br&amp;gt;  Они все время двигаются вперед с&amp;lt;br&amp;gt; разной мощностью&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, &amp;lt;br&amp;gt;the robot проскакивает поворот &amp;lt;br&amp;gt; in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||It is important to modify the sketch &amp;lt;br&amp;gt;coded for USB, because at a high speed, &amp;lt;br&amp;gt; the in-between values of the sensor &amp;lt;br&amp;gt;cannot be handled. Объединяем все&amp;lt;br&amp;gt; промежуточные значения &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, &amp;lt;br&amp;gt; coded for a 5V power supply (USB). Заменить &amp;lt;br&amp;gt;время движения робота в поворотах со 100 до &amp;lt;br&amp;gt;10 milliseconds. А время движения прямо&amp;lt;br&amp;gt; увеличить до  200 milliseconds. &amp;lt;br&amp;gt; It is necessary because &amp;lt;br&amp;gt; at a high speed, the robot rushes too fast &amp;lt;br&amp;gt;along the path section, where the values of the sensors are changing&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3 &amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt; The trajectory the robot follows is a  line with long straight sections, and the robot can travel without slowing down all along. &amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (рекорд трассы!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Описание проезда по чёрной линии с ДВУМЯ датчиками==&lt;br /&gt;
Сложную трассу с перекрестками, ответвлениями, &amp;quot;зебрами&amp;quot; и инверсными участками с одним датчиком проехать невозможно. При подключении двух датчиков требуется использовани специальных алгоритмов, которые автоматизируют движение робота.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4. - Релейный регулятор  &amp;lt;/font&amp;gt;''' Задача этого алгоритма - удерживать робота в положении &amp;quot;Оба датчика робота находятся над белой линией&amp;quot;, т.е. слева и справа от чёрной линии. Если оба датчика попадают на черную линию, the robot останавливается   &amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||При питании от USB робот &amp;lt;br&amp;gt;останавливается на повороте, &amp;lt;br&amp;gt;т.к. оба датчика оказываются&amp;lt;br&amp;gt; на черной линии [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
|| When extra powered &amp;lt;br&amp;gt;from the battery, the robot &amp;lt;br&amp;gt;cuts the sharp turning off, &amp;lt;br&amp;gt;because at a speed, &amp;lt;br&amp;gt;the sensors cannot be &amp;lt;br&amp;gt;above the black line both at the same time [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0 Arduino IDE Video]. If the battery is run down, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - простой релейный регулятор + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5 Пропорциональный регулятор &amp;lt;/font&amp;gt;''' Пропорциональный̆ регулятор is a device that оказывающее управляющее воздействие на объект ''пропорционально'' его отклонению от заданного состояния. Принцип действия П-регулятора основывается на том, что мы находим значение отклонения от заданного состояния, которое назовем '''error''' и обозначим буквой E. Ошибка – это разница между показаниями датчиков линии:&lt;br /&gt;
E = S1 – S2. To obtain the value of controlling action '''U''', we multiply this value by a chosen ratio '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6 Пропорционально-дифференциальный регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7 ПИД-регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T10:55:07Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1. &amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;  [[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, &amp;lt;br&amp;gt; two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, &amp;lt;br&amp;gt;the robot cuts off the corners &amp;lt;br&amp;gt;in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2 &amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt; The readings of the sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward. The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is стоит. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;» The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel without slowing down all along. &amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch хуже, чем ArduiniIDE &amp;lt;br&amp;gt; обрабатывает время движения, поэтому &amp;lt;br&amp;gt; количество диапазонов мы сократили до 5 &amp;lt;br&amp;gt; и упростили движение моторов.&amp;lt;br&amp;gt;  Они все время двигаются вперед с&amp;lt;br&amp;gt; разной мощностью&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, &amp;lt;br&amp;gt;the robot проскакивает поворот &amp;lt;br&amp;gt; in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||It is important to modify the sketch &amp;lt;br&amp;gt;coded for USB, because at a high speed, &amp;lt;br&amp;gt; the in-between values of the sensor &amp;lt;br&amp;gt;cannot be handled. Объединяем все&amp;lt;br&amp;gt; промежуточные значения &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, &amp;lt;br&amp;gt; coded for a 5V power supply (USB). Заменить &amp;lt;br&amp;gt;время движения робота в поворотах со 100 до &amp;lt;br&amp;gt;10 milliseconds. А время движения прямо&amp;lt;br&amp;gt; увеличить до  200 milliseconds. &amp;lt;br&amp;gt; It is necessary because &amp;lt;br&amp;gt; at a high speed, the robot rushes too fast &amp;lt;br&amp;gt;along the path section, where the values of the sensors are changing&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3 &amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt; The trajectory the robot follows is a  line with long straight sections, and the robot can travel without slowing down all along. &amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (рекорд трассы!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Описание проезда по чёрной линии с ДВУМЯ датчиками==&lt;br /&gt;
Сложную трассу с перекрестками, ответвлениями, &amp;quot;зебрами&amp;quot; и инверсными участками с одним датчиком проехать невозможно. При подключении двух датчиков требуется использовани специальных алгоритмов, которые автоматизируют движение робота.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4. - Релейный регулятор  &amp;lt;/font&amp;gt;''' Задача этого алгоритма - удерживать робота в положении &amp;quot;Оба датчика робота находятся над белой линией&amp;quot;, т.е. слева и справа от чёрной линии. Если оба датчика попадают на черную линию, the robot останавливается   &amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||При питании от USB робот &amp;lt;br&amp;gt;останавливается на повороте, &amp;lt;br&amp;gt;т.к. оба датчика оказываются&amp;lt;br&amp;gt; на черной линии [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
|| When extra powered &amp;lt;br&amp;gt;from the battery, the robot &amp;lt;br&amp;gt;cuts the sharp turning off, &amp;lt;br&amp;gt;because at a speed, &amp;lt;br&amp;gt;the sensors cannot be &amp;lt;br&amp;gt;above the black line both at the same time [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0 Arduino IDE Video]. If the battery is run down, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - простой релейный регулятор + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5 Пропорциональный регулятор &amp;lt;/font&amp;gt;''' Пропорциональный̆ регулятор is a device that оказывающее управляющее воздействие на объект ''пропорционально'' его отклонению от заданного состояния. Принцип действия П-регулятора основывается на том, что мы находим значение отклонения от заданного состояния, которое назовем '''error''' и обозначим буквой E. Ошибка – это разница между показаниями датчиков линии:&lt;br /&gt;
E = S1 – S2. To obtain the value of controlling action '''U''', we multiply this value by a chosen ratio '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6 Пропорционально-дифференциальный регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7 ПИД-регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T10:53:43Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1. &amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;  [[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, &amp;lt;br&amp;gt; two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, &amp;lt;br&amp;gt;the robot cuts off the corners &amp;lt;br&amp;gt;in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2 &amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt; The readings of the sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward.&amp;lt;br&amp;gt;The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is стоит. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;» The rest of the values ('''4''', '''5''', and '''6''') are mirroring the '''0''', '''1''', and '''2''' options. &amp;lt;center&amp;gt;&amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel without slowing down all along. &amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch хуже, чем ArduiniIDE &amp;lt;br&amp;gt; обрабатывает время движения, поэтому &amp;lt;br&amp;gt; количество диапазонов мы сократили до 5 &amp;lt;br&amp;gt; и упростили движение моторов.&amp;lt;br&amp;gt;  Они все время двигаются вперед с&amp;lt;br&amp;gt; разной мощностью&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, &amp;lt;br&amp;gt;the robot проскакивает поворот &amp;lt;br&amp;gt; in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||It is important to modify the sketch &amp;lt;br&amp;gt;coded for USB, because at a high speed, &amp;lt;br&amp;gt; the in-between values of the sensor &amp;lt;br&amp;gt;cannot be handled. Объединяем все&amp;lt;br&amp;gt; промежуточные значения &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, &amp;lt;br&amp;gt; coded for a 5V power supply (USB). Заменить &amp;lt;br&amp;gt;время движения робота в поворотах со 100 до &amp;lt;br&amp;gt;10 milliseconds. А время движения прямо&amp;lt;br&amp;gt; увеличить до  200 milliseconds. &amp;lt;br&amp;gt; It is necessary because &amp;lt;br&amp;gt; at a high speed, the robot rushes too fast &amp;lt;br&amp;gt;along the path section, where the values of the sensors are changing&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3 &amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt; The trajectory the robot follows is a  line with long straight sections, and the robot can travel without slowing down all along. &amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (рекорд трассы!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Описание проезда по чёрной линии с ДВУМЯ датчиками==&lt;br /&gt;
Сложную трассу с перекрестками, ответвлениями, &amp;quot;зебрами&amp;quot; и инверсными участками с одним датчиком проехать невозможно. При подключении двух датчиков требуется использовани специальных алгоритмов, которые автоматизируют движение робота.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4. - Релейный регулятор  &amp;lt;/font&amp;gt;''' Задача этого алгоритма - удерживать робота в положении &amp;quot;Оба датчика робота находятся над белой линией&amp;quot;, т.е. слева и справа от чёрной линии. Если оба датчика попадают на черную линию, the robot останавливается   &amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||При питании от USB робот &amp;lt;br&amp;gt;останавливается на повороте, &amp;lt;br&amp;gt;т.к. оба датчика оказываются&amp;lt;br&amp;gt; на черной линии [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
|| When extra powered &amp;lt;br&amp;gt;from the battery, the robot &amp;lt;br&amp;gt;cuts the sharp turning off, &amp;lt;br&amp;gt;because at a speed, &amp;lt;br&amp;gt;the sensors cannot be &amp;lt;br&amp;gt;above the black line both at the same time [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0 Arduino IDE Video]. If the battery is run down, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - простой релейный регулятор + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5 Пропорциональный регулятор &amp;lt;/font&amp;gt;''' Пропорциональный̆ регулятор is a device that оказывающее управляющее воздействие на объект ''пропорционально'' его отклонению от заданного состояния. Принцип действия П-регулятора основывается на том, что мы находим значение отклонения от заданного состояния, которое назовем '''error''' и обозначим буквой E. Ошибка – это разница между показаниями датчиков линии:&lt;br /&gt;
E = S1 – S2. To obtain the value of controlling action '''U''', we multiply this value by a chosen ratio '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6 Пропорционально-дифференциальный регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7 ПИД-регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T10:48:52Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1. &amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;  [[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, &amp;lt;br&amp;gt; two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, &amp;lt;br&amp;gt;the robot cuts off the corners &amp;lt;br&amp;gt;in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2 &amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt; The readings of the sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward.&amp;lt;br&amp;gt;The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is стоит. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;» Остальные значения ('''4''', '''5''', and '''6''') являются зеркальными по отношению к '''0''', '''1''', and '''2'''. &amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel without slowing down all along. &amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch хуже, чем ArduiniIDE &amp;lt;br&amp;gt; обрабатывает время движения, поэтому &amp;lt;br&amp;gt; количество диапазонов мы сократили до 5 &amp;lt;br&amp;gt; и упростили движение моторов.&amp;lt;br&amp;gt;  Они все время двигаются вперед с&amp;lt;br&amp;gt; разной мощностью&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, &amp;lt;br&amp;gt;the robot проскакивает поворот &amp;lt;br&amp;gt; in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||It is important to modify the sketch &amp;lt;br&amp;gt;coded for USB, because at a high speed, &amp;lt;br&amp;gt; the in-between values of the sensor &amp;lt;br&amp;gt;cannot be handled. Объединяем все&amp;lt;br&amp;gt; промежуточные значения &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, &amp;lt;br&amp;gt; coded for a 5V power supply (USB). Заменить &amp;lt;br&amp;gt;время движения робота в поворотах со 100 до &amp;lt;br&amp;gt;10 milliseconds. А время движения прямо&amp;lt;br&amp;gt; увеличить до  200 milliseconds. &amp;lt;br&amp;gt; It is necessary because &amp;lt;br&amp;gt; at a high speed, the robot rushes too fast &amp;lt;br&amp;gt;along the path section, where the values of the sensors are changing&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3 &amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt; The trajectory the robot follows is a  line with long straight sections, and the robot can travel without slowing down all along. &amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (рекорд трассы!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Описание проезда по чёрной линии с ДВУМЯ датчиками==&lt;br /&gt;
Сложную трассу с перекрестками, ответвлениями, &amp;quot;зебрами&amp;quot; и инверсными участками с одним датчиком проехать невозможно. При подключении двух датчиков требуется использовани специальных алгоритмов, которые автоматизируют движение робота.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4. - Релейный регулятор  &amp;lt;/font&amp;gt;''' Задача этого алгоритма - удерживать робота в положении &amp;quot;Оба датчика робота находятся над белой линией&amp;quot;, т.е. слева и справа от чёрной линии. Если оба датчика попадают на черную линию, the robot останавливается   &amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||При питании от USB робот &amp;lt;br&amp;gt;останавливается на повороте, &amp;lt;br&amp;gt;т.к. оба датчика оказываются&amp;lt;br&amp;gt; на черной линии [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
|| When extra powered &amp;lt;br&amp;gt;from the battery, the robot &amp;lt;br&amp;gt;cuts the sharp turning off, &amp;lt;br&amp;gt;because at a speed, &amp;lt;br&amp;gt;the sensors cannot be &amp;lt;br&amp;gt;above the black line both at the same time [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0 Arduino IDE Video]. If the battery is run down, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - простой релейный регулятор + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5 Пропорциональный регулятор &amp;lt;/font&amp;gt;''' Пропорциональный̆ регулятор is a device that оказывающее управляющее воздействие на объект ''пропорционально'' его отклонению от заданного состояния. Принцип действия П-регулятора основывается на том, что мы находим значение отклонения от заданного состояния, которое назовем '''error''' и обозначим буквой E. Ошибка – это разница между показаниями датчиков линии:&lt;br /&gt;
E = S1 – S2. To obtain the value of controlling action '''U''', we multiply this value by a chosen ratio '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6 Пропорционально-дифференциальный регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7 ПИД-регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T10:47:32Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1. &amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;  [[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, &amp;lt;br&amp;gt; two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, &amp;lt;br&amp;gt;the robot cuts off the corners &amp;lt;br&amp;gt;in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2 &amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt; The readings of the sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward.&amp;lt;br&amp;gt;The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position above the white area, closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is стоит. The robot turns on the fly during 0.1 second. &amp;lt;br&amp;gt;'''» 2''' means the position at the border of the white and black areas, even more closer to the black line. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is at its half (120), rotating forward, too. The robot goes ahead and turns a bit, on the fly, during 0.1 second. &amp;lt;br&amp;gt;'''» 3''' means the position at the border of the white and black areas, already above the black line. The left-hand and the right-hand motors are on and in full swing (255), both rotating forward. The robot goes ahead during 0.1 second. &amp;lt;br&amp;gt;» Остальные значения ('''4''', '''5''', and '''6''') являются зеркальными по отношению к '''0''', '''1''', and '''2'''. &amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel without slowing down all along. &amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch хуже, чем ArduiniIDE &amp;lt;br&amp;gt; обрабатывает время движения, поэтому &amp;lt;br&amp;gt; количество диапазонов мы сократили до 5 &amp;lt;br&amp;gt; и упростили движение моторов.&amp;lt;br&amp;gt;  Они все время двигаются вперед с&amp;lt;br&amp;gt; разной мощностью&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, &amp;lt;br&amp;gt;the robot проскакивает поворот &amp;lt;br&amp;gt; in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||It is important to modify the sketch &amp;lt;br&amp;gt;coded for USB, because at a high speed, &amp;lt;br&amp;gt; the in-between values of the sensor &amp;lt;br&amp;gt;cannot be handled. Объединяем все&amp;lt;br&amp;gt; промежуточные значения &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, &amp;lt;br&amp;gt; coded for a 5V power supply (USB). Заменить &amp;lt;br&amp;gt;время движения робота в поворотах со 100 до &amp;lt;br&amp;gt;10 milliseconds. А время движения прямо&amp;lt;br&amp;gt; увеличить до  200 milliseconds. &amp;lt;br&amp;gt; It is necessary because &amp;lt;br&amp;gt; at a high speed, the robot rushes too fast &amp;lt;br&amp;gt;along the path section, where the values of the sensors are changing&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3 &amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt; The trajectory the robot follows is a  line with long straight sections, and the robot can travel without slowing down all along. &amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (рекорд трассы!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Описание проезда по чёрной линии с ДВУМЯ датчиками==&lt;br /&gt;
Сложную трассу с перекрестками, ответвлениями, &amp;quot;зебрами&amp;quot; и инверсными участками с одним датчиком проехать невозможно. При подключении двух датчиков требуется использовани специальных алгоритмов, которые автоматизируют движение робота.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4. - Релейный регулятор  &amp;lt;/font&amp;gt;''' Задача этого алгоритма - удерживать робота в положении &amp;quot;Оба датчика робота находятся над белой линией&amp;quot;, т.е. слева и справа от чёрной линии. Если оба датчика попадают на черную линию, the robot останавливается   &amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||При питании от USB робот &amp;lt;br&amp;gt;останавливается на повороте, &amp;lt;br&amp;gt;т.к. оба датчика оказываются&amp;lt;br&amp;gt; на черной линии [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
|| When extra powered &amp;lt;br&amp;gt;from the battery, the robot &amp;lt;br&amp;gt;cuts the sharp turning off, &amp;lt;br&amp;gt;because at a speed, &amp;lt;br&amp;gt;the sensors cannot be &amp;lt;br&amp;gt;above the black line both at the same time [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0 Arduino IDE Video]. If the battery is run down, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - простой релейный регулятор + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5 Пропорциональный регулятор &amp;lt;/font&amp;gt;''' Пропорциональный̆ регулятор is a device that оказывающее управляющее воздействие на объект ''пропорционально'' его отклонению от заданного состояния. Принцип действия П-регулятора основывается на том, что мы находим значение отклонения от заданного состояния, которое назовем '''error''' и обозначим буквой E. Ошибка – это разница между показаниями датчиков линии:&lt;br /&gt;
E = S1 – S2. To obtain the value of controlling action '''U''', we multiply this value by a chosen ratio '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6 Пропорционально-дифференциальный регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7 ПИД-регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T10:37:24Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1. &amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;  [[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, &amp;lt;br&amp;gt; two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, &amp;lt;br&amp;gt;the robot cuts off the corners &amp;lt;br&amp;gt;in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2 &amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt; The readings of the sensor are as follows: &amp;lt;/center&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward.&amp;lt;br&amp;gt;The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position над белым полем, ближе к чёрной линии. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is стоит. The robot поворачивается в движении during 0.1 second &amp;lt;br&amp;gt; '''» 2''' means the position на границе белого и черного полей, еще ближе к чёрной линии. The left-hand motor включен на полную мощность (255) и крутится вперед, а правый  включен на половине  мощности (120) и тоже крутится вперед. The robot едет прямо и немного поворачивается в движении в течение 0,1 секунды &amp;lt;br&amp;gt; '''» 3''' means the position на границе белого и черного полей, уже на  чёрной линии. The left-hand and правые motors включены на полную мощность (255) и оба крутятся вперед. The robot едет прямо в течение 0,1 секунды &amp;lt;br&amp;gt; Остальные значения (4,5 и 6) являются зеркальными по отношению к 0,1 и 2. &amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel without slowing down all along. &amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch хуже, чем ArduiniIDE &amp;lt;br&amp;gt; обрабатывает время движения, поэтому &amp;lt;br&amp;gt; количество диапазонов мы сократили до 5 &amp;lt;br&amp;gt; и упростили движение моторов.&amp;lt;br&amp;gt;  Они все время двигаются вперед с&amp;lt;br&amp;gt; разной мощностью&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, &amp;lt;br&amp;gt;the robot проскакивает поворот &amp;lt;br&amp;gt; in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||It is important to modify the sketch &amp;lt;br&amp;gt;coded for USB, because at a high speed, &amp;lt;br&amp;gt; the in-between values of the sensor &amp;lt;br&amp;gt;cannot be handled. Объединяем все&amp;lt;br&amp;gt; промежуточные значения &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, &amp;lt;br&amp;gt; coded for a 5V power supply (USB). Заменить &amp;lt;br&amp;gt;время движения робота в поворотах со 100 до &amp;lt;br&amp;gt;10 milliseconds. А время движения прямо&amp;lt;br&amp;gt; увеличить до  200 milliseconds. &amp;lt;br&amp;gt; It is necessary because &amp;lt;br&amp;gt; at a high speed, the robot rushes too fast &amp;lt;br&amp;gt;along the path section, where the values of the sensors are changing&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3 &amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt; The trajectory the robot follows is a  line with long straight sections, and the robot can travel without slowing down all along. &amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (рекорд трассы!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Описание проезда по чёрной линии с ДВУМЯ датчиками==&lt;br /&gt;
Сложную трассу с перекрестками, ответвлениями, &amp;quot;зебрами&amp;quot; и инверсными участками с одним датчиком проехать невозможно. При подключении двух датчиков требуется использовани специальных алгоритмов, которые автоматизируют движение робота.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4. - Релейный регулятор  &amp;lt;/font&amp;gt;''' Задача этого алгоритма - удерживать робота в положении &amp;quot;Оба датчика робота находятся над белой линией&amp;quot;, т.е. слева и справа от чёрной линии. Если оба датчика попадают на черную линию, the robot останавливается   &amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||При питании от USB робот &amp;lt;br&amp;gt;останавливается на повороте, &amp;lt;br&amp;gt;т.к. оба датчика оказываются&amp;lt;br&amp;gt; на черной линии [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
|| When extra powered &amp;lt;br&amp;gt;from the battery, the robot &amp;lt;br&amp;gt;cuts the sharp turning off, &amp;lt;br&amp;gt;because at a speed, &amp;lt;br&amp;gt;the sensors cannot be &amp;lt;br&amp;gt;above the black line both at the same time [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0 Arduino IDE Video]. If the battery is run down, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - простой релейный регулятор + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5 Пропорциональный регулятор &amp;lt;/font&amp;gt;''' Пропорциональный̆ регулятор is a device that оказывающее управляющее воздействие на объект ''пропорционально'' его отклонению от заданного состояния. Принцип действия П-регулятора основывается на том, что мы находим значение отклонения от заданного состояния, которое назовем '''error''' и обозначим буквой E. Ошибка – это разница между показаниями датчиков линии:&lt;br /&gt;
E = S1 – S2. To obtain the value of controlling action '''U''', we multiply this value by a chosen ratio '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6 Пропорционально-дифференциальный регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7 ПИД-регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T10:36:29Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1. &amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;  [[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, &amp;lt;br&amp;gt; two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, &amp;lt;br&amp;gt;the robot cuts off the corners &amp;lt;br&amp;gt;in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2 &amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt; The readings of the sensor are as follows: &amp;lt;/center&amp;gt; &amp;lt;br&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward.&amp;lt;br&amp;gt;The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position над белым полем, ближе к чёрной линии. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is стоит. The robot поворачивается в движении during 0.1 second &amp;lt;br&amp;gt; '''» 2''' means the position на границе белого и черного полей, еще ближе к чёрной линии. The left-hand motor включен на полную мощность (255) и крутится вперед, а правый  включен на половине  мощности (120) и тоже крутится вперед. The robot едет прямо и немного поворачивается в движении в течение 0,1 секунды &amp;lt;br&amp;gt; '''» 3''' means the position на границе белого и черного полей, уже на  чёрной линии. The left-hand and правые motors включены на полную мощность (255) и оба крутятся вперед. The robot едет прямо в течение 0,1 секунды &amp;lt;br&amp;gt; Остальные значения (4,5 и 6) являются зеркальными по отношению к 0,1 и 2. &amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel without slowing down all along. &amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch хуже, чем ArduiniIDE &amp;lt;br&amp;gt; обрабатывает время движения, поэтому &amp;lt;br&amp;gt; количество диапазонов мы сократили до 5 &amp;lt;br&amp;gt; и упростили движение моторов.&amp;lt;br&amp;gt;  Они все время двигаются вперед с&amp;lt;br&amp;gt; разной мощностью&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, &amp;lt;br&amp;gt;the robot проскакивает поворот &amp;lt;br&amp;gt; in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||It is important to modify the sketch &amp;lt;br&amp;gt;coded for USB, because at a high speed, &amp;lt;br&amp;gt; the in-between values of the sensor &amp;lt;br&amp;gt;cannot be handled. Объединяем все&amp;lt;br&amp;gt; промежуточные значения &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, &amp;lt;br&amp;gt; coded for a 5V power supply (USB). Заменить &amp;lt;br&amp;gt;время движения робота в поворотах со 100 до &amp;lt;br&amp;gt;10 milliseconds. А время движения прямо&amp;lt;br&amp;gt; увеличить до  200 milliseconds. &amp;lt;br&amp;gt; It is necessary because &amp;lt;br&amp;gt; at a high speed, the robot rushes too fast &amp;lt;br&amp;gt;along the path section, where the values of the sensors are changing&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3 &amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt; The trajectory the robot follows is a  line with long straight sections, and the robot can travel without slowing down all along. &amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (рекорд трассы!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Описание проезда по чёрной линии с ДВУМЯ датчиками==&lt;br /&gt;
Сложную трассу с перекрестками, ответвлениями, &amp;quot;зебрами&amp;quot; и инверсными участками с одним датчиком проехать невозможно. При подключении двух датчиков требуется использовани специальных алгоритмов, которые автоматизируют движение робота.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4. - Релейный регулятор  &amp;lt;/font&amp;gt;''' Задача этого алгоритма - удерживать робота в положении &amp;quot;Оба датчика робота находятся над белой линией&amp;quot;, т.е. слева и справа от чёрной линии. Если оба датчика попадают на черную линию, the robot останавливается   &amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||При питании от USB робот &amp;lt;br&amp;gt;останавливается на повороте, &amp;lt;br&amp;gt;т.к. оба датчика оказываются&amp;lt;br&amp;gt; на черной линии [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
|| When extra powered &amp;lt;br&amp;gt;from the battery, the robot &amp;lt;br&amp;gt;cuts the sharp turning off, &amp;lt;br&amp;gt;because at a speed, &amp;lt;br&amp;gt;the sensors cannot be &amp;lt;br&amp;gt;above the black line both at the same time [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0 Arduino IDE Video]. If the battery is run down, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - простой релейный регулятор + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5 Пропорциональный регулятор &amp;lt;/font&amp;gt;''' Пропорциональный̆ регулятор is a device that оказывающее управляющее воздействие на объект ''пропорционально'' его отклонению от заданного состояния. Принцип действия П-регулятора основывается на том, что мы находим значение отклонения от заданного состояния, которое назовем '''error''' и обозначим буквой E. Ошибка – это разница между показаниями датчиков линии:&lt;br /&gt;
E = S1 – S2. To obtain the value of controlling action '''U''', we multiply this value by a chosen ratio '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6 Пропорционально-дифференциальный регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7 ПИД-регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T10:33:11Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1. &amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;  [[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, &amp;lt;br&amp;gt; two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, &amp;lt;br&amp;gt;the robot cuts off the corners &amp;lt;br&amp;gt;in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2 &amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;aligned-left&amp;gt; &amp;lt;br&amp;gt; The readings of the sensor are as follows: &amp;lt;br&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward.&amp;lt;br&amp;gt;The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position над белым полем, ближе к чёрной линии. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is стоит. The robot поворачивается в движении during 0.1 second &amp;lt;br&amp;gt; '''» 2''' means the position на границе белого и черного полей, еще ближе к чёрной линии. The left-hand motor включен на полную мощность (255) и крутится вперед, а правый  включен на половине  мощности (120) и тоже крутится вперед. The robot едет прямо и немного поворачивается в движении в течение 0,1 секунды &amp;lt;br&amp;gt; '''» 3''' means the position на границе белого и черного полей, уже на  чёрной линии. The left-hand and правые motors включены на полную мощность (255) и оба крутятся вперед. The robot едет прямо в течение 0,1 секунды &amp;lt;br&amp;gt; Остальные значения (4,5 и 6) являются зеркальными по отношению к 0,1 и 2. &amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel without slowing down all along. &amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch хуже, чем ArduiniIDE &amp;lt;br&amp;gt; обрабатывает время движения, поэтому &amp;lt;br&amp;gt; количество диапазонов мы сократили до 5 &amp;lt;br&amp;gt; и упростили движение моторов.&amp;lt;br&amp;gt;  Они все время двигаются вперед с&amp;lt;br&amp;gt; разной мощностью&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, &amp;lt;br&amp;gt;the robot проскакивает поворот &amp;lt;br&amp;gt; in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||It is important to modify the sketch &amp;lt;br&amp;gt;coded for USB, because at a high speed, &amp;lt;br&amp;gt; the in-between values of the sensor &amp;lt;br&amp;gt;cannot be handled. Объединяем все&amp;lt;br&amp;gt; промежуточные значения &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, &amp;lt;br&amp;gt; coded for a 5V power supply (USB). Заменить &amp;lt;br&amp;gt;время движения робота в поворотах со 100 до &amp;lt;br&amp;gt;10 milliseconds. А время движения прямо&amp;lt;br&amp;gt; увеличить до  200 milliseconds. &amp;lt;br&amp;gt; It is necessary because &amp;lt;br&amp;gt; at a high speed, the robot rushes too fast &amp;lt;br&amp;gt;along the path section, where the values of the sensors are changing&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3 &amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt; The trajectory the robot follows is a  line with long straight sections, and the robot can travel without slowing down all along. &amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (рекорд трассы!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Описание проезда по чёрной линии с ДВУМЯ датчиками==&lt;br /&gt;
Сложную трассу с перекрестками, ответвлениями, &amp;quot;зебрами&amp;quot; и инверсными участками с одним датчиком проехать невозможно. При подключении двух датчиков требуется использовани специальных алгоритмов, которые автоматизируют движение робота.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4. - Релейный регулятор  &amp;lt;/font&amp;gt;''' Задача этого алгоритма - удерживать робота в положении &amp;quot;Оба датчика робота находятся над белой линией&amp;quot;, т.е. слева и справа от чёрной линии. Если оба датчика попадают на черную линию, the robot останавливается   &amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||При питании от USB робот &amp;lt;br&amp;gt;останавливается на повороте, &amp;lt;br&amp;gt;т.к. оба датчика оказываются&amp;lt;br&amp;gt; на черной линии [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
|| When extra powered &amp;lt;br&amp;gt;from the battery, the robot &amp;lt;br&amp;gt;cuts the sharp turning off, &amp;lt;br&amp;gt;because at a speed, &amp;lt;br&amp;gt;the sensors cannot be &amp;lt;br&amp;gt;above the black line both at the same time [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0 Arduino IDE Video]. If the battery is run down, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - простой релейный регулятор + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5 Пропорциональный регулятор &amp;lt;/font&amp;gt;''' Пропорциональный̆ регулятор is a device that оказывающее управляющее воздействие на объект ''пропорционально'' его отклонению от заданного состояния. Принцип действия П-регулятора основывается на том, что мы находим значение отклонения от заданного состояния, которое назовем '''error''' и обозначим буквой E. Ошибка – это разница между показаниями датчиков линии:&lt;br /&gt;
E = S1 – S2. To obtain the value of controlling action '''U''', we multiply this value by a chosen ratio '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6 Пропорционально-дифференциальный регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7 ПИД-регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T10:32:21Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1. &amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;  [[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, &amp;lt;br&amp;gt; two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, &amp;lt;br&amp;gt;the robot cuts off the corners &amp;lt;br&amp;gt;in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2 &amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;aligned left&amp;gt; &amp;lt;br&amp;gt; The readings of the sensor are as follows: &amp;lt;br&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward.&amp;lt;br&amp;gt;The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position над белым полем, ближе к чёрной линии. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is стоит. The robot поворачивается в движении during 0.1 second &amp;lt;br&amp;gt; '''» 2''' means the position на границе белого и черного полей, еще ближе к чёрной линии. The left-hand motor включен на полную мощность (255) и крутится вперед, а правый  включен на половине  мощности (120) и тоже крутится вперед. The robot едет прямо и немного поворачивается в движении в течение 0,1 секунды &amp;lt;br&amp;gt; '''» 3''' means the position на границе белого и черного полей, уже на  чёрной линии. The left-hand and правые motors включены на полную мощность (255) и оба крутятся вперед. The robot едет прямо в течение 0,1 секунды &amp;lt;br&amp;gt; Остальные значения (4,5 и 6) являются зеркальными по отношению к 0,1 и 2. &amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel without slowing down all along. &amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch хуже, чем ArduiniIDE &amp;lt;br&amp;gt; обрабатывает время движения, поэтому &amp;lt;br&amp;gt; количество диапазонов мы сократили до 5 &amp;lt;br&amp;gt; и упростили движение моторов.&amp;lt;br&amp;gt;  Они все время двигаются вперед с&amp;lt;br&amp;gt; разной мощностью&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, &amp;lt;br&amp;gt;the robot проскакивает поворот &amp;lt;br&amp;gt; in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||It is important to modify the sketch &amp;lt;br&amp;gt;coded for USB, because at a high speed, &amp;lt;br&amp;gt; the in-between values of the sensor &amp;lt;br&amp;gt;cannot be handled. Объединяем все&amp;lt;br&amp;gt; промежуточные значения &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, &amp;lt;br&amp;gt; coded for a 5V power supply (USB). Заменить &amp;lt;br&amp;gt;время движения робота в поворотах со 100 до &amp;lt;br&amp;gt;10 milliseconds. А время движения прямо&amp;lt;br&amp;gt; увеличить до  200 milliseconds. &amp;lt;br&amp;gt; It is necessary because &amp;lt;br&amp;gt; at a high speed, the robot rushes too fast &amp;lt;br&amp;gt;along the path section, where the values of the sensors are changing&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3 &amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt; The trajectory the robot follows is a  line with long straight sections, and the robot can travel without slowing down all along. &amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (рекорд трассы!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Описание проезда по чёрной линии с ДВУМЯ датчиками==&lt;br /&gt;
Сложную трассу с перекрестками, ответвлениями, &amp;quot;зебрами&amp;quot; и инверсными участками с одним датчиком проехать невозможно. При подключении двух датчиков требуется использовани специальных алгоритмов, которые автоматизируют движение робота.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4. - Релейный регулятор  &amp;lt;/font&amp;gt;''' Задача этого алгоритма - удерживать робота в положении &amp;quot;Оба датчика робота находятся над белой линией&amp;quot;, т.е. слева и справа от чёрной линии. Если оба датчика попадают на черную линию, the robot останавливается   &amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||При питании от USB робот &amp;lt;br&amp;gt;останавливается на повороте, &amp;lt;br&amp;gt;т.к. оба датчика оказываются&amp;lt;br&amp;gt; на черной линии [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
|| When extra powered &amp;lt;br&amp;gt;from the battery, the robot &amp;lt;br&amp;gt;cuts the sharp turning off, &amp;lt;br&amp;gt;because at a speed, &amp;lt;br&amp;gt;the sensors cannot be &amp;lt;br&amp;gt;above the black line both at the same time [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0 Arduino IDE Video]. If the battery is run down, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - простой релейный регулятор + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5 Пропорциональный регулятор &amp;lt;/font&amp;gt;''' Пропорциональный̆ регулятор is a device that оказывающее управляющее воздействие на объект ''пропорционально'' его отклонению от заданного состояния. Принцип действия П-регулятора основывается на том, что мы находим значение отклонения от заданного состояния, которое назовем '''error''' и обозначим буквой E. Ошибка – это разница между показаниями датчиков линии:&lt;br /&gt;
E = S1 – S2. To obtain the value of controlling action '''U''', we multiply this value by a chosen ratio '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6 Пропорционально-дифференциальный регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7 ПИД-регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T10:31:35Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1. &amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;  [[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, &amp;lt;br&amp;gt; two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, &amp;lt;br&amp;gt;the robot cuts off the corners &amp;lt;br&amp;gt;in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2 &amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;left-aligned&amp;gt; &amp;lt;br&amp;gt; The readings of the sensor are as follows: &amp;lt;br&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward.&amp;lt;br&amp;gt;The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position над белым полем, ближе к чёрной линии. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is стоит. The robot поворачивается в движении during 0.1 second &amp;lt;br&amp;gt; '''» 2''' means the position на границе белого и черного полей, еще ближе к чёрной линии. The left-hand motor включен на полную мощность (255) и крутится вперед, а правый  включен на половине  мощности (120) и тоже крутится вперед. The robot едет прямо и немного поворачивается в движении в течение 0,1 секунды &amp;lt;br&amp;gt; '''» 3''' means the position на границе белого и черного полей, уже на  чёрной линии. The left-hand and правые motors включены на полную мощность (255) и оба крутятся вперед. The robot едет прямо в течение 0,1 секунды &amp;lt;br&amp;gt; Остальные значения (4,5 и 6) являются зеркальными по отношению к 0,1 и 2. &amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel without slowing down all along. &amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch хуже, чем ArduiniIDE &amp;lt;br&amp;gt; обрабатывает время движения, поэтому &amp;lt;br&amp;gt; количество диапазонов мы сократили до 5 &amp;lt;br&amp;gt; и упростили движение моторов.&amp;lt;br&amp;gt;  Они все время двигаются вперед с&amp;lt;br&amp;gt; разной мощностью&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, &amp;lt;br&amp;gt;the robot проскакивает поворот &amp;lt;br&amp;gt; in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||It is important to modify the sketch &amp;lt;br&amp;gt;coded for USB, because at a high speed, &amp;lt;br&amp;gt; the in-between values of the sensor &amp;lt;br&amp;gt;cannot be handled. Объединяем все&amp;lt;br&amp;gt; промежуточные значения &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, &amp;lt;br&amp;gt; coded for a 5V power supply (USB). Заменить &amp;lt;br&amp;gt;время движения робота в поворотах со 100 до &amp;lt;br&amp;gt;10 milliseconds. А время движения прямо&amp;lt;br&amp;gt; увеличить до  200 milliseconds. &amp;lt;br&amp;gt; It is necessary because &amp;lt;br&amp;gt; at a high speed, the robot rushes too fast &amp;lt;br&amp;gt;along the path section, where the values of the sensors are changing&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3 &amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt; The trajectory the robot follows is a  line with long straight sections, and the robot can travel without slowing down all along. &amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (рекорд трассы!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Описание проезда по чёрной линии с ДВУМЯ датчиками==&lt;br /&gt;
Сложную трассу с перекрестками, ответвлениями, &amp;quot;зебрами&amp;quot; и инверсными участками с одним датчиком проехать невозможно. При подключении двух датчиков требуется использовани специальных алгоритмов, которые автоматизируют движение робота.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4. - Релейный регулятор  &amp;lt;/font&amp;gt;''' Задача этого алгоритма - удерживать робота в положении &amp;quot;Оба датчика робота находятся над белой линией&amp;quot;, т.е. слева и справа от чёрной линии. Если оба датчика попадают на черную линию, the robot останавливается   &amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||При питании от USB робот &amp;lt;br&amp;gt;останавливается на повороте, &amp;lt;br&amp;gt;т.к. оба датчика оказываются&amp;lt;br&amp;gt; на черной линии [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
|| When extra powered &amp;lt;br&amp;gt;from the battery, the robot &amp;lt;br&amp;gt;cuts the sharp turning off, &amp;lt;br&amp;gt;because at a speed, &amp;lt;br&amp;gt;the sensors cannot be &amp;lt;br&amp;gt;above the black line both at the same time [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0 Arduino IDE Video]. If the battery is run down, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - простой релейный регулятор + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5 Пропорциональный регулятор &amp;lt;/font&amp;gt;''' Пропорциональный̆ регулятор is a device that оказывающее управляющее воздействие на объект ''пропорционально'' его отклонению от заданного состояния. Принцип действия П-регулятора основывается на том, что мы находим значение отклонения от заданного состояния, которое назовем '''error''' и обозначим буквой E. Ошибка – это разница между показаниями датчиков линии:&lt;br /&gt;
E = S1 – S2. To obtain the value of controlling action '''U''', we multiply this value by a chosen ratio '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6 Пропорционально-дифференциальный регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7 ПИД-регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T10:29:33Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1. &amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;  [[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, &amp;lt;br&amp;gt; two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, &amp;lt;br&amp;gt;the robot cuts off the corners &amp;lt;br&amp;gt;in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;left&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2 &amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; The readings of the sensor are as follows: &amp;lt;br&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward.&amp;lt;br&amp;gt;The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position над белым полем, ближе к чёрной линии. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is стоит. The robot поворачивается в движении during 0.1 second &amp;lt;br&amp;gt; '''» 2''' means the position на границе белого и черного полей, еще ближе к чёрной линии. The left-hand motor включен на полную мощность (255) и крутится вперед, а правый  включен на половине  мощности (120) и тоже крутится вперед. The robot едет прямо и немного поворачивается в движении в течение 0,1 секунды &amp;lt;br&amp;gt; '''» 3''' means the position на границе белого и черного полей, уже на  чёрной линии. The left-hand and правые motors включены на полную мощность (255) и оба крутятся вперед. The robot едет прямо в течение 0,1 секунды &amp;lt;br&amp;gt; Остальные значения (4,5 и 6) являются зеркальными по отношению к 0,1 и 2. &amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel without slowing down all along. &amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch хуже, чем ArduiniIDE &amp;lt;br&amp;gt; обрабатывает время движения, поэтому &amp;lt;br&amp;gt; количество диапазонов мы сократили до 5 &amp;lt;br&amp;gt; и упростили движение моторов.&amp;lt;br&amp;gt;  Они все время двигаются вперед с&amp;lt;br&amp;gt; разной мощностью&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, &amp;lt;br&amp;gt;the robot проскакивает поворот &amp;lt;br&amp;gt; in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||It is important to modify the sketch &amp;lt;br&amp;gt;coded for USB, because at a high speed, &amp;lt;br&amp;gt; the in-between values of the sensor &amp;lt;br&amp;gt;cannot be handled. Объединяем все&amp;lt;br&amp;gt; промежуточные значения &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, &amp;lt;br&amp;gt; coded for a 5V power supply (USB). Заменить &amp;lt;br&amp;gt;время движения робота в поворотах со 100 до &amp;lt;br&amp;gt;10 milliseconds. А время движения прямо&amp;lt;br&amp;gt; увеличить до  200 milliseconds. &amp;lt;br&amp;gt; It is necessary because &amp;lt;br&amp;gt; at a high speed, the robot rushes too fast &amp;lt;br&amp;gt;along the path section, where the values of the sensors are changing&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3 &amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt; The trajectory the robot follows is a  line with long straight sections, and the robot can travel without slowing down all along. &amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (рекорд трассы!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Описание проезда по чёрной линии с ДВУМЯ датчиками==&lt;br /&gt;
Сложную трассу с перекрестками, ответвлениями, &amp;quot;зебрами&amp;quot; и инверсными участками с одним датчиком проехать невозможно. При подключении двух датчиков требуется использовани специальных алгоритмов, которые автоматизируют движение робота.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4. - Релейный регулятор  &amp;lt;/font&amp;gt;''' Задача этого алгоритма - удерживать робота в положении &amp;quot;Оба датчика робота находятся над белой линией&amp;quot;, т.е. слева и справа от чёрной линии. Если оба датчика попадают на черную линию, the robot останавливается   &amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||При питании от USB робот &amp;lt;br&amp;gt;останавливается на повороте, &amp;lt;br&amp;gt;т.к. оба датчика оказываются&amp;lt;br&amp;gt; на черной линии [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
|| When extra powered &amp;lt;br&amp;gt;from the battery, the robot &amp;lt;br&amp;gt;cuts the sharp turning off, &amp;lt;br&amp;gt;because at a speed, &amp;lt;br&amp;gt;the sensors cannot be &amp;lt;br&amp;gt;above the black line both at the same time [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0 Arduino IDE Video]. If the battery is run down, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - простой релейный регулятор + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5 Пропорциональный регулятор &amp;lt;/font&amp;gt;''' Пропорциональный̆ регулятор is a device that оказывающее управляющее воздействие на объект ''пропорционально'' его отклонению от заданного состояния. Принцип действия П-регулятора основывается на том, что мы находим значение отклонения от заданного состояния, которое назовем '''error''' и обозначим буквой E. Ошибка – это разница между показаниями датчиков линии:&lt;br /&gt;
E = S1 – S2. To obtain the value of controlling action '''U''', we multiply this value by a chosen ratio '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6 Пропорционально-дифференциальный регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7 ПИД-регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	<entry>
		<id>http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline</id>
		<title>Project ScratchDuinoRobotKit blackline</title>
		<link rel="alternate" type="text/html" href="http://wiki.robbo.world/wiki/Project_ScratchDuinoRobotKit_blackline"/>
				<updated>2018-06-25T10:27:55Z</updated>
		
		<summary type="html">&lt;p&gt;Elena Vostrikova: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Name of author (s)==&lt;br /&gt;
[[User:Elena Vostrikova]]&lt;br /&gt;
&lt;br /&gt;
==Description of the ROBBO Scratch project ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time|| Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 1. &amp;lt;/font&amp;gt;''' The robot uses '''ONE''' numerical value of the line sensor — the AVERAGE between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; If the sensor shows a value greater than the average, then the robot turns to the left during 0.1 second &amp;lt;br&amp;gt; and goes forward during 0.1 second. &amp;lt;br&amp;gt; If the sensor shows a value less than the average,  &amp;lt;br&amp;gt; then the robot turns to the right during 0.1 second and goes forward during 0.1 second. &amp;lt;br&amp;gt; The trajectory the robot follows is a zigzag. &amp;lt;br&amp;gt;  [[File:Zigzag.png]] &amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|38 seconds &lt;br /&gt;
||[[File:Black line analog1 code1.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||[https://youtu.be/Mvm1UxDkF-A ROBBO Scratch Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch] &lt;br /&gt;
||30  seconds&lt;br /&gt;
||To turn the robot on and off, &amp;lt;br&amp;gt; two touch sensors are used: &amp;lt;br&amp;gt;analogRead(A3) – right-hand rear sensor — ON, &amp;lt;br&amp;gt; analogRead(A1) — left-hand rear sensor — OFF &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-- &lt;br /&gt;
|13 seconds&lt;br /&gt;
||The high speed causes numerous errors. &amp;lt;br&amp;gt;At a high speed, &amp;lt;br&amp;gt;the robot cuts off the corners &amp;lt;br&amp;gt;in half the cases.&lt;br /&gt;
||Battery 7.4V&lt;br /&gt;
||[https://youtu.be/0X8lQPaMAsU ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Project_Black_line_analog1_code1.sb2 Download the sketch]&lt;br /&gt;
||11 seconds&lt;br /&gt;
||[https://youtu.be/1VJxK9uEw7A Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_zigzag.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 2 &amp;lt;/font&amp;gt;''' The robot uses '''SEVEN (FIVE, in case of USB)''' numerical values of the line sensor — these are values between  &amp;lt;br&amp;gt; two extreme values, obtained when the sensor is positioned above the white area and above the black line.  &amp;lt;br&amp;gt; The readings of the sensor are as follows: &amp;lt;br&amp;gt;'''» 0''' means the position above the white area. Both motors are on and in full swing (255), the left-hand motor is rotating forward, the right-hand motor is rotating backward.&amp;lt;br&amp;gt;The robot turns in place during 0.1 second. &amp;lt;br&amp;gt;'''» 1''' means the position над белым полем, ближе к чёрной линии. The left-hand motor is on and in full swing (255), rotating forward, while the right-hand motor is стоит. The robot поворачивается в движении during 0.1 second &amp;lt;br&amp;gt; '''» 2''' means the position на границе белого и черного полей, еще ближе к чёрной линии. The left-hand motor включен на полную мощность (255) и крутится вперед, а правый  включен на половине  мощности (120) и тоже крутится вперед. The robot едет прямо и немного поворачивается в движении в течение 0,1 секунды &amp;lt;br&amp;gt; '''» 3''' means the position на границе белого и черного полей, уже на  чёрной линии. The left-hand and правые motors включены на полную мощность (255) и оба крутятся вперед. The robot едет прямо в течение 0,1 секунды &amp;lt;br&amp;gt; Остальные значения (4,5 и 6) являются зеркальными по отношению к 0,1 и 2. &amp;lt;br&amp;gt; The trajectory the robot follows is a smooth curve with long tangent sections, so the robot can travel without slowing down all along. &amp;lt;br&amp;gt; [[File:Line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25–26 seconds&lt;br /&gt;
|ROBBO Scratch хуже, чем ArduiniIDE &amp;lt;br&amp;gt; обрабатывает время движения, поэтому &amp;lt;br&amp;gt; количество диапазонов мы сократили до 5 &amp;lt;br&amp;gt; и упростили движение моторов.&amp;lt;br&amp;gt;  Они все время двигаются вперед с&amp;lt;br&amp;gt; разной мощностью&lt;br /&gt;
||USB&lt;br /&gt;
|| [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
|| 18 seconds&lt;br /&gt;
||[https://youtu.be/yjE4zHcG3h4 Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed.ino Download the sketch]&lt;br /&gt;
|--&lt;br /&gt;
|12 seconds&lt;br /&gt;
||&amp;lt;br&amp;gt;At a high speed, &amp;lt;br&amp;gt;the robot проскакивает поворот &amp;lt;br&amp;gt; in 4 of 5 cases.&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||It is important to modify the sketch &amp;lt;br&amp;gt;coded for USB, because at a high speed, &amp;lt;br&amp;gt; the in-between values of the sensor &amp;lt;br&amp;gt;cannot be handled. Объединяем все&amp;lt;br&amp;gt; промежуточные значения &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog1-RSalgoritm2.sb2 Download the sketch]&lt;br /&gt;
||9.5 seconds&lt;br /&gt;
||It is important to immediately modify the sketch, &amp;lt;br&amp;gt; coded for a 5V power supply (USB). Заменить &amp;lt;br&amp;gt;время движения робота в поворотах со 100 до &amp;lt;br&amp;gt;10 milliseconds. А время движения прямо&amp;lt;br&amp;gt; увеличить до  200 milliseconds. &amp;lt;br&amp;gt; It is necessary because &amp;lt;br&amp;gt; at a high speed, the robot rushes too fast &amp;lt;br&amp;gt;along the path section, where the values of the sensors are changing&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 3 &amp;lt;/font&amp;gt;''' The robot uses '''EIGHT''' numerical values of the line sensor — these are values between &lt;br /&gt;
two extreme values, obtained when the sensor is positioned above the white area and above the black line. &amp;lt;br&amp;gt; The trajectory the robot follows is a  line with long straight sections, and the robot can travel without slowing down all along. &amp;lt;br&amp;gt; [[File:Line-line.png]]&amp;lt;br&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|| &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;8.5 seconds (рекорд трассы!)&amp;lt;/font&amp;gt;&lt;br /&gt;
||  [https://youtu.be/GO4fXPLDF1k Arduino IDE Video] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black_line_analog1_Speed-7-4-var2.ino Download the sketch] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Описание проезда по чёрной линии с ДВУМЯ датчиками==&lt;br /&gt;
Сложную трассу с перекрестками, ответвлениями, &amp;quot;зебрами&amp;quot; и инверсными участками с одним датчиком проехать невозможно. При подключении двух датчиков требуется использовани специальных алгоритмов, которые автоматизируют движение робота.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;standard&amp;quot; border=1 &lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
&lt;br /&gt;
!Trip time ||Sketch||Power supply||ROBBO Scratch||Trip time || Arduino IDE&lt;br /&gt;
&lt;br /&gt;
|-- &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 4. - Релейный регулятор  &amp;lt;/font&amp;gt;''' Задача этого алгоритма - удерживать робота в положении &amp;quot;Оба датчика робота находятся над белой линией&amp;quot;, т.е. слева и справа от чёрной линии. Если оба датчика попадают на черную линию, the robot останавливается   &amp;lt;br&amp;gt; [[File:2line.png]] &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||[[File:Eng-relay-controller-RS.png]]&lt;br /&gt;
||USB&lt;br /&gt;
||При питании от USB робот &amp;lt;br&amp;gt;останавливается на повороте, &amp;lt;br&amp;gt;т.к. оба датчика оказываются&amp;lt;br&amp;gt; на черной линии [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch]&lt;br /&gt;
||XX seconds &lt;br /&gt;
||&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
    analog0 = analogRead(A0); // Got a value from the sensor analog1&amp;lt;br&amp;gt;&lt;br /&gt;
    analog4 = analogRead(A4); // Got a value from the sensor analog4&amp;lt;br&amp;gt;&lt;br /&gt;
    limit = 50;&amp;lt;br&amp;gt;&lt;br /&gt;
    time1 = 200;&amp;lt;br&amp;gt;&lt;br /&gt;
    power = 255;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
    //if both sensors &amp;quot;see&amp;quot; white, the robot moves straight:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    //if the left sensor &amp;quot;sees&amp;quot; black, the robot turns to the left:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;gt; limit &amp;amp;&amp;amp; analog4 &amp;lt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (0, power, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt; &lt;br /&gt;
    //if the right sensor &amp;quot;sees&amp;quot; black, the robot turns to the right:&amp;lt;br&amp;gt;&lt;br /&gt;
    if (analog0 &amp;lt; limit &amp;amp;&amp;amp; analog4 &amp;gt; limit) {&amp;lt;br&amp;gt;&lt;br /&gt;
      move_robbo (power, 0, 0, 0, time1);&amp;lt;br&amp;gt;&lt;br /&gt;
    }&amp;lt;br&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
|-- &lt;br /&gt;
|'''10 seconds''' &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
|| When extra powered &amp;lt;br&amp;gt;from the battery, the robot &amp;lt;br&amp;gt;cuts the sharp turning off, &amp;lt;br&amp;gt;because at a speed, &amp;lt;br&amp;gt;the sensors cannot be &amp;lt;br&amp;gt;above the black line both at the same time [https://youtu.be/9rBbZvaQ1FE ROBBO Scratch Video] &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Black-Line-USB-analog2_and_analog5-RS.sb2 Download the sketch] &lt;br /&gt;
||XX seconds &lt;br /&gt;
||[https://youtu.be/Dv97KMJkuF0 Arduino IDE Video]. If the battery is run down, the robot stops at the turn. &amp;lt;br&amp;gt;[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Test_analog0-analog4.ino Download the sketch - sensor readings] &amp;lt;br&amp;gt; [http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay-controller-2-5.ino Download the sketch - простой релейный регулятор + ON/OFF by touch sensors] &lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 5 Пропорциональный регулятор &amp;lt;/font&amp;gt;''' Пропорциональный̆ регулятор is a device that оказывающее управляющее воздействие на объект ''пропорционально'' его отклонению от заданного состояния. Принцип действия П-регулятора основывается на том, что мы находим значение отклонения от заданного состояния, которое назовем '''error''' и обозначим буквой E. Ошибка – это разница между показаниями датчиков линии:&lt;br /&gt;
E = S1 – S2. To obtain the value of controlling action '''U''', we multiply this value by a chosen ratio '''kp''': U = kp⋅E. U is the momentum that we have to '''add''' to one motor and '''extract''' from other motor. Thus, the robot will control its position '''itself''' — that is, for turning or taxing to the required direction.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds. &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;&lt;br /&gt;
||XX seconds &lt;br /&gt;
||[http://wiki.robbo.ru/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Relay_scratchduino.ino Download the sketch]&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 6 Пропорционально-дифференциальный регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
XX seconds&lt;br /&gt;
||&lt;br /&gt;
||7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=6| &amp;lt;center&amp;gt;'''&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Algorithm 7 ПИД-регулятор&amp;lt;/font&amp;gt;''' &amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||USB&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
||&lt;br /&gt;
|--&lt;br /&gt;
|XX seconds &lt;br /&gt;
||&lt;br /&gt;
||Battery 7.4 V&lt;br /&gt;
||ROBBO Scratch Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
||XX seconds &lt;br /&gt;
||Arduino IDE Video &amp;lt;br&amp;gt;Download the sketch&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Project]]&lt;br /&gt;
[[Category: ScratchDuino 2016]]&lt;br /&gt;
[[Category:Projects_ROBBOKit]]&lt;/div&gt;</summary>
		<author><name>Elena Vostrikova</name></author>	</entry>

	</feed>