Monday, October 7, 2013

Toy Car missile launcher

I have one of these (similar) missile rocket launcher which I don't use anymore, after all how much will you use it.

It's time to recycle!

The plan is to place the missile launcher on the Smart Car and control it via the PlayStation joystick - now that will make a nice toy for my kid.

Let's dissect and see what's inside shall we?
Nothing much in the upper part of the launcher, but there are a few things to notice here. The motors are regular DC motors and not servo or stepper motors therefore controlling the angle of the head is not something predetermined. The first thing to watch out is when tilting the head of the launcher it needs to stop at a certain point so that it won't simply break the gears or burn the motors. The way they do it for this launcher is by a trigger switch which you can see in the following picture:

When the head tilts as low as it can a trigger switch will be pressed that will cause the motors to stop. This is also done for the turning of the head left and right. This is something that needs to be handled via the PCB that I need to build to make the launcher work properly and not break after a few shots.
The trigger switches for the head turning left and right (horizontal turns) are connected to the two yellow lines and the second one is connected to the two orange lines.
I have marked with RED the lines that go to the motors and in BLUE the trigger lines that indicate that the head of the missile launcher reached the end of the horizontal or vertical turn. This is important so that when triggered the motor should not be moved any more in that direction so that the missile motors and gear won't get damaged.

I disassembled the head to understand what I'm dealing with here. The missile are loaded and shot from a single motor. The motor turns the missile holder to load the next missile, then it pulls back a missile shooter which is placed on a spring and then releases it. When the missile is released, there is a trigger that is pressed when the missile is released, this is to know when to stop the motor.

This made me think a little, if the motor stops when the missile release trigger is pressed, then the next missile shooting should start when someone presses the fire button, this will require the missile launcher to load the next missile, pull back on the missile shooter and then release. This can take some time, well, 3-4 seconds.
I have a better plan for this. I'm sure I can make a piece of code that can measure how much time it took for the missile to get released and calculate the time it requires to simply load the next missile, pull back on the missile shooter, but stop just before the release making the shoot time when pressing the fire button as short as possible.
The green wire is connected to the trigger and the orange-red wire is the motor power line.

Just to give you an idea, I did the schematics for the motors and it's very similar to the first schematics which are for the wheels of the Toy Car as they both use regular DC motors. The difference here are the trigger points that must be connected to the PCB to trigger when reaching the limits of the head turning.

PlayStation Joystick Control

So I now have a Toy Car, with a basic remote that can make the car go forward backwards and turn in both directions. This is really not something new to my kid nor that of a unique toy, but I have some plans to spice it up but this will have to wait to the next post.

Let's focus on the title of the post, the PlayStation joystick. I have one laying around from the old days, it's a wireless one and also came with a dual port converter to USB.
The USB converter seems to have become broken for some reason that I care little about (I have another one). It does show signs of life as you see in the picture, but nothing much happens beyond the USB port.
Great, now lets take it apart! :).

Yeah, I really don't give a damn about the board, but I only need the connectors. The connectors can be attached to an Arduino that is programmed with the relevant software and see what happens.

I took the first connector and attached some wires to it to see if this is really any good or if it even works.

I connected the wires and uploaded the sketch taking from:
I used the picture of the connector to connect the wires.
The communication with the controller is rather simple but require some effort.
1. Send an "Attention" to the controller so that it will be ready to receive a command via the "attention" line. This is actually the "Control Select" line which is used to indicate which control is currently in use. Each controller has it's own line. The rest of the wires (lines) are shared between all controllers (sort of a bus like).
2. Send a command to the controller via the "command" line.
3. Receive the data via the "data" line.
4. should receive and ACK from the "acknowledge" line, but the library simple doesn't use it, I can understand why :).
The "clock" line, well it's a clock line what do you think it does? :).

The wires that are required for the connector to function are 4:
1. Attention (or Select)
2. Command
3. Data
4. Clock

Seems to do the job. The joystick functions rather well, let's use the other connector and make a more convenient connector to plug into whatever PCB I will make.




Although the "ACK" line is not required, I still connected it, and also maintained the coloring as described in the link above just to get a better reference when connecting the plug to the Arduino.