Internet Controlled Car Project
This project was created as a senior project during my undergraduate degree at Charleston Southern University. I have exposed all my code for educational purposes, although Charleston Southern University may own rights to this project due to their student project policies. My aim is to use this page to fully explain how each component of the project is pieced together, if anything is left unexplained, I am happy to personally answer any questions via email or through the comment section found at the bottom of this page. I hope you find this page is helpful, any comments will be appreciated.

Main objectives of this project
- To transform a radio frequency remote controlled car with a limited range into an radio frequency internet controlled car with an unlimited range.
- To allow the user to control the vehicle from a number of different devices using various different methods of communication.
- To stream real time footage from the vehicle using an on-board IP camera to the to users device to enable real time steering.
- To expand my knowledge in the area of networking and software development.
- To develop a project that can easily be extended into something more sophisticated and complex.
- To provide material for others to learn from.
Ways Of Communication
Android Application
Hand Movement
I am unable to share the source code since I am not the original owner, if there are any questions regarding this part of the project then please send me an email and I will be happy to discuss.
Website
Arcade Joystick

HTTP requests from any browser
Hardware
Equipment used
The Basics
So how exactly does it all work?
Depending on your level of understanding you may be asking your self a couple of questions;
What is an HTTP request?
To put it simply an HTTP request is an instruction sent from one router to another router. The request can be thought of as an
instruction or command, usually containing information regarding the data hoping to be received in return. For instance, to get this website pulled up
on your browser you're computer sent a request to another server asking for this specific page. The request looked something like this
GET http://www.brandoncaddow-young/internetCar.php HTTP/1.1. Again, to put it in simply, you sent a message(instruction) to another server that
held the contents of this website and said "I want the page internetCar.php".
What is an Arduino?
An Arduino is a microcontroller. A microcontroller is a device that generally takes input, process the data that is collected
and the takes appropriate action based on a program being executed on-board the microcontroller. Microcontrollers can be thought of as mini
computers capable of computation and 'add life' to a project. All electronic toys will contain some sort of a microcontroller in order to
control its movement and provide the device with 'intelligence'.
Why I chose to use an Arduino
The main reason I was attracted to the Arduino was because of their open source approach to their products combined with their attitude in general.
The Arduino UNO is relatively cheap although well built which makes for a great educational tool. The Arduino team have an interesting story and some
very interesting ideas of which include open source hardware, for more information on the Arduino team watch this video;
To jump to more details about the Arduino please click here.
What do you mean by open-source hardware?
Open-source hardware shares much of the principles and approach of free and open-source software. In particular, we believe that people should be able to
study our hardware to understand how it works, make changes to it, and share those changes. To facilitate this, we release all of the original design files
(Eagle CAD) for the Arduino hardware. These files are licensed under a Creative Commons Attribution Share-Alike license, which allows for both personal and
commercial derivative works, as long as they credit Arduino and release their designs under the same license. The Arduino software is also open-source.
The source code for the Java environment is released under the GPL and the C/C++ microcontroller libraries are under the LGPL.
The information above was taken directly from http://arduino.cc/en/Main/FAQ
Understanding the process better
More specifically
HTTP Requests are sent from the client(person controlling the vehicle) to the server(router where microcontroller physically resides).
The information above was taken directly from http://www.jmarshall.com/easy/http
How does the request reach the destination router?
The requests referred to are eventually received at the client side.
The HTTP request is forwarded onto the microcontroller via its Ethernet Shield.
The request is parsed and stripped of any 'irrelevant' information.
Here is the specific code which runs on the Arduino that makes this part of the process possible.

Depending on the given data, the Arduino forwards signal on to a specific connection of the transmitter

Radio frequency then takes care of communication between the transmitter and receiver.
The fortunate part of this project is that the communication between the vehicle and the transmitter had been previously assembled which
eradicated much of the hard work. I could have taken this project a step further and dealt with that communication myself although I feel it
was beyond the scope of this project given my limitations with respect to time and money. With that being said, I all that was required from
this point on to get the car performing the correct functions was to trigger the connections on the PCB in oder to successfully send
appropriate signals to the car.
The Local Area Network Vs. The Internet
What is the range?
TRACERT results for accessing this website from my computer

More interestingly, I used a service provided by a website named yougetsignal.com to visually trace the route of the packets sent. With my website sitting on a server in the United States and both myself and the vehicle being located in the United Kingdom, the packets had to travel a distance of approximately 14,000 miles during its round trip! The astonishing part about the whole process is that this has to happen for each and every instruction given to the vehicle. To top it off, the the whole process takes less than a second to complete its round trip. Can you imagine the distance covered by light being shot around the world when the vehicle is driven for half an hour at a time!?
A visual representation of the route that each instruction takes

The two main enabling factors which allow for this extensive range are as follow; the use of the internet in general through an ISP combined with the fact that a router was used as the main method of communication. The router enables the vehicle to be controlled over both the Local Area Network and the Internet. The benefit associated with using the Local Area Network is that there is almost no lag time involved.
Steps Involved
Step 1.
        Buying the remote controlled car
Step 2.
        Buying the Arduino and the Ethernet Shield
Step 3.
        Buying the router
Step 4.
        Setting up the router
Step 5.
        Hacking the transmitter
Step 6.
        Buying the IP camera
Step 7.
        Hacking the IP camera's power supply

Step 8.
        Mounting the IP camera on the vehicle
Step 9.
        Ways of communication
website
A simple but effective website making use of HTML and some basic JavaScript allows the user to control the vehicle using just the arrow keys on the keyboard. The user is also provided with the ability to move the position of the IP camera on board he vehicle by using buttons located above, below, left and right of the streamed footage.
IOS Application
I developed an IOS application to control the vehicle making use of the built in accelerometer. Feedback from the accelerometer sends appropriate HTTP requests resulting in the car responding to the users request. whilst real time footage from the on-board IP camera is streamed to the application. The minimalist approach to the design of the application allows the user to view the streamed footage in full screen whilst simply tilting the device to maneuver the vehicle.
Hand movement
This section of the project was created by Mark Frost, a fellow Computer Science graduate of Charleston Southern. The program is written in C# using Visual Studio making use of either a built in or plug and play camera to track a specific marker. Based on the position of the marker, the program communicates with the vehicle accordingly.
Arcade Joystick
A basic arcade style joystick is connected to a computer where 'already built' drivers over ride the Windows arrow keys. By using this approach alongside the website I previously described I am able to successfully communicate with the vehicle. I also used a USB SNES to PC controller to perform a similar task.
The Arduino
Arduino
The information above was taken directly from http://arduino.cc/en/Main/ArduinoBoardUno

The Arduino Development Environment
Writing programs to upload to the Arduino
Input and Output
The Arduino UNO also provides 6 analog inputs, of which each provides 10 bits of resolution (2^10 = 1024 different values). By default they measure from ground to 5 volts.
Uploading programs to the Arduino
Libraries
Memory
There are three approaches to storing data on the Arduino (ATmega168). As with all memory there are limitations as to how much can be stored on-board. Because of its limited capabilities the programmer is careful in the design of the program to ensure that memory is not wasted and rather used wisely.Flash memory which is also known as program space(non-volatile).
This is where the Arduino sketch(source code) is stored. There is 32 KB bytes (0.5k is used for the boot loader) available.
SRAM also known as static random access memory(non-volatile).
This is where the sketch creates and manipulates variables at run time. There is 2 KB available. Many strings or other variable can (relatively) quickly use up this memory. To give some idea of how much memory is available each ASCII character is represented by one byte, which means that you have maximum of 1024 characters before the sketch will fail to successfully execute.
EEPROM is memory space that programmers can use to store long-term information.
There is 1 KB available.
Summary
- Microcontroller (ATmega328)
- Operating Voltage 5V
- Input Voltage (recommended) 7-12V
- Input Voltage (limits) 6-20V
- Digital I/O Pins 14 (of which 6 provide PWM output)
- Analog Input Pins 6
- DC Current per I/O Pin 40 mA
- DC Current for 3.3V Pin 50 mA
- Flash Memory 32 KB (ATmega328)
- SRAM 2 KB (ATmega328)
- EEPROM 1 KB (ATmega328)
- Speed 16 MHz
Alternative Solutions
Other methods which could have worked
The first alternative solution
I could have avoided using an Arduino entirely by hacking the IP camera. Similar to the method used to control the vehicle in this project, the IP camera's pan and tilt functions happen to also use HTTP requests for means of communication. The processing of the data contained within the HTTP requests have been previously configured by the manufacturer's of the IP camera. So in theory, If I was to go down this route I would just be standing on the shoulders of the Foscam's work. To be more specific in my approach, this process could of been achieved by redirecting the signal from the motors which control the pan and tilt functionality to the motors which drive the wheels of the vehicle. There are extremely small IP cameras out there which offer this functionality so it is interesting to note how light and small and effortless the project could of been by just standing on the shoulders of other peoples work.
The second alternative solution
This solution is similar to the approach used in this project although slightly different in terms of communication. The idea involves the purchase of second router that would sit on-board the vehicle connected via ethernet cable to the microcontroller. The router previously referred to would then need to communicate with another router, connected to the internet. The benefit to this solution would be having the microcontroller on-board the vehicle as this would allow for the use of sensors. Once this is achieved the vehicle is would suddenly become intelligent and could be able to do things like avoid obstacles or react to voice commands. The extent of what the vehicle could then do would only be limited to the creativity and desire of the programmer! The drawback to this solution is that the router, the Arduino and the IP camera would also need to be powered by battery pack. This would lead to both a heavier and more expensive alternative. The combined weight of all these items would also lead to a slower, more power consuming vehicle. An alternative to this solution would be to just place a second microcontroller on board the vehicle to be used as means of intelligence.
Difficulties
Obstacles that got in the way
Maneuvering the car so it could turn and accelerate at the same time
Unfortunately the Arduino doesn't natively support multiple threads which means that I was limited to calling only one instruction at a time. This proved to be a challenge as in order to get the car to move left or right the vehicle needed to also be accelerating or reversing at the same time. Recently I have found that there exists a library which handles 'lightweight stack-less' threads. Looking back I could have included this library and sent more than one signal at once. A short tutorial can be found by clicking here.
Due to my ignorance of the library mentioned above, I chose to combat the problem from a different angle, I decided to take less efficient yet more creative path by staggering the signals sent to the vehicle. For example, when it came to both accelerating and turning at the same time I would send multiple short bursts of alternate signal to both turn the wheels and accelerate. The momentum created when sending short bursts of signal to accelerate the vehicle was enough to allow the car to move whilst the brief 'turning signals' helped steer the moving vehicle. The draw back to using this method is that it provides for a bad turning radius, especially when turning from a still position. In hindsight I would of made use of the threading library which would of allowed for numerous instructions to be executed at once.
Soldering
Getting signal to the transmitter
How much did it cost?
Other useful links
Future Improvements
Where to go from here?
        - Making use of the threaded library to improve turning radius.
        - upgrading to a bigger, stronger, faster vehicle.
        - adding distance sensors for anti crashing system.
        - adding voice control.
        - adding GPS for navigation purposes.
        - adding a small pellet gun or some sort of device on board the vehicle.
        - adding a LCD display.
        - adding autonomous control.
        - adding automatic charging(charging pad).
By implementing most of the above improvements would of course mean mounting an Arduino onto the vehicle itself. By doing so you are in effect giving the vehicle a brain of its own. It's intelligence being solely limited by the programmers creativity and knowledge. For instance on the account of the vehicle being driven outside of its range and left stranded, it could autonomously find its way back to a location within range of the transmitter.
How would the vehicle autonomously navigate back toward its radio frequency range?
Each instruction given to the vehicle could be pushed onto the stack. If the car was to receive no instruction for over 20 seconds, then instructions could be popped off the stack and reversed resulting in the vehicle navigating its way back to the point where it lost connection with the transmitter. Alternatively I could incorporate GPS by storing the x and y coordinates of each successful instruction undertaken by the RC car. If the car was to receive no instruction within 20 seconds then the car would navigate its way toward the last stored x and y coordinates, thus navigating back to a point within its radio frequency range.
Anti crashing system
Another interesting upgrade would be to make use of distance sensors. By connecting the Arduino to the RC cars brakes would allow for the car to intelligently stop before hitting an object. If the sensor reports that there is an object within a certain distance it could either stop all instruction to the car or apply the brakes. This is something that should be implemented in every vehicle around the world!
Commercial Ideas
With extensions of this project in mind, I foresee room for a number of possible ways in which this project could be developed into a commercial product.
Idea #1 Autonomous Lawn Mower
My concerns regarding this idea involve the worry that I do not have the expertise to deal with the hacking of the lawn mower and would need additional mechanical support from someone with the required skills.

Idea #2 Radio Frequency Extender
Wanting to learn more?
Other useful links and information
Additional Information
Additional information
I made every attempt to be as independent as possible throughout the duration of this project although from time to time
I was guided along the way by my advisor, Dr. Yu-Ju Lin. With Dr. Lin's strong background in networking combined with my
own determination and knowledge we were able to successfully accomplish our goals .
Dr. Yu-Ju ("Joseph") Lin
Associate Professor of Computer Science
Charleston Southern University
Ashby Hall 206
Phone: (843) 863-7076
E-mail: ylin@csuniv.edu
Bio: Ph.D. Electrical and Computer Engineering, University of Florida. Dr. Lin's dissertation investigated methods
by which networks, including the Internet, can by carried over the same power lines that provide electricity to
your home and to the workplaces. Dr. Lin is originally from Taiwan. His previous employment includes the Industrial
Technology Research Institute in Taiwan where he was a Software Engineer, and the Intellon Corporation of Florida
where he was an intern in their Research and Development department. He has published several articles and papers
on wireless networks, and on communication using power line transmissions.
Final Conclusion
Allot of time and energy was spent on this project which has resulted in myself being satisfied with the progress achieved. It is rewarding feeling to write a conclusion after spending so many hours troubleshooting and finding ways over and around obstacles. Despite my satisfaction there are many improvements (as mentioned above) that I would have loved to of implemented given less restriction's on time and money. This project has taught me allot with regards to networking. I now feel I have a basic understanding of some of the key concepts involved in communication over networks. Up until this point my background had been solely in software development although so it required that I stepped outside of my known comfort zone. I would like to personally thank Dr. Yu-Ju Lin(my advisor) for his guidance aswell as Charleston Southern University for their general support.

