BuildMecar-Kit

From Waveshare Wiki
Jump to: navigation, search
BuildMecar-Kit
BuildMecar Kit

BuildMecar Kit, Smart Building Block Robot with Mecanum Wheels, 5MP Camera, Based on Raspberry Pi Build HAT
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

Introduction

The smart robot is always the favorite thing of electronic fans, meanwhile, building blocks can be used to make various objects in different constructions, such as vehicles, buildings, and working robots. Whatever you made, you can break it down and build another new thing by the pieces again.

The Build HAT Python library is able to control sorts of motors and sensors with an LPF2 connector, this makes it possible to build creative combinations by using the Raspberry Pi Build HAT and building blocks, so here comes our BuildMecar - a smart robot with Mecanum wheels, and built by blocks. It will move in any direction based on the Mecanum wheel technology, enabling more funny possibilities for the smart robots.

Features

  • Designed on the basis of Raspberry Pi Build HAT, easily controlling sorts of motors and sensors with an LPF2 connector.
  • Built by blocks, feel free to customize your unique robot.
  • High discharge coefficient Li-ion batteries, providing great power supply for the robot.
  • Features Mecanum wheels, which allows lateral movement, or spinning in the original place.
  • Optional camera, gives your robot an eye.

Notice

  • If you need to connect the camera, please first power off and then connect it, otherwise, the camera may be damaged.
  • To driver the motors, please use the Li-ion battery provided
  • Li-ion and Li-po batteries are quite unstable. They may cause fire, personal injury, or property damage if they're not properly recharged or used.
  • Do not reversely connect the polarities when recharging or discharging the battery. Do not use an inferior charger/charging panel to recharge the battery.
  • Do not mix use old batteries with new ones, avoid using batteries of different brands.
  • When buying a Lithium battery, should always make sure the battery specification is compatible with the expansion board. Choose batteries from the formal manufacturer, and ensure the batteries will work stably and safely by aging test.
  • Lithium batteries have limited cycle life, they will also deteriorate as time goes by. Should be replaced with new ones when the batteries reach their max cycle life or work over two years, whichever comes first.
  • Should be placed carefully and properly, keep it away from inflammable and explosive articles, away from children, avoid any safety accident caused by careless storage.

Connection of Motor and Wheel

Build HAT Port Motor Position Wheel Direction
PORT A right-back L
PORT B right-front R
PORT C left-back R
PORT D left-front L
Buildmecar-wheel-01.png

Write Image

  • We recommend you to use the pre-built image: BuukdMecar image
  • Please download the image and write to a Micro SD card (recommend 16G) by Win32DiskImage tool.

Configure WLAN (optional)

  • If you have a keyboard and display to connect the Raspberry Pi, you can just connect the wifi on the GUI desktop and skip this part.
  • Create a file wpa_supplicant.conf under boot directory.
Wlan-config-03.png
  • Append the following lines to the file and modify according to the actual situation
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev 
country=<The country number based on ISO 3166-1> 
update_config=1 

network={ 
 ssid="<The SSID of WIFI>" 
 psk="<The Password of WIFI>" 
}
For example:
Wlan-config-02.png
  • Save and start the Pi.

Configure SSH (Optional)

  • Our image has SSH enabled by default. If users are using the official buster image, they need to enable SSH by themselves.
  • The opening method is as follows:
  • Create a folder named SSH under the boot drive letter.

Boot01.png

Login Raspberry Pi

With Display

  • You can directly connect a display to the Pi and login the Desktop directly.
Th.png

Remote Login

  • If you want to use remote login to Raspberry Pi, you need to meet the following requirements:
  1. Make sure the Raspberry Pi is connected to the network, either via WLAN or a cable.
  2. Make sure the Raspberry Pi and your computer are under the same router or on the same network segment.
  3. Make sure that the corresponding remote login function is enabled on the Raspberry Pi.
  • In addition to these requirements, if you have multiple Raspberry Pis online under the same network segment, you also need to obtain the IP address of your Raspberry Pi
  • You can use some LAN IP scanning tools, here is an example of Advanced IP Scanner (if you do not have multiple Raspberry Pi online or use the mirror provided by us, you can skip this step).
1. Run Advanced IP Scanner.
2. Click the Scan button to scan the IP address in the current LAN.

BuildMecar Kit Setup01.jpg

3. Find all IP addresses with the word Raspberry Pi in the Manufacturer and record them.

BuildMecar Kit Setup02.jpg

4. Power on the device and make sure the device is connected to the network.
5. Click the Scan button again to scan the IP address in the current LAN.
6. Exclude all the IP addresses that have the word Raspberry Pi in the previously recorded Manufacturer, and the rest is your Raspberry Pi IP address.

SSH Login

  • Make sure SSH is enabled, here use the SSH login command that comes with Windows.
  1. Press win and R at the same time, type cmd, and enter to open the command line.
    BuildMecar Kit 09.jpg
  2. Input the corresponding commands, there are roughly three cases:
    • If you are using the image we provide, use the following command:
    ssh pi@BuildMecar
    • If you are using the original Raspberry Pi image and only one Raspberry Pi device is online, use the following command:
    ssh pi@raspberrypi
    • If you are using the original Raspberry Pi image and multiple Raspberry Pi devices are online, please use the following command:
    ssh pi@IP address
    • A method of obtaining an IP address has been described above, so I won't repeat it here.
    • Suppose you get the address 192.168.10.51, the command should be:
    ssh [email protected]
    CmdSSH-01.png
  3. Input the password 'raspberry and Enter.
    CmdSSH-02.png
  4. Here the SSH login was successful.

Software Setup

If you use the pre-built image, you can just skip this part.

Enable UART

Execute the following command to enter the Raspberry Pi configuration:

sudo raspi-config

Choose Interfacing Options -> Serial -> No -> Yes:
You need to disable the login shell and enable the srial port hardware:

L76X GPS Module rpi serial.png

Reboot Raspberry Pi:

sudo reboot

Open the /boot/config.txt file and find the following configuration statement to enable the serial port, if not, add it at the end of the file:

enable_uart=1

Reboot to take effect.

Enable Camera

Open a terminal and run the following command:

sudo raspi-config

Choose Interfacing Options -> Serial -> No -> Yes.

Download Demo and Install Libraries

Open a terminal and run the following commands.

cd ~
sudo apt-get install unzip -y
wget https://files.waveshare.com/upload/a/ad/BuildMecar-code.zip
unzip BuildMecar-code.zip
sudo pip3 install -r ~/BuildMecar-code/requirements.txt
wget https://files.waveshare.com/upload/9/91/Python-build-hat.zip
unzip Python-build-hat.zip
cd python-build-hat/
chmod +x ./*
sudo pip3 install . --user
sudo ./build.sh

About Examples

  • Before using the example, please make sure that you have assembled the hardware and set up the software normally.

001-MotorRotation

About hardware
  • The battery is connected to the Buildhat board.
  • The Buildhat board is connected to Raspberry Pi.
  • Motor is connected to the PORT A of Buildhat.
Run example
  • Open a terminal and run the following command:
sudo python3 ~/BuildMecar-code/001-MotorRotation/MotorRotation.py
Expected result

The motor which is connected to Buildhat PORT A will run for 1s and then stop.
Please lift the car if the motor doesn't run.

002-MotorSpeedControl

About hardware
  • The battery is connected to the Buildhat board.
  • The Buildhat board is connected to Raspberry Pi.
  • Motor is connected to the PORT A of Buildhat.
Run example
  • Open a terminal and run the following command.
sudo python3 ~/BuildMecar-code/002-MotorSpeedControl/MotorSpeedControl.py
Expected result
  1. The motor which is connected to PORT A run and speeds up.
  2. After touching the max speed, the motor speed down until stops.
  3. The motor turns in the opposite direction, then speeds up and speeds down in a loop.

003-MultipleMotors

About hardware
  • The battery is connected to the Buildhat board.
  • The Buildhat board is connected to Raspberry Pi.
  • Motors are connected to the four ports of Buildhat.
Run example
  • Open a terminal and run the following command.
sudo python3 ~/BuildMecar-code/003-MultipleMotors/MultipleMotors.py
Expected result
  1. The motors run and speed up.
  2. After touching the max speed, the motors speed down until stop.
  3. The motors turn in the opposite direction, then speed up and speed down in a loop.

004-WebControl

Run example
  • Open a terminal and run the following command.
sudo python3 ~/BuildMecar-code/004-WebControl/WebControl.py
Expected result
  • The IP address is printed in the terminal.
WedControl-01.png
  • Open a browse and input the IP with port 5000, for example:
WedControl-02.png
  • Press the BUTTON_1 and BUTTON_2, and the corresponding data are printed in the Raspberry Pi terminal.

005-CameraStreamer

About hardware
  • Connect the camera to the Raspberry Pi.
Run example
  • Open a terminal and run the following command.
sudo python3 ~/BuildMecar-code/005-CameraStreamer/CameraStreamer.py
Expected result
  • The IP address is printed in the terminal.
WedControl-01.png
  • Open a browse and input the IP with port 5000, for example:
WedControl-04.png
  • The camera steam is pushed to the webpage.

006-Example

About hardware
  • The BuildMecar should be assembled.
  • The camera is connected to the Pi (optional).
Run example
  • The IP address is printed in the terminal.
WedControl-01.png
  • Open a browse and input the IP with port 5000, for example:
WedControl-05.png
  • Click the buttons to control the BuildMecar.
  • If you connect a terminal, the image will be shown on the webpage as well.

Resource

Documents

Software

Demo Codes

Support



Technical Support

If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 AM GMT+8 (Monday to Friday)