Team-08 Wireless Controlled Car Project

From eLinux.org
Revision as of 10:04, 27 November 2015 by Vinodkgupta96 (talk | contribs) (Future Work)
Jump to: navigation, search

thumb‎ Embedded Linux Class by Mark A. Yoder


Team members: Divakar Maurya Himanshu Kamboj Vinod Kumar

Grading Template

I'm using the following template to grade. Each slot is 10 points. 0 = Missing, 5=OK, 10=Wow!

00 Executive Summary
00 Installation Instructions 
00 User Instructions
00 Highlights
00 Theory of Operation
00 Work Breakdown
00 Future Work
00 Conclusions
00 Demo
00 Not Late
Comments: I'm looking forward to seeing this.

Score:  00/100

(Inline Comment)

Executive Summary

Introduction to Project: The goal of this project is to create a Wireless Controlled Car using DC motors interfaced with beaglebone/pi/... The Control signals will be sent over WiFi. Capacitive touch screen is used to get the Input Signal. The motivation is to build an unmanned vehicle which has a long range of operation.

Working parts: All the electronic components such as DC motor, Raspberry Pi, Motor drivers, Arduino, various Sensors have been installed on the car and are functioning properly. Software component of our project like interfacing the touch screen to Pi and Pi to WiFi Server also perform with almost zero latency.

Not Working Parts: I take pride in claiming that till now everything that we proposed to deliver has been implemented successfully.

Conclusion: It has been a great experience to assemble all the required parts. Interfacing touch screen and connecting to WiFi to move the car has been a great learning experience.

Installment Instructions

1. Install Raspbian OS on two SD Cards following the instruction given in installation instruction section.

2. Install the Tkinter package on one raspberry pi (which is connected to touch screen say it 'A').

3. Write the program to make buttons on touch screen and interacting client code.

  (our code is at https://github.com/vinodkgupta96/Project/blob/master/7button.py).

4. Write code for server side interaction on second Pi.

  (our code is at https://github.com/vinodkgupta96/Project/blob/master/server.py) 

5. Follow the setup.py file on github.

  (https://github.com/vinodkgupta96/gitLearn/blob/master/setup.sh)

6. Software to write codes on Arduino is also to be installed. If you have a voltage converter, you can avoid the usage of Arduino.

7. Follow the User Intstructions on this wiki page.

Packaging

 The total photos of making this can be found here:

Above_Samplephotos_of_process_can_be_found_here source :[[Source]]

These are the essential photos in our project work:

basic structure car chasis connected with DC motor inside it
loaded with aurduino and raspberry pi and driver
This is raspberry pi with raspbian(in SD CARD)
pi with wifi module
5in touch screen
Pi with touch screen
Another Pi connected with wifi module and SD CARD
Both raspberry pi

Installation Instructions

Give step by step instructions on how to install your project.

Installing Raspbian on Raspberry PI

DOWNLOAD THE IMAGE

Official images for recommended Operating Systems are available to download from the Raspberry Pi website: raspberrypi.org/downloads

Alternative distributions are available from third party vendors.

After downloading the .zip file, unzip it to get the image file (.img) for writing to your SD card.

For Linux:


1. Please note that the use of the dd tool can overwrite any partition of your machine. If you specify the wrong device in the instructions below you could delete your primary Linux partition. Please be careful.

2. Run df -h to see what devices are currently mounted.

3. If your computer has a slot for SD cards, insert the card. If not, insert the card into an SD card reader, then connect the reader to your computer.

4. Run df -h again. The new device that has appeared is your SD card. The left column gives the device name of your SD card; it will be listed as something like /dev/mmcblk0p1 or /dev/sdd1. The last part (p1 or 1 respectively) is the partition number but you want to write to the whole SD card, not just one partition. Therefore you need to remove that part from the name (getting, for example, /dev/mmcblk0 or /dev/sdd) as the device for the whole SD card. Note that the SD card can show up more than once in the output of df; it will do this if you have previously written a Raspberry Pi image to this SD card, because the Raspberry Pi SD images have more than one partition.

5. Now that you've noted what the device name is, you need to unmount it so that files can't be read or written to the SD card while you are copying over the SD image.

6. Run umount /dev/sdd1, replacing sdd1 with whatever your SD card's device name is (including the partition number).

7. If your SD card shows up more than once in the output of df due to having multiple partitions on the SD card, you should unmount all of these partitions.

8. In the terminal, write the image to the card with the command below, making sure you replace the input file if= argument with the path to your .img file, and the /dev/sdd in the output file of= argument with the right device name. This is very important, as you will lose all data on the hard drive if you provide the wrong device name. Make sure the device name is the name of the whole SD card as described above, not just a partition of it; for example sdd, not sdds1 or sddp1; or mmcblk0, not mmcblk0p1.

9. dd bs=4M if=2015-09-24-raspbian-jessie.img of=/dev/sdd Please note that block size set to 4M will work most of the time; if not, please try 1M, although this will take considerably longer.

10. Also note that if you are not logged in as root you will need to prefix this with sudo.

11. The dd command does not give any information of its progress and so may appear to have frozen; it could take more than five minutes to finish writing to the card. If your card reader has an LED it may blink during the write process. To see the progress of the copy operation you can run pkill -USR1 -n -x dd in another terminal, prefixed with sudo if you are not logged in as root. The progress will be displayed in the original window and not the window with the pkill command; it may not display immediately, due to buffering.

12. Instead of dd you can use dcfldd; it will give a progress report about how much has been written.

13. You can check what's written to the SD card by dd-ing from the card back to another image on your hard disk, truncating the new image to the same size as the original, and then running diff (or md5sum) on those two images.

14. The SD card might be bigger than the original image, and dd will make a copy of the whole card. We must therefore truncate the new image to the size of the original image. Make sure you replace the input file if= argument with the right device name. diff should report that the files are identical.

15. dd bs=4M if=/dev/sdd of=from-sd-card.img truncate --reference 2015-09-24-raspbian-jessie.img from-sd-card.img diff -s from-sd-card.img 2015-09-24-raspbian-jessie.img 16.Run sync; this will ensure the write cache is flushed and that it is safe to unmount your SD card.

17. Remove the SD card from the card reader

  • Link to the github repositry for detailed description of this project.
 https://github.com/vinodkgupta96/gitLearn/
  • Arduino Mega is also needed. Basically, here it has been used to step up the voltage. Boost Converter would be a good replace. For more details
 https://www.arduino.cc/en/Guide/HomePage

User Instructions

1. Make sure that WiFi is On.

2. Run Setup icon and button will appear on touch screen side

3. Run Setup icon on car side

4. Press FORWARD button to move the car in Forward direction.

5. Press BACKWARD button move the car in Backward direction.

6. Press Speed Up button to Increase the car's speed.

7. press Speed DOWN button to Decrease the car's speed.

8. Press LEFT button to move the car in the Left direction.

9. Press RIGHT button to move the car in the Right direction.

10. Press HORN ON/OFF button to Blow the horn.

11. Press STOP to stop the car.

12. Need not to take tension of preventing it from hitting walls as it will automatically stop when it is about to.

Highlights

What Our project can do and its possibility in future.

  1. This car can be controlled from any location in the world. Once the car has the camera installed on it, it need not to be in Line Of Sight (LOS) anymore.
  2. This car can be used for the surveillance system after mounting a camera on it.
  3. We can use it as a vehicle for delivering the small loads, how about your morning tea coming to your bed.
  4. Ease of control: It is being controlled by capacitive touch screen which can easily fir in the pocket. There is also a possibility to control the car with hand gestures by using leap motion.
  5. After a little reprogramming, it can be used to perform regular errands.

See it Roaring....

YouTube demo1.

YouTube demo2.

Theory of Operation

High Level Overview of the structure of your software

Raspbian Operating System Raspbian is a free operating system based on Debian optimized for the Raspberry Pi hardware. An operating system is the set of basic programs and utilities that make your Raspberry Pi run. However, Raspbian provides more than a pure OS: it comes with over 35,000 packages, pre-compiled software bundled in a nice format for easy installation on your Raspberry Pi.

The initial build of over 35,000 Raspbian packages, optimized for best performance on the Raspberry Pi, was completed in June of 2012. However, Raspbian is still under active development with an emphasis on improving the stability and performance of as many Debian packages as possible.

Note: Raspbian is not affiliated with the Raspberry Pi Foundation. Raspbian was created by a small, dedicated team of developers that are fans of the Raspberry Pi hardware, the educational goals of the Raspberry Pi Foundation and, of course, the Debian Project.

Source https://www.raspbian.org/

Tkinter

Tkinter is Python's de-facto standard GUI (Graphical User Interface) package. It is a thin object-oriented layer on top of Tcl/Tk.

Tkinter is not the only GuiProgramming toolkit for Python. It is however the most commonly used one. CameronLaird calls the yearly decision to keep Tkinter "one of the minor traditions of the Python world."

Tkinter wiki: http://tkinter.unpythonic.net/wiki/


No we are not using Gstreamer.

Yes,multiple task is running.

This is what they do and this is how they interact.

Here is the summary of the key functions from socket - Low-level networking interface:

1. socket.socket(): Create a new socket using the given address family, socket type and protocol number.

2. socket.bind(address): Bind the socket to address.

3. socket.listen(backlog): Listen for connections made to the socket. The backlog argument specifies the maximum number of queued connections and should be at least 0; the maximum value is system-dependent (usually 5), the minimum value is forced to 0.

4. socket.accept(): The return value is a pair (conn, address) where conn is a new socket object usable to send and receive data on the connection, and address is the address bound to the socket on the other end of the connection. At accept(), a new socket is created that is distinct from the named socket. This new socket is used solely for communication with this particular client.

For TCP servers, the socket object used to receive connections is not the same socket used to perform subsequent communication with the client. In particular, the accept() system call returns a new socket object that's actually used for the connection. This allows a server to manage connections from a large number of clients simultaneously.

5. socket.send(bytes[, flags]): Send data to the socket. The socket must be connected to a remote socket. Returns the number of bytes sent. Applications are responsible for checking that all data has been sent; if only some of the data was transmitted, the application needs to attempt delivery of the remaining data.

6. socket.colse(): Mark the socket closed. all future operations on the socket object will fail. The remote end will receive no more data (after queued data is flushed). Sockets are automatically closed when they are garbage-collected, but it is recommended to close() them explicitly. Note that the server socket doesn't receive any data. It just produces client sockets. Each client-socket is created in response to some other client socket doing a connect() to the host and port we're bound to. As soon as we've created that client-socket, we go back to listening for more connections.

Source : http://www.stackoverflow.com

Work Breakdown

Software Part:

1.Installed the Raspbian OS for two raspberry pi.Both raspberry pis are having different configuration. Because of we need only one touch screen for one raspberry pi(demand of project). (done by Vinod Kumar,Himanshu Kamboj)

2.Created the 9buttons on using Tkinter package avialable for python 2.7-3.1 .(done by Vinod Kumar)

3.We have connected the car (server) and touch screen with pi (client ) to remote wifi (router).(done by Vinod Kumar)

4.We interaacted the car with touch screen ,both are connected with same wifi.(done by Vinod Kumar,Himanshu Kamboj)


Hardware Part:

1.Connected the DC motor with Car Chasis. ( done by Divakar Maurya,Himanshu kamboj,Vinod Kumar)

2.Controlling the DC Motor with L298D motror drive.( done by Divakar Maurya,Himanshu kamboj,Vinod Kumar)

3.Interface the driver with aurduino(mega).( done by Divakar Maurya,Himanshu kamboj)

4.Connecting the touch screen with raspberry pi.( done by Divakar Maurya,Himanshu kamboj,Vinod Kumar)

5.Controlling the output coming from touch screen to car via wifi.( done by Divakar Maurya,Himanshu kamboj,Vinod Kumar)

6.connecting with sensors.( done by Divakar Maurya)


Assembly of Hardware and Software Part:

1.Integrated the Touch screen with button and client side socket program.( done by Divakar Maurya,Himanshu kamboj,Vinod Kumar)

2.Integrated the car with server side socket programming in order to take the input coming from touch screen.( done by Divakar Maurya,Himanshu kamboj,Vinod Kumar) 3.Tested the Car with appropriate input and output.( done by Divakar Maurya,Himanshu kamboj,Vinod Kumar)


Documentation Part:

#All the documentation from uploading the project proposal,project code image ... to making the wiki,are done.( done by Vinod Kumar)


We have completed our promises given in Project Proposal And we have completed our Project less than the expected week.

Future Work

As, we have implemented according to our Project Proposal. There is no remaining part to be implemented. But, Still we can add or modify in order to achieve new features and functionalities.

1. We can use advanced version of touch screen instead of using capacitive touch screen for better sensitivity.

2. We can use leap motion sensor to control the car.

3. If we use tyres with better grip, the car can be made to run on difficult terrains.

4. The car can also be programmed to run on a predefined path (viz. a parabolic path).

5. The car can be used to run daily errands (like a delivery van from kitchen to drawing room).Just need to reprogram it.

Conclusions

After Completing the Our project We concluded various things:

1.We learnt how to select appropriate hardware components(keeping in mind for future use in project).

2.We didn't expect that some small parts are very important in order to complete the project.

3.There was also short circuiting due to we lost the component.Stiil we stand by our project and its proposed features.

4.We learnt how to interact two machine using router.

5.We also got the idea of socket progarming and various protocol while implememting this.

6.Over all ,We got strength to work in group and assign the work individually oor in group to complete within time.




thumb‎ Embedded Linux Class by Mark A. Yoder