|Buy from US||Buy from UK||Buy from DE||Buy from IT||Buy from FR||Buy from ES|
In this lesson, we will install the most important framework in the smart car and make car to do some simple movements as per our python sample code. If you have passed the test movement of this lesson, that means Arduino, voltage meter,motor drive module(Model-PI), motors, batteries，chassis and wire connections between these parts are all functioning well.
As your experiments in future lessons are all based on frame work of Lesson One, it is very important to test the installation and sample code in this Lesson properly.
STEP6.Plug the 4 pin female to female cable (white,red,black,yellow) and 2 pin female to female cable(black,red) into PCA9685 compatible board as follows.
STEP7.Plug the 2 PCS 1 pin to 5 pin female to female cable (Black and Red) into PCA9685 compatible board as follows.
STEP8.Install the model pi motor driver board as follows. Then connect PCA9685 compatible module to motor driver board via 4pin and 2 pin cable.Meanwhile, connect the voltage meter to motor driver board via 3pin cable.
STEP9.Install camera module on the top car chassis as follows.
STEP10.Install battery box on the top car chassis as follows.
STEP11.Install raspberry pi on the top car chassis as follows.
STEP12.Intall the top chassis as follows.
STEP13.Before intall the top chassis as follows, you need to plug the battery box into model pi motor driver, then connect the Raspberry Pi board to PCA9685 compatible module adn model Pi motor driver board as follows.
STEP14.Install the left and right wheels.
Video intutorial for SD Card Pre-installed OSOYOO Image
Video intutorial for Your SD Card
Software Preparation:Imager utility: Win32DiskImager utility
OS: Raspbian (Use OS Raspbian 2018-04-18 in the subsequent tutorials)
Format Tool: SDFormatter (Optional)
SSH Tool: PuTTY (for Windows users)
Step 0:Before connect to Raspberry Pi, you need to install Raspbian Operation System(OS) onto SD card(skip this step if your SD card has pre-installed Osoyoo Robot Image).You can select the latest version of RASPBIAN system on the official website: https://downloads.raspberrypi.org/raspbian/images/. Write the image via Win32DiskImager utility into your microSD/TF card(minimum 16G), then plug the card into the slot on your Raspberry Pi.Step 1: Connect Wifi
Firstly, Connect Raspberry Pi to your HDMI monitor or TV. Put a keyboard and mouse into Raspberry Pi USB ports. Insert SD card into the slot on your Raspberry Pi.Click on the wireless icon top right on desktop, should give a list of access points, select your wifi ssid and connect it. Once your Pi is connect to Wifi, you can hover your mouse to the wifi icon to see the your IP address.
Or your can type sudo ifconfig wlan0 command in terminal. Your local ip address will show in wlan0 block(right side of the word inet addr:). It will look like 192.168……
Important Note:As the raspberry pi robot car image was written into SD Card, you just need to follow the step 1 to connect wifi and skip Step 2 to Step 5, directly run the Testing Python code.
Step 2: Open SSH connection
SSH enable user to type shell command remotely from internet so that we can control the car through wifi.In order to enable SSH function, we need type following command from terminal:
Then select Interfacing Options->SSH->Yes->Ok->Finish
Step 3:Use SSH to connect Raspberry Pi terminal remotely
In order to make the car moving freely, we need disconnect Raspberry Pi from monitor, keyboard/mouse and use SSH to send command to Raspberry Pi terminal remotely.
If you are using Windows to send ssh command. you need download a free software called PuTTy to connect the Raspberry Pi local IP(you got from STEP 1).
If you are using MacBook or other linux computer, please type: ssh email@example.com
*your_raspberry_pi_local_ip_address means the wifi IP address you got from STEP 1
When connecting ssh, you need use default user name pi and default password raspberry to login to Raspberry Pi.
Step 4: Open I2C function(skip this step if your SD card has pre-installed Osoyoo Robot Image)
I2C is a protocol which will be used to exchange data with I2C device. In our project, I2C device is PCA9685 module.In order to use I2C function, we need type following command from terminal:
Then select Interfacing Options->I2C->Yes->Ok->Finish
cd ~ sudo apt-get update
sudo apt-get install build-essential python-pip python-dev python-smbus git
git clone https://github.com/adafruit/Adafruit_Python_GPIO.git cd Adafruit_Python_GPIO sudo python setup.py install
cd ~ sudo rm -fr Adafruit_Python_GPIO
Step 5:Testing Previous Installation(skip this step if your SD card has pre-installed Osoyoo Robot Image)
cd ~ mkdir osoyoo-robot/ cd osoyoo-robot/ wget http://osoyoo.com/driver/motor-test.tar.gz tar -zxvf motor-test.tar.gz
Step 6: Run Testing Python code
Important Note:As the raspberry pi robot car image was written into SD Card, you just need to follow the step 1 to connect wifi and skip others steps, directly run the Testing Python code.
After running above python sample code, your car should move forward for 2 seconds, then move backward for 2 seconds , then turn left for 2 seconds and finally turn right for 2 seconds.
If your car does not move as per above scenario, the installation should have some problem. You need double check the wire connection and software installation as per our previous steps.
You must be logged in to post a comment