{"id":556,"date":"2023-02-27T20:00:23","date_gmt":"2023-02-27T19:00:23","guid":{"rendered":"http:\/\/engineerlab.de\/?page_id=556"},"modified":"2023-03-01T19:51:57","modified_gmt":"2023-03-01T18:51:57","slug":"lego-robot","status":"publish","type":"page","link":"https:\/\/engineerlab.de\/?page_id=556","title":{"rendered":"Lego Robot"},"content":{"rendered":"<h1>Raspberry pi configuration<\/h1>\n<p>Raspberry Pi 2 Module B Rev 1.1<br \/>\nVersion 11 Bullseye<\/p>\n<p>We have to prepare the raspberry pi for the bluetooth module.<br \/>\n-Enable serial port trough &#8222;sudo raspi-config&#8220; then choose 3 Interface options &gt;&gt; I6 Serial Port &gt;&gt; login to shell = No, Serial Hardware Enable = Yes. Then do a reboot.<br \/>\nNow we can check if this has worked: cd \/dev then type in ls -l. You should now see a serial port:<\/p>\n<p><img loading=\"lazy\" class=\"alignnone size-medium wp-image-598\" src=\"http:\/\/engineerlab.de\/wp-content\/uploads\/2023\/03\/serial_port-300x78.png\" alt=\"\" width=\"300\" height=\"78\" srcset=\"https:\/\/engineerlab.de\/wp-content\/uploads\/2023\/03\/serial_port-300x78.png 300w, https:\/\/engineerlab.de\/wp-content\/uploads\/2023\/03\/serial_port.png 398w\" sizes=\"(max-width: 300px) 85vw, 300px\" \/><\/p>\n<p>Needed library for python:<br \/>\nsudo pip3 install pyserial<\/p>\n<p>Name: lego<br \/>\nThere are two ways possible ways to load a programm into the raspberry pi:<br \/>\nWay 1: Connect trough Putty and change the file directly: motor_run<br \/>\n<img loading=\"lazy\" class=\"alignnone size-medium wp-image-583\" src=\"http:\/\/engineerlab.de\/wp-content\/uploads\/2023\/02\/file_robot_path-300x123.png\" alt=\"\" width=\"300\" height=\"123\" srcset=\"https:\/\/engineerlab.de\/wp-content\/uploads\/2023\/02\/file_robot_path-300x123.png 300w, https:\/\/engineerlab.de\/wp-content\/uploads\/2023\/02\/file_robot_path.png 478w\" sizes=\"(max-width: 300px) 85vw, 300px\" \/><\/p>\n<p>Way 2: Open the app Thonny:<br \/>\nSetup first the connection to the PI<\/p>\n<p><img loading=\"lazy\" class=\"alignnone size-medium wp-image-588\" src=\"http:\/\/engineerlab.de\/wp-content\/uploads\/2023\/02\/thonny_connection_setup-300x236.png\" alt=\"\" width=\"300\" height=\"236\" srcset=\"https:\/\/engineerlab.de\/wp-content\/uploads\/2023\/02\/thonny_connection_setup-300x236.png 300w, https:\/\/engineerlab.de\/wp-content\/uploads\/2023\/02\/thonny_connection_setup.png 662w\" sizes=\"(max-width: 300px) 85vw, 300px\" \/><\/p>\n<p>If connection established you can see your folders from the pi:<br \/>\n<img loading=\"lazy\" class=\"alignnone size-medium wp-image-590\" src=\"http:\/\/engineerlab.de\/wp-content\/uploads\/2023\/02\/thonny_connection_setup1-300x196.png\" alt=\"\" width=\"300\" height=\"196\" srcset=\"https:\/\/engineerlab.de\/wp-content\/uploads\/2023\/02\/thonny_connection_setup1-300x196.png 300w, https:\/\/engineerlab.de\/wp-content\/uploads\/2023\/02\/thonny_connection_setup1.png 530w\" sizes=\"(max-width: 300px) 85vw, 300px\" \/><\/p>\n<p>https:\/\/bluedot.readthedocs.io\/en\/latest\/<\/p>\n<h1>Controlling the robot trough bluetooth connection (HC-05)<\/h1>\n<p>Enter AT-mode:<br \/>\n&#8211; Connect the bluetooth module with a RS232 USB converter. Rx \/Tx should be have not more than 3.3V level<br \/>\n&#8211; Connect Pin &#8222;Key&#8220; permanently with 5V (Led flashes slow, every 2s)<br \/>\n&#8211; Check COM-Port (here COM3) and connect trough a terminal program. Set baudrate to 38400 (only in AT mode)<br \/>\n&#8211; Send following command for testing the connection:<br \/>\nAT+UART?$0D$0A<\/p>\n<p><img loading=\"lazy\" class=\"alignnone  wp-image-566\" src=\"http:\/\/engineerlab.de\/wp-content\/uploads\/2023\/02\/lego_roboter_at_commands-300x297.png\" alt=\"\" width=\"477\" height=\"472\" srcset=\"https:\/\/engineerlab.de\/wp-content\/uploads\/2023\/02\/lego_roboter_at_commands-300x297.png 300w, https:\/\/engineerlab.de\/wp-content\/uploads\/2023\/02\/lego_roboter_at_commands.png 684w\" sizes=\"(max-width: 477px) 85vw, 477px\" \/><\/p>\n<p>Configuration:<br \/>\nName: Lego<br \/>\nBaudrate: 9600<br \/>\nRole: Slave<br \/>\nPWD: 1234<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Raspberry pi configuration Raspberry Pi 2 Module B Rev 1.1 Version 11 Bullseye We have to prepare the raspberry pi for the bluetooth module. -Enable serial port trough &#8222;sudo raspi-config&#8220; then choose 3 Interface options &gt;&gt; I6 Serial Port &gt;&gt; login to shell = No, Serial Hardware Enable = Yes. Then do a reboot. Now &hellip; <a href=\"https:\/\/engineerlab.de\/?page_id=556\" class=\"more-link\"><span class=\"screen-reader-text\">&#8222;Lego Robot&#8220; <\/span>weiterlesen<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/engineerlab.de\/index.php?rest_route=\/wp\/v2\/pages\/556"}],"collection":[{"href":"https:\/\/engineerlab.de\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/engineerlab.de\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/engineerlab.de\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/engineerlab.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=556"}],"version-history":[{"count":17,"href":"https:\/\/engineerlab.de\/index.php?rest_route=\/wp\/v2\/pages\/556\/revisions"}],"predecessor-version":[{"id":599,"href":"https:\/\/engineerlab.de\/index.php?rest_route=\/wp\/v2\/pages\/556\/revisions\/599"}],"wp:attachment":[{"href":"https:\/\/engineerlab.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=556"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}