The content below briefly shows the process of how the car was developed. If you want to know more about this project, checkout the embedded pdf below of my project submission.
For my A-Level (aged 18) Product Design assignment, I wanted to make a iPhone controlled remote controlled car which could be built with Lego. Below is a brief overview of how the development of the project, with design and final outcome images as well as code snippets. The full development for this project can be found in the embedded pdf portfolio at the bottom of the page.
This project was awarded an A*.
I designed and 3D printed a chassis for the RC car which holds the Raspberry Pi, motor controller unit, rechargeable battery for Raspberry Pi, and 9v battery for motors. As well as this, on the underside of the chassis is lego surface, which allows you to stick lego accessories onto the underside.
The technical setup
- Raspberry Pi Model B
- Dual Bridge L298N Stepper Motor Driver Controller Board Module
- A pair of inputs that can be controlled by TTL logic levels (like the Raspberry Pi uses).
- Connections for a 9 Volt battery.
- A pair of outputs to connect to the DC motors.
- 2 x 9v motors
- One motor will control the steering.
- The other for the forward and backward drive.
- I used LEGO 9V Technic Motors.
- 9v Battery
- Connects to the L298N Stepper Motor Driver which then powers the 2 motors in parallel.
- Rechargeable Power Bank
- 100-240v input, 5.1v output.
- Commonly used for recharging mobile phones.
Below is example code which demonstrates control of the motors. The python code is executed from my computer which is connected to the Raspberry Pi over wifi using SSH.
#These are the keyboard mappings #q = Go forward #a = Stop going forward or back #z = Go back #i= Go left #o = Stop steering #p = Go right #Get the GPIO module import RPi.GPIO as GPIO #Get the time module import time #A routine to control a pair of pins def ControlAPairOfPins(FirstPin, FirstState,SecondPin,SecondState): print "Controlling them pins" if FirstState == "1": GPIO.output(int(FirstPin),True) else: GPIO.output(int(FirstPin),False) if SecondState == "1": GPIO.output(int(SecondPin),True) else: GPIO.output(int(SecondPin),False) #Just retur return ####Main body of code #Get rid of warnings GPIO.setwarnings(False) #Set the GPIO mode GPIO.setmode(GPIO.BOARD) #Set the pins to be outputs GPIO.setup(11,GPIO.OUT) GPIO.setup(13,GPIO.OUT) GPIO.setup(19,GPIO.OUT) GPIO.setup(21,GPIO.OUT) while True: MyChar = raw_input ("Press a character:") print "You pressed: " + MyChar if MyChar == "q": ControlAPairOfPins ("19","1","21","0") print "Forward" elif MyChar == "a": ControlAPairOfPins ("19","0","21","0") print "Stop" elif MyChar == "z": ControlAPairOfPins ("19","0","21","1") print ("Back") elif MyChar == "i": ControlAPairOfPins ("11","1","13","0") print "Left" elif MyChar == "o": ControlAPairOfPins ("11","0","13","0") print "Stop steering" elif MyChar == "p": ControlAPairOfPins ("11","0","13","1") print "Right" else: print "Not a command"
Online Instruction Manual
I also created a website which is an online instruction manual on how to assemble the lego parts. It can be found here.
Please note that this pdf was converted from a PowerPoint presentation. Because of this, embedded videos which were once on the PowerPoint are not present on this pdf.
If you’re interested in seeing how I designed the licence plate logo, visit this post.