Lego Robot

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 „sudo raspi-config“ then choose 3 Interface options >> I6 Serial Port >> login to shell = No, Serial Hardware Enable = Yes. Then do a reboot.
Now we can check if this has worked: cd /dev then type in ls -l. You should now see a serial port:

Needed library for python:
sudo pip3 install pyserial

Name: lego
There are two ways possible ways to load a programm into the raspberry pi:
Way 1: Connect trough Putty and change the file directly: motor_run

Way 2: Open the app Thonny:
Setup first the connection to the PI

If connection established you can see your folders from the pi:

https://bluedot.readthedocs.io/en/latest/

Controlling the robot trough bluetooth connection (HC-05)

Enter AT-mode:
– Connect the bluetooth module with a RS232 USB converter. Rx /Tx should be have not more than 3.3V level
– Connect Pin „Key“ permanently with 5V (Led flashes slow, every 2s)
– Check COM-Port (here COM3) and connect trough a terminal program. Set baudrate to 38400 (only in AT mode)
– Send following command for testing the connection:
AT+UART?$0D$0A

Configuration:
Name: Lego
Baudrate: 9600
Role: Slave
PWD: 1234