Edits for 'RC car' project. (#522)

* Edits for 'RC car' project.

* Line spacing below video frame.
This commit is contained in:
Galen Nickel 2017-08-29 15:47:09 -07:00 committed by Peli de Halleux
parent 743979b9ea
commit 01f665b268
5 changed files with 56 additions and 56 deletions

View File

@ -111,7 +111,7 @@ Fun games to build with your @boardname@.
"url":"/projects/railway-crossing",
"imageUrl":"/static/mb/projects/railway-crossing.png"
},{
"name": "Hacked RC car with Kitronik",
"name": "Kitronik RC car hack",
"url": "/projects/rc-car",
"imageUrl":"/static/mb/projects/rc-car.jpg"
}]

View File

@ -2,42 +2,43 @@
### ~avatar avatar
Hack a toy RC car with your @boardname@!
Hack a toy RC car and control it with your @boardname@ and Kitronik parts!
### ~
https://youtu.be/xQJCZwVvjyw
### ~ hint
**Warning**
This activity involves opening an electronic toy, cutting into cables and potentially rendering it completly useless.
This activity involves opening an electronic toy, cutting its wires and reconnecting them. Your toy could end up becoming totally useless. Hacking has its risks and rewards!
### ~
## Materials
* Toy RC car with 4 or 6 AA batteries
* 1 @boardname@
* a cable trimmer
* toy RC car with 4 or 6 AA batteries
* 1 @boardname@ (optionally, another @boardname@ too if you want radio control)
* wire trimmer
* small Philips screw driver
* [1 Kitronik motor driver](https://www.kitronik.co.uk/5620-motor-driver-board-for-the-bbc-microbit-v2.html)
## What's the plan?
## What's our hack plan?
Most toy RC car use 3 small DC motors to operate:
* 1 DC motor for the back wheels torque,
* 1 DC motor for the front wheels torque,
Most toy RC cars use 3 small DC motors to operate:
* 1 DC motor to spin (torque) the back wheels
* 1 DC motor to spin (torque) the front wheels
* 1 DC motor to steer the front wheels
The plan is to open up the RC car, remove the existing electronic controller and replace it with the motor driver
that can control 2 DC motors. We will connect both torque motors to one controller and the steering motor to the other controller.
What we're going to do is open up the RC car, remove the existing electronic controller, and replace it with the **Kitronik** motor driver that controls 2 DC motors. We will connect the two torque motors to one controller and the steering motor to the other controller.
Once the motor driver is connected, we will use a @boardname@ to control it. Another @boardname@ can also be used as a radio controller
for the @boardname@ in the car.
After the motor driver is connected, we will use a @boardname@ to control it. Also, we can use another @boardname@ as a radio controller for the @boardname@ that's in the car.
### ~ hint
Ask friends and family for old RC cars lying around, scout thrift shops and other second hand shops for discarded RC cars.
**Getting a car to hack**
Ask friends or family members if they have any old RC cars lying around. Scout around at thrift shops and other second hand stores for donated RC cars.
### ~

View File

@ -2,21 +2,20 @@
## Step 1: Add the Kitronik package
Kitronik published a set of blocks to use their motor driver. We need to add it to our project.
Kitronik has a package with blocks that program their motor driver. We need to add it to our project.
* Click on **Advanced**
* Click **Add Package**
* Type ``kitronik``, press **Enter**
* Select the **kitronik-motor-driver** package
After the package gets loaded, you should see a new **Kitronik" category in the toolbox.
After the package is loaded, you should see a new **Kitronik** category in the toolbox.
## Step 2: Round and round we go!
https://youtu.be/pD6tM1nXCPA
The first program will have the car drive in a circle for 5 seconds when the user presses button ``A``.
This is simply done by turning both motor controllers on for 5 seconds.
The first program has the car drive around in a circle for 5 seconds when the user presses the ``A`` button. This is simply done by turning both motor controllers on for 5 seconds.
```blocks-ignore
input.onButtonPressed(Button.A, () => {
@ -32,18 +31,19 @@ input.onButtonPressed(Button.A, () => {
### ~ hint
Make sure to unplug the @boardname@ from the Edge connector while your are connecting it to your computer to avoid any kind of electrical problem.
**Protect your electronics**
Make sure to unplug the @boardname@ from the edge connector when you're connecting it to your computer. This helps protect everything from potential electrical problems.
### ~
Depending on how you've connected your cables to the motor driver, your car may be going backward instead of forward.
You can either swap the cables or change your code to account for that.
Depending on how your wires are connected to the motor driver, your car may go backward instead of forward. If so, you can either swap the wires or change the ``MotorDirection`` in your code to get it to go the right way.
## Step 3: Figure Eight
## Step 3: Figure eight
https://youtu.be/agor9wtiAkE
Instead of stopping after 5 seconds, we reverse the steering motor to turn the other direction. This will create a figure eight trajectory.
Instead of stopping after 5 seconds, we reverse the steering motor to turn in the other direction. This will create a figure eight path.
```blocks-ignore
input.onButtonPressed(Button.A, () => {
@ -59,7 +59,7 @@ input.onButtonPressed(Button.A, () => {
})
```
Great! It's now time to use another @boardname@ to remove control the car.
Great! The code to drive the car is done! Now let's get another @boardname@ and control the car remotely.
### ~button /projects/rc-car/connect

View File

@ -1,10 +1,11 @@
# Connect
## Step 4: Remote control
https://youtu.be/XXesoUC0XBU
We are going to use radio to remote control the toy car.
A second @microbit@ will send commands to control the throttle and the steering.
We can use the radio on the @boardname@ to control the toy car remotely.
A second @boardname@ will send commands to control the throttle and the steering.
```blocks-ignore
let steering = 0

View File

@ -9,65 +9,63 @@ Hack the @boardname@ into the car!
### ~
https://youtu.be/gH__3l_oDeM
## Materials
* a toy RC car with 4 or 6 AA batteries
* a cable trimmer
* small Philips screw driver
<br/>
![A toy RC car](/static/mb/projects/rc-car/rccar.jpg)
## Step 1: Remove the batteries!
Make sure all the batteries are removed from the toy car!
## Step 2: Remove the cover
## Step 2: Remove the body and electronics cover
Remove the various protective covers until you have access to the electronic controller. Make sure to keep track of all the screws you remove,
you will need them again!
Remove the car body and the plastic pieces that protect electronic controller so you can access it. Make sure to keep track of all the screws you remove, you will need them again!
## Step 3: Cut out the electronic board
## Step 3: Disconnect the original electronics
Follow the motor and power cables and cut the wires as close as possible from the electronic board. You should end up with a total of 8 cables:
2 for power, 2 for the steering motor and 2 pairs for the torque motors.
Follow the motor and power wires to the controller. Cut them as close as possible to the surface of the electronic board (neurosurgery). You should end up with a total of **8** wires:
**2** for power, **2** for the steering motor and **2 pairs** for the torque motors.
You can pull out the old controller board to make some more room.
![Electronic board removed](/static/mb/projects/rc-car/elecremoved.jpg)
## Step 4: Prepare the cables
## Step 4: Prepare the wires
Using the wire trimmer, expose 1/4 inch (1/2 cm) of metal on each wire so you can attach it to the motor driver.
Using the wire trimmer, remove the insulation on the wires to expose about 1/4 inch (1/2 cm) of the metal conductor on each wire so you can attach it to the motor driver.
![Various cables](/static/mb/projects/rc-car/cables.jpg)
## Step 5: Connect the battery cables
## Step 5: Connect the battery wires
* Connect the cables from the battery section to the power input on the motor shield.
Make sure the **+** cable goes into the **+** port!
* Connect both torque motors to the **motor 1** connector in the motor driver.
Make sure to connect the cables of same colors so that your wheel turn the same direction!
* Connect the remaining motor cables to the **motor 2** connector.
* Connect the wires from the battery section to the power input on the motor driver.
Make sure the **+** wire goes into the **+** port!
* Connect both torque motors to the **motor 1** connector on the motor driver.
Make sure you match wires to the same color when you connect them so that your wheel will turn in the right direction!
* Connect the remaining motor wires to the **motor 2** connector.
![Wiring](/static/mb/projects/rc-car/wiring.jpg)
## Step 6: Slot in the @boardname@
## Step 6: Insert the @boardname@ in the slot
Probably the easiest step, insert the @boardname@ in the edge connector until clips in.
This is probably the easiest step. Insert the @boardname@ in the edge connector until clips in.
## (Optional) Step 7: Cut out a slot in the cover to fit the @boardname@
## Step 7: Cut out a slot in the cover to fit the @boardname@ (optional)
Depending on your car size, you may be able to fit back the decoration top back on the car.
Otherwise, get some cardboard, scissors and a glue gun to rebuild it yourself!
Cut a slot in the cover for the original controller over edge connector. The **Kitronik** controller is protected and your @boardname@ has a nice finished slot to occupy.
![Cutout](/static/mb/projects/rc-car/cutout.jpg)
## (Optional) Step 8: Paint job
## Step 8: Mount the car body (optional)
Once you have replaced the cover (original or carboard), decorate it to your taste!
Depending on the size and shape of your car, you may be able to fit the car body back on the top of the car. If not, get some cardboard, scissors, and a glue gun to 'fab up' (make) a new one of your own (à la _Mad Max_).
## Step 9: Paint job (optional)
Once you've got the body on (the original or a cardboard one), finish it with some style!
![Painted](/static/mb/projects/rc-car/painted.jpg)
That's it, it's time to code!
That's it, time to code!
### ~button /projects/rc-car/code